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 |
|---|---|---|---|---|---|---|---|
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import os
import mimetypes
from weibopy.binder import bind_api
from weibopy.error import WeibopError
from weibopy.parsers import ModelParser
class API(object):
"""Twitter API"""
def __init__(self, auth_handler=None,
host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',
cache=None, secure=False, api_root='', search_root='',
retry_count=0, retry_delay=0, retry_errors=None,source=None,
parser=None, log = None):
self.auth = auth_handler
self.host = host
if source == None:
if auth_handler != None:
self.source = self.auth._consumer.key
else:
self.source = source
self.search_host = search_host
self.api_root = api_root
self.search_root = search_root
self.cache = cache
self.secure = secure
self.retry_count = retry_count
self.retry_delay = retry_delay
self.retry_errors = retry_errors
self.parser = parser or ModelParser()
self.log = log
""" statuses/public_timeline """
public_timeline = bind_api(
path = '/statuses/public_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = []
)
""" statuses/home_timeline """
home_timeline = bind_api(
path = '/statuses/home_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/friends_timeline """
friends_timeline = bind_api(
path = '/statuses/friends_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/comment """
comment = bind_api(
path = '/statuses/comment.json',
method = 'POST',
payload_type = 'comments',
allowed_param = ['id', 'cid', 'comment'],
require_auth = True
)
""" statuses/comment_destroy """
comment_destroy = bind_api(
path = '/statuses/comment_destroy/{id}.json',
method = 'POST',
payload_type = 'comments',
allowed_param = ['id'],
require_auth = True
)
""" statuses/comments_timeline """
comments = bind_api(
path = '/statuses/comments.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['id', 'count', 'page'],
require_auth = True
)
""" statuses/comments_timeline """
comments_timeline = bind_api(
path = '/statuses/comments_timeline.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/comments_by_me """
comments_by_me = bind_api(
path = '/statuses/comments_by_me.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/user_timeline """
user_timeline = bind_api(
path = '/statuses/user_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'since_id',
'max_id', 'count', 'page']
)
""" statuses/mentions """
mentions = bind_api(
path = '/statuses/mentions.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/counts """
counts = bind_api(
path = '/statuses/counts.json',
payload_type = 'counts', payload_list = True,
allowed_param = ['ids'],
require_auth = True
)
""" statuses/unread """
unread = bind_api(
path = '/statuses/unread.json',
payload_type = 'counts'
)
""" statuses/retweeted_by_me """
retweeted_by_me = bind_api(
path = '/statuses/retweeted_by_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/retweeted_to_me """
retweeted_to_me = bind_api(
path = '/statuses/retweeted_to_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/retweets_of_me """
retweets_of_me = bind_api(
path = '/statuses/retweets_of_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/show """
get_status = bind_api(
path = '/statuses/show.json',
payload_type = 'status',
allowed_param = ['id']
)
""" statuses/update """
update_status = bind_api(
path = '/statuses/update.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['status', 'lat', 'long', 'source'],
require_auth = True
)
""" statuses/upload """
def upload(self, filename, status, lat=None, long=None, source=None):
if source is None:
source=self.source
headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname="pic")
args = [status]
allowed_param = ['status']
if lat is not None:
args.append(lat)
allowed_param.append('lat')
if long is not None:
args.append(long)
allowed_param.append('long')
if source is not None:
args.append(source)
allowed_param.append('source')
return bind_api(
path = '/statuses/upload.json',
method = 'POST',
payload_type = 'status',
require_auth = True,
allowed_param = allowed_param
)(self, *args, post_data=post_data, headers=headers)
""" statuses/reply """
reply = bind_api(
path = '/statuses/reply.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id', 'cid','comment'],
require_auth = True
)
""" statuses/repost """
repost = bind_api(
path = '/statuses/repost.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id', 'status'],
require_auth = True
)
""" statuses/destroy """
destroy_status = bind_api(
path = '/statuses/destroy/{id}.json',
method = 'DELETE',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" statuses/retweet """
retweet = bind_api(
path = '/statuses/retweet/{id}.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" statuses/retweets """
retweets = bind_api(
path = '/statuses/retweets/{id}.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'count'],
require_auth = True
)
""" users/show """
get_user = bind_api(
path = '/users/show.json',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name']
)
""" Get the authenticated user """
def me(self):
return self.get_user(screen_name=self.auth.get_username())
""" users/search """
search_users = bind_api(
path = '/users/search.json',
payload_type = 'user', payload_list = True,
require_auth = True,
allowed_param = ['q', 'per_page', 'page']
)
""" statuses/friends """
friends = bind_api(
path = '/statuses/friends.json',
payload_type = 'user', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']
)
""" statuses/followers """
followers = bind_api(
path = '/statuses/followers.json',
payload_type = 'user', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']
)
""" direct_messages """
direct_messages = bind_api(
path = '/direct_messages.json',
payload_type = 'direct_message', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" direct_messages/sent """
sent_direct_messages = bind_api(
path = '/direct_messages/sent.json',
payload_type = 'direct_message', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" direct_messages/new """
new_direct_message = bind_api(
path = '/direct_messages/new.json',
method = 'POST',
payload_type = 'direct_message',
allowed_param = ['id', 'screen_name', 'user_id', 'text'],
require_auth = True
)
""" direct_messages/destroy """
destroy_direct_message = bind_api(
path = '/direct_messages/destroy/{id}.json',
method = 'DELETE',
payload_type = 'direct_message',
allowed_param = ['id'],
require_auth = True
)
""" friendships/create """
create_friendship = bind_api(
path = '/friendships/create.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name', 'follow'],
require_auth = True
)
""" friendships/destroy """
destroy_friendship = bind_api(
path = '/friendships/destroy.json',
method = 'DELETE',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" friendships/exists """
exists_friendship = bind_api(
path = '/friendships/exists.json',
payload_type = 'json',
allowed_param = ['user_a', 'user_b']
)
""" friendships/show """
show_friendship = bind_api(
path = '/friendships/show.json',
payload_type = 'friendship',
allowed_param = ['source_id', 'source_screen_name',
'target_id', 'target_screen_name']
)
""" friends/ids """
friends_ids = bind_api(
path = '/friends/ids.json',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name', 'cursor', 'count'],
require_auth = True
)
""" followers/ids """
followers_ids = bind_api(
path = '/followers/ids.json',
payload_type = 'json',
allowed_param = ['id', 'page'],
)
""" account/verify_credentials """
def verify_credentials(self):
try:
return bind_api(
path = '/account/verify_credentials.json',
payload_type = 'user',
require_auth = True
)(self)
except WeibopError:
return False
""" account/rate_limit_status """
rate_limit_status = bind_api(
path = '/account/rate_limit_status.json',
payload_type = 'json'
)
""" account/update_delivery_device """
set_delivery_device = bind_api(
path = '/account/update_delivery_device.json',
method = 'POST',
allowed_param = ['device'],
payload_type = 'user',
require_auth = True
)
""" account/update_profile_colors """
update_profile_colors = bind_api(
path = '/account/update_profile_colors.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['profile_background_color', 'profile_text_color',
'profile_link_color', 'profile_sidebar_fill_color',
'profile_sidebar_border_color'],
require_auth = True
)
""" account/update_profile_image """
def update_profile_image(self, filename):
headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)
return bind_api(
path = '/account/update_profile_image.json',
method = 'POST',
payload_type = 'user',
require_auth = True
)(self, post_data=post_data, headers=headers)
""" account/update_profile_background_image """
def update_profile_background_image(self, filename, *args, **kargs):
headers, post_data = API._pack_image(filename, 800)
bind_api(
path = '/account/update_profile_background_image.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['tile'],
require_auth = True
)(self, post_data=post_data, headers=headers)
""" account/update_profile """
update_profile = bind_api(
path = '/account/update_profile.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['name', 'url', 'location', 'description'],
require_auth = True
)
""" favorites """
favorites = bind_api(
path = '/favorites/{id}.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'page']
)
""" favorites/create """
create_favorite = bind_api(
path = '/favorites/create/{id}.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" favorites/destroy """
destroy_favorite = bind_api(
path = '/favorites/destroy/{id}.json',
method = 'DELETE',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" notifications/follow """
enable_notifications = bind_api(
path = '/notifications/follow.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" notifications/leave """
disable_notifications = bind_api(
path = '/notifications/leave.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/create """
create_block = bind_api(
path = '/blocks/create.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/destroy """
destroy_block = bind_api(
path = '/blocks/destroy.json',
method = 'DELETE',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/exists """
def exists_block(self, *args, **kargs):
try:
bind_api(
path = '/blocks/exists.json',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)(self, *args, **kargs)
except WeibopError:
return False
return True
""" blocks/blocking """
blocks = bind_api(
path = '/blocks/blocking.json',
payload_type = 'user', payload_list = True,
allowed_param = ['page'],
require_auth = True
)
""" blocks/blocking/ids """
blocks_ids = bind_api(
path = '/blocks/blocking/ids.json',
payload_type = 'json',
require_auth = True
)
""" statuses/repost """
report_spam = bind_api(
path = '/report_spam.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" saved_searches """
saved_searches = bind_api(
path = '/saved_searches.json',
payload_type = 'saved_search', payload_list = True,
require_auth = True
)
""" saved_searches/show """
get_saved_search = bind_api(
path = '/saved_searches/show/{id}.json',
payload_type = 'saved_search',
allowed_param = ['id'],
require_auth = True
)
""" saved_searches/create """
create_saved_search = bind_api(
path = '/saved_searches/create.json',
method = 'POST',
payload_type = 'saved_search',
allowed_param = ['query'],
require_auth = True
)
""" saved_searches/destroy """
destroy_saved_search = bind_api(
path = '/saved_searches/destroy/{id}.json',
method = 'DELETE',
payload_type = 'saved_search',
allowed_param = ['id'],
require_auth = True
)
""" help/test """
def test(self):
try:
bind_api(
path = '/help/test.json',
)(self)
except WeibopError:
return False
return True
def create_list(self, *args, **kargs):
return bind_api(
path = '/%s/lists.json' % self.auth.get_username(),
method = 'POST',
payload_type = 'list',
allowed_param = ['name', 'mode', 'description'],
require_auth = True
)(self, *args, **kargs)
def destroy_list(self, slug):
return bind_api(
path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
method = 'DELETE',
payload_type = 'list',
require_auth = True
)(self)
def update_list(self, slug, *args, **kargs):
return bind_api(
path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['name', 'mode', 'description'],
require_auth = True
)(self, *args, **kargs)
lists = bind_api(
path = '/{user}/lists.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
lists_memberships = bind_api(
path = '/{user}/lists/memberships.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
lists_subscriptions = bind_api(
path = '/{user}/lists/subscriptions.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
list_timeline = bind_api(
path = '/{owner}/lists/{slug}/statuses.json',
payload_type = 'status', payload_list = True,
allowed_param = ['owner', 'slug', 'since_id', 'max_id', 'count', 'page']
)
get_list = bind_api(
path = '/{owner}/lists/{slug}.json',
payload_type = 'list',
allowed_param = ['owner', 'slug']
)
def add_list_member(self, slug, *args, **kargs):
return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs)
def remove_list_member(self, slug, *args, **kargs):
return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'DELETE',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs)
list_members = bind_api(
path = '/{owner}/{slug}/members.json',
payload_type = 'user', payload_list = True,
allowed_param = ['owner', 'slug', 'cursor']
)
def is_list_member(self, owner, slug, user_id):
try:
return bind_api(
path = '/%s/%s/members/%s.json' % (owner, slug, user_id),
payload_type = 'user'
)(self)
except WeibopError:
return False
subscribe_list = bind_api(
path = '/{owner}/{slug}/subscribers.json',
method = 'POST',
payload_type = 'list',
allowed_param = ['owner', 'slug'],
require_auth = True
)
unsubscribe_list = bind_api(
path = '/{owner}/{slug}/subscribers.json',
method = 'DELETE',
payload_type = 'list',
allowed_param = ['owner', 'slug'],
require_auth = True
)
list_subscribers = bind_api(
path = '/{owner}/{slug}/subscribers.json',
payload_type = 'user', payload_list = True,
allowed_param = ['owner', 'slug', 'cursor']
)
def is_subscribed_list(self, owner, slug, user_id):
try:
return bind_api(
path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),
payload_type = 'user'
)(self)
except WeibopError:
return False
""" trends/available """
trends_available = bind_api(
path = '/trends/available.json',
payload_type = 'json',
allowed_param = ['lat', 'long']
)
""" trends/location """
trends_location = bind_api(
path = '/trends/{woeid}.json',
payload_type = 'json',
allowed_param = ['woeid']
)
""" search """
search = bind_api(
search_api = True,
path = '/search.json',
payload_type = 'search_result', payload_list = True,
allowed_param = ['q', 'lang', 'locale', 'rpp', 'page', 'since_id', 'geocode', 'show_user']
)
search.pagination_mode = 'page'
""" trends """
trends = bind_api(
search_api = True,
path = '/trends.json',
payload_type = 'json'
)
""" trends/current """
trends_current = bind_api(
search_api = True,
path = '/trends/current.json',
payload_type = 'json',
allowed_param = ['exclude']
)
""" trends/daily """
trends_daily = bind_api(
search_api = True,
path = '/trends/daily.json',
payload_type = 'json',
allowed_param = ['date', 'exclude']
)
""" trends/weekly """
trends_weekly = bind_api(
search_api = True,
path = '/trends/weekly.json',
payload_type = 'json',
allowed_param = ['date', 'exclude']
)
""" Internal use only """
@staticmethod
def _pack_image(filename, max_size, source=None, status=None, lat=None, long=None, contentname="image"):
"""Pack image from file into multipart-formdata post body"""
# image must be less than 700kb in size
try:
if os.path.getsize(filename) > (max_size * 1024):
raise WeibopError('File is too big, must be less than 700kb.')
#except os.error, e:
except os.error:
raise WeibopError('Unable to access file')
# image must be gif, jpeg, or png
file_type = mimetypes.guess_type(filename)
if file_type is None:
raise WeibopError('Could not determine file type')
file_type = file_type[0]
if file_type not in ['image/gif', 'image/jpeg', 'image/png']:
raise WeibopError('Invalid file type for image: %s' % file_type)
# build the mulitpart-formdata body
fp = open(filename, 'rb')
BOUNDARY = 'Tw3ePy'
body = []
if status is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="status"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(status)
if source is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="source"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(source)
if lat is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="lat"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(lat)
if long is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="long"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(long)
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="'+ contentname +'"; filename="%s"' % filename)
body.append('Content-Type: %s' % file_type)
body.append('Content-Transfer-Encoding: binary')
body.append('')
body.append(fp.read())
body.append('--' + BOUNDARY + '--')
body.append('')
fp.close()
body.append('--' + BOUNDARY + '--')
body.append('')
body = '\r\n'.join(body)
# build headers
headers = {
'Content-Type': 'multipart/form-data; boundary=Tw3ePy',
'Content-Length': len(body)
}
return headers, body
| ajibawa-2023/Python-Code-Large/train/row_128 | 273 | 811 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_128:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0012, 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_128:Import_L6_C0", "label": "mimetypes import mimetypes", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0012, 0, 0.66, 0.2, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["mimetypes"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mimetypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:ImportFrom_L8_C0", "label": "from weibopy.binder import bind_api", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0012, 0, 0.66, 0.4, 89, 0, 1, 0, 0, 89, 0, 0], "semantic": {"name": "weibopy.binder", "arg_names": [], "import_names": ["bind_api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.binder import bind_api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:ImportFrom_L9_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0111, 0.0012, 0, 0.66, 0.6, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:ImportFrom_L10_C0", "label": "from weibopy.parsers import ModelParser", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0123, 0.0012, 0, 0.66, 0.8, 699, 0, 1, 0, 0, 699, 0, 0], "semantic": {"name": "weibopy.parsers", "arg_names": [], "import_names": ["ModelParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.parsers import ModelParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "label": "API", "type": "class", "loc": [13, 810], "level": 0, "parent": null, "vector": [3, 0, 0.5074, 0.984, 0, 0.66, 1.0, 839, 0, 16, 0, 0, 186, 0, 99], "semantic": {"name": "API", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class API(object):\n \"\"\"Twitter API\"\"\"\n\n def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',\n cache=None, secure=False, api_root='', search_root='',\n retry_count=0, retry_delay=0, retry_errors=None,source=None,\n parser=None, log = None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0173, 0.0012, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Twitter API\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "label": "__init__", "type": "function", "loc": [16, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.0327, 0.0271, 1, 0.45, 0.0064, 555, 0, 14, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "auth_handler", "host", "search_host", "cache", "secure", "api_root", "search_root", "retry_count", "retry_delay", "retry_errors", "source", "parser", "log"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',\n cache=None, secure=False, api_root='', search_root='',\n retry_count=0, retry_delay=0, retry_errors=None,source=None,\n parser=None, log = None):\n self.auth = auth_handler\n self.host = host\n if source == None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L21_C8", "label": "self.auth =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0259, 0.0012, 2, 0.63, 0.0, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth = auth_handler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L22_C8", "label": "self.host =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0271, 0.0012, 2, 0.63, 0.0833, 445, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.host = host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8", "label": "if", "type": "if", "loc": [23, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [4, 2, 0.0308, 0.0062, 2, 0.63, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source == None:\n if auth_handler != None:\n self.source = self.auth._consumer.key\n else:\n self.source = source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L24_C12", "label": "if", "type": "if", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8", "vector": [4, 3, 0.0302, 0.0025, 3, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_handler != None:\n self.source = self.auth._consumer.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L25_C16", "label": "self.source =", "type": "assigned_variable", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L24_C12", "vector": [14, 4, 0.0308, 0.0012, 4, 0.84, 0.0, 848, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.source = self.auth._consumer.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L27_C12", "label": "self.source =", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8", "vector": [14, 3, 0.0333, 0.0012, 3, 0.33, 1.0, 848, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.source = source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L28_C8", "label": "self.search_host =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0345, 0.0012, 2, 0.63, 0.25, 124, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.search_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.search_host = search_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L29_C8", "label": "self.api_root =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0358, 0.0012, 2, 0.63, 0.3333, 800, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.api_root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.api_root = api_root"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L30_C8", "label": "self.search_root =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.037, 0.0012, 2, 0.63, 0.4167, 598, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.search_root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.search_root = search_root"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L31_C8", "label": "self.cache =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0382, 0.0012, 2, 0.63, 0.5, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cache = cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L32_C8", "label": "self.secure =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0395, 0.0012, 2, 0.63, 0.5833, 9, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secure = secure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L33_C8", "label": "self.retry_count =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0407, 0.0012, 2, 0.63, 0.6667, 141, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_count = retry_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L34_C8", "label": "self.retry_delay =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0419, 0.0012, 2, 0.63, 0.75, 869, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_delay = retry_delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L35_C8", "label": "self.retry_errors =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0432, 0.0012, 2, 0.63, 0.8333, 816, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_errors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_errors = retry_errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L36_C8", "label": "self.parser =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0444, 0.0012, 2, 0.63, 0.9167, 980, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.parser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parser = parser or ModelParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L37_C8", "label": "self.log =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "vector": [14, 2, 0.0456, 0.0012, 2, 0.63, 1.0, 338, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.log", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.log = log"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0481, 0.0012, 1, 0.45, 0.0128, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/public_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L40_C4", "label": "public_timeline = bind_api()", "type": "assigned_variable", "loc": [40, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.0518, 0.0062, 1, 0.45, 0.0192, 203, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "public_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " public_timeline = bind_api(\n path = '/statuses/public_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = []\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L46_C4", "label": "expression", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0567, 0.0012, 1, 0.45, 0.0256, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/home_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L47_C4", "label": "home_timeline = bind_api()", "type": "assigned_variable", "loc": [47, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.061, 0.0074, 1, 0.45, 0.0321, 302, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "home_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " home_timeline = bind_api(\n path = '/statuses/home_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0666, 0.0012, 1, 0.45, 0.0385, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/friends_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L55_C4", "label": "friends_timeline = bind_api()", "type": "assigned_variable", "loc": [55, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.0709, 0.0074, 1, 0.45, 0.0449, 395, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "friends_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends_timeline = bind_api(\n path = '/statuses/friends_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L61_C4", "label": "expression", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0752, 0.0012, 1, 0.45, 0.0513, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comment \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L62_C4", "label": "comment = bind_api()", "type": "assigned_variable", "loc": [62, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.0801, 0.0086, 1, 0.45, 0.0577, 34, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comment = bind_api(\n path = '/statuses/comment.json',\n method = 'POST',\n payload_type = 'comments',\n allowed_param = ['id', 'cid', 'comment'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0863, 0.0012, 1, 0.45, 0.0641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comment_destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L71_C4", "label": "comment_destroy = bind_api()", "type": "assigned_variable", "loc": [71, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.0912, 0.0086, 1, 0.45, 0.0705, 828, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comment_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comment_destroy = bind_api(\n path = '/statuses/comment_destroy/{id}.json',\n method = 'POST',\n payload_type = 'comments',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.0974, 0.0012, 1, 0.45, 0.0769, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L80_C4", "label": "comments = bind_api()", "type": "assigned_variable", "loc": [80, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1017, 0.0074, 1, 0.45, 0.0833, 122, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments = bind_api(\n path = '/statuses/comments.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L87_C4", "label": "expression", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1073, 0.0012, 1, 0.45, 0.0897, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L88_C4", "label": "comments_timeline = bind_api()", "type": "assigned_variable", "loc": [88, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1116, 0.0074, 1, 0.45, 0.0962, 23, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments_timeline = bind_api(\n path = '/statuses/comments_timeline.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L95_C4", "label": "expression", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1171, 0.0012, 1, 0.45, 0.1026, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_by_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L96_C4", "label": "comments_by_me = bind_api()", "type": "assigned_variable", "loc": [96, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1215, 0.0074, 1, 0.45, 0.109, 817, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments_by_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments_by_me = bind_api(\n path = '/statuses/comments_by_me.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L103_C4", "label": "expression", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.127, 0.0012, 1, 0.45, 0.1154, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/user_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L104_C4", "label": "user_timeline = bind_api()", "type": "assigned_variable", "loc": [104, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1313, 0.0074, 1, 0.45, 0.1218, 101, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "user_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " user_timeline = bind_api(\n path = '/statuses/user_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'since_id',\n 'max_id', 'count', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L111_C4", "label": "expression", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1369, 0.0012, 1, 0.45, 0.1282, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/mentions \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L112_C4", "label": "mentions = bind_api()", "type": "assigned_variable", "loc": [112, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1412, 0.0074, 1, 0.45, 0.1346, 369, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "mentions", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " mentions = bind_api(\n path = '/statuses/mentions.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L119_C4", "label": "expression", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1467, 0.0012, 1, 0.45, 0.141, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/counts \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L120_C4", "label": "counts = bind_api()", "type": "assigned_variable", "loc": [120, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.151, 0.0074, 1, 0.45, 0.1474, 560, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " counts = bind_api(\n path = '/statuses/counts.json',\n payload_type = 'counts', payload_list = True,\n allowed_param = ['ids'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L127_C4", "label": "expression", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1566, 0.0012, 1, 0.45, 0.1538, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/unread \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L128_C4", "label": "unread = bind_api()", "type": "assigned_variable", "loc": [128, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1597, 0.0049, 1, 0.45, 0.1603, 545, 3, 2, 0, 0, 446, 10, 1], "semantic": {"name": "unread", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " unread = bind_api(\n path = '/statuses/unread.json',\n payload_type = 'counts'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L133_C4", "label": "expression", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.164, 0.0012, 1, 0.45, 0.1667, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweeted_by_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L134_C4", "label": "retweeted_by_me = bind_api()", "type": "assigned_variable", "loc": [134, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1683, 0.0074, 1, 0.45, 0.1731, 618, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweeted_by_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweeted_by_me = bind_api(\n path = '/statuses/retweeted_by_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L141_C4", "label": "expression", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1739, 0.0012, 1, 0.45, 0.1795, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweeted_to_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L142_C4", "label": "retweeted_to_me = bind_api()", "type": "assigned_variable", "loc": [142, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1782, 0.0074, 1, 0.45, 0.1859, 533, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweeted_to_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweeted_to_me = bind_api(\n path = '/statuses/retweeted_to_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L149_C4", "label": "expression", "type": "expression", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1837, 0.0012, 1, 0.45, 0.1923, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweets_of_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L150_C4", "label": "retweets_of_me = bind_api()", "type": "assigned_variable", "loc": [150, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.188, 0.0074, 1, 0.45, 0.1987, 959, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweets_of_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweets_of_me = bind_api(\n path = '/statuses/retweets_of_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L157_C4", "label": "expression", "type": "expression", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.1936, 0.0012, 1, 0.45, 0.2051, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L158_C4", "label": "get_status = bind_api()", "type": "assigned_variable", "loc": [158, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.1973, 0.0062, 1, 0.45, 0.2115, 163, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_status = bind_api(\n path = '/statuses/show.json',\n payload_type = 'status',\n allowed_param = ['id']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L164_C4", "label": "expression", "type": "expression", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2022, 0.0012, 1, 0.45, 0.2179, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/update \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L165_C4", "label": "update_status = bind_api()", "type": "assigned_variable", "loc": [165, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2072, 0.0086, 1, 0.45, 0.2244, 715, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_status = bind_api(\n path = '/statuses/update.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['status', 'lat', 'long', 'source'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2121, 0.0012, 1, 0.45, 0.2308, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/upload \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "label": "upload", "type": "function", "loc": [173, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.2281, 0.0308, 1, 0.45, 0.2372, 920, 0, 6, 1, 0, 0, 0, 9], "semantic": {"name": "upload", "arg_names": ["self", "filename", "status", "lat", "long", "source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def upload(self, filename, status, lat=None, long=None, source=None):\n if source is None:\n source=self.source\n headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname=\"pic\")\n args = [status]\n allowed_param = ['status']\n \n if lat is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L174_C8", "label": "if", "type": "if", "loc": [174, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [4, 2, 0.2152, 0.0025, 2, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is None:\n source=self.source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L175_C12", "label": "source =", "type": "assigned_variable", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L174_C8", "vector": [14, 3, 0.2158, 0.0012, 3, 0.32, 0.0, 703, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source=self.source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L176_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [14, 2, 0.217, 0.0012, 2, 0.67, 0.1429, 165, 3, 7, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname=\"pic\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L177_C8", "label": "args =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [14, 2, 0.2182, 0.0012, 2, 0.67, 0.2857, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [status]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L178_C8", "label": "allowed_param =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [14, 2, 0.2195, 0.0012, 2, 0.67, 0.4286, 992, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "allowed_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " allowed_param = ['status']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8", "label": "if", "type": "if", "loc": [180, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [4, 2, 0.2232, 0.0037, 2, 0.67, 0.5714, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lat is not None:\n args.append(lat)\n allowed_param.append('lat')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L181_C12", "label": "append()", "type": "expression", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8", "vector": [8, 3, 0.2232, 0.0012, 3, 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": " args.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L182_C12", "label": "append()", "type": "expression", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8", "vector": [8, 3, 0.2244, 0.0012, 3, 0.81, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " allowed_param.append('lat')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8", "label": "if", "type": "if", "loc": [184, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [4, 2, 0.2281, 0.0037, 2, 0.67, 0.7143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if long is not None:\n args.append(long)\n allowed_param.append('long')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L185_C12", "label": "append()", "type": "expression", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8", "vector": [8, 3, 0.2281, 0.0012, 3, 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": " args.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L186_C12", "label": "append()", "type": "expression", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8", "vector": [8, 3, 0.2293, 0.0012, 3, 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": " allowed_param.append('long')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8", "label": "if", "type": "if", "loc": [188, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [4, 2, 0.233, 0.0037, 2, 0.67, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is not None:\n args.append(source)\n allowed_param.append('source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L189_C12", "label": "append()", "type": "expression", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8", "vector": [8, 3, 0.233, 0.0012, 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": " args.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L190_C12", "label": "append()", "type": "expression", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8", "vector": [8, 3, 0.2343, 0.0012, 3, 0.57, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " allowed_param.append('source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L191_C8", "label": "return", "type": "return", "loc": [191, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "vector": [13, 2, 0.2392, 0.0086, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/statuses/upload.json', \n method = 'POST',\n payload_type = 'status',\n require_auth = True,\n allowed_param = allowed_param \n )(self, *args, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L199_C4", "label": "expression", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2454, 0.0012, 1, 0.45, 0.2436, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/reply \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L200_C4", "label": "reply = bind_api()", "type": "assigned_variable", "loc": [200, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2503, 0.0086, 1, 0.45, 0.25, 714, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " reply = bind_api(\n path = '/statuses/reply.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id', 'cid','comment'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L208_C4", "label": "expression", "type": "expression", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2565, 0.0012, 1, 0.45, 0.2564, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/repost \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L209_C4", "label": "repost = bind_api()", "type": "assigned_variable", "loc": [209, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2614, 0.0086, 1, 0.45, 0.2628, 412, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "repost", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " repost = bind_api(\n path = '/statuses/repost.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id', 'status'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L217_C4", "label": "expression", "type": "expression", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2676, 0.0012, 1, 0.45, 0.2692, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L218_C4", "label": "destroy_status = bind_api()", "type": "assigned_variable", "loc": [218, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2725, 0.0086, 1, 0.45, 0.2756, 103, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_status = bind_api(\n path = '/statuses/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L226_C4", "label": "expression", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2787, 0.0012, 1, 0.45, 0.2821, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweet \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L227_C4", "label": "retweet = bind_api()", "type": "assigned_variable", "loc": [227, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2836, 0.0086, 1, 0.45, 0.2885, 313, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweet", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweet = bind_api(\n path = '/statuses/retweet/{id}.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L235_C4", "label": "expression", "type": "expression", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2898, 0.0012, 1, 0.45, 0.2949, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweets \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L236_C4", "label": "retweets = bind_api()", "type": "assigned_variable", "loc": [236, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.2941, 0.0074, 1, 0.45, 0.3013, 728, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweets", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweets = bind_api(\n path = '/statuses/retweets/{id}.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'count'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.2996, 0.0012, 1, 0.45, 0.3077, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" users/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L244_C4", "label": "get_user = bind_api()", "type": "assigned_variable", "loc": [244, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3033, 0.0062, 1, 0.45, 0.3141, 174, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_user", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_user = bind_api(\n path = '/users/show.json',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L250_C4", "label": "expression", "type": "expression", "loc": [250, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3083, 0.0012, 1, 0.45, 0.3205, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Get the authenticated user \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L251_C4", "label": "me", "type": "function", "loc": [251, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.3101, 0.0025, 1, 0.45, 0.3269, 763, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "me", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def me(self):\n return self.get_user(screen_name=self.auth.get_username())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L252_C8", "label": "return", "type": "return", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L251_C4", "vector": [13, 2, 0.3107, 0.0012, 2, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_user(screen_name=self.auth.get_username())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L254_C4", "label": "expression", "type": "expression", "loc": [254, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3132, 0.0012, 1, 0.45, 0.3333, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" users/search \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L255_C4", "label": "search_users = bind_api()", "type": "assigned_variable", "loc": [255, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3175, 0.0074, 1, 0.45, 0.3397, 220, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "search_users", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " search_users = bind_api(\n path = '/users/search.json',\n payload_type = 'user', payload_list = True,\n require_auth = True,\n allowed_param = ['q', 'per_page', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L262_C4", "label": "expression", "type": "expression", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3231, 0.0012, 1, 0.45, 0.3462, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/friends \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L263_C4", "label": "friends = bind_api()", "type": "assigned_variable", "loc": [263, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3268, 0.0062, 1, 0.45, 0.3526, 875, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "friends", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends = bind_api(\n path = '/statuses/friends.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L269_C4", "label": "expression", "type": "expression", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3317, 0.0012, 1, 0.45, 0.359, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/followers \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L270_C4", "label": "followers = bind_api()", "type": "assigned_variable", "loc": [270, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3354, 0.0062, 1, 0.45, 0.3654, 530, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " followers = bind_api(\n path = '/statuses/followers.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L276_C4", "label": "expression", "type": "expression", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3403, 0.0012, 1, 0.45, 0.3718, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L277_C4", "label": "direct_messages = bind_api()", "type": "assigned_variable", "loc": [277, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3446, 0.0074, 1, 0.45, 0.3782, 385, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "direct_messages", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " direct_messages = bind_api(\n path = '/direct_messages.json',\n payload_type = 'direct_message', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3502, 0.0012, 1, 0.45, 0.3846, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/sent \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L285_C4", "label": "sent_direct_messages = bind_api()", "type": "assigned_variable", "loc": [285, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3545, 0.0074, 1, 0.45, 0.391, 492, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "sent_direct_messages", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " sent_direct_messages = bind_api(\n path = '/direct_messages/sent.json',\n payload_type = 'direct_message', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L291_C4", "label": "expression", "type": "expression", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3588, 0.0012, 1, 0.45, 0.3974, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/new \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L292_C4", "label": "new_direct_message = bind_api()", "type": "assigned_variable", "loc": [292, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3637, 0.0086, 1, 0.45, 0.4038, 801, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "new_direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " new_direct_message = bind_api(\n path = '/direct_messages/new.json',\n method = 'POST',\n payload_type = 'direct_message',\n allowed_param = ['id', 'screen_name', 'user_id', 'text'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L300_C4", "label": "expression", "type": "expression", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3699, 0.0012, 1, 0.45, 0.4103, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L301_C4", "label": "destroy_direct_message = bind_api()", "type": "assigned_variable", "loc": [301, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3748, 0.0086, 1, 0.45, 0.4167, 777, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_direct_message = bind_api(\n path = '/direct_messages/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'direct_message',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L309_C4", "label": "expression", "type": "expression", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.381, 0.0012, 1, 0.45, 0.4231, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L310_C4", "label": "create_friendship = bind_api()", "type": "assigned_variable", "loc": [310, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.3859, 0.0086, 1, 0.45, 0.4295, 536, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_friendship = bind_api(\n path = '/friendships/create.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name', 'follow'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L318_C4", "label": "expression", "type": "expression", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.3921, 0.0012, 1, 0.45, 0.4359, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L319_C4", "label": "destroy_friendship = bind_api()", "type": "assigned_variable", "loc": [319, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.397, 0.0086, 1, 0.45, 0.4423, 506, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_friendship = bind_api(\n path = '/friendships/destroy.json',\n method = 'DELETE',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L327_C4", "label": "expression", "type": "expression", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4032, 0.0012, 1, 0.45, 0.4487, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/exists \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L328_C4", "label": "exists_friendship = bind_api()", "type": "assigned_variable", "loc": [328, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4069, 0.0062, 1, 0.45, 0.4551, 932, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "exists_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " exists_friendship = bind_api(\n path = '/friendships/exists.json',\n payload_type = 'json',\n allowed_param = ['user_a', 'user_b']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L334_C4", "label": "expression", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4118, 0.0012, 1, 0.45, 0.4615, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L335_C4", "label": "show_friendship = bind_api()", "type": "assigned_variable", "loc": [335, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4162, 0.0074, 1, 0.45, 0.4679, 881, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "show_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " show_friendship = bind_api(\n path = '/friendships/show.json',\n payload_type = 'friendship',\n allowed_param = ['source_id', 'source_screen_name',\n 'target_id', 'target_screen_name']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L342_C4", "label": "expression", "type": "expression", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4217, 0.0012, 1, 0.45, 0.4744, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friends/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L343_C4", "label": "friends_ids = bind_api()", "type": "assigned_variable", "loc": [343, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.426, 0.0074, 1, 0.45, 0.4808, 509, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "friends_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends_ids = bind_api(\n path = '/friends/ids.json',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name', 'cursor', 'count'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L350_C4", "label": "expression", "type": "expression", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4316, 0.0012, 1, 0.45, 0.4872, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" followers/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L351_C4", "label": "followers_ids = bind_api()", "type": "assigned_variable", "loc": [351, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4353, 0.0062, 1, 0.45, 0.4936, 328, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "followers_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " followers_ids = bind_api( \n path = '/followers/ids.json',\n payload_type = 'json',\n allowed_param = ['id', 'page'],\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L357_C4", "label": "expression", "type": "expression", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4402, 0.0012, 1, 0.45, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/verify_credentials \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L358_C4", "label": "verify_credentials", "type": "function", "loc": [358, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.4464, 0.0111, 1, 0.45, 0.5064, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "verify_credentials", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_credentials(self):\n try:\n return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)\n except WeibopError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8", "label": "try", "type": "try", "loc": [359, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L358_C4", "vector": [7, 2, 0.447, 0.0099, 2, 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 return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L360_C12", "label": "return", "type": "return", "loc": [360, 364], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8", "vector": [13, 3, 0.4464, 0.0062, 3, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L366_C12", "label": "return", "type": "return", "loc": [366, 366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8", "vector": [13, 3, 0.4513, 0.0012, 3, 0.15, 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_128:Expr_L368_C4", "label": "expression", "type": "expression", "loc": [368, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4538, 0.0012, 1, 0.45, 0.5128, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/rate_limit_status \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L369_C4", "label": "rate_limit_status = bind_api()", "type": "assigned_variable", "loc": [369, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4568, 0.0049, 1, 0.45, 0.5192, 31, 3, 2, 0, 0, 446, 10, 1], "semantic": {"name": "rate_limit_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " rate_limit_status = bind_api(\n path = '/account/rate_limit_status.json',\n payload_type = 'json'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L374_C4", "label": "expression", "type": "expression", "loc": [374, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4612, 0.0012, 1, 0.45, 0.5256, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_delivery_device \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L375_C4", "label": "set_delivery_device = bind_api()", "type": "assigned_variable", "loc": [375, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4661, 0.0086, 1, 0.45, 0.5321, 216, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "set_delivery_device", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " set_delivery_device = bind_api(\n path = '/account/update_delivery_device.json',\n method = 'POST',\n allowed_param = ['device'],\n payload_type = 'user',\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L383_C4", "label": "expression", "type": "expression", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4723, 0.0012, 1, 0.45, 0.5385, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_colors \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L384_C4", "label": "update_profile_colors = bind_api()", "type": "assigned_variable", "loc": [384, 392], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.4784, 0.0111, 1, 0.45, 0.5449, 979, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_profile_colors", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_profile_colors = bind_api(\n path = '/account/update_profile_colors.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['profile_background_color', 'profile_text_color',\n 'profile_link_color', 'profile_sidebar_fill_color',\n 'profile_sidebar_border_color'],\n require_auth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L394_C4", "label": "expression", "type": "expression", "loc": [394, 394], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4858, 0.0012, 1, 0.45, 0.5513, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_image \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4", "label": "update_profile_image", "type": "function", "loc": [395, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.4914, 0.0099, 1, 0.45, 0.5577, 456, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "update_profile_image", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_profile_image(self, filename):\n headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)\n return bind_api(\n path = '/account/update_profile_image.json',\n method = 'POST',\n payload_type = 'user',\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L396_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [396, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4", "vector": [14, 2, 0.4883, 0.0012, 2, 0.07, 0.0, 165, 3, 3, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L397_C8", "label": "return", "type": "return", "loc": [397, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4", "vector": [13, 2, 0.4926, 0.0074, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/account/update_profile_image.json',\n method = 'POST',\n payload_type = 'user',\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L404_C4", "label": "expression", "type": "expression", "loc": [404, 404], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.4982, 0.0012, 1, 0.45, 0.5641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_background_image \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4", "label": "update_profile_background_image", "type": "function", "loc": [405, 413], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.5043, 0.0111, 1, 0.45, 0.5705, 569, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "update_profile_background_image", "arg_names": ["self", "filename", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_profile_background_image(self, filename, *args, **kargs):\n headers, post_data = API._pack_image(filename, 800)\n bind_api(\n path = '/account/update_profile_background_image.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['tile'],\n require_auth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L406_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4", "vector": [14, 2, 0.5006, 0.0012, 2, 0.62, 0.0, 165, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename, 800)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L407_C8", "label": "expression", "type": "expression", "loc": [407, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4", "vector": [8, 2, 0.5055, 0.0086, 2, 0.62, 1.0, 0, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/account/update_profile_background_image.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['tile'],\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L415_C4", "label": "expression", "type": "expression", "loc": [415, 415], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5117, 0.0012, 1, 0.45, 0.5769, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L416_C4", "label": "update_profile = bind_api()", "type": "assigned_variable", "loc": [416, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5166, 0.0086, 1, 0.45, 0.5833, 829, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_profile", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_profile = bind_api(\n path = '/account/update_profile.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['name', 'url', 'location', 'description'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L424_C4", "label": "expression", "type": "expression", "loc": [424, 424], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5228, 0.0012, 1, 0.45, 0.5897, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L425_C4", "label": "favorites = bind_api()", "type": "assigned_variable", "loc": [425, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5265, 0.0062, 1, 0.45, 0.5962, 501, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "favorites", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " favorites = bind_api(\n path = '/favorites/{id}.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L431_C4", "label": "expression", "type": "expression", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5314, 0.0012, 1, 0.45, 0.6026, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L432_C4", "label": "create_favorite = bind_api()", "type": "assigned_variable", "loc": [432, 438], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5364, 0.0086, 1, 0.45, 0.609, 288, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_favorite", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_favorite = bind_api(\n path = '/favorites/create/{id}.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L440_C4", "label": "expression", "type": "expression", "loc": [440, 440], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5425, 0.0012, 1, 0.45, 0.6154, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L441_C4", "label": "destroy_favorite = bind_api()", "type": "assigned_variable", "loc": [441, 447], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5475, 0.0086, 1, 0.45, 0.6218, 959, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_favorite", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_favorite = bind_api(\n path = '/favorites/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L449_C4", "label": "expression", "type": "expression", "loc": [449, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5536, 0.0012, 1, 0.45, 0.6282, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" notifications/follow \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L450_C4", "label": "enable_notifications = bind_api()", "type": "assigned_variable", "loc": [450, 456], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5586, 0.0086, 1, 0.45, 0.6346, 363, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "enable_notifications", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " enable_notifications = bind_api(\n path = '/notifications/follow.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L458_C4", "label": "expression", "type": "expression", "loc": [458, 458], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5647, 0.0012, 1, 0.45, 0.641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" notifications/leave \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L459_C4", "label": "disable_notifications = bind_api()", "type": "assigned_variable", "loc": [459, 465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5697, 0.0086, 1, 0.45, 0.6474, 877, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "disable_notifications", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " disable_notifications = bind_api(\n path = '/notifications/leave.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L467_C4", "label": "expression", "type": "expression", "loc": [467, 467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5758, 0.0012, 1, 0.45, 0.6538, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L468_C4", "label": "create_block = bind_api()", "type": "assigned_variable", "loc": [468, 474], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5808, 0.0086, 1, 0.45, 0.6603, 826, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_block", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_block = bind_api(\n path = '/blocks/create.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L476_C4", "label": "expression", "type": "expression", "loc": [476, 476], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.5869, 0.0012, 1, 0.45, 0.6667, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L477_C4", "label": "destroy_block = bind_api()", "type": "assigned_variable", "loc": [477, 483], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.5919, 0.0086, 1, 0.45, 0.6731, 557, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_block", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_block = bind_api(\n path = '/blocks/destroy.json',\n method = 'DELETE',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L485_C4", "label": "expression", "type": "expression", "loc": [485, 485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.598, 0.0012, 1, 0.45, 0.6795, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/exists \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4", "label": "exists_block", "type": "function", "loc": [486, 495], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.6048, 0.0123, 1, 0.45, 0.6859, 234, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "exists_block", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exists_block(self, *args, **kargs):\n try:\n bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)\n except WeibopError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8", "label": "try", "type": "try", "loc": [487, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4", "vector": [7, 2, 0.6048, 0.0099, 2, 0.99, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L488_C12", "label": "expression", "type": "expression", "loc": [488, 492], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8", "vector": [8, 3, 0.6042, 0.0062, 3, 0.18, 0.0, 0, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L494_C12", "label": "return", "type": "return", "loc": [494, 494], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8", "vector": [13, 3, 0.6091, 0.0012, 3, 0.18, 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_128:Return_L495_C8", "label": "return", "type": "return", "loc": [495, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4", "vector": [13, 2, 0.6104, 0.0012, 2, 0.99, 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_128:Expr_L497_C4", "label": "expression", "type": "expression", "loc": [497, 497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6128, 0.0012, 1, 0.45, 0.6923, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/blocking \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L498_C4", "label": "blocks = bind_api()", "type": "assigned_variable", "loc": [498, 503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6171, 0.0074, 1, 0.45, 0.6987, 384, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " blocks = bind_api(\n path = '/blocks/blocking.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L505_C4", "label": "expression", "type": "expression", "loc": [505, 505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6227, 0.0012, 1, 0.45, 0.7051, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/blocking/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L506_C4", "label": "blocks_ids = bind_api()", "type": "assigned_variable", "loc": [506, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6264, 0.0062, 1, 0.45, 0.7115, 469, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "blocks_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " blocks_ids = bind_api(\n path = '/blocks/blocking/ids.json',\n payload_type = 'json',\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L512_C4", "label": "expression", "type": "expression", "loc": [512, 512], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6313, 0.0012, 1, 0.45, 0.7179, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/repost \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L513_C4", "label": "report_spam = bind_api()", "type": "assigned_variable", "loc": [513, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6363, 0.0086, 1, 0.45, 0.7244, 138, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "report_spam", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " report_spam = bind_api(\n path = '/report_spam.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L521_C4", "label": "expression", "type": "expression", "loc": [521, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6424, 0.0012, 1, 0.45, 0.7308, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L522_C4", "label": "saved_searches = bind_api()", "type": "assigned_variable", "loc": [522, 526], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6461, 0.0062, 1, 0.45, 0.7372, 36, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "saved_searches", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " saved_searches = bind_api(\n path = '/saved_searches.json',\n payload_type = 'saved_search', payload_list = True,\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L528_C4", "label": "expression", "type": "expression", "loc": [528, 528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.651, 0.0012, 1, 0.45, 0.7436, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L529_C4", "label": "get_saved_search = bind_api()", "type": "assigned_variable", "loc": [529, 534], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6554, 0.0074, 1, 0.45, 0.75, 758, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "get_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_saved_search = bind_api(\n path = '/saved_searches/show/{id}.json',\n payload_type = 'saved_search',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L536_C4", "label": "expression", "type": "expression", "loc": [536, 536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6609, 0.0012, 1, 0.45, 0.7564, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L537_C4", "label": "create_saved_search = bind_api()", "type": "assigned_variable", "loc": [537, 543], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6658, 0.0086, 1, 0.45, 0.7628, 758, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_saved_search = bind_api(\n path = '/saved_searches/create.json',\n method = 'POST',\n payload_type = 'saved_search',\n allowed_param = ['query'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L545_C4", "label": "expression", "type": "expression", "loc": [545, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.672, 0.0012, 1, 0.45, 0.7692, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L546_C4", "label": "destroy_saved_search = bind_api()", "type": "assigned_variable", "loc": [546, 552], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.6769, 0.0086, 1, 0.45, 0.7756, 4, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_saved_search = bind_api(\n path = '/saved_searches/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'saved_search',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L554_C4", "label": "expression", "type": "expression", "loc": [554, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.6831, 0.0012, 1, 0.45, 0.7821, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" help/test \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4", "label": "test", "type": "function", "loc": [555, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.6887, 0.0099, 1, 0.45, 0.7885, 224, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test(self):\n try:\n bind_api(\n path = '/help/test.json',\n )(self)\n except WeibopError:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8", "label": "try", "type": "try", "loc": [556, 561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4", "vector": [7, 2, 0.6887, 0.0074, 2, 0.93, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n bind_api(\n path = '/help/test.json',\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L557_C12", "label": "expression", "type": "expression", "loc": [557, 559], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8", "vector": [8, 3, 0.688, 0.0037, 3, 0.14, 0.0, 0, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/help/test.json',\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L561_C12", "label": "return", "type": "return", "loc": [561, 561], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8", "vector": [13, 3, 0.6917, 0.0012, 3, 0.14, 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_128:Return_L562_C8", "label": "return", "type": "return", "loc": [562, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4", "vector": [13, 2, 0.693, 0.0012, 2, 0.93, 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_128:FunctionDef_L564_C4", "label": "create_list", "type": "function", "loc": [564, 571], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.6998, 0.0099, 1, 0.45, 0.7949, 955, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "create_list", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_list(self, *args, **kargs):\n return bind_api(\n path = '/%s/lists.json' % self.auth.get_username(),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L565_C8", "label": "return", "type": "return", "loc": [565, 571], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L564_C4", "vector": [13, 2, 0.7004, 0.0086, 2, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists.json' % self.auth.get_username(),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L573_C4", "label": "destroy_list", "type": "function", "loc": [573, 579], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.7102, 0.0086, 1, 0.45, 0.8013, 679, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "destroy_list", "arg_names": ["self", "slug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy_list(self, slug):\n return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L574_C8", "label": "return", "type": "return", "loc": [574, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L573_C4", "vector": [13, 2, 0.7109, 0.0074, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L581_C4", "label": "update_list", "type": "function", "loc": [581, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.7207, 0.0099, 1, 0.45, 0.8077, 886, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "update_list", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_list(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L582_C8", "label": "return", "type": "return", "loc": [582, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L581_C4", "vector": [13, 2, 0.7213, 0.0086, 2, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L590_C4", "label": "lists = bind_api()", "type": "assigned_variable", "loc": [590, 595], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7306, 0.0074, 1, 0.45, 0.8141, 194, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists = bind_api(\n path = '/{user}/lists.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L597_C4", "label": "lists_memberships = bind_api()", "type": "assigned_variable", "loc": [597, 602], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7392, 0.0074, 1, 0.45, 0.8205, 262, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists_memberships", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists_memberships = bind_api(\n path = '/{user}/lists/memberships.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L604_C4", "label": "lists_subscriptions = bind_api()", "type": "assigned_variable", "loc": [604, 609], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7478, 0.0074, 1, 0.45, 0.8269, 33, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists_subscriptions", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists_subscriptions = bind_api(\n path = '/{user}/lists/subscriptions.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L611_C4", "label": "list_timeline = bind_api()", "type": "assigned_variable", "loc": [611, 615], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7559, 0.0062, 1, 0.45, 0.8333, 458, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_timeline = bind_api(\n path = '/{owner}/lists/{slug}/statuses.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['owner', 'slug', 'since_id', 'max_id', 'count', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L617_C4", "label": "get_list = bind_api()", "type": "assigned_variable", "loc": [617, 621], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7633, 0.0062, 1, 0.45, 0.8397, 868, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_list = bind_api(\n path = '/{owner}/lists/{slug}.json',\n payload_type = 'list',\n allowed_param = ['owner', 'slug']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L623_C4", "label": "add_list_member", "type": "function", "loc": [623, 630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.7725, 0.0099, 1, 0.45, 0.8462, 485, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "add_list_member", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_list_member(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L624_C8", "label": "return", "type": "return", "loc": [624, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L623_C4", "vector": [13, 2, 0.7731, 0.0086, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L632_C4", "label": "remove_list_member", "type": "function", "loc": [632, 639], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.7836, 0.0099, 1, 0.45, 0.8526, 218, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "remove_list_member", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_list_member(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L633_C8", "label": "return", "type": "return", "loc": [633, 639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L632_C4", "vector": [13, 2, 0.7842, 0.0086, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L641_C4", "label": "list_members = bind_api()", "type": "assigned_variable", "loc": [641, 645], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.7928, 0.0062, 1, 0.45, 0.859, 968, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_members", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_members = bind_api(\n path = '/{owner}/{slug}/members.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['owner', 'slug', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L647_C4", "label": "is_list_member", "type": "function", "loc": [647, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.8021, 0.0099, 1, 0.45, 0.8654, 656, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "is_list_member", "arg_names": ["self", "owner", "slug", "user_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_list_member(self, owner, slug, user_id):\n try:\n return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8", "label": "try", "type": "try", "loc": [648, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L647_C4", "vector": [7, 2, 0.8027, 0.0086, 2, 0.87, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L649_C12", "label": "return", "type": "return", "loc": [649, 652], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8", "vector": [13, 3, 0.8021, 0.0049, 3, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L654_C12", "label": "return", "type": "return", "loc": [654, 654], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8", "vector": [13, 3, 0.8064, 0.0012, 3, 0.33, 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_128:Assign_L656_C4", "label": "subscribe_list = bind_api()", "type": "assigned_variable", "loc": [656, 662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8126, 0.0086, 1, 0.45, 0.8718, 65, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "subscribe_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " subscribe_list = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['owner', 'slug'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L664_C4", "label": "unsubscribe_list = bind_api()", "type": "assigned_variable", "loc": [664, 670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8224, 0.0086, 1, 0.45, 0.8782, 148, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "unsubscribe_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " unsubscribe_list = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['owner', 'slug'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L672_C4", "label": "list_subscribers = bind_api()", "type": "assigned_variable", "loc": [672, 676], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8311, 0.0062, 1, 0.45, 0.8846, 349, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_subscribers", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_subscribers = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['owner', 'slug', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L678_C4", "label": "is_subscribed_list", "type": "function", "loc": [678, 685], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.8403, 0.0099, 1, 0.45, 0.891, 812, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "is_subscribed_list", "arg_names": ["self", "owner", "slug", "user_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_subscribed_list(self, owner, slug, user_id):\n try:\n return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8", "label": "try", "type": "try", "loc": [679, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L678_C4", "vector": [7, 2, 0.8409, 0.0086, 2, 0.08, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L680_C12", "label": "return", "type": "return", "loc": [680, 683], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8", "vector": [13, 3, 0.8403, 0.0049, 3, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L685_C12", "label": "return", "type": "return", "loc": [685, 685], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8", "vector": [13, 3, 0.8446, 0.0012, 3, 0.51, 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_128:Expr_L687_C4", "label": "expression", "type": "expression", "loc": [687, 687], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.8471, 0.0012, 1, 0.45, 0.8974, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/available \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L688_C4", "label": "trends_available = bind_api()", "type": "assigned_variable", "loc": [688, 692], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8508, 0.0062, 1, 0.45, 0.9038, 229, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends_available", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_available = bind_api(\n path = '/trends/available.json',\n payload_type = 'json',\n allowed_param = ['lat', 'long']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L694_C4", "label": "expression", "type": "expression", "loc": [694, 694], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.8557, 0.0012, 1, 0.45, 0.9103, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/location \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L695_C4", "label": "trends_location = bind_api()", "type": "assigned_variable", "loc": [695, 699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8594, 0.0062, 1, 0.45, 0.9167, 973, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends_location", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_location = bind_api(\n path = '/trends/{woeid}.json',\n payload_type = 'json',\n allowed_param = ['woeid']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L701_C4", "label": "expression", "type": "expression", "loc": [701, 701], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.8644, 0.0012, 1, 0.45, 0.9231, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" search \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L702_C4", "label": "search = bind_api()", "type": "assigned_variable", "loc": [702, 707], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8687, 0.0074, 1, 0.45, 0.9295, 163, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " search = bind_api(\n search_api = True,\n path = '/search.json',\n payload_type = 'search_result', payload_list = True,\n allowed_param = ['q', 'lang', 'locale', 'rpp', 'page', 'since_id', 'geocode', 'show_user']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L708_C4", "label": "search.pagination_mode =", "type": "assigned_variable", "loc": [708, 708], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.873, 0.0012, 1, 0.45, 0.9359, 773, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "search.pagination_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search.pagination_mode = 'page'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L710_C4", "label": "expression", "type": "expression", "loc": [710, 710], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.8755, 0.0012, 1, 0.45, 0.9423, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L711_C4", "label": "trends = bind_api()", "type": "assigned_variable", "loc": [711, 715], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8792, 0.0062, 1, 0.45, 0.9487, 935, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends = bind_api(\n search_api = True,\n path = '/trends.json',\n payload_type = 'json'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L717_C4", "label": "expression", "type": "expression", "loc": [717, 717], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.8841, 0.0012, 1, 0.45, 0.9551, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/current \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L718_C4", "label": "trends_current = bind_api()", "type": "assigned_variable", "loc": [718, 723], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8884, 0.0074, 1, 0.45, 0.9615, 235, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_current", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_current = bind_api(\n search_api = True,\n path = '/trends/current.json',\n payload_type = 'json',\n allowed_param = ['exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L725_C4", "label": "expression", "type": "expression", "loc": [725, 725], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.894, 0.0012, 1, 0.45, 0.9679, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/daily \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L726_C4", "label": "trends_daily = bind_api()", "type": "assigned_variable", "loc": [726, 731], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.8983, 0.0074, 1, 0.45, 0.9744, 634, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_daily", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_daily = bind_api(\n search_api = True,\n path = '/trends/daily.json',\n payload_type = 'json',\n allowed_param = ['date', 'exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L733_C4", "label": "expression", "type": "expression", "loc": [733, 733], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.9038, 0.0012, 1, 0.45, 0.9808, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/weekly \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L734_C4", "label": "trends_weekly = bind_api()", "type": "assigned_variable", "loc": [734, 739], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [14, 1, 0.9081, 0.0074, 1, 0.45, 0.9872, 285, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_weekly", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_weekly = bind_api(\n search_api = True,\n path = '/trends/weekly.json',\n payload_type = 'json',\n allowed_param = ['date', 'exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L740_C4", "label": "expression", "type": "expression", "loc": [740, 740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [8, 1, 0.9125, 0.0012, 1, 0.45, 0.9936, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Internal use only \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "label": "_pack_image", "type": "function", "loc": [742, 810], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "vector": [2, 1, 0.9568, 0.0851, 1, 0.45, 1.0, 140, 0, 7, 1, 0, 0, 0, 45], "semantic": {"name": "_pack_image", "arg_names": ["filename", "max_size", "source", "status", "lat", "long", "contentname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _pack_image(filename, max_size, source=None, status=None, lat=None, long=None, contentname=\"image\"):\n \"\"\"Pack image from file into multipart-formdata post body\"\"\"\n # image must be less than 700kb in size\n try:\n if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')\n #except os.error, e:\n except os.error:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L743_C8", "label": "expression", "type": "expression", "loc": [743, 743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9162, 0.0012, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Pack image from file into multipart-formdata post body\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L745_C8", "label": "try", "type": "try", "loc": [745, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [7, 2, 0.9217, 0.0074, 2, 0.88, 0.0385, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')\n #except os.error, e:\n except os.error:\n raise WeibopError('Unable to access file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L746_C12", "label": "if", "type": "if", "loc": [746, 747], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L745_C8", "vector": [4, 3, 0.9205, 0.0025, 3, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L753_C8", "label": "file_type = guess_type()", "type": "assigned_variable", "loc": [753, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9285, 0.0012, 2, 0.88, 0.0769, 402, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "file_type", "arg_names": [], "import_names": [], "rhs_call_name": "guess_type", "annotation": ""}, "snippet": " file_type = mimetypes.guess_type(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L754_C8", "label": "if", "type": "if", "loc": [754, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.9303, 0.0025, 2, 0.88, 0.1154, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file_type is None:\n raise WeibopError('Could not determine file type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L756_C8", "label": "file_type =", "type": "assigned_variable", "loc": [756, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9322, 0.0012, 2, 0.88, 0.1538, 402, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_type = file_type[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L757_C8", "label": "if", "type": "if", "loc": [757, 758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.934, 0.0025, 2, 0.88, 0.1923, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file_type not in ['image/gif', 'image/jpeg', 'image/png']:\n raise WeibopError('Invalid file type for image: %s' % file_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L761_C8", "label": "fp = open()", "type": "assigned_variable", "loc": [761, 761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9383, 0.0012, 2, 0.88, 0.2308, 392, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fp = open(filename, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L762_C8", "label": "BOUNDARY =", "type": "assigned_variable", "loc": [762, 762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9396, 0.0012, 2, 0.88, 0.2692, 677, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDARY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDARY = 'Tw3ePy'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L763_C8", "label": "body =", "type": "assigned_variable", "loc": [763, 763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9408, 0.0012, 2, 0.88, 0.3077, 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_128:If_L764_C8", "label": "if", "type": "if", "loc": [764, 770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.9457, 0.0086, 2, 0.88, 0.3462, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"status\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L765_C12", "label": "append()", "type": "expression", "loc": [765, 765], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.9433, 0.0012, 3, 0.82, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L766_C12", "label": "append()", "type": "expression", "loc": [766, 766], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.9445, 0.0012, 3, 0.82, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"status\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L767_C12", "label": "append()", "type": "expression", "loc": [767, 767], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.9457, 0.0012, 3, 0.82, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L768_C12", "label": "append()", "type": "expression", "loc": [768, 768], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.947, 0.0012, 3, 0.82, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L769_C12", "label": "append()", "type": "expression", "loc": [769, 769], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.9482, 0.0012, 3, 0.82, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L770_C12", "label": "append()", "type": "expression", "loc": [770, 770], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "vector": [8, 3, 0.9494, 0.0012, 3, 0.82, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "label": "if", "type": "if", "loc": [771, 777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.9544, 0.0086, 2, 0.88, 0.3846, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"source\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L772_C12", "label": "append()", "type": "expression", "loc": [772, 772], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9519, 0.0012, 3, 0.05, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L773_C12", "label": "append()", "type": "expression", "loc": [773, 773], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9531, 0.0012, 3, 0.05, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"source\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L774_C12", "label": "append()", "type": "expression", "loc": [774, 774], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9544, 0.0012, 3, 0.05, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L775_C12", "label": "append()", "type": "expression", "loc": [775, 775], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9556, 0.0012, 3, 0.05, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L776_C12", "label": "append()", "type": "expression", "loc": [776, 776], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9568, 0.0012, 3, 0.05, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L777_C12", "label": "append()", "type": "expression", "loc": [777, 777], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "vector": [8, 3, 0.9581, 0.0012, 3, 0.05, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "label": "if", "type": "if", "loc": [778, 784], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.963, 0.0086, 2, 0.88, 0.4231, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lat is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"lat\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L779_C12", "label": "append()", "type": "expression", "loc": [779, 779], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.9605, 0.0012, 3, 0.92, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L780_C12", "label": "append()", "type": "expression", "loc": [780, 780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.9618, 0.0012, 3, 0.92, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"lat\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L781_C12", "label": "append()", "type": "expression", "loc": [781, 781], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.963, 0.0012, 3, 0.92, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L782_C12", "label": "append()", "type": "expression", "loc": [782, 782], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.9642, 0.0012, 3, 0.92, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L783_C12", "label": "append()", "type": "expression", "loc": [783, 783], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.9655, 0.0012, 3, 0.92, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L784_C12", "label": "append()", "type": "expression", "loc": [784, 784], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "vector": [8, 3, 0.9667, 0.0012, 3, 0.92, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "label": "if", "type": "if", "loc": [785, 791], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [4, 2, 0.9716, 0.0086, 2, 0.88, 0.4615, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if long is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"long\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L786_C12", "label": "append()", "type": "expression", "loc": [786, 786], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9692, 0.0012, 3, 0.79, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L787_C12", "label": "append()", "type": "expression", "loc": [787, 787], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9704, 0.0012, 3, 0.79, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"long\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L788_C12", "label": "append()", "type": "expression", "loc": [788, 788], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9716, 0.0012, 3, 0.79, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L789_C12", "label": "append()", "type": "expression", "loc": [789, 789], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9729, 0.0012, 3, 0.79, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L790_C12", "label": "append()", "type": "expression", "loc": [790, 790], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9741, 0.0012, 3, 0.79, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L791_C12", "label": "append()", "type": "expression", "loc": [791, 791], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "vector": [8, 3, 0.9753, 0.0012, 3, 0.79, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L792_C8", "label": "append()", "type": "expression", "loc": [792, 792], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9766, 0.0012, 2, 0.88, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L793_C8", "label": "append()", "type": "expression", "loc": [793, 793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9778, 0.0012, 2, 0.88, 0.5385, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"'+ contentname +'\"; filename=\"%s\"' % filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L794_C8", "label": "append()", "type": "expression", "loc": [794, 794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.979, 0.0012, 2, 0.88, 0.5769, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: %s' % file_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L795_C8", "label": "append()", "type": "expression", "loc": [795, 795], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9803, 0.0012, 2, 0.88, 0.6154, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: binary')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L796_C8", "label": "append()", "type": "expression", "loc": [796, 796], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9815, 0.0012, 2, 0.88, 0.6538, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L797_C8", "label": "append()", "type": "expression", "loc": [797, 797], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9827, 0.0012, 2, 0.88, 0.6923, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(fp.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L798_C8", "label": "append()", "type": "expression", "loc": [798, 798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.984, 0.0012, 2, 0.88, 0.7308, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY + '--')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L799_C8", "label": "append()", "type": "expression", "loc": [799, 799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9852, 0.0012, 2, 0.88, 0.7692, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L800_C8", "label": "close()", "type": "expression", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9864, 0.0012, 2, 0.88, 0.8077, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L801_C8", "label": "append()", "type": "expression", "loc": [801, 801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9877, 0.0012, 2, 0.88, 0.8462, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY + '--')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L802_C8", "label": "append()", "type": "expression", "loc": [802, 802], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [8, 2, 0.9889, 0.0012, 2, 0.88, 0.8846, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L803_C8", "label": "body = join()", "type": "assigned_variable", "loc": [803, 803], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9901, 0.0012, 2, 0.88, 0.9231, 477, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " body = '\\r\\n'.join(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L805_C8", "label": "headers =", "type": "assigned_variable", "loc": [805, 808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [14, 2, 0.9945, 0.0049, 2, 0.88, 0.9615, 950, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'Content-Type': 'multipart/form-data; boundary=Tw3ePy',\n 'Content-Length': len(body)\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L810_C8", "label": "return", "type": "return", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "vector": [13, 2, 0.9988, 0.0012, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return headers, body"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L328_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L366_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L425_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L441_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L449_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L450_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L458_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L477_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L486_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L498_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L522_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L546_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L554_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L573_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L581_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L581_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L597_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L623_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L623_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L649_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L654_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L656_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L672_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L680_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L685_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L687_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L688_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L694_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L701_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L702_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L708_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L710_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L711_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L717_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L718_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L725_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L726_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L733_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L734_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L740_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:Try_L745_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L746_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L753_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L754_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L757_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L762_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L765_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L766_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L767_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L768_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L769_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L770_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L772_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L773_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L774_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L775_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L776_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L777_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L779_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L780_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L781_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L782_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L783_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L784_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L786_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L787_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L788_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L789_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L790_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L791_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L793_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L795_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L796_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L797_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Expr_L802_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L803_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Assign_L805_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_128:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_128:Return_L810_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.error import WeibopError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
self.iterator = CursorIterator(method, args, kargs)
else:
self.iterator = PageIterator(method, args, kargs)
else:
raise WeibopError('This method does not perform pagination')
def pages(self, limit=0):
"""Return iterator for pages"""
if limit > 0:
self.iterator.limit = limit
return self.iterator
def items(self, limit=0):
"""Return iterator for items in each page"""
i = ItemIterator(self.iterator)
i.limit = limit
return i
class BaseIterator(object):
def __init__(self, method, args, kargs):
self.method = method
self.args = args
self.kargs = kargs
self.limit = 0
def next(self):
raise NotImplementedError
def prev(self):
raise NotImplementedError
def __iter__(self):
return self
class CursorIterator(BaseIterator):
def __init__(self, method, args, kargs):
BaseIterator.__init__(self, method, args, kargs)
self.next_cursor = -1
self.prev_cursor = 0
self.count = 0
def next(self):
if self.next_cursor == 0 or (self.limit and self.count == self.limit):
raise StopIteration
data, cursors = self.method(
cursor=self.next_cursor, *self.args, **self.kargs
)
self.prev_cursor, self.next_cursor = cursors
if len(data) == 0:
raise StopIteration
self.count += 1
return data
def prev(self):
if self.prev_cursor == 0:
raise WeibopError('Can not page back more, at first page')
data, self.next_cursor, self.prev_cursor = self.method(
cursor=self.prev_cursor, *self.args, **self.kargs
)
self.count -= 1
return data
class PageIterator(BaseIterator):
def __init__(self, method, args, kargs):
BaseIterator.__init__(self, method, args, kargs)
self.current_page = 0
def next(self):
self.current_page += 1
items = self.method(page=self.current_page, *self.args, **self.kargs)
if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):
raise StopIteration
return items
def prev(self):
if (self.current_page == 1):
raise WeibopError('Can not page back more, at first page')
self.current_page -= 1
return self.method(page=self.current_page, *self.args, **self.kargs)
class ItemIterator(BaseIterator):
def __init__(self, page_iterator):
self.page_iterator = page_iterator
self.limit = 0
self.current_page = None
self.page_index = -1
self.count = 0
def next(self):
if self.limit > 0 and self.count == self.limit:
raise StopIteration
if self.current_page is None or self.page_index == len(self.current_page) - 1:
# Reached end of current page, get the next page...
self.current_page = self.page_iterator.next()
self.page_index = -1
self.page_index += 1
self.count += 1
return self.current_page[self.page_index]
def prev(self):
if self.current_page is None:
raise WeibopError('Can not go back more, at first page')
if self.page_index == 0:
# At the beginning of the current page, move to next...
self.current_page = self.page_iterator.prev()
self.page_index = len(self.current_page)
if self.page_index == 0:
raise WeibopError('No more items')
self.page_index -= 1
self.count -= 1
return self.current_page[self.page_index]
| ajibawa-2023/Python-Code-Large/train/row_129 | 75 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_129:ImportFrom_L5_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0078, 0, 0.66, 0.0, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "label": "Cursor", "type": "class", "loc": [7, 29], "level": 0, "parent": null, "vector": [3, 0, 0.1406, 0.1797, 0, 0.66, 0.2, 647, 0, 3, 0, 0, 186, 0, 5], "semantic": {"name": "Cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Cursor(object):\n \"\"\"Pagination helper class\"\"\"\n\n def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "vector": [8, 1, 0.0625, 0.0078, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Pagination helper class\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "vector": [2, 1, 0.1055, 0.0625, 1, 0.94, 0.3333, 555, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)\n else:\n raise WeibopError('This method does not perform pagination')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L11_C8", "label": "if", "type": "if", "loc": [11, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L10_C4", "vector": [4, 2, 0.1094, 0.0547, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)\n else:\n raise WeibopError('This method does not perform pagination')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12", "label": "if", "type": "if", "loc": [12, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L11_C8", "vector": [4, 3, 0.1055, 0.0312, 3, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L13_C16", "label": "self.iterator = CursorIterator()", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12", "vector": [14, 4, 0.1016, 0.0078, 4, 0.6, 0.0, 313, 3, 3, 0, 0, 41, 10, 1], "semantic": {"name": "self.iterator", "arg_names": [], "import_names": [], "rhs_call_name": "CursorIterator", "annotation": ""}, "snippet": " self.iterator = CursorIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L15_C16", "label": "self.iterator = PageIterator()", "type": "assigned_variable", "loc": [15, 15], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12", "vector": [14, 4, 0.1172, 0.0078, 4, 0.6, 1.0, 313, 3, 3, 0, 0, 539, 10, 1], "semantic": {"name": "self.iterator", "arg_names": [], "import_names": [], "rhs_call_name": "PageIterator", "annotation": ""}, "snippet": " self.iterator = PageIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "label": "pages", "type": "function", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "vector": [2, 1, 0.1641, 0.0391, 1, 0.94, 0.6667, 125, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "pages", "arg_names": ["self", "limit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pages(self, limit=0):\n \"\"\"Return iterator for pages\"\"\"\n if limit > 0:\n self.iterator.limit = limit\n return self.iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L20_C8", "label": "expression", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "vector": [8, 2, 0.1562, 0.0078, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return iterator for pages\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "vector": [4, 2, 0.168, 0.0156, 2, 0.33, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if limit > 0:\n self.iterator.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L22_C12", "label": "self.iterator.limit =", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L21_C8", "vector": [14, 3, 0.1719, 0.0078, 3, 0.41, 0.0, 908, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.iterator.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.iterator.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L23_C8", "label": "return", "type": "return", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "vector": [13, 2, 0.1797, 0.0078, 2, 0.33, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "label": "items", "type": "function", "loc": [25, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "vector": [2, 1, 0.2109, 0.0391, 1, 0.94, 1.0, 339, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self", "limit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, limit=0):\n \"\"\"Return iterator for items in each page\"\"\"\n i = ItemIterator(self.iterator)\n i.limit = limit\n return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "vector": [8, 2, 0.2031, 0.0078, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return iterator for items in each page\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L27_C8", "label": "i = ItemIterator()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "vector": [14, 2, 0.2109, 0.0078, 2, 0.98, 0.3333, 826, 3, 1, 0, 0, 198, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "ItemIterator", "annotation": ""}, "snippet": " i = ItemIterator(self.iterator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L28_C8", "label": "i.limit =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "vector": [14, 2, 0.2188, 0.0078, 2, 0.98, 0.6667, 151, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "vector": [13, 2, 0.2266, 0.0078, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "label": "BaseIterator", "type": "class", "loc": [31, 46], "level": 0, "parent": null, "vector": [3, 0, 0.3008, 0.125, 0, 0.66, 0.4, 890, 0, 4, 0, 0, 186, 0, 0], "semantic": {"name": "BaseIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseIterator(object):\n\n def __init__(self, method, args, kargs):\n self.method = method\n self.args = args\n self.kargs = kargs\n self.limit = 0\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "label": "__init__", "type": "function", "loc": [33, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "vector": [2, 1, 0.2734, 0.0391, 1, 0.98, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n self.method = method\n self.args = args\n self.kargs = kargs\n self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L34_C8", "label": "self.method =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "vector": [14, 2, 0.2656, 0.0078, 2, 0.23, 0.0, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L35_C8", "label": "self.args =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "vector": [14, 2, 0.2734, 0.0078, 2, 0.23, 0.3333, 640, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.args = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L36_C8", "label": "self.kargs =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "vector": [14, 2, 0.2812, 0.0078, 2, 0.23, 0.6667, 182, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kargs = kargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L37_C8", "label": "self.limit =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "vector": [14, 2, 0.2891, 0.0078, 2, 0.23, 1.0, 467, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L39_C4", "label": "next", "type": "function", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "vector": [2, 1, 0.3086, 0.0156, 1, 0.98, 0.3333, 11, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def next(self):\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L42_C4", "label": "prev", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "vector": [2, 1, 0.332, 0.0156, 1, 0.98, 0.6667, 749, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L45_C4", "label": "__iter__", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "vector": [2, 1, 0.3555, 0.0156, 1, 0.98, 1.0, 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_129:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L45_C4", "vector": [13, 2, 0.3594, 0.0078, 2, 0.75, 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_129:ClassDef_L48_C0", "label": "CursorIterator", "type": "class", "loc": [48, 75], "level": 0, "parent": null, "vector": [3, 0, 0.4805, 0.2188, 0, 0.66, 0.6, 41, 0, 3, 0, 0, 890, 0, 5], "semantic": {"name": "CursorIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CursorIterator(BaseIterator):\n\n def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.next_cursor = -1\n self.prev_cursor = 0\n self.count = 0\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "label": "__init__", "type": "function", "loc": [50, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "vector": [2, 1, 0.4062, 0.0391, 1, 0.54, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.next_cursor = -1\n self.prev_cursor = 0\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L51_C8", "label": "__init__()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "vector": [8, 2, 0.3984, 0.0078, 2, 0.09, 0.0, 555, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " BaseIterator.__init__(self, method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L52_C8", "label": "self.next_cursor =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "vector": [14, 2, 0.4062, 0.0078, 2, 0.09, 0.3333, 650, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.next_cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.next_cursor = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L53_C8", "label": "self.prev_cursor =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "vector": [14, 2, 0.4141, 0.0078, 2, 0.09, 0.6667, 209, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.prev_cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prev_cursor = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L54_C8", "label": "self.count =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "vector": [14, 2, 0.4219, 0.0078, 2, 0.09, 1.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_129:FunctionDef_L56_C4", "label": "next", "type": "function", "loc": [56, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "vector": [2, 1, 0.4766, 0.0859, 1, 0.54, 0.5, 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.next_cursor == 0 or (self.limit and self.count == self.limit):\n raise StopIteration\n data, cursors = self.method(\n cursor=self.next_cursor, *self.args, **self.kargs\n )\n self.prev_cursor, self.next_cursor = cursors\n if len(data) == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L57_C8", "label": "if", "type": "if", "loc": [57, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "vector": [4, 2, 0.4492, 0.0156, 2, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.next_cursor == 0 or (self.limit and self.count == self.limit):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L59_C8", "label": "data, cursors = method()", "type": "assigned_variable", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "vector": [14, 2, 0.4688, 0.0234, 2, 0.71, 0.25, 413, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "data, cursors", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " data, cursors = self.method(\n cursor=self.next_cursor, *self.args, **self.kargs\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L62_C8", "label": "assign", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "vector": [14, 2, 0.4844, 0.0078, 2, 0.71, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prev_cursor, self.next_cursor = cursors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "vector": [4, 2, 0.4961, 0.0156, 2, 0.71, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(data) == 0:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "vector": [13, 2, 0.5156, 0.0078, 2, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "label": "prev", "type": "function", "loc": [68, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "vector": [2, 1, 0.5586, 0.0625, 1, 0.54, 1.0, 749, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if self.prev_cursor == 0:\n raise WeibopError('Can not page back more, at first page')\n data, self.next_cursor, self.prev_cursor = self.method(\n cursor=self.prev_cursor, *self.args, **self.kargs\n )\n self.count -= 1\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L69_C8", "label": "if", "type": "if", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "vector": [4, 2, 0.543, 0.0156, 2, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.prev_cursor == 0:\n raise WeibopError('Can not page back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L71_C8", "label": "data = method()", "type": "assigned_variable", "loc": [71, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "vector": [14, 2, 0.5625, 0.0234, 2, 0.94, 0.5, 929, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " data, self.next_cursor, self.prev_cursor = self.method(\n cursor=self.prev_cursor, *self.args, **self.kargs\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "vector": [13, 2, 0.5859, 0.0078, 2, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "label": "PageIterator", "type": "class", "loc": [77, 94], "level": 0, "parent": null, "vector": [3, 0, 0.668, 0.1406, 0, 0.66, 0.8, 539, 0, 3, 0, 0, 890, 0, 5], "semantic": {"name": "PageIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PageIterator(BaseIterator):\n\n def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.current_page = 0\n\n def next(self):\n self.current_page += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4", "label": "__init__", "type": "function", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "vector": [2, 1, 0.625, 0.0234, 1, 0.6, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.current_page = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L80_C8", "label": "__init__()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4", "vector": [8, 2, 0.625, 0.0078, 2, 0.04, 0.0, 555, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " BaseIterator.__init__(self, method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L81_C8", "label": "self.current_page =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4", "vector": [14, 2, 0.6328, 0.0078, 2, 0.04, 1.0, 384, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_page = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "label": "next", "type": "function", "loc": [83, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "vector": [2, 1, 0.668, 0.0469, 1, 0.6, 0.5, 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 self.current_page += 1\n items = self.method(page=self.current_page, *self.args, **self.kargs)\n if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):\n raise StopIteration\n return items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L85_C8", "label": "items = method()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "vector": [14, 2, 0.6641, 0.0078, 2, 0.45, 0.0, 339, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " items = self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L86_C8", "label": "if", "type": "if", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "vector": [4, 2, 0.6758, 0.0156, 2, 0.45, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L88_C8", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "vector": [13, 2, 0.6875, 0.0078, 2, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4", "label": "prev", "type": "function", "loc": [90, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "vector": [2, 1, 0.7188, 0.0391, 1, 0.6, 1.0, 749, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if (self.current_page == 1):\n raise WeibopError('Can not page back more, at first page')\n self.current_page -= 1\n return self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L91_C8", "label": "if", "type": "if", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4", "vector": [4, 2, 0.7148, 0.0156, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.current_page == 1):\n raise WeibopError('Can not page back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4", "vector": [13, 2, 0.7344, 0.0078, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "label": "ItemIterator", "type": "class", "loc": [96, 127], "level": 0, "parent": null, "vector": [3, 0, 0.8711, 0.25, 0, 0.66, 1.0, 198, 0, 3, 0, 0, 890, 0, 6], "semantic": {"name": "ItemIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ItemIterator(BaseIterator):\n\n def __init__(self, page_iterator):\n self.page_iterator = page_iterator\n self.limit = 0\n self.current_page = None\n self.page_index = -1\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "vector": [2, 1, 0.7852, 0.0469, 1, 0.67, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "page_iterator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, page_iterator):\n self.page_iterator = page_iterator\n self.limit = 0\n self.current_page = None\n self.page_index = -1\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L99_C8", "label": "self.page_iterator =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "vector": [14, 2, 0.7734, 0.0078, 2, 0.49, 0.0, 79, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_iterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_iterator = page_iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L100_C8", "label": "self.limit =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "vector": [14, 2, 0.7812, 0.0078, 2, 0.49, 0.25, 467, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L101_C8", "label": "self.current_page =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "vector": [14, 2, 0.7891, 0.0078, 2, 0.49, 0.5, 384, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_page = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L102_C8", "label": "self.page_index =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "vector": [14, 2, 0.7969, 0.0078, 2, 0.49, 0.75, 502, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L103_C8", "label": "self.count =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "vector": [14, 2, 0.8047, 0.0078, 2, 0.49, 1.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_129:FunctionDef_L105_C4", "label": "next", "type": "function", "loc": [105, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "vector": [2, 1, 0.8555, 0.0781, 1, 0.67, 0.5, 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.limit > 0 and self.count == self.limit:\n raise StopIteration\n if self.current_page is None or self.page_index == len(self.current_page) - 1:\n # Reached end of current page, get the next page...\n self.current_page = self.page_iterator.next()\n self.page_index = -1\n self.page_index += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L106_C8", "label": "if", "type": "if", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "vector": [4, 2, 0.832, 0.0156, 2, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.limit > 0 and self.count == self.limit:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8", "label": "if", "type": "if", "loc": [108, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "vector": [4, 2, 0.8555, 0.0312, 2, 0.47, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_page is None or self.page_index == len(self.current_page) - 1:\n # Reached end of current page, get the next page...\n self.current_page = self.page_iterator.next()\n self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L110_C12", "label": "self.current_page = next()", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8", "vector": [14, 3, 0.8594, 0.0078, 3, 0.09, 0.0, 384, 3, 0, 0, 0, 11, 10, 1], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " self.current_page = self.page_iterator.next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L111_C12", "label": "self.page_index =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8", "vector": [14, 3, 0.8672, 0.0078, 3, 0.09, 1.0, 502, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "vector": [13, 2, 0.8906, 0.0078, 2, 0.47, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.current_page[self.page_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "label": "prev", "type": "function", "loc": [116, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "vector": [2, 1, 0.9492, 0.0938, 1, 0.67, 1.0, 749, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if self.current_page is None:\n raise WeibopError('Can not go back more, at first page')\n if self.page_index == 0:\n # At the beginning of the current page, move to next...\n self.current_page = self.page_iterator.prev()\n self.page_index = len(self.current_page)\n if self.page_index == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L117_C8", "label": "if", "type": "if", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "vector": [4, 2, 0.918, 0.0156, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_page is None:\n raise WeibopError('Can not go back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "label": "if", "type": "if", "loc": [119, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "vector": [4, 2, 0.9492, 0.0469, 2, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.page_index == 0:\n # At the beginning of the current page, move to next...\n self.current_page = self.page_iterator.prev()\n self.page_index = len(self.current_page)\n if self.page_index == 0:\n raise WeibopError('No more items')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L121_C12", "label": "self.current_page = prev()", "type": "assigned_variable", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "vector": [14, 3, 0.9453, 0.0078, 3, 0.45, 0.0, 384, 3, 0, 0, 0, 749, 10, 1], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "prev", "annotation": ""}, "snippet": " self.current_page = self.page_iterator.prev()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L122_C12", "label": "self.page_index = len()", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "vector": [14, 3, 0.9531, 0.0078, 3, 0.45, 0.5, 502, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.page_index = len(self.current_page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:If_L123_C12", "label": "if", "type": "if", "loc": [123, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "vector": [4, 3, 0.9648, 0.0156, 3, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.page_index == 0:\n raise WeibopError('No more items')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "vector": [13, 2, 0.9922, 0.0078, 2, 0.46, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.current_page[self.page_index]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L13_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L15_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_129:If_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_129:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_129:Return_L127_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
import cPickle as pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
# Probably on a windows system
# TODO: use win32file
pass
class Cache(object):
"""Cache interface"""
def __init__(self, timeout=60):
"""Initialize the cache
timeout: number of seconds to keep a cached entry
"""
self.timeout = timeout
def store(self, key, value):
"""Add new record to cache
key: entry key
value: data of entry
"""
raise NotImplementedError
def get(self, key, timeout=None):
"""Get cached entry if exists and not expired
key: which entry to get
timeout: override timeout with this value [optional]
"""
raise NotImplementedError
def count(self):
"""Get count of entries currently stored in cache"""
raise NotImplementedError
def cleanup(self):
"""Delete any expired entries in cache."""
raise NotImplementedError
def flush(self):
"""Delete all cached entries"""
raise NotImplementedError
class MemoryCache(Cache):
"""In-memory cache"""
def __init__(self, timeout=60):
Cache.__init__(self, timeout)
self._entries = {}
self.lock = threading.Lock()
def __getstate__(self):
# pickle
return {'entries': self._entries, 'timeout': self.timeout}
def __setstate__(self, state):
# unpickle
self.lock = threading.Lock()
self._entries = state['entries']
self.timeout = state['timeout']
def _is_expired(self, entry, timeout):
return timeout > 0 and (time.time() - entry[0]) >= timeout
def store(self, key, value):
self.lock.acquire()
self._entries[key] = (time.time(), value)
self.lock.release()
def get(self, key, timeout=None):
self.lock.acquire()
try:
# check to see if we have this key
entry = self._entries.get(key)
if not entry:
# no hit, return nothing
return None
# use provided timeout in arguments if provided
# otherwise use the one provided during init.
if timeout is None:
timeout = self.timeout
# make sure entry is not expired
if self._is_expired(entry, timeout):
# entry expired, delete and return nothing
del self._entries[key]
return None
# entry found and not expired, return it
return entry[1]
finally:
self.lock.release()
def count(self):
return len(self._entries)
def cleanup(self):
self.lock.acquire()
try:
for k, v in self._entries.items():
if self._is_expired(v, self.timeout):
del self._entries[k]
finally:
self.lock.release()
def flush(self):
self.lock.acquire()
self._entries.clear()
self.lock.release()
class FileCache(Cache):
"""File-based cache"""
# locks used to make cache thread-safe
cache_locks = {}
def __init__(self, cache_dir, timeout=60):
Cache.__init__(self, timeout)
if os.path.exists(cache_dir) is False:
os.mkdir(cache_dir)
self.cache_dir = cache_dir
if cache_dir in FileCache.cache_locks:
self.lock = FileCache.cache_locks[cache_dir]
else:
self.lock = threading.Lock()
FileCache.cache_locks[cache_dir] = self.lock
if os.name == 'posix':
self._lock_file = self._lock_file_posix
self._unlock_file = self._unlock_file_posix
elif os.name == 'nt':
self._lock_file = self._lock_file_win32
self._unlock_file = self._unlock_file_win32
else:
print 'Warning! FileCache locking not supported on this system!'
self._lock_file = self._lock_file_dummy
self._unlock_file = self._unlock_file_dummy
def _get_path(self, key):
md5 = hashlib.md5()
md5.update(key)
return os.path.join(self.cache_dir, md5.hexdigest())
def _lock_file_dummy(self, path, exclusive=True):
return None
def _unlock_file_dummy(self, lock):
return
def _lock_file_posix(self, path, exclusive=True):
lock_path = path + '.lock'
if exclusive is True:
f_lock = open(lock_path, 'w')
fcntl.lockf(f_lock, fcntl.LOCK_EX)
else:
f_lock = open(lock_path, 'r')
fcntl.lockf(f_lock, fcntl.LOCK_SH)
if os.path.exists(lock_path) is False:
f_lock.close()
return None
return f_lock
def _unlock_file_posix(self, lock):
lock.close()
def _lock_file_win32(self, path, exclusive=True):
# TODO: implement
return None
def _unlock_file_win32(self, lock):
# TODO: implement
return
def _delete_file(self, path):
os.remove(path)
if os.path.exists(path + '.lock'):
os.remove(path + '.lock')
def store(self, key, value):
path = self._get_path(key)
self.lock.acquire()
try:
# acquire lock and open file
f_lock = self._lock_file(path)
datafile = open(path, 'wb')
# write data
pickle.dump((time.time(), value), datafile)
# close and unlock file
datafile.close()
self._unlock_file(f_lock)
finally:
self.lock.release()
def get(self, key, timeout=None):
return self._get(self._get_path(key), timeout)
def _get(self, path, timeout):
if os.path.exists(path) is False:
# no record
return None
self.lock.acquire()
try:
# acquire lock and open
f_lock = self._lock_file(path, False)
datafile = open(path, 'rb')
# read pickled object
created_time, value = pickle.load(datafile)
datafile.close()
# check if value is expired
if timeout is None:
timeout = self.timeout
if timeout > 0 and (time.time() - created_time) >= timeout:
# expired! delete from cache
value = None
self._delete_file(path)
# unlock and return result
self._unlock_file(f_lock)
return value
finally:
self.lock.release()
def count(self):
c = 0
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
c += 1
return c
def cleanup(self):
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
self._get(os.path.join(self.cache_dir, entry), None)
def flush(self):
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
self._delete_file(os.path.join(self.cache_dir, entry))
| ajibawa-2023/Python-Code-Large/train/row_130 | 158 | 264 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L5_C0", "label": "time import time", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0038, 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_130:Import_L6_C0", "label": "threading import threading", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0038, 0, 0.66, 0.125, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L7_C0", "label": "os import os", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0265, 0.0038, 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_130:Import_L8_C0", "label": "cPickle import pickle", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0038, 0, 0.66, 0.375, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "label": "try", "type": "try", "loc": [10, 14], "level": 0, "parent": null, "vector": [7, 0, 0.0455, 0.0189, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import hashlib\nexcept ImportError:\n # python 2.4\n import md5 as hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L11_C4", "label": "hashlib import hashlib", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "vector": [1, 1, 0.0417, 0.0038, 1, 0.73, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L14_C4", "label": "md5 import hashlib", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "vector": [1, 1, 0.053, 0.0038, 1, 0.73, 0.0, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "md5", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import md5 as hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L16_C0", "label": "try", "type": "try", "loc": [16, 21], "level": 0, "parent": null, "vector": [7, 0, 0.0701, 0.0227, 0, 0.66, 0.625, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import fcntl\nexcept ImportError:\n # Probably on a windows system\n # TODO: use win32file\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L17_C4", "label": "fcntl import fcntl", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L16_C0", "vector": [1, 1, 0.0644, 0.0038, 1, 0.24, 0.0, 488, 0, 1, 0, 0, 488, 0, 0], "semantic": {"name": "fcntl", "arg_names": [], "import_names": ["fcntl"], "rhs_call_name": "", "annotation": ""}, "snippet": " import fcntl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "label": "Cache", "type": "class", "loc": [24, 57], "level": 0, "parent": null, "vector": [3, 0, 0.1534, 0.1288, 0, 0.66, 0.75, 419, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "Cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Cache(object):\n \"\"\"Cache interface\"\"\"\n\n def __init__(self, timeout=60):\n \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\"\n self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [8, 1, 0.0947, 0.0038, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Cache interface\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4", "label": "__init__", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.1098, 0.0189, 1, 0.92, 0.1667, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, timeout=60):\n \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\"\n self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L28_C8", "label": "expression", "type": "expression", "loc": [28, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4", "vector": [8, 2, 0.1098, 0.0114, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L31_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4", "vector": [14, 2, 0.1174, 0.0038, 2, 0.56, 1.0, 621, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L33_C4", "label": "store", "type": "function", "loc": [33, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.1345, 0.0227, 1, 0.92, 0.3333, 354, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n \"\"\"Add new record to cache\n key: entry key\n value: data of entry\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L34_C8", "label": "expression", "type": "expression", "loc": [34, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L33_C4", "vector": [8, 2, 0.1345, 0.0152, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Add new record to cache\n key: entry key\n value: data of entry\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L40_C4", "label": "get", "type": "function", "loc": [40, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.161, 0.0227, 1, 0.92, 0.5, 607, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n \"\"\"Get cached entry if exists and not expired\n key: which entry to get\n timeout: override timeout with this value [optional]\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L40_C4", "vector": [8, 2, 0.161, 0.0152, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get cached entry if exists and not expired\n key: which entry to get\n timeout: override timeout with this value [optional]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L47_C4", "label": "count", "type": "function", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.1818, 0.0114, 1, 0.92, 0.6667, 778, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n \"\"\"Get count of entries currently stored in cache\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L48_C8", "label": "expression", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L47_C4", "vector": [8, 2, 0.1818, 0.0038, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get count of entries currently stored in cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L51_C4", "label": "cleanup", "type": "function", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.197, 0.0114, 1, 0.92, 0.8333, 656, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n \"\"\"Delete any expired entries in cache.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L51_C4", "vector": [8, 2, 0.197, 0.0038, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete any expired entries in cache.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L55_C4", "label": "flush", "type": "function", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "vector": [2, 1, 0.2121, 0.0114, 1, 0.92, 1.0, 439, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n \"\"\"Delete all cached entries\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L55_C4", "vector": [8, 2, 0.2121, 0.0038, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete all cached entries\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "label": "MemoryCache", "type": "class", "loc": [60, 126], "level": 0, "parent": null, "vector": [3, 0, 0.3523, 0.2538, 0, 0.66, 0.875, 322, 0, 9, 0, 0, 419, 0, 19], "semantic": {"name": "MemoryCache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MemoryCache(Cache):\n \"\"\"In-memory cache\"\"\"\n\n def __init__(self, timeout=60):\n Cache.__init__(self, timeout)\n self._entries = {}\n self.lock = threading.Lock()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L61_C4", "label": "expression", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [8, 1, 0.2311, 0.0038, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"In-memory cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "label": "__init__", "type": "function", "loc": [63, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.2443, 0.0152, 1, 0.91, 0.1111, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, timeout=60):\n Cache.__init__(self, timeout)\n self._entries = {}\n self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L64_C8", "label": "__init__()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "vector": [8, 2, 0.2424, 0.0038, 2, 0.66, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L65_C8", "label": "self._entries =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "vector": [14, 2, 0.2462, 0.0038, 2, 0.66, 0.5, 710, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._entries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L66_C8", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "vector": [14, 2, 0.25, 0.0038, 2, 0.66, 1.0, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L68_C4", "label": "__getstate__", "type": "function", "loc": [68, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.2614, 0.0114, 1, 0.91, 0.2222, 250, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n # pickle\n return {'entries': self._entries, 'timeout': self.timeout}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L68_C4", "vector": [13, 2, 0.2652, 0.0038, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'entries': self._entries, 'timeout': self.timeout}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "label": "__setstate__", "type": "function", "loc": [72, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.2803, 0.0189, 1, 0.91, 0.3333, 698, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__setstate__", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setstate__(self, state):\n # unpickle\n self.lock = threading.Lock()\n self._entries = state['entries']\n self.timeout = state['timeout']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L74_C8", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "vector": [14, 2, 0.2803, 0.0038, 2, 0.33, 0.0, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L75_C8", "label": "self._entries =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "vector": [14, 2, 0.2841, 0.0038, 2, 0.33, 0.5, 710, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._entries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries = state['entries']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L76_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "vector": [14, 2, 0.2879, 0.0038, 2, 0.33, 1.0, 621, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = state['timeout']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L78_C4", "label": "_is_expired", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.2973, 0.0076, 1, 0.91, 0.4444, 501, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_is_expired", "arg_names": ["self", "entry", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _is_expired(self, entry, timeout):\n return timeout > 0 and (time.time() - entry[0]) >= timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L78_C4", "vector": [13, 2, 0.2992, 0.0038, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return timeout > 0 and (time.time() - entry[0]) >= timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "label": "store", "type": "function", "loc": [81, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.3125, 0.0152, 1, 0.91, 0.5556, 354, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n self.lock.acquire()\n self._entries[key] = (time.time(), value)\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L82_C8", "label": "acquire()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "vector": [8, 2, 0.3106, 0.0038, 2, 0.08, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L83_C8", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "vector": [14, 2, 0.3144, 0.0038, 2, 0.08, 0.5, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries[key] = (time.time(), value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L84_C8", "label": "release()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "vector": [8, 2, 0.3182, 0.0038, 2, 0.08, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4", "label": "get", "type": "function", "loc": [86, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.3693, 0.0909, 1, 0.91, 0.6667, 607, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n self.lock.acquire()\n try:\n # check to see if we have this key\n entry = self._entries.get(key)\n if not entry:\n # no hit, return nothing\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L87_C8", "label": "acquire()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4", "vector": [8, 2, 0.3295, 0.0038, 2, 0.6, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "label": "try", "type": "try", "loc": [88, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4", "vector": [7, 2, 0.3731, 0.0833, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # check to see if we have this key\n entry = self._entries.get(key)\n if not entry:\n # no hit, return nothing\n return None\n\n # use provided timeout in arguments if provided"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L90_C12", "label": "entry = get()", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [14, 3, 0.3409, 0.0038, 3, 0.38, 0.0, 812, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " entry = self._entries.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L91_C12", "label": "if", "type": "if", "loc": [91, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [4, 3, 0.3485, 0.0114, 3, 0.38, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not entry:\n # no hit, return nothing\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L93_C16", "label": "return", "type": "return", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L91_C12", "vector": [13, 4, 0.3523, 0.0038, 4, 0.52, 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_130:If_L97_C12", "label": "if", "type": "if", "loc": [97, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [4, 3, 0.3693, 0.0076, 3, 0.38, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout is None:\n timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L98_C16", "label": "timeout =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L97_C12", "vector": [14, 4, 0.3712, 0.0038, 4, 0.47, 0.0, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L101_C12", "label": "if", "type": "if", "loc": [101, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [4, 3, 0.3883, 0.0152, 3, 0.38, 0.6, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._is_expired(entry, timeout):\n # entry expired, delete and return nothing\n del self._entries[key]\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L104_C16", "label": "return", "type": "return", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L101_C12", "vector": [13, 4, 0.3939, 0.0038, 4, 0.82, 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_130:Return_L107_C12", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [13, 3, 0.4053, 0.0038, 3, 0.38, 0.8, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return entry[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L109_C12", "label": "release()", "type": "expression", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "vector": [8, 3, 0.4129, 0.0038, 3, 0.38, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L111_C4", "label": "count", "type": "function", "loc": [111, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.4223, 0.0076, 1, 0.91, 0.7778, 778, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n return len(self._entries)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L111_C4", "vector": [13, 2, 0.4242, 0.0038, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._entries)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4", "label": "cleanup", "type": "function", "loc": [114, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.4451, 0.0303, 1, 0.91, 0.8889, 656, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n self.lock.acquire()\n try:\n for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]\n finally:\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L115_C8", "label": "acquire()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4", "vector": [8, 2, 0.4356, 0.0038, 2, 0.5, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8", "label": "try", "type": "try", "loc": [116, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4", "vector": [7, 2, 0.4489, 0.0227, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]\n finally:\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:For_L117_C12", "label": "for k, v", "type": "for", "loc": [117, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8", "vector": [6, 3, 0.447, 0.0114, 3, 0.36, 0.0, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L118_C16", "label": "if", "type": "if", "loc": [118, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L117_C12", "vector": [4, 4, 0.4489, 0.0076, 4, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._is_expired(v, self.timeout):\n del self._entries[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L121_C12", "label": "release()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8", "vector": [8, 3, 0.4583, 0.0038, 3, 0.36, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "label": "flush", "type": "function", "loc": [123, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "vector": [2, 1, 0.4716, 0.0152, 1, 0.91, 1.0, 439, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n self.lock.acquire()\n self._entries.clear()\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L124_C8", "label": "acquire()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "vector": [8, 2, 0.4697, 0.0038, 2, 0.47, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L125_C8", "label": "clear()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "vector": [8, 2, 0.4735, 0.0038, 2, 0.47, 0.5, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self._entries.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L126_C8", "label": "release()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "vector": [8, 2, 0.4773, 0.0038, 2, 0.47, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "label": "FileCache", "type": "class", "loc": [129, 263], "level": 0, "parent": null, "vector": [3, 0, 0.7424, 0.5114, 0, 0.66, 1.0, 315, 0, 15, 0, 0, 419, 0, 50], "semantic": {"name": "FileCache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileCache(Cache):\n \"\"\"File-based cache\"\"\"\n\n # locks used to make cache thread-safe\n cache_locks = {}\n\n def __init__(self, cache_dir, timeout=60):\n Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L130_C4", "label": "expression", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [8, 1, 0.4924, 0.0038, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"File-based cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L133_C4", "label": "cache_locks =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [14, 1, 0.5038, 0.0038, 1, 0.59, 0.0625, 629, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cache_locks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cache_locks = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "label": "__init__", "type": "function", "loc": [135, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.5492, 0.0795, 1, 0.59, 0.125, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "cache_dir", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, cache_dir, timeout=60):\n Cache.__init__(self, timeout)\n if os.path.exists(cache_dir) is False:\n os.mkdir(cache_dir)\n self.cache_dir = cache_dir\n if cache_dir in FileCache.cache_locks:\n self.lock = FileCache.cache_locks[cache_dir]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L136_C8", "label": "__init__()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "vector": [8, 2, 0.5152, 0.0038, 2, 0.18, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L137_C8", "label": "if", "type": "if", "loc": [137, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "vector": [4, 2, 0.5208, 0.0076, 2, 0.18, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(cache_dir) is False:\n os.mkdir(cache_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L138_C12", "label": "mkdir()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L137_C8", "vector": [8, 3, 0.5227, 0.0038, 3, 0.6, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(cache_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L139_C8", "label": "self.cache_dir =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "vector": [14, 2, 0.5265, 0.0038, 2, 0.18, 0.5, 977, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cache_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cache_dir = cache_dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "label": "if", "type": "if", "loc": [140, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "vector": [4, 2, 0.5379, 0.0189, 2, 0.18, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cache_dir in FileCache.cache_locks:\n self.lock = FileCache.cache_locks[cache_dir]\n else:\n self.lock = threading.Lock()\n FileCache.cache_locks[cache_dir] = self.lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L141_C12", "label": "self.lock =", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "vector": [14, 3, 0.5341, 0.0038, 3, 0.1, 0.0, 45, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lock = FileCache.cache_locks[cache_dir]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L143_C12", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "vector": [14, 3, 0.5417, 0.0038, 3, 0.1, 0.5, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L144_C12", "label": "assign", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "vector": [14, 3, 0.5455, 0.0038, 3, 0.1, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FileCache.cache_locks[cache_dir] = self.lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "label": "if", "type": "if", "loc": [146, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "vector": [4, 2, 0.5701, 0.0379, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'posix':\n self._lock_file = self._lock_file_posix\n self._unlock_file = self._unlock_file_posix\n elif os.name == 'nt':\n self._lock_file = self._lock_file_win32\n self._unlock_file = self._unlock_file_win32\n else:\n print('Warning! FileCache locking not supported on this system!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L147_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "vector": [14, 3, 0.5568, 0.0038, 3, 0.17, 0.0, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_posix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L148_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "vector": [14, 3, 0.5606, 0.0038, 3, 0.17, 0.5, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_posix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "label": "if", "type": "if", "loc": [149, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "vector": [4, 3, 0.5758, 0.0265, 3, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif os.name == 'nt':\n self._lock_file = self._lock_file_win32\n self._unlock_file = self._unlock_file_win32\n else:\n print('Warning! FileCache locking not supported on this system!')\n self._lock_file = self._lock_file_dummy\n self._unlock_file = self._unlock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L150_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "vector": [14, 4, 0.5682, 0.0038, 4, 0.26, 0.0, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_win32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L151_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "vector": [14, 4, 0.572, 0.0038, 4, 0.26, 0.25, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_win32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L153_C12", "label": "print()", "type": "expression", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "vector": [8, 4, 0.5795, 0.0038, 4, 0.26, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Warning! FileCache locking not supported on this system!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L154_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "vector": [14, 4, 0.5833, 0.0038, 4, 0.26, 0.75, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L155_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [155, 155], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "vector": [14, 4, 0.5871, 0.0038, 4, 0.26, 1.0, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "label": "_get_path", "type": "function", "loc": [157, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.6004, 0.0152, 1, 0.59, 0.1875, 771, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_path", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_path(self, key):\n md5 = hashlib.md5()\n md5.update(key)\n return os.path.join(self.cache_dir, md5.hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L158_C8", "label": "md5 = md5()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "vector": [14, 2, 0.5985, 0.0038, 2, 0.92, 0.0, 604, 3, 0, 0, 0, 604, 10, 1], "semantic": {"name": "md5", "arg_names": [], "import_names": [], "rhs_call_name": "md5", "annotation": ""}, "snippet": " md5 = hashlib.md5()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L159_C8", "label": "update()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "vector": [8, 2, 0.6023, 0.0038, 2, 0.92, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " md5.update(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "vector": [13, 2, 0.6061, 0.0038, 2, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(self.cache_dir, md5.hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L162_C4", "label": "_lock_file_dummy", "type": "function", "loc": [162, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.6155, 0.0076, 1, 0.59, 0.25, 13, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_lock_file_dummy", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_dummy(self, path, exclusive=True):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L163_C8", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L162_C4", "vector": [13, 2, 0.6174, 0.0038, 2, 0.21, 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_130:FunctionDef_L165_C4", "label": "_unlock_file_dummy", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.6269, 0.0076, 1, 0.59, 0.3125, 709, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_unlock_file_dummy", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_dummy(self, lock):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L165_C4", "vector": [13, 2, 0.6288, 0.0038, 2, 0.6, 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_130:FunctionDef_L168_C4", "label": "_lock_file_posix", "type": "function", "loc": [168, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.6572, 0.0455, 1, 0.59, 0.375, 523, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "_lock_file_posix", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_posix(self, path, exclusive=True):\n lock_path = path + '.lock'\n if exclusive is True:\n f_lock = open(lock_path, 'w')\n fcntl.lockf(f_lock, fcntl.LOCK_EX)\n else:\n f_lock = open(lock_path, 'r')\n fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L169_C8", "label": "lock_path =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "vector": [14, 2, 0.6402, 0.0038, 2, 0.85, 0.0, 496, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lock_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lock_path = path + '.lock'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "label": "if", "type": "if", "loc": [170, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "vector": [4, 2, 0.6534, 0.0227, 2, 0.85, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exclusive is True:\n f_lock = open(lock_path, 'w')\n fcntl.lockf(f_lock, fcntl.LOCK_EX)\n else:\n f_lock = open(lock_path, 'r')\n fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L171_C12", "label": "f_lock = open()", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "vector": [14, 3, 0.6477, 0.0038, 3, 0.23, 0.0, 815, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f_lock = open(lock_path, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L172_C12", "label": "lockf()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "vector": [8, 3, 0.6515, 0.0038, 3, 0.23, 0.3333, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lockf", "arg_names": [], "import_names": [], "rhs_call_name": "lockf", "annotation": ""}, "snippet": " fcntl.lockf(f_lock, fcntl.LOCK_EX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L174_C12", "label": "f_lock = open()", "type": "assigned_variable", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "vector": [14, 3, 0.6591, 0.0038, 3, 0.23, 0.6667, 815, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f_lock = open(lock_path, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L175_C12", "label": "lockf()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "vector": [8, 3, 0.6629, 0.0038, 3, 0.23, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lockf", "arg_names": [], "import_names": [], "rhs_call_name": "lockf", "annotation": ""}, "snippet": " fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8", "label": "if", "type": "if", "loc": [176, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "vector": [4, 2, 0.6705, 0.0114, 2, 0.85, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(lock_path) is False:\n f_lock.close()\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L177_C12", "label": "close()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8", "vector": [8, 3, 0.6705, 0.0038, 3, 0.36, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f_lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L178_C12", "label": "return", "type": "return", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8", "vector": [13, 3, 0.6742, 0.0038, 3, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "vector": [13, 2, 0.678, 0.0038, 2, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f_lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L181_C4", "label": "_unlock_file_posix", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.6875, 0.0076, 1, 0.59, 0.4375, 341, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file_posix", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_posix(self, lock):\n lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L182_C8", "label": "close()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L181_C4", "vector": [8, 2, 0.6894, 0.0038, 2, 0.24, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L184_C4", "label": "_lock_file_win32", "type": "function", "loc": [184, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.7008, 0.0114, 1, 0.59, 0.5, 190, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_lock_file_win32", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_win32(self, path, exclusive=True):\n # TODO: implement\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L186_C8", "label": "return", "type": "return", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L184_C4", "vector": [13, 2, 0.7045, 0.0038, 2, 0.85, 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_130:FunctionDef_L188_C4", "label": "_unlock_file_win32", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.7159, 0.0114, 1, 0.59, 0.5625, 14, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_unlock_file_win32", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_win32(self, lock):\n # TODO: implement\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L190_C8", "label": "return", "type": "return", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L188_C4", "vector": [13, 2, 0.7197, 0.0038, 2, 0.32, 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_130:FunctionDef_L192_C4", "label": "_delete_file", "type": "function", "loc": [192, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.733, 0.0152, 1, 0.59, 0.625, 237, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_delete_file", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_file(self, path):\n os.remove(path)\n if os.path.exists(path + '.lock'):\n os.remove(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L193_C8", "label": "remove()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L192_C4", "vector": [8, 2, 0.7311, 0.0038, 2, 0.87, 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(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L194_C8", "label": "if", "type": "if", "loc": [194, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L192_C4", "vector": [4, 2, 0.7367, 0.0076, 2, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path + '.lock'):\n os.remove(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L195_C12", "label": "remove()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L194_C8", "vector": [8, 3, 0.7386, 0.0038, 3, 0.91, 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(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "label": "store", "type": "function", "loc": [197, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.7746, 0.0606, 1, 0.59, 0.6875, 354, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n path = self._get_path(key)\n self.lock.acquire()\n try:\n # acquire lock and open file\n f_lock = self._lock_file(path)\n datafile = open(path, 'wb')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L198_C8", "label": "path = _get_path()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "vector": [14, 2, 0.75, 0.0038, 2, 0.45, 0.0, 358, 3, 1, 0, 0, 771, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "_get_path", "annotation": ""}, "snippet": " path = self._get_path(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L199_C8", "label": "acquire()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "vector": [8, 2, 0.7538, 0.0038, 2, 0.45, 0.5, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "label": "try", "type": "try", "loc": [200, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "vector": [7, 2, 0.7803, 0.0492, 2, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # acquire lock and open file\n f_lock = self._lock_file(path)\n datafile = open(path, 'wb')\n\n # write data\n pickle.dump((time.time(), value), datafile)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L202_C12", "label": "f_lock = _lock_file()", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [14, 3, 0.7652, 0.0038, 3, 0.29, 0.0, 815, 3, 1, 0, 0, 732, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_lock_file", "annotation": ""}, "snippet": " f_lock = self._lock_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L203_C12", "label": "datafile = open()", "type": "assigned_variable", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [14, 3, 0.7689, 0.0038, 3, 0.29, 0.2, 14, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "datafile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " datafile = open(path, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L206_C12", "label": "dump()", "type": "expression", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [8, 3, 0.7803, 0.0038, 3, 0.29, 0.4, 952, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pickle.dump((time.time(), value), datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L209_C12", "label": "close()", "type": "expression", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [8, 3, 0.7917, 0.0038, 3, 0.29, 0.6, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L210_C12", "label": "_unlock_file()", "type": "expression", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [8, 3, 0.7955, 0.0038, 3, 0.29, 0.8, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "_unlock_file", "annotation": ""}, "snippet": " self._unlock_file(f_lock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L212_C12", "label": "release()", "type": "expression", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "vector": [8, 3, 0.803, 0.0038, 3, 0.29, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L214_C4", "label": "get", "type": "function", "loc": [214, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.8125, 0.0076, 1, 0.59, 0.75, 607, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n return self._get(self._get_path(key), timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L215_C8", "label": "return", "type": "return", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L214_C4", "vector": [13, 2, 0.8144, 0.0038, 2, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get(self._get_path(key), timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "label": "_get", "type": "function", "loc": [217, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.8712, 0.1023, 1, 0.59, 0.8125, 342, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "_get", "arg_names": ["self", "path", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get(self, path, timeout):\n if os.path.exists(path) is False:\n # no record\n return None\n self.lock.acquire()\n try:\n # acquire lock and open\n f_lock = self._lock_file(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L218_C8", "label": "if", "type": "if", "loc": [218, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "vector": [4, 2, 0.8295, 0.0114, 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 os.path.exists(path) is False:\n # no record\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L220_C12", "label": "return", "type": "return", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L218_C8", "vector": [13, 3, 0.8333, 0.0038, 3, 0.47, 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_130:Expr_L221_C8", "label": "acquire()", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "vector": [8, 2, 0.8371, 0.0038, 2, 0.6, 0.5, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "label": "try", "type": "try", "loc": [222, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "vector": [7, 2, 0.8807, 0.0833, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # acquire lock and open\n f_lock = self._lock_file(path, False)\n datafile = open(path, 'rb')\n\n # read pickled object\n created_time, value = pickle.load(datafile)\n datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L224_C12", "label": "f_lock = _lock_file()", "type": "assigned_variable", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [14, 3, 0.8485, 0.0038, 3, 0.44, 0.0, 815, 3, 2, 0, 0, 732, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_lock_file", "annotation": ""}, "snippet": " f_lock = self._lock_file(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L225_C12", "label": "datafile = open()", "type": "assigned_variable", "loc": [225, 225], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [14, 3, 0.8523, 0.0038, 3, 0.44, 0.125, 14, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "datafile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " datafile = open(path, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L228_C12", "label": "created_time, value = load()", "type": "assigned_variable", "loc": [228, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [14, 3, 0.8636, 0.0038, 3, 0.44, 0.25, 678, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "created_time, value", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " created_time, value = pickle.load(datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L229_C12", "label": "close()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [8, 3, 0.8674, 0.0038, 3, 0.44, 0.375, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L232_C12", "label": "if", "type": "if", "loc": [232, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [4, 3, 0.8807, 0.0076, 3, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout is None:\n timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L233_C16", "label": "timeout =", "type": "assigned_variable", "loc": [233, 233], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L232_C12", "vector": [14, 4, 0.8826, 0.0038, 4, 0.35, 0.0, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [4, 3, 0.892, 0.0152, 3, 0.44, 0.625, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout > 0 and (time.time() - created_time) >= timeout:\n # expired! delete from cache\n value = None\n self._delete_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L236_C16", "label": "value =", "type": "assigned_variable", "loc": [236, 236], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12", "vector": [14, 4, 0.8939, 0.0038, 4, 0.41, 0.0, 441, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L237_C16", "label": "_delete_file()", "type": "expression", "loc": [237, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12", "vector": [8, 4, 0.8977, 0.0038, 4, 0.41, 1.0, 237, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_file", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_file", "annotation": ""}, "snippet": " self._delete_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L240_C12", "label": "_unlock_file()", "type": "expression", "loc": [240, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [8, 3, 0.9091, 0.0038, 3, 0.44, 0.75, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "_unlock_file", "annotation": ""}, "snippet": " self._unlock_file(f_lock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L241_C12", "label": "return", "type": "return", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [13, 3, 0.9129, 0.0038, 3, 0.44, 0.875, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L243_C12", "label": "release()", "type": "expression", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "vector": [8, 3, 0.9205, 0.0038, 3, 0.44, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "label": "count", "type": "function", "loc": [245, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.9394, 0.0265, 1, 0.59, 0.875, 778, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n c = 0\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n c += 1\n return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L246_C8", "label": "c =", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "vector": [14, 2, 0.9318, 0.0038, 2, 0.54, 0.0, 411, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:For_L247_C8", "label": "for entry", "type": "for", "loc": [247, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "vector": [6, 2, 0.9413, 0.0152, 2, 0.54, 0.5, 812, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n c += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L248_C12", "label": "if", "type": "if", "loc": [248, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L247_C8", "vector": [4, 3, 0.9413, 0.0076, 3, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L251_C8", "label": "return", "type": "return", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "vector": [13, 2, 0.9508, 0.0038, 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 c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L253_C4", "label": "cleanup", "type": "function", "loc": [253, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.9659, 0.0189, 1, 0.59, 0.9375, 656, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8", "label": "for entry", "type": "for", "loc": [254, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L253_C4", "vector": [6, 2, 0.9678, 0.0152, 2, 0.51, 0.0, 812, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L255_C12", "label": "if", "type": "if", "loc": [255, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8", "vector": [4, 3, 0.9678, 0.0076, 3, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L257_C12", "label": "_get()", "type": "expression", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8", "vector": [8, 3, 0.9735, 0.0038, 3, 0.68, 1.0, 342, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_get", "arg_names": [], "import_names": [], "rhs_call_name": "_get", "annotation": ""}, "snippet": " self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L259_C4", "label": "flush", "type": "function", "loc": [259, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "vector": [2, 1, 0.9886, 0.0189, 1, 0.59, 1.0, 439, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._delete_file(os.path.join(self.cache_dir, entry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8", "label": "for entry", "type": "for", "loc": [260, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L259_C4", "vector": [6, 2, 0.9905, 0.0152, 2, 0.51, 0.0, 812, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._delete_file(os.path.join(self.cache_dir, entry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:If_L261_C12", "label": "if", "type": "if", "loc": [261, 262], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8", "vector": [4, 3, 0.9905, 0.0076, 3, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L263_C12", "label": "_delete_file()", "type": "expression", "loc": [263, 263], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8", "vector": [8, 3, 0.9962, 0.0038, 3, 0.14, 1.0, 237, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_file", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_file", "annotation": ""}, "snippet": " self._delete_file(os.path.join(self.cache_dir, entry))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Import_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:For_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L214_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L218_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L225_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L228_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L236_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L240_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:For_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Return_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L255_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L254_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:If_L261_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_130:For_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_130:Expr_L263_C12"}] |
#coding:utf8
import os, sys
from bottle import route, run, debug, template, request, validate, error, response, redirect
# only needed when you run Bottle on mod_wsgi
from bottle import default_app
from y_home import *
from y_apply import *
from y_admin import *
from y_login import *
#reload(sys)
#sys.setdefaultencoding('utf-8')
debug(True)
def main():
run(reloader=True);
if __name__ == "__main__":
# Interactive mode
main()
else:
# Mod WSGI launch
os.chdir(os.path.dirname(__file__))
application = default_app()
| ajibawa-2023/Python-Code-Large/train/row_131 | 14 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_131:Import_L2_C0", "label": "os import os, sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.04, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L3_C0", "label": "from bottle import route, run, debug\u2026", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.12, 0.04, 0, 0.66, 0.1111, 591, 0, 9, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["route", "run", "debug", "template", "request", "validate", "error", "response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import route, run, debug, template, request, validate, error, response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L5_C0", "label": "from bottle import default_app", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.04, 0, 0.66, 0.2222, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["default_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import default_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L6_C0", "label": "from y_home import *", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.24, 0.04, 0, 0.66, 0.3333, 917, 0, 1, 0, 0, 917, 0, 0], "semantic": {"name": "y_home", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from y_home import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L7_C0", "label": "from y_apply import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.28, 0.04, 0, 0.66, 0.4444, 606, 0, 1, 0, 0, 606, 0, 0], "semantic": {"name": "y_apply", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from y_apply import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L8_C0", "label": "from y_admin import *", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.32, 0.04, 0, 0.66, 0.5556, 204, 0, 1, 0, 0, 204, 0, 0], "semantic": {"name": "y_admin", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from y_admin import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:ImportFrom_L9_C0", "label": "from y_login import *", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.36, 0.04, 0, 0.66, 0.6667, 75, 0, 1, 0, 0, 75, 0, 0], "semantic": {"name": "y_login", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from y_login import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L14_C0", "label": "debug()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.56, 0.04, 0, 0.66, 0.7778, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": "debug(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:FunctionDef_L16_C0", "label": "main", "type": "function", "loc": [16, 17], "level": 0, "parent": null, "vector": [2, 0, 0.66, 0.08, 0, 0.66, 0.8889, 624, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n run(reloader=True);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L17_C4", "label": "run()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_131:FunctionDef_L16_C0", "vector": [8, 1, 0.68, 0.04, 1, 0.95, 0.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " run(reloader=True);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "label": "if", "type": "if", "loc": [19, 25], "level": 0, "parent": null, "vector": [4, 0, 0.88, 0.28, 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 # Interactive mode\n main()\nelse:\n # Mod WSGI launch\n os.chdir(os.path.dirname(__file__))\n application = default_app()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L21_C4", "label": "main()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "vector": [8, 1, 0.84, 0.04, 1, 0.43, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L24_C4", "label": "chdir()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "vector": [8, 1, 0.96, 0.04, 1, 0.43, 0.5, 122, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(os.path.dirname(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_131:Assign_L25_C4", "label": "application = default_app()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "vector": [14, 1, 1.0, 0.04, 1, 0.43, 1.0, 244, 3, 0, 0, 0, 424, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "default_app", "annotation": ""}, "snippet": " application = default_app()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_131:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_131:If_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_131:Assign_L25_C4"}] |
import sys, uuid
from datetime import datetime
def now():
return str(datetime.now()) + " "
dic = open("tag_list.dict", "r")
result = []
dic2 = []
dic3 = []
for item in dic:
m = unicode(item, "utf-8").split()
if len(m) > 1:
tag, group = m
else:
tag, group = m[0], "0"
tag_id = uuid.uuid4().hex
result += [(tag_id, tag, group, 0)]
dic2 += [tag]
dic3 += [(tag_id, tag)]
dic.close()
#dic = open("tag_list_nogroup.dict", "w")
#dic.write("\n".join(dic2).encode("utf-8").lower())
#dic.close()
#dic = open("tag_list_withid.dict", "w")
#dic.write("\n".join([" ".join(x) for x in dic3]).encode("utf-8").lower())
#dic.close()
print now() + "Wrote Dict."
import MySQLdb
db = MySQLdb.connect("127.0.0.1","apis","G2WvPRsxGEr77wEd","apis",charset="utf8")
c = db.cursor()
c.executemany("""INSERT INTO tags (tag_id, name, tag_group, count) VALUES (%s, %s, %s, %s)""",
result)
db.commit()
c.close()
print now() + "Wrote Database."
| ajibawa-2023/Python-Code-Large/train/row_135 | 23 | 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_135:Import_L1_C0", "label": "sys import sys, uuid", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "uuid"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, uuid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:ImportFrom_L2_C0", "label": "from datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0278, 0, 0.66, 0.0625, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:FunctionDef_L3_C0", "label": "now", "type": "function", "loc": [3, 4], "level": 0, "parent": null, "vector": [2, 0, 0.0972, 0.0556, 0, 0.66, 0.125, 894, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def now():\n return str(datetime.now()) + \" \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Return_L4_C4", "label": "return", "type": "return", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:FunctionDef_L3_C0", "vector": [13, 1, 0.1111, 0.0278, 1, 0.15, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(datetime.now()) + \" \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L6_C0", "label": "dic = open()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.1667, 0.0278, 0, 0.66, 0.1875, 37, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "dic", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "dic = open(\"tag_list.dict\", \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L7_C0", "label": "result =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1944, 0.0278, 0, 0.66, 0.25, 51, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "result = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L8_C0", "label": "dic2 =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2222, 0.0278, 0, 0.66, 0.3125, 920, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "dic2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dic2 = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L9_C0", "label": "dic3 =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0278, 0, 0.66, 0.375, 586, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "dic3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dic3 = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "label": "for item", "type": "for", "loc": [10, 19], "level": 0, "parent": null, "vector": [6, 0, 0.4028, 0.2778, 0, 0.66, 0.4375, 434, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for item in dic:\n m = unicode(item, \"utf-8\").split()\n if len(m) > 1:\n tag, group = m\n else:\n tag, group = m[0], \"0\"\n tag_id = uuid.uuid4().hex\n result += [(tag_id, tag, group, 0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L11_C4", "label": "m = split()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "vector": [14, 1, 0.3056, 0.0278, 1, 0.6, 0.0, 711, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " m = unicode(item, \"utf-8\").split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4", "label": "if", "type": "if", "loc": [12, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "vector": [4, 1, 0.375, 0.1111, 1, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(m) > 1:\n tag, group = m\n else:\n tag, group = m[0], \"0\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L13_C8", "label": "tag, group =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4", "vector": [14, 2, 0.3611, 0.0278, 2, 0.57, 0.0, 142, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag, group = m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L15_C8", "label": "tag, group =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4", "vector": [14, 2, 0.4167, 0.0278, 2, 0.57, 1.0, 142, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "tag, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag, group = m[0], \"0\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L16_C4", "label": "tag_id =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "vector": [14, 1, 0.4444, 0.0278, 1, 0.6, 1.0, 524, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tag_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag_id = uuid.uuid4().hex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L20_C0", "label": "close()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 0.5556, 0.0278, 0, 0.66, 0.5, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "dic.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L27_C0", "label": "print()", "type": "expression", "loc": [27, 27], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.0278, 0, 0.66, 0.5625, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(now() + \"Wrote Dict.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Import_L29_C0", "label": "MySQLdb import MySQLdb", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.8056, 0.0278, 0, 0.66, 0.625, 838, 0, 1, 0, 0, 838, 0, 0], "semantic": {"name": "MySQLdb", "arg_names": [], "import_names": ["MySQLdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import MySQLdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L30_C0", "label": "db = connect()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0278, 0, 0.66, 0.6875, 761, 3, 5, 0, 0, 242, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "db = MySQLdb.connect(\"127.0.0.1\",\"apis\",\"G2WvPRsxGEr77wEd\",\"apis\",charset=\"utf8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L31_C0", "label": "c = cursor()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.8611, 0.0278, 0, 0.66, 0.75, 411, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "c = db.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L32_C0", "label": "executemany()", "type": "expression", "loc": [32, 33], "level": 0, "parent": null, "vector": [8, 0, 0.9028, 0.0556, 0, 0.66, 0.8125, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "c.executemany(\"\"\"INSERT INTO tags (tag_id, name, tag_group, count) VALUES (%s, %s, %s, %s)\"\"\",\n result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L34_C0", "label": "commit()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.9444, 0.0278, 0, 0.66, 0.875, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "db.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L35_C0", "label": "close()", "type": "expression", "loc": [35, 35], "level": 0, "parent": null, "vector": [8, 0, 0.9722, 0.0278, 0, 0.66, 0.9375, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "c.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_135:Expr_L36_C0", "label": "print()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0278, 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(now() + \"Wrote Database.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_135:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_135:For_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_135:Assign_L16_C4"}] |
#coding:utf-8
from threading import Thread
from Queue import Queue
from time import sleep
import sqlite3
import sys, re, StringIO
import urllib2 as urllib
q = Queue()
NUM = 17
JOBS = 3000
results = []
def craw(arguments):
global results
try:
a = unicode(urllib.urlopen("http://tbole.com/result.php?searchid=%d" % (arguments,)).read(), "gbk")
a = a.replace("\n", " ").replace("\r", "")
b = re.findall(u"<span class=\"about_text\">[^<]+?</span>(.+?)</div>", a)
for c in b:
d = re.findall(u"<span><a[^>]*>(.+?)</a></span>", c)
for e in d:
results += [e]
print arguments, "Done."
except:
print arguments, "Error."
pass
sleep(0.2)
def working():
while True:
arguments = q.get()
craw(arguments)
q.task_done()
for i in range(NUM):
t = Thread(target=working)
t.setDaemon(True)
t.start()
for i in range(JOBS):
q.put(i)
q.join()
print "Craw completed."
b = {}
for a in results:
b[a] = 1;
f = open("tbole_key.txt", "w")
f.write("\n".join(b.keys()).encode('utf-8'))
f.close()
print "Wrote results."
| ajibawa-2023/Python-Code-Large/train/row_136 | 41 | 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_136:ImportFrom_L2_C0", "label": "from threading import Thread", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0377, 0.0189, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:ImportFrom_L3_C0", "label": "from Queue import Queue", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0566, 0.0189, 0, 0.66, 0.0476, 952, 0, 1, 0, 0, 952, 0, 0], "semantic": {"name": "Queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:ImportFrom_L4_C0", "label": "from time import sleep", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0755, 0.0189, 0, 0.66, 0.0952, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["sleep"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import sleep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Import_L5_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0943, 0.0189, 0, 0.66, 0.1429, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Import_L6_C0", "label": "sys import sys, re, StringIO", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1132, 0.0189, 0, 0.66, 0.1905, 509, 0, 3, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "re", "StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, re, StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Import_L7_C0", "label": "urllib2 import urllib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1321, 0.0189, 0, 0.66, 0.2381, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2 as urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L8_C0", "label": "q = Queue()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1509, 0.0189, 0, 0.66, 0.2857, 516, 3, 0, 0, 0, 952, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "Queue", "annotation": ""}, "snippet": "q = Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L9_C0", "label": "NUM =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1698, 0.0189, 0, 0.66, 0.3333, 228, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NUM = 17"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L10_C0", "label": "JOBS =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1887, 0.0189, 0, 0.66, 0.381, 372, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "JOBS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "JOBS = 3000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L11_C0", "label": "results =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2075, 0.0189, 0, 0.66, 0.4286, 143, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "results = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "label": "craw", "type": "function", "loc": [13, 27], "level": 0, "parent": null, "vector": [2, 0, 0.3774, 0.283, 0, 0.66, 0.4762, 800, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "craw", "arg_names": ["arguments"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def craw(arguments):\n global results\n try:\n a = unicode(urllib.urlopen(\"http://tbole.com/result.php?searchid=%d\" % (arguments,)).read(), \"gbk\")\n a = a.replace(\"\\n\", \" \").replace(\"\\r\", \"\")\n b = re.findall(u\"<span class=\\\"about_text\\\">[^<]+?</span>(.+?)</div>\", a)\n for c in b:\n d = re.findall(u\"<span><a[^>]*>(.+?)</a></span>\", c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "label": "try", "type": "try", "loc": [15, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "vector": [7, 1, 0.3868, 0.2264, 1, 0.37, 0.0, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n a = unicode(urllib.urlopen(\"http://tbole.com/result.php?searchid=%d\" % (arguments,)).read(), \"gbk\")\n a = a.replace(\"\\n\", \" \").replace(\"\\r\", \"\")\n b = re.findall(u\"<span class=\\\"about_text\\\">[^<]+?</span>(.+?)</div>\", a)\n for c in b:\n d = re.findall(u\"<span><a[^>]*>(.+?)</a></span>\", c)\n for e in d:\n results += [e]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L16_C8", "label": "a = unicode()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [14, 2, 0.3019, 0.0189, 2, 0.93, 0.0, 475, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " a = unicode(urllib.urlopen(\"http://tbole.com/result.php?searchid=%d\" % (arguments,)).read(), \"gbk\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L17_C8", "label": "a = replace()", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [14, 2, 0.3208, 0.0189, 2, 0.93, 0.25, 475, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " a = a.replace(\"\\n\", \" \").replace(\"\\r\", \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L18_C8", "label": "b = findall()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [14, 2, 0.3396, 0.0189, 2, 0.93, 0.5, 756, 3, 2, 0, 0, 737, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " b = re.findall(u\"<span class=\\\"about_text\\\">[^<]+?</span>(.+?)</div>\", a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8", "label": "for c", "type": "for", "loc": [19, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [6, 2, 0.3868, 0.0755, 2, 0.93, 0.75, 411, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in b:\n d = re.findall(u\"<span><a[^>]*>(.+?)</a></span>\", c)\n for e in d:\n results += [e]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L20_C12", "label": "d = findall()", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8", "vector": [14, 3, 0.3774, 0.0189, 3, 0.19, 0.0, 355, 3, 2, 0, 0, 737, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " d = re.findall(u\"<span><a[^>]*>(.+?)</a></span>\", c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:For_L21_C12", "label": "for e", "type": "for", "loc": [21, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8", "vector": [6, 3, 0.4057, 0.0377, 3, 0.19, 1.0, 175, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in d:\n results += [e]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L23_C8", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [8, 2, 0.434, 0.0189, 2, 0.93, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(arguments, \"Done.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L25_C8", "label": "print()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "vector": [8, 2, 0.4717, 0.0189, 2, 0.93, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(arguments, \"Error.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L27_C4", "label": "sleep()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "vector": [8, 1, 0.5094, 0.0189, 1, 0.37, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(0.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L29_C0", "label": "working", "type": "function", "loc": [29, 33], "level": 0, "parent": null, "vector": [2, 0, 0.5849, 0.0943, 0, 0.66, 0.5238, 380, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "working", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def working():\n while True:\n arguments = q.get()\n craw(arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "label": "while", "type": "while", "loc": [30, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L29_C0", "vector": [5, 1, 0.5943, 0.0755, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n arguments = q.get()\n craw(arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L31_C8", "label": "arguments = get()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "vector": [14, 2, 0.5849, 0.0189, 2, 0.53, 0.0, 426, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "arguments", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " arguments = q.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L32_C8", "label": "craw()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "vector": [8, 2, 0.6038, 0.0189, 2, 0.53, 0.5, 800, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "craw", "arg_names": [], "import_names": [], "rhs_call_name": "craw", "annotation": ""}, "snippet": " craw(arguments)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L33_C8", "label": "task_done()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "vector": [8, 2, 0.6226, 0.0189, 2, 0.53, 1.0, 393, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "task_done", "arg_names": [], "import_names": [], "rhs_call_name": "task_done", "annotation": ""}, "snippet": " q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "label": "for i", "type": "for", "loc": [35, 38], "level": 0, "parent": null, "vector": [6, 0, 0.6887, 0.0755, 0, 0.66, 0.5714, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(NUM):\n t = Thread(target=working)\n t.setDaemon(True)\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L36_C4", "label": "t = Thread()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "vector": [14, 1, 0.6792, 0.0189, 1, 0.85, 0.0, 15, 3, 1, 0, 0, 134, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " t = Thread(target=working)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L37_C4", "label": "setDaemon()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "vector": [8, 1, 0.6981, 0.0189, 1, 0.85, 0.5, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setDaemon", "arg_names": [], "import_names": [], "rhs_call_name": "setDaemon", "annotation": ""}, "snippet": " t.setDaemon(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L38_C4", "label": "start()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "vector": [8, 1, 0.717, 0.0189, 1, 0.85, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:For_L40_C0", "label": "for i", "type": "for", "loc": [40, 41], "level": 0, "parent": null, "vector": [6, 0, 0.7642, 0.0377, 0, 0.66, 0.619, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(JOBS):\n q.put(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L41_C4", "label": "put()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L40_C0", "vector": [8, 1, 0.7736, 0.0189, 1, 0.06, 0.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " q.put(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L43_C0", "label": "join()", "type": "expression", "loc": [43, 43], "level": 0, "parent": null, "vector": [8, 0, 0.8113, 0.0189, 0, 0.66, 0.6667, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "q.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L44_C0", "label": "print()", "type": "expression", "loc": [44, 44], "level": 0, "parent": null, "vector": [8, 0, 0.8302, 0.0189, 0, 0.66, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Craw completed.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L46_C0", "label": "b =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.8679, 0.0189, 0, 0.66, 0.7619, 756, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "b = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:For_L47_C0", "label": "for a", "type": "for", "loc": [47, 48], "level": 0, "parent": null, "vector": [6, 0, 0.8962, 0.0377, 0, 0.66, 0.8095, 475, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for a in results:\n b[a] = 1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L48_C4", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_136:For_L47_C0", "vector": [14, 1, 0.9057, 0.0189, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b[a] = 1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L50_C0", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.9434, 0.0189, 0, 0.66, 0.8571, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"tbole_key.txt\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L51_C0", "label": "write()", "type": "expression", "loc": [51, 51], "level": 0, "parent": null, "vector": [8, 0, 0.9623, 0.0189, 0, 0.66, 0.9048, 837, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\"\\n\".join(b.keys()).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L52_C0", "label": "close()", "type": "expression", "loc": [52, 52], "level": 0, "parent": null, "vector": [8, 0, 0.9811, 0.0189, 0, 0.66, 0.9524, 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_136:Expr_L53_C0", "label": "print()", "type": "expression", "loc": [53, 53], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0189, 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(\"Wrote results.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_136:For_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_136:For_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_136:Assign_L48_C4"}] |
#coding:utf-8
#!/usr/bin/env python
from threading import Thread
from Queue import Queue
from time import sleep
import sqlite3
import sys, re, StringIO, os
import urllib2 as urllib
from datetime import datetime
q = Queue()
NUM = 20
TIMEOUT = 0.1
C = (u"名人堂", u"媒体汇", u"品牌馆")
def now():
return str(datetime.now()) + " "
print now() + "Initializing..."
def craw(url, tag1, tag2, tag3):
print now() + "Crawler",tag1,tag2,tag3,"Initializing..."
while True:
try:
a = unicode(urllib.urlopen(url).read(), "utf-8")
break
except:
print now() + "Crawler",tag1,tag2,tag3,"initialize failed, Retrying..."
sleep(TIMEOUT)
f = open(tag1 + os.sep + tag2 + os.sep + tag3 + ".txt", "w")
i = 0
while True:
i += 1
print now() + "Crawler",tag1,tag2,tag3,"Page",i,"Crawing..."
b = re.findall("<a href=\"(home.php\?uid=(\d+)&[^\"]+)\">([^<]+)</a>", a)
for urltmp, userid, nickname in b:
url = 'http://t.sina.cn/dpool/ttt/' + urltmp.replace("home.php", "user.php")
while True:
try:
c = unicode(urllib.urlopen(url).read(), "utf-8")
break
except:
try:
print now() + "Crawler",tag1,tag2,tag3,"Page",i,"User",nickname,"fetch failed, Retrying..."
except:
print now() + "Crawler",tag1,tag2,tag3,"Page",i,"User XXX","fetch failed, Retrying..."
sleep(TIMEOUT)
try:
d = re.findall(u"认证说明:([^<]+)", c)[0]
except:
d = ""
try:
print now() + "Crawler",tag1,tag2,tag3,"Page",i,"User",nickname,"("+d+")","Fetched."
except:
print now() + "Crawler",tag1,tag2,tag3,"Page",i,"User XXX","(XXX)","Fetched."
f.write((userid + '\t' + nickname + '\t' + d + '\n').encode('utf-8'))
sleep(TIMEOUT)
try:
nextpage = re.findall(u"<a href=\"([^\"]+)\">下页</a>", a)[0].replace("&", "&")
except:
f.close()
return
sleep(TIMEOUT)
url = "http://t.sina.cn" + nextpage
while True:
try:
a = unicode(urllib.urlopen(url).read(), "utf-8")
break
except:
print now() + "Crawler",tag1,tag2,tag3,"Page",i+1,"fetch failed, Retrying..."
sleep(TIMEOUT)
def working():
global q
while True:
arguments = q.get()
craw(*arguments)
q.task_done()
for i in range(NUM):
t = Thread(target=working)
t.setDaemon(True)
t.start()
for ntagt, tag1 in enumerate(C[2:]):
ntag1 = ntagt + 2
print now() + "Seeking",tag1,"..."
try:
os.mkdir(tag1)
except:
pass
url = "http://t.sina.cn/dpool/ttt/v2star.php?cat=%d&sorttype=industry&gsid=3_5bc659f93ba7c3eac863570828ad7bccb5" % (ntag1 + 1,)
while True:
try:
a = unicode(urllib.urlopen(url).read(), "utf-8")
break
except:
print now() + "Seeking",tag1,"failed, Retrying..."
sleep(TIMEOUT)
b = re.findall("<a href=\"(/dpool/ttt/v2star.php\?cat=%d&ta[^\"]+)\">([^<]+)</a>" % (ntag1 + 1,), a)
if(len(b)) == 0:
b = [[url, tag1]]
for (url, tag2) in b:
print now() + "Seeking",tag1,tag2,"..."
try:
os.mkdir(tag1 + os.sep + tag2)
except:
pass
if url[0] == '/':
url = 'http://t.sina.cn' + url.replace('&', '&')
while True:
try:
a = unicode(urllib.urlopen(url).read(), "utf-8")
break
except:
print now() + "Seeking",tag1,tag2,"failed, Retrying..."
sleep(TIMEOUT)
b2 = re.findall("<a href=\"(/dpool/ttt/v2star.php\?cat=%d&su[^\"]+)\">([^<]+)</a>" % (ntag1 + 1,), a)
for (url, tag3) in b2:
q.put(('http://t.sina.cn' + url.replace('&', '&'), tag1, tag2, tag3))
q.join()
| ajibawa-2023/Python-Code-Large/train/row_137 | 92 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_137:ImportFrom_L3_C0", "label": "from threading import Thread", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0252, 0.0084, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:ImportFrom_L4_C0", "label": "from Queue import Queue", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0336, 0.0084, 0, 0.66, 0.0588, 952, 0, 1, 0, 0, 952, 0, 0], "semantic": {"name": "Queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:ImportFrom_L5_C0", "label": "from time import sleep", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.042, 0.0084, 0, 0.66, 0.1176, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["sleep"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import sleep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Import_L6_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0504, 0.0084, 0, 0.66, 0.1765, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Import_L7_C0", "label": "sys import sys, re, StringIO\u2026", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0084, 0, 0.66, 0.2353, 509, 0, 4, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "re", "StringIO", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, re, StringIO, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Import_L8_C0", "label": "urllib2 import urllib", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0672, 0.0084, 0, 0.66, 0.2941, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2 as urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:ImportFrom_L9_C0", "label": "from datetime import datetime", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0756, 0.0084, 0, 0.66, 0.3529, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L10_C0", "label": "q = Queue()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.084, 0.0084, 0, 0.66, 0.4118, 516, 3, 0, 0, 0, 952, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "Queue", "annotation": ""}, "snippet": "q = Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L11_C0", "label": "NUM =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0924, 0.0084, 0, 0.66, 0.4706, 228, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NUM = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L12_C0", "label": "TIMEOUT =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1008, 0.0084, 0, 0.66, 0.5294, 824, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "TIMEOUT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TIMEOUT = 0.1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L13_C0", "label": "C =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1092, 0.0084, 0, 0.66, 0.5882, 619, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "C", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "C = (u\"\u540d\u4eba\u5802\", u\"\u5a92\u4f53\u6c47\", u\"\u54c1\u724c\u9986\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L15_C0", "label": "now", "type": "function", "loc": [15, 16], "level": 0, "parent": null, "vector": [2, 0, 0.1303, 0.0168, 0, 0.66, 0.6471, 894, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def now():\n\treturn str(datetime.now()) + \" \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Return_L16_C1", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L15_C0", "vector": [13, 1, 0.1345, 0.0084, 1, 0.1, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn str(datetime.now()) + \" \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L17_C0", "label": "print()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.0084, 0, 0.66, 0.7059, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(now() + \"Initializing...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "label": "craw", "type": "function", "loc": [19, 69], "level": 0, "parent": null, "vector": [2, 0, 0.3697, 0.4286, 0, 0.66, 0.7647, 800, 0, 4, 0, 0, 0, 0, 39], "semantic": {"name": "craw", "arg_names": ["url", "tag1", "tag2", "tag3"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def craw(url, tag1, tag2, tag3):\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Initializing...\")\n while True:\n try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"initialize failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L20_C4", "label": "print()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "vector": [8, 1, 0.1681, 0.0084, 1, 0.36, 0.0, 535, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Initializing...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L21_C4", "label": "while", "type": "while", "loc": [21, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "vector": [5, 1, 0.2017, 0.0588, 1, 0.36, 0.25, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"initialize failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "label": "try", "type": "try", "loc": [22, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L21_C4", "vector": [7, 2, 0.2059, 0.0504, 2, 0.43, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"initialize failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L23_C12", "label": "a = unicode()", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "vector": [14, 3, 0.1933, 0.0084, 3, 0.25, 0.0, 475, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " a = unicode(urllib.urlopen(url).read(), \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L26_C12", "label": "print()", "type": "expression", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "vector": [8, 3, 0.2185, 0.0084, 3, 0.25, 0.0, 535, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"initialize failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L27_C12", "label": "sleep()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "vector": [8, 3, 0.2269, 0.0084, 3, 0.25, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L28_C4", "label": "f = open()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "vector": [14, 1, 0.2353, 0.0084, 1, 0.36, 0.5, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(tag1 + os.sep + tag2 + os.sep + tag3 + \".txt\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L29_C4", "label": "i =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "vector": [14, 1, 0.2437, 0.0084, 1, 0.36, 0.75, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "label": "while", "type": "while", "loc": [30, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "vector": [5, 1, 0.416, 0.3361, 1, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 0, 30], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n i += 1\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"Crawing...\")\n b = re.findall(\"<a href=\\\"(home.php\\?uid=(\\d+)&[^\\\"]+)\\\">([^<]+)</a>\", a)\n for urltmp, userid, nickname in b:\n url = 'http://t.sina.cn/dpool/ttt/' + urltmp.replace(\"home.php\", \"user.php\")\n while True:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L32_C8", "label": "print()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [8, 2, 0.2689, 0.0084, 2, 0.57, 0.0, 535, 3, 7, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"Crawing...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L33_C8", "label": "b = findall()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [14, 2, 0.2773, 0.0084, 2, 0.57, 0.1667, 756, 3, 2, 0, 0, 737, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " b = re.findall(\"<a href=\\\"(home.php\\?uid=(\\d+)&[^\\\"]+)\\\">([^<]+)</a>\", a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "label": "for urltmp, userid, nickname", "type": "for", "loc": [34, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [6, 2, 0.3739, 0.1849, 2, 0.57, 0.3333, 677, 2, 0, 0, 0, 0, 0, 17], "semantic": {"name": "urltmp, userid, nickname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for urltmp, userid, nickname in b:\n url = 'http://t.sina.cn/dpool/ttt/' + urltmp.replace(\"home.php\", \"user.php\")\n while True:\n try:\n c = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L35_C12", "label": "url =", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [14, 3, 0.2941, 0.0084, 3, 0.44, 0.0, 789, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://t.sina.cn/dpool/ttt/' + urltmp.replace(\"home.php\", \"user.php\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L36_C12", "label": "while", "type": "while", "loc": [36, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [5, 3, 0.3403, 0.084, 3, 0.44, 0.2, 0, 1, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n c = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n try:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"fetch failed, Retrying...\")\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "label": "try", "type": "try", "loc": [37, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L36_C12", "vector": [7, 4, 0.3445, 0.0756, 4, 0.83, 0.0, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n c = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n try:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"fetch failed, Retrying...\")\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User XXX\",\"fetch failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L38_C20", "label": "c = unicode()", "type": "assigned_variable", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "vector": [14, 5, 0.3193, 0.0084, 5, 0.5, 0.0, 411, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " c = unicode(urllib.urlopen(url).read(), \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20", "label": "try", "type": "try", "loc": [41, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "vector": [7, 5, 0.3571, 0.0336, 5, 0.5, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"fetch failed, Retrying...\")\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User XXX\",\"fetch failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L42_C24", "label": "print()", "type": "expression", "loc": [42, 42], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20", "vector": [8, 6, 0.3529, 0.0084, 6, 0.11, 0.0, 535, 3, 9, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"fetch failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L44_C24", "label": "print()", "type": "expression", "loc": [44, 44], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20", "vector": [8, 6, 0.3697, 0.0084, 6, 0.11, 0.0, 535, 3, 8, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User XXX\",\"fetch failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L45_C20", "label": "sleep()", "type": "expression", "loc": [45, 45], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "vector": [8, 5, 0.3782, 0.0084, 5, 0.5, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12", "label": "try", "type": "try", "loc": [46, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [7, 3, 0.3992, 0.0336, 3, 0.44, 0.4, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n d = re.findall(u\"\u8ba4\u8bc1\u8bf4\u660e:([^<]+)\", c)[0]\n except:\n d = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L47_C16", "label": "d =", "type": "assigned_variable", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12", "vector": [14, 4, 0.395, 0.0084, 4, 0.8, 0.0, 355, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = re.findall(u\"\u8ba4\u8bc1\u8bf4\u660e:([^<]+)\", c)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L49_C16", "label": "d =", "type": "assigned_variable", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12", "vector": [14, 4, 0.4118, 0.0084, 4, 0.8, 0.0, 355, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12", "label": "try", "type": "try", "loc": [50, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [7, 3, 0.4328, 0.0336, 3, 0.44, 0.6, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"(\"+d+\")\",\"Fetched.\")\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User XXX\",\"(XXX)\",\"Fetched.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L51_C16", "label": "print()", "type": "expression", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12", "vector": [8, 4, 0.4286, 0.0084, 4, 0.43, 0.0, 535, 3, 10, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User\",nickname,\"(\"+d+\")\",\"Fetched.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L53_C16", "label": "print()", "type": "expression", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12", "vector": [8, 4, 0.4454, 0.0084, 4, 0.43, 0.0, 535, 3, 9, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i,\"User XXX\",\"(XXX)\",\"Fetched.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L54_C12", "label": "write()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [8, 3, 0.4538, 0.0084, 3, 0.44, 0.8, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write((userid + '\\t' + nickname + '\\t' + d + '\\n').encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L55_C12", "label": "sleep()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "vector": [8, 3, 0.4622, 0.0084, 3, 0.44, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "label": "try", "type": "try", "loc": [56, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [7, 2, 0.4874, 0.042, 2, 0.57, 0.5, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextpage = re.findall(u\"<a href=\\\"([^\\\"]+)\\\">\u4e0b\u9875</a>\", a)[0].replace(\"&\", \"&\")\n except:\n f.close()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L57_C12", "label": "nextpage = replace()", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "vector": [14, 3, 0.479, 0.0084, 3, 0.79, 0.0, 413, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "nextpage", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " nextpage = re.findall(u\"<a href=\\\"([^\\\"]+)\\\">\u4e0b\u9875</a>\", a)[0].replace(\"&\", \"&\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L59_C12", "label": "close()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "vector": [8, 3, 0.4958, 0.0084, 3, 0.79, 0.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_137:Return_L60_C12", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "vector": [13, 3, 0.5042, 0.0084, 3, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L61_C8", "label": "sleep()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [8, 2, 0.5126, 0.0084, 2, 0.57, 0.6667, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L62_C8", "label": "url =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [14, 2, 0.521, 0.0084, 2, 0.57, 0.8333, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = \"http://t.sina.cn\" + nextpage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L63_C8", "label": "while", "type": "while", "loc": [63, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "vector": [5, 2, 0.5546, 0.0588, 2, 0.57, 1.0, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i+1,\"fetch failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "label": "try", "type": "try", "loc": [64, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L63_C8", "vector": [7, 3, 0.5588, 0.0504, 3, 0.34, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i+1,\"fetch failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L65_C16", "label": "a = unicode()", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "vector": [14, 4, 0.5462, 0.0084, 4, 0.57, 0.0, 475, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " a = unicode(urllib.urlopen(url).read(), \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L68_C16", "label": "print()", "type": "expression", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "vector": [8, 4, 0.5714, 0.0084, 4, 0.57, 0.0, 535, 3, 7, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Crawler\",tag1,tag2,tag3,\"Page\",i+1,\"fetch failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L69_C16", "label": "sleep()", "type": "expression", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "vector": [8, 4, 0.5798, 0.0084, 4, 0.57, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L71_C0", "label": "working", "type": "function", "loc": [71, 76], "level": 0, "parent": null, "vector": [2, 0, 0.6176, 0.0504, 0, 0.66, 0.8235, 380, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "working", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def working():\n global q\n while True:\n arguments = q.get()\n craw(*arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "label": "while", "type": "while", "loc": [73, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L71_C0", "vector": [5, 1, 0.6261, 0.0336, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n arguments = q.get()\n craw(*arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L74_C8", "label": "arguments = get()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "vector": [14, 2, 0.6218, 0.0084, 2, 0.31, 0.0, 426, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "arguments", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " arguments = q.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L75_C8", "label": "craw()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "vector": [8, 2, 0.6303, 0.0084, 2, 0.31, 0.5, 800, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "craw", "arg_names": [], "import_names": [], "rhs_call_name": "craw", "annotation": ""}, "snippet": " craw(*arguments)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L76_C8", "label": "task_done()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "vector": [8, 2, 0.6387, 0.0084, 2, 0.31, 1.0, 393, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "task_done", "arg_names": [], "import_names": [], "rhs_call_name": "task_done", "annotation": ""}, "snippet": " q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "label": "for i", "type": "for", "loc": [78, 81], "level": 0, "parent": null, "vector": [6, 0, 0.6681, 0.0336, 0, 0.66, 0.8824, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(NUM):\n t = Thread(target=working)\n t.setDaemon(True)\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L79_C4", "label": "t = Thread()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "vector": [14, 1, 0.6639, 0.0084, 1, 0.3, 0.0, 15, 3, 1, 0, 0, 134, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " t = Thread(target=working)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L80_C4", "label": "setDaemon()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "vector": [8, 1, 0.6723, 0.0084, 1, 0.3, 0.5, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setDaemon", "arg_names": [], "import_names": [], "rhs_call_name": "setDaemon", "annotation": ""}, "snippet": " t.setDaemon(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L81_C4", "label": "start()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "vector": [8, 1, 0.6807, 0.0084, 1, 0.3, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "label": "for ntagt, tag1", "type": "for", "loc": [83, 118], "level": 0, "parent": null, "vector": [6, 0, 0.8445, 0.3025, 0, 0.66, 0.9412, 75, 3, 0, 0, 0, 0, 0, 25], "semantic": {"name": "ntagt, tag1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for ntagt, tag1 in enumerate(C[2:]):\n ntag1 = ntagt + 2\n print(now() + \"Seeking\",tag1,\"...\")\n try:\n os.mkdir(tag1)\n except:\n pass\n url = \"http://t.sina.cn/dpool/ttt/v2star.php?cat=%d&sorttype=industry&gsid=3_5bc659f93ba7c3eac863570828ad7bccb5\" % (ntag1 + 1,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L84_C4", "label": "ntag1 =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [14, 1, 0.7059, 0.0084, 1, 0.72, 0.0, 159, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ntag1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ntag1 = ntagt + 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L85_C4", "label": "print()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [8, 1, 0.7143, 0.0084, 1, 0.72, 0.1429, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Seeking\",tag1,\"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L86_C4", "label": "try", "type": "try", "loc": [86, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [7, 1, 0.7353, 0.0336, 1, 0.72, 0.2857, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n os.mkdir(tag1)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L87_C8", "label": "mkdir()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L86_C4", "vector": [8, 2, 0.7311, 0.0084, 2, 0.43, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(tag1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L90_C4", "label": "url =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [14, 1, 0.7563, 0.0084, 1, 0.72, 0.4286, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = \"http://t.sina.cn/dpool/ttt/v2star.php?cat=%d&sorttype=industry&gsid=3_5bc659f93ba7c3eac863570828ad7bccb5\" % (ntag1 + 1,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L91_C4", "label": "while", "type": "while", "loc": [91, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [5, 1, 0.7899, 0.0588, 1, 0.72, 0.5714, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Seeking\",tag1,\"failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "label": "try", "type": "try", "loc": [92, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L91_C4", "vector": [7, 2, 0.7941, 0.0504, 2, 0.16, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Seeking\",tag1,\"failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L93_C12", "label": "a = unicode()", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "vector": [14, 3, 0.7815, 0.0084, 3, 0.0, 0.0, 475, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " a = unicode(urllib.urlopen(url).read(), \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L96_C12", "label": "print()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "vector": [8, 3, 0.8067, 0.0084, 3, 0.0, 0.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Seeking\",tag1,\"failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L97_C12", "label": "sleep()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "vector": [8, 3, 0.8151, 0.0084, 3, 0.0, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L98_C4", "label": "b = findall()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [14, 1, 0.8235, 0.0084, 1, 0.72, 0.7143, 756, 3, 2, 0, 0, 737, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " b = re.findall(\"<a href=\\\"(/dpool/ttt/v2star.php\\?cat=%d&ta[^\\\"]+)\\\">([^<]+)</a>\" % (ntag1 + 1,), a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:If_L99_C4", "label": "if", "type": "if", "loc": [99, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [4, 1, 0.8361, 0.0168, 1, 0.72, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if(len(b)) == 0:\n b = [[url, tag1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L100_C8", "label": "b =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:If_L99_C4", "vector": [14, 2, 0.8403, 0.0084, 2, 0.34, 0.0, 756, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b = [[url, tag1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "label": "for url, tag2", "type": "for", "loc": [101, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "vector": [6, 1, 0.9202, 0.1513, 1, 0.72, 1.0, 83, 2, 0, 0, 0, 0, 0, 13], "semantic": {"name": "url, tag2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (url, tag2) in b:\n print(now() + \"Seeking\",tag1,tag2,\"...\")\n try:\n os.mkdir(tag1 + os.sep + tag2)\n except:\n pass\n if url[0] == '/':\n url = 'http://t.sina.cn' + url.replace('&', '&')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L102_C8", "label": "print()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [8, 2, 0.8571, 0.0084, 2, 0.92, 0.0, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Seeking\",tag1,tag2,\"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L103_C8", "label": "try", "type": "try", "loc": [103, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [7, 2, 0.8782, 0.0336, 2, 0.92, 0.2, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n os.mkdir(tag1 + os.sep + tag2)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L104_C12", "label": "mkdir()", "type": "expression", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L103_C8", "vector": [8, 3, 0.8739, 0.0084, 3, 0.66, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(tag1 + os.sep + tag2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:If_L107_C8", "label": "if", "type": "if", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [4, 2, 0.9034, 0.0168, 2, 0.92, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url[0] == '/':\n url = 'http://t.sina.cn' + url.replace('&', '&')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L108_C12", "label": "url =", "type": "assigned_variable", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:If_L107_C8", "vector": [14, 3, 0.9076, 0.0084, 3, 0.21, 0.0, 789, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://t.sina.cn' + url.replace('&', '&')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:While_L109_C8", "label": "while", "type": "while", "loc": [109, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [5, 2, 0.9412, 0.0588, 2, 0.92, 0.6, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Seeking\",tag1,tag2,\"failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "label": "try", "type": "try", "loc": [110, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:While_L109_C8", "vector": [7, 3, 0.9454, 0.0504, 3, 0.14, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n a = unicode(urllib.urlopen(url).read(), \"utf-8\")\n break\n except:\n print(now() + \"Seeking\",tag1,tag2,\"failed, Retrying...\")\n sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L111_C16", "label": "a = unicode()", "type": "assigned_variable", "loc": [111, 111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "vector": [14, 4, 0.9328, 0.0084, 4, 0.6, 0.0, 475, 3, 2, 0, 0, 733, 10, 3], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " a = unicode(urllib.urlopen(url).read(), \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L114_C16", "label": "print()", "type": "expression", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "vector": [8, 4, 0.958, 0.0084, 4, 0.6, 0.0, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(now() + \"Seeking\",tag1,tag2,\"failed, Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L115_C16", "label": "sleep()", "type": "expression", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "vector": [8, 4, 0.9664, 0.0084, 4, 0.6, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L116_C8", "label": "b2 = findall()", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [14, 2, 0.9748, 0.0084, 2, 0.92, 0.8, 670, 3, 2, 0, 0, 737, 10, 1], "semantic": {"name": "b2", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " b2 = re.findall(\"<a href=\\\"(/dpool/ttt/v2star.php\\?cat=%d&su[^\\\"]+)\\\">([^<]+)</a>\" % (ntag1 + 1,), a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:For_L117_C8", "label": "for url, tag3", "type": "for", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "vector": [6, 2, 0.9874, 0.0168, 2, 0.92, 1.0, 713, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "url, tag3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (url, tag3) in b2:\n q.put(('http://t.sina.cn' + url.replace('&', '&'), tag1, tag2, tag3))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L118_C12", "label": "put()", "type": "expression", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_137:For_L117_C8", "vector": [8, 3, 0.9916, 0.0084, 3, 0.72, 0.0, 636, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " q.put(('http://t.sina.cn' + url.replace('&', '&'), tag1, tag2, tag3))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L119_C0", "label": "join()", "type": "expression", "loc": [119, 119], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0084, 0, 0.66, 1.0, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "q.join()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Return_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L22_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L38_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L42_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L41_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L44_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L45_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L47_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L51_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Return_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:If_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:While_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:While_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:Try_L110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L115_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_137:For_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_137:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_137:Expr_L118_C12"}] |
#coding:utf-8
from threading import Thread
from Queue import Queue
import sqlite3
import sys, re, StringIO
from time import sleep
import urllib2, urllib
TARGET = 1000
NUM = 10
ids = []
results = []
count = 0
q = Queue()
KEYS = ['招聘']
class UserAgentProcessor(urllib2.BaseHandler):
"""A handler to add a custom UA string to urllib2 requests
"""
def __init__(self):
self.handler_order = 100
self.ua = "User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.25 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.707.0 Chrome/12.0.707.0 Safari/534.25"
def http_request(self, request):
request.add_header("User-Agent", self.ua)
return request
https_request = http_request
opener = urllib2.build_opener(UserAgentProcessor())
urllib2.install_opener(opener)
def craw(key):
global count, results, q, ids
key = key.replace(" ", "%20")
print key
params = urllib.urlencode({'keyword': key, 'smblog': '搜微博'})
a = urllib2.urlopen("http://t.sina.cn/dpool/ttt/search.php?PHPSESSID=f54ade2b393f1a28b59db06939c8f420", data=params)
while True:
b = a.read().split('<div class="c"')
for item in b[1:-2]:
try:
if "转发了" in item:
continue
id = re.findall('id="([^"]+)"', item)[0]
text = re.findall('<span class="ctt">(.+?)</span>[\[\&]', item)[0]
text = re.sub("<.+?>","",text)
if text[0] == ':':
text = text[1:]
if id in ids:
continue
print id, text
results.append((id, unicode(text,'utf-8')))
ids.append(id)
count += 1
#print count
if count > TARGET:
return
except:
pass
try:
nextpage = re.findall("<a href=\"([^\"]+)\">下页</a>", b[-3])[0].replace("&", "&")
except:
return
sleep(0.1)
a = urllib.urlopen("http://t.sina.cn/dpool/ttt/" + nextpage)
def working():
global q
while True:
arguments = q.get()
craw(arguments)
q.task_done()
for i in range(NUM):
t = Thread(target=working)
t.setDaemon(True)
t.start()
for key in KEYS:
q.put(key)
q.join()
print "Craw completed."
sys.exit(1)
conn = sqlite3.connect("train.dat")
cur = conn.cursor()
try:
cur.execute("create table tweets (id text, content text)")
except sqlite3.OperationalError:
pass
cur.executemany("insert into tweets values (?,?)", results)
conn.commit()
cur.close()
conn.close()
print "Wrote Database."
| ajibawa-2023/Python-Code-Large/train/row_138 | 73 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_138:ImportFrom_L2_C0", "label": "from threading import Thread", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0102, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:ImportFrom_L3_C0", "label": "from Queue import Queue", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0306, 0.0102, 0, 0.66, 0.0333, 952, 0, 1, 0, 0, 952, 0, 0], "semantic": {"name": "Queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Import_L4_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0408, 0.0102, 0, 0.66, 0.0667, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Import_L5_C0", "label": "sys import sys, re, StringIO", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.051, 0.0102, 0, 0.66, 0.1, 509, 0, 3, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "re", "StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, re, StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:ImportFrom_L6_C0", "label": "from time import sleep", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0102, 0, 0.66, 0.1333, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["sleep"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import sleep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Import_L7_C0", "label": "urllib2 import urllib2, urllib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0102, 0, 0.66, 0.1667, 345, 0, 2, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib2", "urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2, urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L9_C0", "label": "TARGET =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0918, 0.0102, 0, 0.66, 0.2, 712, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "TARGET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TARGET = 1000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L10_C0", "label": "NUM =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.102, 0.0102, 0, 0.66, 0.2333, 228, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NUM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NUM = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L12_C0", "label": "ids =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1224, 0.0102, 0, 0.66, 0.2667, 202, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ids = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L13_C0", "label": "results =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1327, 0.0102, 0, 0.66, 0.3, 143, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "results = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L14_C0", "label": "count =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.1429, 0.0102, 0, 0.66, 0.3333, 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_138:Assign_L15_C0", "label": "q = Queue()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1531, 0.0102, 0, 0.66, 0.3667, 516, 3, 0, 0, 0, 952, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "Queue", "annotation": ""}, "snippet": "q = Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L17_C0", "label": "KEYS =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1735, 0.0102, 0, 0.66, 0.4, 564, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "KEYS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "KEYS = ['\u62db\u8058']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "label": "UserAgentProcessor", "type": "class", "loc": [19, 29], "level": 0, "parent": null, "vector": [3, 0, 0.2449, 0.1122, 0, 0.66, 0.4333, 891, 0, 2, 0, 0, 162, 0, 1], "semantic": {"name": "UserAgentProcessor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UserAgentProcessor(urllib2.BaseHandler):\n \"\"\"A handler to add a custom UA string to urllib2 requests\n \"\"\"\n def __init__(self):\n self.handler_order = 100\n self.ua = \"User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.25 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.707.0 Chrome/12.0.707.0 Safari/534.25\"\n\n def http_request(self, request):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "vector": [8, 1, 0.2092, 0.0204, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A handler to add a custom UA string to urllib2 requests\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4", "label": "__init__", "type": "function", "loc": [22, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "vector": [2, 1, 0.2347, 0.0306, 1, 0.87, 0.3333, 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.handler_order = 100\n self.ua = \"User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.25 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.707.0 Chrome/12.0.707.0 Safari/534.25\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L23_C8", "label": "self.handler_order =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4", "vector": [14, 2, 0.2347, 0.0102, 2, 0.92, 0.0, 310, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.handler_order", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.handler_order = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L24_C8", "label": "self.ua =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4", "vector": [14, 2, 0.2449, 0.0102, 2, 0.92, 1.0, 261, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.ua", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ua = \"User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.25 (KHTML, like Gecko) Ubuntu/11.04 Chromium/12.0.707.0 Chrome/12.0.707.0 Safari/534.25\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4", "label": "http_request", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "vector": [2, 1, 0.2755, 0.0306, 1, 0.87, 0.6667, 29, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "http_request", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def http_request(self, request):\n request.add_header(\"User-Agent\", self.ua)\n return request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L27_C8", "label": "add_header()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4", "vector": [8, 2, 0.2755, 0.0102, 2, 0.14, 0.0, 643, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_header", "arg_names": [], "import_names": [], "rhs_call_name": "add_header", "annotation": ""}, "snippet": " request.add_header(\"User-Agent\", self.ua)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4", "vector": [13, 2, 0.2857, 0.0102, 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 request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L29_C4", "label": "https_request =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "vector": [14, 1, 0.2959, 0.0102, 1, 0.87, 1.0, 108, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "https_request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " https_request = http_request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L31_C0", "label": "opener = build_opener()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.3163, 0.0102, 0, 0.66, 0.4667, 98, 3, 1, 0, 0, 207, 10, 2], "semantic": {"name": "opener", "arg_names": [], "import_names": [], "rhs_call_name": "build_opener", "annotation": ""}, "snippet": "opener = urllib2.build_opener(UserAgentProcessor())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L32_C0", "label": "install_opener()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 0.3265, 0.0102, 0, 0.66, 0.5, 73, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "install_opener", "arg_names": [], "import_names": [], "rhs_call_name": "install_opener", "annotation": ""}, "snippet": "urllib2.install_opener(opener)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "label": "craw", "type": "function", "loc": [34, 67], "level": 0, "parent": null, "vector": [2, 0, 0.5153, 0.3469, 0, 0.66, 0.5333, 800, 0, 1, 0, 0, 0, 0, 17], "semantic": {"name": "craw", "arg_names": ["key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def craw(key):\n global count, results, q, ids\n key = key.replace(\" \", \"%20\")\n print(key)\n params = urllib.urlencode({'keyword': key, 'smblog': '\u641c\u5fae\u535a'})\n a = urllib2.urlopen(\"http://t.sina.cn/dpool/ttt/search.php?PHPSESSID=f54ade2b393f1a28b59db06939c8f420\", data=params)\n while True:\n b = a.read().split('<div class=\"c\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L36_C4", "label": "key = replace()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "vector": [14, 1, 0.3673, 0.0102, 1, 0.41, 0.0, 230, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " key = key.replace(\" \", \"%20\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L37_C4", "label": "print()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "vector": [8, 1, 0.3776, 0.0102, 1, 0.41, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L38_C4", "label": "params = urlencode()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "vector": [14, 1, 0.3878, 0.0102, 1, 0.41, 0.5, 206, 3, 1, 0, 0, 414, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " params = urllib.urlencode({'keyword': key, 'smblog': '\u641c\u5fae\u535a'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L39_C4", "label": "a = urlopen()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "vector": [14, 1, 0.398, 0.0102, 1, 0.41, 0.75, 475, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " a = urllib2.urlopen(\"http://t.sina.cn/dpool/ttt/search.php?PHPSESSID=f54ade2b393f1a28b59db06939c8f420\", data=params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "label": "while", "type": "while", "loc": [40, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "vector": [5, 1, 0.5459, 0.2857, 1, 0.41, 1.0, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n b = a.read().split('<div class=\"c\"')\n for item in b[1:-2]:\n try:\n if \"\u8f6c\u53d1\u4e86\" in item:\n continue\n id = re.findall('id=\"([^\"]+)\"', item)[0]\n text = re.findall('<span class=\"ctt\">(.+?)</span>[\\[\\&]', item)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L41_C8", "label": "b = split()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "vector": [14, 2, 0.4184, 0.0102, 2, 0.07, 0.0, 756, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " b = a.read().split('<div class=\"c\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:For_L42_C8", "label": "for item", "type": "for", "loc": [42, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "vector": [6, 2, 0.5255, 0.2041, 2, 0.07, 0.25, 434, 6, 0, 0, 0, 0, 0, 7], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in b[1:-2]:\n try:\n if \"\u8f6c\u53d1\u4e86\" in item:\n continue\n id = re.findall('id=\"([^\"]+)\"', item)[0]\n text = re.findall('<span class=\"ctt\">(.+?)</span>[\\[\\&]', item)[0]\n text = re.sub(\"<.+?>\",\"\",text)\n if text[0] == ':':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "label": "try", "type": "try", "loc": [43, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:For_L42_C8", "vector": [7, 3, 0.5306, 0.1939, 3, 0.55, 0.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if \"\u8f6c\u53d1\u4e86\" in item:\n continue\n id = re.findall('id=\"([^\"]+)\"', item)[0]\n text = re.findall('<span class=\"ctt\">(.+?)</span>[\\[\\&]', item)[0]\n text = re.sub(\"<.+?>\",\"\",text)\n if text[0] == ':':\n text = text[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:If_L44_C16", "label": "if", "type": "if", "loc": [44, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [4, 4, 0.4541, 0.0204, 4, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"\u8f6c\u53d1\u4e86\" in item:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L46_C16", "label": "id =", "type": "assigned_variable", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [14, 4, 0.4694, 0.0102, 4, 0.32, 0.1111, 941, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " id = re.findall('id=\"([^\"]+)\"', item)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L47_C16", "label": "text =", "type": "assigned_variable", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [14, 4, 0.4796, 0.0102, 4, 0.32, 0.2222, 439, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = re.findall('<span class=\"ctt\">(.+?)</span>[\\[\\&]', item)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L48_C16", "label": "text = sub()", "type": "assigned_variable", "loc": [48, 48], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [14, 4, 0.4898, 0.0102, 4, 0.32, 0.3333, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text = re.sub(\"<.+?>\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:If_L49_C16", "label": "if", "type": "if", "loc": [49, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [4, 4, 0.5051, 0.0204, 4, 0.32, 0.4444, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if text[0] == ':':\n text = text[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L50_C20", "label": "text =", "type": "assigned_variable", "loc": [50, 50], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:If_L49_C16", "vector": [14, 5, 0.5102, 0.0102, 5, 0.09, 0.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:If_L51_C16", "label": "if", "type": "if", "loc": [51, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [4, 4, 0.5255, 0.0204, 4, 0.32, 0.5556, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if id in ids:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L53_C16", "label": "print()", "type": "expression", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [8, 4, 0.5408, 0.0102, 4, 0.32, 0.6667, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(id, text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L54_C16", "label": "append()", "type": "expression", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [8, 4, 0.551, 0.0102, 4, 0.32, 0.7778, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append((id, unicode(text,'utf-8')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L55_C16", "label": "append()", "type": "expression", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [8, 4, 0.5612, 0.0102, 4, 0.32, 0.8889, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ids.append(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:If_L58_C16", "label": "if", "type": "if", "loc": [58, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "vector": [4, 4, 0.5969, 0.0204, 4, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count > TARGET:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L59_C20", "label": "return", "type": "return", "loc": [59, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:If_L58_C16", "vector": [13, 5, 0.602, 0.0102, 5, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8", "label": "try", "type": "try", "loc": [62, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "vector": [7, 2, 0.648, 0.0408, 2, 0.07, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextpage = re.findall(\"<a href=\\\"([^\\\"]+)\\\">\u4e0b\u9875</a>\", b[-3])[0].replace(\"&\", \"&\")\n except:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L63_C12", "label": "nextpage = replace()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8", "vector": [14, 3, 0.6429, 0.0102, 3, 0.87, 0.0, 413, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "nextpage", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " nextpage = re.findall(\"<a href=\\\"([^\\\"]+)\\\">\u4e0b\u9875</a>\", b[-3])[0].replace(\"&\", \"&\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L65_C12", "label": "return", "type": "return", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8", "vector": [13, 3, 0.6633, 0.0102, 3, 0.87, 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_138:Expr_L66_C8", "label": "sleep()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "vector": [8, 2, 0.6735, 0.0102, 2, 0.07, 0.75, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L67_C8", "label": "a = urlopen()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "vector": [14, 2, 0.6837, 0.0102, 2, 0.07, 1.0, 475, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " a = urllib.urlopen(\"http://t.sina.cn/dpool/ttt/\" + nextpage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L69_C0", "label": "working", "type": "function", "loc": [69, 74], "level": 0, "parent": null, "vector": [2, 0, 0.7296, 0.0612, 0, 0.66, 0.5667, 380, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "working", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def working():\n global q\n while True:\n arguments = q.get()\n craw(arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "label": "while", "type": "while", "loc": [71, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L69_C0", "vector": [5, 1, 0.7398, 0.0408, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n arguments = q.get()\n craw(arguments)\n q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L72_C8", "label": "arguments = get()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "vector": [14, 2, 0.7347, 0.0102, 2, 0.13, 0.0, 426, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "arguments", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " arguments = q.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L73_C8", "label": "craw()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "vector": [8, 2, 0.7449, 0.0102, 2, 0.13, 0.5, 800, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "craw", "arg_names": [], "import_names": [], "rhs_call_name": "craw", "annotation": ""}, "snippet": " craw(arguments)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L74_C8", "label": "task_done()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "vector": [8, 2, 0.7551, 0.0102, 2, 0.13, 1.0, 393, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "task_done", "arg_names": [], "import_names": [], "rhs_call_name": "task_done", "annotation": ""}, "snippet": " q.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "label": "for i", "type": "for", "loc": [76, 79], "level": 0, "parent": null, "vector": [6, 0, 0.7908, 0.0408, 0, 0.66, 0.6, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(NUM):\n t = Thread(target=working)\n t.setDaemon(True)\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L77_C4", "label": "t = Thread()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "vector": [14, 1, 0.7857, 0.0102, 1, 0.0, 0.0, 15, 3, 1, 0, 0, 134, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " t = Thread(target=working)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L78_C4", "label": "setDaemon()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "vector": [8, 1, 0.7959, 0.0102, 1, 0.0, 0.5, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setDaemon", "arg_names": [], "import_names": [], "rhs_call_name": "setDaemon", "annotation": ""}, "snippet": " t.setDaemon(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L79_C4", "label": "start()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "vector": [8, 1, 0.8061, 0.0102, 1, 0.0, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:For_L81_C0", "label": "for key", "type": "for", "loc": [81, 82], "level": 0, "parent": null, "vector": [6, 0, 0.8316, 0.0204, 0, 0.66, 0.6333, 230, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for key in KEYS:\n q.put(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L82_C4", "label": "put()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:For_L81_C0", "vector": [8, 1, 0.8367, 0.0102, 1, 0.47, 0.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " q.put(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L84_C0", "label": "join()", "type": "expression", "loc": [84, 84], "level": 0, "parent": null, "vector": [8, 0, 0.8571, 0.0102, 0, 0.66, 0.6667, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "q.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L85_C0", "label": "print()", "type": "expression", "loc": [85, 85], "level": 0, "parent": null, "vector": [8, 0, 0.8673, 0.0102, 0, 0.66, 0.7, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Craw completed.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L86_C0", "label": "exit()", "type": "expression", "loc": [86, 86], "level": 0, "parent": null, "vector": [8, 0, 0.8776, 0.0102, 0, 0.66, 0.7333, 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_138:Assign_L87_C0", "label": "conn = connect()", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.8878, 0.0102, 0, 0.66, 0.7667, 345, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "conn = sqlite3.connect(\"train.dat\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L88_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [88, 88], "level": 0, "parent": null, "vector": [14, 0, 0.898, 0.0102, 0, 0.66, 0.8, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = conn.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L90_C0", "label": "try", "type": "try", "loc": [90, 93], "level": 0, "parent": null, "vector": [7, 0, 0.9337, 0.0408, 0, 0.66, 0.8333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n cur.execute(\"create table tweets (id text, content text)\")\nexcept sqlite3.OperationalError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L91_C4", "label": "execute()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L90_C0", "vector": [8, 1, 0.9286, 0.0102, 1, 0.31, 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(\"create table tweets (id text, content text)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L94_C0", "label": "executemany()", "type": "expression", "loc": [94, 94], "level": 0, "parent": null, "vector": [8, 0, 0.9592, 0.0102, 0, 0.66, 0.8667, 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 tweets values (?,?)\", results)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L95_C0", "label": "commit()", "type": "expression", "loc": [95, 95], "level": 0, "parent": null, "vector": [8, 0, 0.9694, 0.0102, 0, 0.66, 0.9, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "conn.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L96_C0", "label": "close()", "type": "expression", "loc": [96, 96], "level": 0, "parent": null, "vector": [8, 0, 0.9796, 0.0102, 0, 0.66, 0.9333, 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_138:Expr_L97_C0", "label": "close()", "type": "expression", "loc": [97, 97], "level": 0, "parent": null, "vector": [8, 0, 0.9898, 0.0102, 0, 0.66, 0.9667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "conn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L98_C0", "label": "print()", "type": "expression", "loc": [98, 98], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0102, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Wrote Database.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:For_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:If_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L47_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L48_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:If_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:If_L49_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L50_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:If_L51_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_138:If_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:If_L58_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L59_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Return_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:While_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:For_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:For_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_138:Try_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_138:Expr_L91_C4"}] |
#!/usr/bin/env python
#coding=utf-8
catelist = [
(1, u"传统网络Internet"),
(2, u"移动互联"),
(3, u"网游"),
(4, u"电子商务_B2C/团购"),
(5, u"软件、电信"),
(6, u"新媒体"),
(7, u"风投/投行"),
(8, u"其他外企"),
]
idlist = [
[1, (u"超超Sandy", "d11c25990634d0e486235f1b42a55f9f", "89859ba49065135017b894df5e5a9089")],
[1, (u"传统网络2", "9257d982dcbc26d21fa4f0afb16a54be", "e99c1ae713e14edc3ec3abb7e2344be3")],
[2, (u"冬冬Billy", "f6449dd703d66cf2be5274f321416958", "31c47db4cd79e43a9196871a554d0847")],
[2, (u"新潮-独", "e17cec5e79cd81704aa4b73d15caf639", "983582e2b4b880cc35caa7ac38ce3449")],
[2, (u"移动互联2", "6193a010668f5dcc106e671babf4fbe1", "605e4449590b2c3d96d34b049f96fdbd")],
[3, (u"田田July", "032ec596fa363aa9bd3e5e5917f6aea4", "9e0c243fa3ff3515765510ba4010c411")],
[3, (u"网游2", "743700d7ec385d0b740ecc9a4ef519d4", "b89c6d406e235ab3c49ccea1d82b5622")],
[4, (u"田田Lily", "3ef7fc951a66918dd1cd722485fe1686", "74f524fe376ce995703e73e63407684f")],
[4, (u"电子商务临2", "669001d16b1641a2138d529b435eaefb", "13f58a73995fd2b80bc0aa875ad363f0")],
[5, (u"小朱Linda", "0c10534f393fe08451edb140e3b1150d", "423fd333a2542dbf6e2a38119a6e7e04")],
[5, (u"软件电信2", "f577ad7699dc1a74330bc41329c2ce71", "20cc173dbb46a6784588767e71de03ef")],
[6, (u"小王trueman", "1f8f7db82cdbc346a91840cef2bc1cb9", "a16ead9ee3b6b3f43e601de127275ddc")],
[6, (u"新媒体2", "fc565ccfa32bdb962becc8d49a5a37d3", "8504469c6cad83cde0998299aca8b2fa")],
[7, (u"小毕Simon", "4151efe34301f5fddb9d34fc72e5f4a4", "dc4a07e8b7936d688726604a7442e4bc")],
[7, (u"风投2", "b14cbaaae5e46079770ea77feeaa0c91", "2dd7a1e5bb6036d69b2c983aa3f2a682")],
[8, (u"小黄Lily", "8ee871ac7d18e0141b54077fefd58af6", "dc5cda5a9a4ab5c5a5cd53f85f1f7915")],
[8, (u"外企名企2", "6712203ce54da88930f72014a0ef90bd", "d97779c02d60cacbabd0c398cb8acd93")],
]
| ajibawa-2023/Python-Code-Large/train/row_140 | 2 | 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_140:Assign_L4_C0", "label": "catelist =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.2656, 0.3125, 0, 0.66, 0.0, 219, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "catelist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "catelist = [\n (1, u\"\u4f20\u7edf\u7f51\u7edcInternet\"),\n (2, u\"\u79fb\u52a8\u4e92\u8054\"),\n (3, u\"\u7f51\u6e38\"),\n (4, u\"\u7535\u5b50\u5546\u52a1_B2C/\u56e2\u8d2d\"),\n (5, u\"\u8f6f\u4ef6\u3001\u7535\u4fe1\"),\n (6, u\"\u65b0\u5a92\u4f53\"),\n (7, u\"\u98ce\u6295/\u6295\u884c\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_140:Assign_L14_C0", "label": "idlist =", "type": "assigned_variable", "loc": [14, 32], "level": 0, "parent": null, "vector": [14, 0, 0.7188, 0.5938, 0, 0.66, 1.0, 77, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "idlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "idlist = [\n [1, (u\"\u8d85\u8d85Sandy\", \"d11c25990634d0e486235f1b42a55f9f\", \"89859ba49065135017b894df5e5a9089\")],\n [1, (u\"\u4f20\u7edf\u7f51\u7edc2\", \"9257d982dcbc26d21fa4f0afb16a54be\", \"e99c1ae713e14edc3ec3abb7e2344be3\")],\n [2, (u\"\u51ac\u51acBilly\", \"f6449dd703d66cf2be5274f321416958\", \"31c47db4cd79e43a9196871a554d0847\")],\n [2, (u\"\u65b0\u6f6e-\u72ec\", \"e17cec5e79cd81704aa4b73d15caf639\", \"983582e2b4b880cc35caa7ac38ce3449\")],\n [2, (u\"\u79fb\u52a8\u4e92\u80542\", \"6193a010668f5dcc106e671babf4fbe1\", \"605e4449590b2c3d96d34b049f96fdbd\")],\n [3, (u\"\u7530\u7530July\", \"032ec596fa363aa9bd3e5e5917f6aea4\", \"9e0c243fa3ff3515765510ba4010c411\")],\n [3, (u\"\u7f51\u6e382\", \"743700d7ec385d0b740ecc9a4ef519d4\", \"b89c6d406e235ab3c49ccea1d82b5622\")],"}] | [] |
from pymining.segmenter import Segmenter
from pymining.configuration import Configuration
class detect:
def __init__(self):
self.cfg = Configuration.FromFile("pymining/conf/test.xml")
self.segmenter = Segmenter(self.cfg, "segmenter")
def Split(self, line):
wordList = self.segmenter.Split(line)
return wordList
| ajibawa-2023/Python-Code-Large/train/row_141 | 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_141:ImportFrom_L1_C0", "label": "from pymining.segmenter import Segmenter", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "pymining.segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pymining.segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:ImportFrom_L2_C0", "label": "from pymining.configuration import Configuration", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.5, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "pymining.configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pymining.configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "label": "detect", "type": "class", "loc": [4, 11], "level": 0, "parent": null, "vector": [3, 0, 0.6818, 0.7273, 0, 0.66, 1.0, 654, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "detect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class detect:\n def __init__(self):\n self.cfg = Configuration.FromFile(\"pymining/conf/test.xml\")\n self.segmenter = Segmenter(self.cfg, \"segmenter\")\n\n def Split(self, line):\n wordList = self.segmenter.Split(line)\n return wordList"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "label": "__init__", "type": "function", "loc": [5, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "vector": [2, 1, 0.5455, 0.2727, 1, 0.16, 0.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.cfg = Configuration.FromFile(\"pymining/conf/test.xml\")\n self.segmenter = Segmenter(self.cfg, \"segmenter\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L6_C8", "label": "self.cfg = FromFile()", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "vector": [14, 2, 0.5455, 0.0909, 2, 0.17, 0.0, 845, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "self.cfg", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " self.cfg = Configuration.FromFile(\"pymining/conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L7_C8", "label": "self.segmenter = Segmenter()", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "vector": [14, 2, 0.6364, 0.0909, 2, 0.17, 1.0, 300, 3, 2, 0, 0, 461, 10, 1], "semantic": {"name": "self.segmenter", "arg_names": [], "import_names": [], "rhs_call_name": "Segmenter", "annotation": ""}, "snippet": " self.segmenter = Segmenter(self.cfg, \"segmenter\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4", "label": "Split", "type": "function", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "vector": [2, 1, 0.9091, 0.2727, 1, 0.16, 1.0, 551, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "Split", "arg_names": ["self", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Split(self, line):\n wordList = self.segmenter.Split(line)\n return wordList"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L10_C8", "label": "wordList = Split()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4", "vector": [14, 2, 0.9091, 0.0909, 2, 0.01, 0.0, 49, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " wordList = self.segmenter.Split(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_141:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4", "vector": [13, 2, 1.0, 0.0909, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordList"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_141:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_141:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_141:Return_L11_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
class WeibopError(Exception):
"""Weibopy exception"""
def __init__(self, reason):
self.reason = reason.encode('utf-8')
def __str__(self):
return self.reason
| ajibawa-2023/Python-Code-Large/train/row_143 | 6 | 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_143:ClassDef_L5_C0", "label": "WeibopError", "type": "class", "loc": [5, 12], "level": 0, "parent": null, "vector": [3, 0, 0.6538, 0.6154, 0, 0.66, 0.0, 305, 0, 2, 0, 0, 645, 0, 1], "semantic": {"name": "WeibopError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WeibopError(Exception):\n \"\"\"Weibopy exception\"\"\"\n\n def __init__(self, reason):\n self.reason = reason.encode('utf-8')\n\n def __str__(self):\n return self.reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_143:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "vector": [8, 1, 0.4615, 0.0769, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Weibopy exception\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "vector": [2, 1, 0.6538, 0.1538, 1, 0.25, 0.5, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "reason"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, reason):\n self.reason = reason.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_143:Assign_L9_C8", "label": "self.reason = encode()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L8_C4", "vector": [14, 2, 0.6923, 0.0769, 2, 0.94, 0.0, 831, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "self.reason", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " self.reason = reason.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L11_C4", "label": "__str__", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "vector": [2, 1, 0.8846, 0.1538, 1, 0.25, 1.0, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_143:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L11_C4", "vector": [13, 2, 0.9231, 0.0769, 2, 0.19, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.reason"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_143:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_143:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_143:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_143:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_143:Return_L12_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \
parse_search_datetime, unescape_html
class ResultSet(list):
"""A list like object that holds results from a Twitter API query."""
class Model(object):
def __init__(self, api=None):
self._api = api
def __getstate__(self):
# pickle
pickle = dict(self.__dict__)
del pickle['_api'] # do not pickle the API reference
return pickle
@classmethod
def parse(cls, api, json):
"""Parse a JSON object into a model instance."""
raise NotImplementedError
@classmethod
def parse_list(cls, api, json_list):
"""Parse a list of JSON objects into a result set of model instances."""
results = ResultSet()
for obj in json_list:
results.append(cls.parse(api, obj))
return results
class Status(Model):
@classmethod
def parse(cls, api, json):
status = cls(api)
for k, v in json.items():
if k == 'user':
user = User.parse(api, v)
setattr(status, 'author', user)
setattr(status, 'user', user) # DEPRECIATED
elif k == 'screen_name':
setattr(status, k, v)
elif k == 'created_at':
setattr(status, k, parse_datetime(v))
elif k == 'source':
if '<' in v:
setattr(status, k, parse_html_value(v))
setattr(status, 'source_url', parse_a_href(v))
else:
setattr(status, k, v)
elif k == 'retweeted_status':
setattr(status, k, User.parse(api, v))
elif k == 'geo':
setattr(status, k, Geo.parse(api, v))
else:
setattr(status, k, v)
return status
def destroy(self):
return self._api.destroy_status(self.id)
def retweet(self):
return self._api.retweet(self.id)
def retweets(self):
return self._api.retweets(self.id)
def favorite(self):
return self._api.create_favorite(self.id)
class Geo(Model):
@classmethod
def parse(cls, api, json):
geo = cls(api)
if json is not None:
for k, v in json.items():
setattr(geo, k, v)
return geo
class Comments(Model):
@classmethod
def parse(cls, api, json):
comments = cls(api)
for k, v in json.items():
if k == 'user':
user = User.parse(api, v)
setattr(comments, 'author', user)
setattr(comments, 'user', user)
elif k == 'status':
status = Status.parse(api, v)
setattr(comments, 'user', status)
elif k == 'created_at':
setattr(comments, k, parse_datetime(v))
elif k == 'reply_comment':
setattr(comments, k, User.parse(api, v))
else:
setattr(comments, k, v)
return comments
def destroy(self):
return self._api.destroy_status(self.id)
def retweet(self):
return self._api.retweet(self.id)
def retweets(self):
return self._api.retweets(self.id)
def favorite(self):
return self._api.create_favorite(self.id)
class User(Model):
@classmethod
def parse(cls, api, json):
user = cls(api)
for k, v in json.items():
if k == 'created_at':
setattr(user, k, parse_datetime(v))
elif k == 'status':
setattr(user, k, Status.parse(api, v))
elif k == 'screen_name':
setattr(user, k, v)
elif k == 'following':
# twitter sets this to null if it is false
if v is True:
setattr(user, k, True)
else:
setattr(user, k, False)
else:
setattr(user, k, v)
return user
@classmethod
def parse_list(cls, api, json_list):
if isinstance(json_list, list):
item_list = json_list
else:
item_list = json_list['users']
results = ResultSet()
for obj in item_list:
results.append(cls.parse(api, obj))
return results
def timeline(self, **kargs):
return self._api.user_timeline(user_id=self.id, **kargs)
def friends(self, **kargs):
return self._api.friends(user_id=self.id, **kargs)
def followers(self, **kargs):
return self._api.followers(user_id=self.id, **kargs)
def follow(self):
self._api.create_friendship(user_id=self.id)
self.following = True
def unfollow(self):
self._api.destroy_friendship(user_id=self.id)
self.following = False
def lists_memberships(self, *args, **kargs):
return self._api.lists_memberships(user=self.screen_name, *args, **kargs)
def lists_subscriptions(self, *args, **kargs):
return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs)
def lists(self, *args, **kargs):
return self._api.lists(user=self.screen_name, *args, **kargs)
def followers_ids(self, *args, **kargs):
return self._api.followers_ids(user_id=self.id, *args, **kargs)
class DirectMessage(Model):
@classmethod
def parse(cls, api, json):
dm = cls(api)
for k, v in json.items():
if k == 'sender' or k == 'recipient':
setattr(dm, k, User.parse(api, v))
elif k == 'created_at':
setattr(dm, k, parse_datetime(v))
else:
setattr(dm, k, v)
return dm
class Friendship(Model):
@classmethod
def parse(cls, api, json):
source = cls(api)
for k, v in json['source'].items():
setattr(source, k, v)
# parse target
target = cls(api)
for k, v in json['target'].items():
setattr(target, k, v)
return source, target
class SavedSearch(Model):
@classmethod
def parse(cls, api, json):
ss = cls(api)
for k, v in json.items():
if k == 'created_at':
setattr(ss, k, parse_datetime(v))
else:
setattr(ss, k, v)
return ss
def destroy(self):
return self._api.destroy_saved_search(self.id)
class SearchResult(Model):
@classmethod
def parse(cls, api, json):
result = cls()
for k, v in json.items():
if k == 'created_at':
setattr(result, k, parse_search_datetime(v))
elif k == 'source':
setattr(result, k, parse_html_value(unescape_html(v)))
else:
setattr(result, k, v)
return result
@classmethod
def parse_list(cls, api, json_list, result_set=None):
results = ResultSet()
results.max_id = json_list.get('max_id')
results.since_id = json_list.get('since_id')
results.refresh_url = json_list.get('refresh_url')
results.next_page = json_list.get('next_page')
results.results_per_page = json_list.get('results_per_page')
results.page = json_list.get('page')
results.completed_in = json_list.get('completed_in')
results.query = json_list.get('query')
for obj in json_list['results']:
results.append(cls.parse(api, obj))
return results
class List(Model):
@classmethod
def parse(cls, api, json):
lst = List(api)
for k,v in json.items():
if k == 'user':
setattr(lst, k, User.parse(api, v))
else:
setattr(lst, k, v)
return lst
@classmethod
def parse_list(cls, api, json_list, result_set=None):
results = ResultSet()
for obj in json_list['lists']:
results.append(cls.parse(api, obj))
return results
def update(self, **kargs):
return self._api.update_list(self.slug, **kargs)
def destroy(self):
return self._api.destroy_list(self.slug)
def timeline(self, **kargs):
return self._api.list_timeline(self.user.screen_name, self.slug, **kargs)
def add_member(self, id):
return self._api.add_list_member(self.slug, id)
def remove_member(self, id):
return self._api.remove_list_member(self.slug, id)
def members(self, **kargs):
return self._api.list_members(self.user.screen_name, self.slug, **kargs)
def is_member(self, id):
return self._api.is_list_member(self.user.screen_name, self.slug, id)
def subscribe(self):
return self._api.subscribe_list(self.user.screen_name, self.slug)
def unsubscribe(self):
return self._api.unsubscribe_list(self.user.screen_name, self.slug)
def subscribers(self, **kargs):
return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs)
def is_subscribed(self, id):
return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)
class JSONModel(Model):
@classmethod
def parse(cls, api, json):
lst = JSONModel(api)
for k,v in json.items():
setattr(lst, k, v)
return lst
class IDSModel(Model):
@classmethod
def parse(cls, api, json):
ids = IDSModel(api)
for k, v in json.items():
setattr(ids, k, v)
return ids
class Counts(Model):
@classmethod
def parse(cls, api, json):
ids = Counts(api)
for k, v in json.items():
setattr(ids, k, v)
return ids
class ModelFactory(object):
"""
Used by parsers for creating instances
of models. You may subclass this factory
to add your own extended models.
"""
status = Status
comments = Comments
user = User
direct_message = DirectMessage
friendship = Friendship
saved_search = SavedSearch
search_result = SearchResult
list = List
json = JSONModel
ids_list = IDSModel
counts = Counts
| ajibawa-2023/Python-Code-Large/train/row_144 | 242 | 355 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_144:ImportFrom_L5_C0", "label": "from weibopy.utils import parse_datetime, parse_html_value, parse_a_href\u2026", "type": "import", "loc": [5, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0155, 0.0056, 0, 0.66, 0.0, 478, 0, 5, 0, 0, 478, 0, 0], "semantic": {"name": "weibopy.utils", "arg_names": [], "import_names": ["parse_datetime", "parse_html_value", "parse_a_href", "parse_search_datetime", "unescape_html"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \\\n parse_search_datetime, unescape_html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L8_C0", "label": "ResultSet", "type": "class", "loc": [8, 9], "level": 0, "parent": null, "vector": [3, 0, 0.0239, 0.0056, 0, 0.66, 0.0667, 885, 0, 0, 0, 0, 430, 0, 0], "semantic": {"name": "ResultSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ResultSet(list):\n \"\"\"A list like object that holds results from a Twitter API query.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L8_C0", "vector": [8, 1, 0.0254, 0.0028, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A list like object that holds results from a Twitter API query.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "label": "Model", "type": "class", "loc": [12, 34], "level": 0, "parent": null, "vector": [3, 0, 0.0648, 0.0648, 0, 0.66, 0.1333, 929, 0, 4, 0, 0, 186, 0, 4], "semantic": {"name": "Model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Model(object):\n\n def __init__(self, api=None):\n self._api = api\n\n def __getstate__(self):\n # pickle\n pickle = dict(self.__dict__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "vector": [2, 1, 0.0408, 0.0056, 1, 0.64, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "api"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, api=None):\n self._api = api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L15_C8", "label": "self._api =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L14_C4", "vector": [14, 2, 0.0423, 0.0028, 2, 0.34, 0.0, 806, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._api", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._api = api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4", "label": "__getstate__", "type": "function", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "vector": [2, 1, 0.0535, 0.0141, 1, 0.64, 0.3333, 250, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n # pickle\n pickle = dict(self.__dict__)\n del pickle['_api'] # do not pickle the API reference\n return pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L19_C8", "label": "pickle = dict()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4", "vector": [14, 2, 0.0535, 0.0028, 2, 0.51, 0.0, 848, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " pickle = dict(self.__dict__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L21_C8", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4", "vector": [13, 2, 0.0592, 0.0028, 2, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L24_C4", "label": "parse", "type": "function", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "vector": [2, 1, 0.0704, 0.0085, 1, 0.64, 0.6667, 678, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n \"\"\"Parse a JSON object into a model instance.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L25_C8", "label": "expression", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L24_C4", "vector": [8, 2, 0.0704, 0.0028, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse a JSON object into a model instance.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "label": "parse_list", "type": "function", "loc": [29, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "vector": [2, 1, 0.0887, 0.0169, 1, 0.64, 1.0, 887, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list):\n \"\"\"Parse a list of JSON objects into a result set of model instances.\"\"\"\n results = ResultSet()\n for obj in json_list:\n results.append(cls.parse(api, obj))\n return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L30_C8", "label": "expression", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "vector": [8, 2, 0.0845, 0.0028, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse a list of JSON objects into a result set of model instances.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L31_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "vector": [14, 2, 0.0873, 0.0028, 2, 0.63, 0.3333, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L32_C8", "label": "for obj", "type": "for", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "vector": [6, 2, 0.0915, 0.0056, 2, 0.63, 0.6667, 505, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L33_C12", "label": "append()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L32_C8", "vector": [8, 3, 0.093, 0.0028, 3, 0.52, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "vector": [13, 2, 0.0958, 0.0028, 2, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "label": "Status", "type": "class", "loc": [37, 75], "level": 0, "parent": null, "vector": [3, 0, 0.1577, 0.1099, 0, 0.66, 0.2, 820, 0, 5, 0, 0, 929, 0, 22], "semantic": {"name": "Status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Status(Model):\n\n @classmethod\n def parse(cls, api, json):\n status = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "label": "parse", "type": "function", "loc": [40, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "vector": [2, 1, 0.1451, 0.0676, 1, 0.35, 0.0, 678, 0, 3, 1, 0, 0, 0, 18], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n status = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L41_C8", "label": "status = cls()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "vector": [14, 2, 0.1155, 0.0028, 2, 0.43, 0.0, 699, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " status = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L42_C8", "label": "for k, v", "type": "for", "loc": [42, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "vector": [6, 2, 0.1465, 0.0592, 2, 0.43, 0.5, 867, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "label": "if", "type": "if", "loc": [43, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L42_C8", "vector": [4, 3, 0.1479, 0.0563, 3, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':\n setattr(status, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L44_C16", "label": "user = parse()", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "vector": [14, 4, 0.1239, 0.0028, 4, 0.31, 0.0, 503, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L45_C16", "label": "setattr()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "vector": [8, 4, 0.1268, 0.0028, 4, 0.31, 0.3333, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'author', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L46_C16", "label": "setattr()", "type": "expression", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "vector": [8, 4, 0.1296, 0.0028, 4, 0.31, 0.6667, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'user', user) # DEPRECIATED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12", "label": "if", "type": "if", "loc": [47, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "vector": [4, 4, 0.1535, 0.0451, 4, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':\n setattr(status, k, parse_datetime(v))\n elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L48_C16", "label": "setattr()", "type": "expression", "loc": [48, 48], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12", "vector": [8, 5, 0.1352, 0.0028, 5, 0.98, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12", "label": "if", "type": "if", "loc": [49, 62], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12", "vector": [4, 5, 0.1563, 0.0394, 5, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(status, k, parse_datetime(v))\n elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L50_C16", "label": "setattr()", "type": "expression", "loc": [50, 50], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12", "vector": [8, 6, 0.1408, 0.0028, 6, 0.58, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12", "label": "if", "type": "if", "loc": [51, 62], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12", "vector": [4, 6, 0.1592, 0.0338, 6, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)\n elif k == 'retweeted_status':\n setattr(status, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "label": "if", "type": "if", "loc": [52, 56], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12", "vector": [4, 7, 0.1521, 0.0141, 7, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L53_C20", "label": "setattr()", "type": "expression", "loc": [53, 53], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "vector": [8, 8, 0.1493, 0.0028, 8, 0.31, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, parse_html_value(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L54_C20", "label": "setattr()", "type": "expression", "loc": [54, 54], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "vector": [8, 8, 0.1521, 0.0028, 8, 0.31, 0.5, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'source_url', parse_a_href(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L56_C20", "label": "setattr()", "type": "expression", "loc": [56, 56], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "vector": [8, 8, 0.1577, 0.0028, 8, 0.31, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12", "label": "if", "type": "if", "loc": [57, 62], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12", "vector": [4, 7, 0.1676, 0.0169, 7, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'retweeted_status':\n setattr(status, k, User.parse(api, v))\n elif k == 'geo':\n setattr(status, k, Geo.parse(api, v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L58_C16", "label": "setattr()", "type": "expression", "loc": [58, 58], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12", "vector": [8, 8, 0.1634, 0.0028, 8, 0.19, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12", "label": "if", "type": "if", "loc": [59, 62], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12", "vector": [4, 8, 0.1704, 0.0113, 8, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'geo':\n setattr(status, k, Geo.parse(api, v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L60_C16", "label": "setattr()", "type": "expression", "loc": [60, 60], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12", "vector": [8, 9, 0.169, 0.0028, 9, 0.22, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, Geo.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L62_C16", "label": "setattr()", "type": "expression", "loc": [62, 62], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12", "vector": [8, 9, 0.1746, 0.0028, 9, 0.22, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "vector": [13, 2, 0.1775, 0.0028, 2, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L65_C4", "label": "destroy", "type": "function", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "vector": [2, 1, 0.1845, 0.0056, 1, 0.35, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L65_C4", "vector": [13, 2, 0.1859, 0.0028, 2, 0.07, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L68_C4", "label": "retweet", "type": "function", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "vector": [2, 1, 0.193, 0.0056, 1, 0.35, 0.5, 313, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweet(self):\n return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L68_C4", "vector": [13, 2, 0.1944, 0.0028, 2, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L71_C4", "label": "retweets", "type": "function", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "vector": [2, 1, 0.2014, 0.0056, 1, 0.35, 0.75, 728, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweets(self):\n return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L72_C8", "label": "return", "type": "return", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L71_C4", "vector": [13, 2, 0.2028, 0.0028, 2, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L74_C4", "label": "favorite", "type": "function", "loc": [74, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "vector": [2, 1, 0.2099, 0.0056, 1, 0.35, 1.0, 918, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "favorite", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def favorite(self):\n return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L74_C4", "vector": [13, 2, 0.2113, 0.0028, 2, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L76_C0", "label": "Geo", "type": "class", "loc": [76, 84], "level": 0, "parent": null, "vector": [3, 0, 0.2254, 0.0254, 0, 0.66, 0.2667, 734, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "Geo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Geo(Model):\n\n @classmethod\n def parse(cls, api, json):\n geo = cls(api)\n if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "label": "parse", "type": "function", "loc": [79, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L76_C0", "vector": [2, 1, 0.2296, 0.0169, 1, 0.02, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n geo = cls(api)\n if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)\n return geo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L80_C8", "label": "geo = cls()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "vector": [14, 2, 0.2254, 0.0028, 2, 0.24, 0.0, 579, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "geo", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " geo = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L81_C8", "label": "if", "type": "if", "loc": [81, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "vector": [4, 2, 0.231, 0.0085, 2, 0.24, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L82_C12", "label": "for k, v", "type": "for", "loc": [82, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L81_C8", "vector": [6, 3, 0.2324, 0.0056, 3, 0.6, 0.0, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L83_C16", "label": "setattr()", "type": "expression", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L82_C12", "vector": [8, 4, 0.2338, 0.0028, 4, 0.26, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "vector": [13, 2, 0.2366, 0.0028, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "label": "Comments", "type": "class", "loc": [86, 117], "level": 0, "parent": null, "vector": [3, 0, 0.2859, 0.0901, 0, 0.66, 0.3333, 483, 0, 5, 0, 0, 929, 0, 16], "semantic": {"name": "Comments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Comments(Model):\n\n @classmethod\n def parse(cls, api, json):\n comments = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "label": "parse", "type": "function", "loc": [89, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "vector": [2, 1, 0.2732, 0.0479, 1, 0.17, 0.0, 678, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n comments = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L90_C8", "label": "comments = cls()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "vector": [14, 2, 0.2535, 0.0028, 2, 0.84, 0.0, 122, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " comments = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L91_C8", "label": "for k, v", "type": "for", "loc": [91, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "vector": [6, 2, 0.2746, 0.0394, 2, 0.84, 0.5, 867, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "label": "if", "type": "if", "loc": [92, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L91_C8", "vector": [4, 3, 0.2761, 0.0366, 3, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L93_C16", "label": "user = parse()", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "vector": [14, 4, 0.262, 0.0028, 4, 0.73, 0.0, 503, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L94_C16", "label": "setattr()", "type": "expression", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "vector": [8, 4, 0.2648, 0.0028, 4, 0.73, 0.3333, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'author', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L95_C16", "label": "setattr()", "type": "expression", "loc": [95, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "vector": [8, 4, 0.2676, 0.0028, 4, 0.73, 0.6667, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'user', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "label": "if", "type": "if", "loc": [96, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "vector": [4, 4, 0.2817, 0.0254, 4, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)\n elif k == 'created_at':\n setattr(comments, k, parse_datetime(v))\n elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L97_C16", "label": "status = parse()", "type": "assigned_variable", "loc": [97, 97], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "vector": [14, 5, 0.2732, 0.0028, 5, 0.43, 0.0, 699, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " status = Status.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L98_C16", "label": "setattr()", "type": "expression", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "vector": [8, 5, 0.2761, 0.0028, 5, 0.43, 0.5, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'user', status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12", "label": "if", "type": "if", "loc": [99, 104], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "vector": [4, 5, 0.2859, 0.0169, 5, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(comments, k, parse_datetime(v))\n elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:\n setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L100_C16", "label": "setattr()", "type": "expression", "loc": [100, 100], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12", "vector": [8, 6, 0.2817, 0.0028, 6, 0.8, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12", "label": "if", "type": "if", "loc": [101, 104], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12", "vector": [4, 6, 0.2887, 0.0113, 6, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:\n setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L102_C16", "label": "setattr()", "type": "expression", "loc": [102, 102], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12", "vector": [8, 7, 0.2873, 0.0028, 7, 0.1, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L104_C16", "label": "setattr()", "type": "expression", "loc": [104, 104], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12", "vector": [8, 7, 0.293, 0.0028, 7, 0.1, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L105_C8", "label": "return", "type": "return", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "vector": [13, 2, 0.2958, 0.0028, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return comments"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L107_C4", "label": "destroy", "type": "function", "loc": [107, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "vector": [2, 1, 0.3028, 0.0056, 1, 0.17, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L108_C8", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L107_C4", "vector": [13, 2, 0.3042, 0.0028, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L110_C4", "label": "retweet", "type": "function", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "vector": [2, 1, 0.3113, 0.0056, 1, 0.17, 0.5, 313, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweet(self):\n return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L111_C8", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L110_C4", "vector": [13, 2, 0.3127, 0.0028, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L113_C4", "label": "retweets", "type": "function", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "vector": [2, 1, 0.3197, 0.0056, 1, 0.17, 0.75, 728, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweets(self):\n return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L113_C4", "vector": [13, 2, 0.3211, 0.0028, 2, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L116_C4", "label": "favorite", "type": "function", "loc": [116, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "vector": [2, 1, 0.3282, 0.0056, 1, 0.17, 1.0, 918, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "favorite", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def favorite(self):\n return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L116_C4", "vector": [13, 2, 0.3296, 0.0028, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "label": "User", "type": "class", "loc": [119, 180], "level": 0, "parent": null, "vector": [3, 0, 0.4211, 0.1746, 0, 0.66, 0.4, 61, 0, 11, 0, 0, 929, 0, 23], "semantic": {"name": "User", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class User(Model):\n\n @classmethod\n def parse(cls, api, json):\n user = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "label": "parse", "type": "function", "loc": [122, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.3676, 0.0507, 1, 0.46, 0.0, 678, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n user = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L123_C8", "label": "user = cls()", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "vector": [14, 2, 0.3465, 0.0028, 2, 0.05, 0.0, 503, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " user = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L124_C8", "label": "for k, v", "type": "for", "loc": [124, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "vector": [6, 2, 0.369, 0.0423, 2, 0.05, 0.5, 867, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12", "label": "if", "type": "if", "loc": [125, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L124_C8", "vector": [4, 3, 0.3704, 0.0394, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L126_C16", "label": "setattr()", "type": "expression", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12", "vector": [8, 4, 0.3549, 0.0028, 4, 0.74, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12", "label": "if", "type": "if", "loc": [127, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12", "vector": [4, 4, 0.3732, 0.0338, 4, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L128_C16", "label": "setattr()", "type": "expression", "loc": [128, 128], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12", "vector": [8, 5, 0.3606, 0.0028, 5, 0.95, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, Status.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12", "label": "if", "type": "if", "loc": [129, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12", "vector": [4, 5, 0.3761, 0.0282, 5, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L130_C16", "label": "setattr()", "type": "expression", "loc": [130, 130], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12", "vector": [8, 6, 0.3662, 0.0028, 6, 0.65, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12", "label": "if", "type": "if", "loc": [131, 138], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12", "vector": [4, 6, 0.3789, 0.0225, 6, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)\n else:\n setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16", "label": "if", "type": "if", "loc": [133, 136], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12", "vector": [4, 7, 0.3789, 0.0113, 7, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L134_C20", "label": "setattr()", "type": "expression", "loc": [134, 134], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16", "vector": [8, 8, 0.3775, 0.0028, 8, 0.59, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L136_C20", "label": "setattr()", "type": "expression", "loc": [136, 136], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16", "vector": [8, 8, 0.3831, 0.0028, 8, 0.59, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L138_C16", "label": "setattr()", "type": "expression", "loc": [138, 138], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12", "vector": [8, 7, 0.3887, 0.0028, 7, 0.63, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "vector": [13, 2, 0.3915, 0.0028, 2, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "label": "parse_list", "type": "function", "loc": [142, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4127, 0.0282, 1, 0.46, 0.1, 887, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list):\n if isinstance(json_list, list):\n item_list = json_list\n else:\n item_list = json_list['users']\n\n results = ResultSet()\n for obj in item_list:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8", "label": "if", "type": "if", "loc": [143, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "vector": [4, 2, 0.407, 0.0113, 2, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(json_list, list):\n item_list = json_list\n else:\n item_list = json_list['users']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L144_C12", "label": "item_list =", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8", "vector": [14, 3, 0.4056, 0.0028, 3, 0.3, 0.0, 839, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_list = json_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L146_C12", "label": "item_list =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8", "vector": [14, 3, 0.4113, 0.0028, 3, 0.3, 1.0, 839, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_list = json_list['users']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L148_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "vector": [14, 2, 0.4169, 0.0028, 2, 0.65, 0.3333, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L149_C8", "label": "for obj", "type": "for", "loc": [149, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "vector": [6, 2, 0.4211, 0.0056, 2, 0.65, 0.6667, 505, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in item_list:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L150_C12", "label": "append()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L149_C8", "vector": [8, 3, 0.4225, 0.0028, 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": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L151_C8", "label": "return", "type": "return", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "vector": [13, 2, 0.4254, 0.0028, 2, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L153_C4", "label": "timeline", "type": "function", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4324, 0.0056, 1, 0.46, 0.2, 147, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "timeline", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def timeline(self, **kargs):\n return self._api.user_timeline(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L153_C4", "vector": [13, 2, 0.4338, 0.0028, 2, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.user_timeline(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L156_C4", "label": "friends", "type": "function", "loc": [156, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4408, 0.0056, 1, 0.46, 0.3, 875, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "friends", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def friends(self, **kargs):\n return self._api.friends(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L156_C4", "vector": [13, 2, 0.4423, 0.0028, 2, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.friends(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L159_C4", "label": "followers", "type": "function", "loc": [159, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4493, 0.0056, 1, 0.46, 0.4, 530, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "followers", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def followers(self, **kargs):\n return self._api.followers(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L159_C4", "vector": [13, 2, 0.4507, 0.0028, 2, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.followers(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4", "label": "follow", "type": "function", "loc": [162, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4592, 0.0085, 1, 0.46, 0.5, 392, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "follow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def follow(self):\n self._api.create_friendship(user_id=self.id)\n self.following = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L163_C8", "label": "create_friendship()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4", "vector": [8, 2, 0.4592, 0.0028, 2, 0.04, 0.0, 536, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "create_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "create_friendship", "annotation": ""}, "snippet": " self._api.create_friendship(user_id=self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L164_C8", "label": "self.following =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4", "vector": [14, 2, 0.462, 0.0028, 2, 0.04, 1.0, 596, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.following", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.following = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4", "label": "unfollow", "type": "function", "loc": [166, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4704, 0.0085, 1, 0.46, 0.6, 515, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unfollow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unfollow(self):\n self._api.destroy_friendship(user_id=self.id)\n self.following = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L167_C8", "label": "destroy_friendship()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4", "vector": [8, 2, 0.4704, 0.0028, 2, 0.69, 0.0, 506, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_friendship", "annotation": ""}, "snippet": " self._api.destroy_friendship(user_id=self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L168_C8", "label": "self.following =", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4", "vector": [14, 2, 0.4732, 0.0028, 2, 0.69, 1.0, 596, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.following", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.following = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L170_C4", "label": "lists_memberships", "type": "function", "loc": [170, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4803, 0.0056, 1, 0.46, 0.7, 262, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists_memberships", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists_memberships(self, *args, **kargs):\n return self._api.lists_memberships(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L171_C8", "label": "return", "type": "return", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L170_C4", "vector": [13, 2, 0.4817, 0.0028, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists_memberships(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L173_C4", "label": "lists_subscriptions", "type": "function", "loc": [173, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4887, 0.0056, 1, 0.46, 0.8, 33, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists_subscriptions", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists_subscriptions(self, *args, **kargs):\n return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L173_C4", "vector": [13, 2, 0.4901, 0.0028, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L176_C4", "label": "lists", "type": "function", "loc": [176, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.4972, 0.0056, 1, 0.46, 0.9, 194, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists(self, *args, **kargs):\n return self._api.lists(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L177_C8", "label": "return", "type": "return", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L176_C4", "vector": [13, 2, 0.4986, 0.0028, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L179_C4", "label": "followers_ids", "type": "function", "loc": [179, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "vector": [2, 1, 0.5056, 0.0056, 1, 0.46, 1.0, 328, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "followers_ids", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def followers_ids(self, *args, **kargs):\n return self._api.followers_ids(user_id=self.id, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L180_C8", "label": "return", "type": "return", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L179_C4", "vector": [13, 2, 0.507, 0.0028, 2, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.followers_ids(user_id=self.id, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L185_C0", "label": "DirectMessage", "type": "class", "loc": [185, 196], "level": 0, "parent": null, "vector": [3, 0, 0.5366, 0.0338, 0, 0.66, 0.4667, 693, 0, 1, 0, 0, 929, 0, 7], "semantic": {"name": "DirectMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DirectMessage(Model):\n @classmethod\n def parse(cls, api, json):\n dm = cls(api)\n for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "label": "parse", "type": "function", "loc": [187, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L185_C0", "vector": [2, 1, 0.5394, 0.0282, 1, 0.04, 0.0, 678, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n dm = cls(api)\n for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L188_C8", "label": "dm = cls()", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "vector": [14, 2, 0.5296, 0.0028, 2, 0.65, 0.0, 0, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "dm", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " dm = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L189_C8", "label": "for k, v", "type": "for", "loc": [189, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "vector": [6, 2, 0.5408, 0.0197, 2, 0.65, 0.5, 867, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12", "label": "if", "type": "if", "loc": [190, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L189_C8", "vector": [4, 3, 0.5423, 0.0169, 3, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L191_C16", "label": "setattr()", "type": "expression", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12", "vector": [8, 4, 0.538, 0.0028, 4, 0.56, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12", "label": "if", "type": "if", "loc": [192, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12", "vector": [4, 4, 0.5451, 0.0113, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L193_C16", "label": "setattr()", "type": "expression", "loc": [193, 193], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12", "vector": [8, 5, 0.5437, 0.0028, 5, 0.59, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L195_C16", "label": "setattr()", "type": "expression", "loc": [195, 195], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12", "vector": [8, 5, 0.5493, 0.0028, 5, 0.59, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L196_C8", "label": "return", "type": "return", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "vector": [13, 2, 0.5521, 0.0028, 2, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L198_C0", "label": "Friendship", "type": "class", "loc": [198, 212], "level": 0, "parent": null, "vector": [3, 0, 0.5775, 0.0423, 0, 0.66, 0.5333, 401, 0, 1, 0, 0, 929, 0, 6], "semantic": {"name": "Friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Friendship(Model):\n\n @classmethod\n def parse(cls, api, json):\n \n source = cls(api)\n for k, v in json['source'].items():\n setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "label": "parse", "type": "function", "loc": [201, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L198_C0", "vector": [2, 1, 0.5817, 0.0338, 1, 0.12, 0.0, 678, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n \n source = cls(api)\n for k, v in json['source'].items():\n setattr(source, k, v)\n\n # parse target\n target = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L203_C8", "label": "source = cls()", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "vector": [14, 2, 0.5718, 0.0028, 2, 0.5, 0.0, 703, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " source = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L204_C8", "label": "for k, v", "type": "for", "loc": [204, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "vector": [6, 2, 0.5761, 0.0056, 2, 0.5, 0.25, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json['source'].items():\n setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L205_C12", "label": "setattr()", "type": "expression", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L204_C8", "vector": [8, 3, 0.5775, 0.0028, 3, 0.24, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L208_C8", "label": "target = cls()", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "vector": [14, 2, 0.5859, 0.0028, 2, 0.5, 0.5, 766, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " target = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L209_C8", "label": "for k, v", "type": "for", "loc": [209, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "vector": [6, 2, 0.5901, 0.0056, 2, 0.5, 0.75, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json['target'].items():\n setattr(target, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L210_C12", "label": "setattr()", "type": "expression", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L209_C8", "vector": [8, 3, 0.5915, 0.0028, 3, 0.55, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(target, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L212_C8", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "vector": [13, 2, 0.5972, 0.0028, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return source, target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L215_C0", "label": "SavedSearch", "type": "class", "loc": [215, 228], "level": 0, "parent": null, "vector": [3, 0, 0.6239, 0.0394, 0, 0.66, 0.6, 895, 0, 2, 0, 0, 929, 0, 6], "semantic": {"name": "SavedSearch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SavedSearch(Model):\n\n @classmethod\n def parse(cls, api, json):\n ss = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "label": "parse", "type": "function", "loc": [218, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L215_C0", "vector": [2, 1, 0.6239, 0.0225, 1, 0.08, 0.0, 678, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ss = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)\n return ss"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L219_C8", "label": "ss = cls()", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "vector": [14, 2, 0.6169, 0.0028, 2, 0.75, 0.0, 582, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "ss", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " ss = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L220_C8", "label": "for k, v", "type": "for", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "vector": [6, 2, 0.6254, 0.0141, 2, 0.75, 0.5, 867, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12", "label": "if", "type": "if", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L220_C8", "vector": [4, 3, 0.6268, 0.0113, 3, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L222_C16", "label": "setattr()", "type": "expression", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12", "vector": [8, 4, 0.6254, 0.0028, 4, 0.87, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ss, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L224_C16", "label": "setattr()", "type": "expression", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12", "vector": [8, 4, 0.631, 0.0028, 4, 0.87, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "vector": [13, 2, 0.6338, 0.0028, 2, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ss"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L227_C4", "label": "destroy", "type": "function", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L215_C0", "vector": [2, 1, 0.6408, 0.0056, 1, 0.08, 1.0, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_saved_search(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L227_C4", "vector": [13, 2, 0.6423, 0.0028, 2, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_saved_search(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L231_C0", "label": "SearchResult", "type": "class", "loc": [231, 259], "level": 0, "parent": null, "vector": [3, 0, 0.6901, 0.0817, 0, 0.66, 0.6667, 821, 0, 2, 0, 0, 929, 0, 19], "semantic": {"name": "SearchResult", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SearchResult(Model):\n\n @classmethod\n def parse(cls, api, json):\n result = cls()\n for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "label": "parse", "type": "function", "loc": [234, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L231_C0", "vector": [2, 1, 0.6718, 0.0282, 1, 0.43, 0.0, 678, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n result = cls()\n for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L235_C8", "label": "result = cls()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "vector": [14, 2, 0.662, 0.0028, 2, 0.74, 0.0, 51, 3, 0, 0, 0, 594, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " result = cls()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L236_C8", "label": "for k, v", "type": "for", "loc": [236, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "vector": [6, 2, 0.6732, 0.0197, 2, 0.74, 0.5, 867, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12", "label": "if", "type": "if", "loc": [237, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L236_C8", "vector": [4, 3, 0.6746, 0.0169, 3, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L238_C16", "label": "setattr()", "type": "expression", "loc": [238, 238], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12", "vector": [8, 4, 0.6704, 0.0028, 4, 0.72, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, parse_search_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12", "label": "if", "type": "if", "loc": [239, 242], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12", "vector": [4, 4, 0.6775, 0.0113, 4, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L240_C16", "label": "setattr()", "type": "expression", "loc": [240, 240], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12", "vector": [8, 5, 0.6761, 0.0028, 5, 0.8, 0.0, 501, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, parse_html_value(unescape_html(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L242_C16", "label": "setattr()", "type": "expression", "loc": [242, 242], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12", "vector": [8, 5, 0.6817, 0.0028, 5, 0.8, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L243_C8", "label": "return", "type": "return", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "vector": [13, 2, 0.6845, 0.0028, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "label": "parse_list", "type": "function", "loc": [246, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L231_C0", "vector": [2, 1, 0.7113, 0.0394, 1, 0.43, 1.0, 887, 0, 4, 1, 0, 0, 0, 11], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list", "result_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list, result_set=None):\n results = ResultSet()\n results.max_id = json_list.get('max_id')\n results.since_id = json_list.get('since_id')\n results.refresh_url = json_list.get('refresh_url')\n results.next_page = json_list.get('next_page')\n results.results_per_page = json_list.get('results_per_page')\n results.page = json_list.get('page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L247_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.6958, 0.0028, 2, 0.84, 0.0, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L248_C8", "label": "results.max_id = get()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.6986, 0.0028, 2, 0.84, 0.1, 655, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.max_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.max_id = json_list.get('max_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L249_C8", "label": "results.since_id = get()", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7014, 0.0028, 2, 0.84, 0.2, 98, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.since_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.since_id = json_list.get('since_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L250_C8", "label": "results.refresh_url = get()", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7042, 0.0028, 2, 0.84, 0.3, 712, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.refresh_url", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.refresh_url = json_list.get('refresh_url')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L251_C8", "label": "results.next_page = get()", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.707, 0.0028, 2, 0.84, 0.4, 188, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.next_page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.next_page = json_list.get('next_page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L252_C8", "label": "results.results_per_page = get()", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7099, 0.0028, 2, 0.84, 0.5, 28, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.results_per_page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.results_per_page = json_list.get('results_per_page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L253_C8", "label": "results.page = get()", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7127, 0.0028, 2, 0.84, 0.6, 706, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.page = json_list.get('page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L254_C8", "label": "results.completed_in = get()", "type": "assigned_variable", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7155, 0.0028, 2, 0.84, 0.7, 445, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.completed_in", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.completed_in = json_list.get('completed_in')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L255_C8", "label": "results.query = get()", "type": "assigned_variable", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [14, 2, 0.7183, 0.0028, 2, 0.84, 0.8, 979, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.query", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.query = json_list.get('query')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L257_C8", "label": "for obj", "type": "for", "loc": [257, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [6, 2, 0.7254, 0.0056, 2, 0.84, 0.9, 505, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list['results']:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L258_C12", "label": "append()", "type": "expression", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L257_C8", "vector": [8, 3, 0.7268, 0.0028, 3, 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": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L259_C8", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "vector": [13, 2, 0.7296, 0.0028, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "label": "List", "type": "class", "loc": [261, 311], "level": 0, "parent": null, "vector": [3, 0, 0.8056, 0.1437, 0, 0.66, 0.7333, 24, 0, 13, 0, 0, 929, 0, 19], "semantic": {"name": "List", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class List(Model):\n\n @classmethod\n def parse(cls, api, json):\n lst = List(api)\n for k,v in json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "label": "parse", "type": "function", "loc": [264, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.7535, 0.0225, 1, 0.7, 0.0, 678, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n lst = List(api)\n for k,v in json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L265_C8", "label": "lst = List()", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "vector": [14, 2, 0.7465, 0.0028, 2, 0.57, 0.0, 564, 3, 1, 0, 0, 24, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "List", "annotation": ""}, "snippet": " lst = List(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L266_C8", "label": "for k, v", "type": "for", "loc": [266, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "vector": [6, 2, 0.7549, 0.0141, 2, 0.57, 0.5, 867, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12", "label": "if", "type": "if", "loc": [267, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L266_C8", "vector": [4, 3, 0.7563, 0.0113, 3, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L268_C16", "label": "setattr()", "type": "expression", "loc": [268, 268], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12", "vector": [8, 4, 0.7549, 0.0028, 4, 0.88, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L270_C16", "label": "setattr()", "type": "expression", "loc": [270, 270], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12", "vector": [8, 4, 0.7606, 0.0028, 4, 0.88, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "vector": [13, 2, 0.7634, 0.0028, 2, 0.57, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "label": "parse_list", "type": "function", "loc": [274, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.7775, 0.0141, 1, 0.7, 0.0833, 887, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list", "result_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list, result_set=None):\n results = ResultSet()\n for obj in json_list['lists']:\n results.append(cls.parse(api, obj))\n return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L275_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "vector": [14, 2, 0.7746, 0.0028, 2, 0.01, 0.0, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L276_C8", "label": "for obj", "type": "for", "loc": [276, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "vector": [6, 2, 0.7789, 0.0056, 2, 0.01, 0.5, 505, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list['lists']:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L277_C12", "label": "append()", "type": "expression", "loc": [277, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L276_C8", "vector": [8, 3, 0.7803, 0.0028, 3, 0.25, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L278_C8", "label": "return", "type": "return", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "vector": [13, 2, 0.7831, 0.0028, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L280_C4", "label": "update", "type": "function", "loc": [280, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.7901, 0.0056, 1, 0.7, 0.1667, 637, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, **kargs):\n return self._api.update_list(self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L281_C8", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L280_C4", "vector": [13, 2, 0.7915, 0.0028, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.update_list(self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L283_C4", "label": "destroy", "type": "function", "loc": [283, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.7986, 0.0056, 1, 0.7, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_list(self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L284_C8", "label": "return", "type": "return", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L283_C4", "vector": [13, 2, 0.8, 0.0028, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_list(self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L286_C4", "label": "timeline", "type": "function", "loc": [286, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.807, 0.0056, 1, 0.7, 0.3333, 147, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "timeline", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def timeline(self, **kargs):\n return self._api.list_timeline(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L287_C8", "label": "return", "type": "return", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L286_C4", "vector": [13, 2, 0.8085, 0.0028, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_timeline(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L289_C4", "label": "add_member", "type": "function", "loc": [289, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8155, 0.0056, 1, 0.7, 0.4167, 837, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_member(self, id):\n return self._api.add_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L290_C8", "label": "return", "type": "return", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L289_C4", "vector": [13, 2, 0.8169, 0.0028, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.add_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L292_C4", "label": "remove_member", "type": "function", "loc": [292, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8239, 0.0056, 1, 0.7, 0.5, 73, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "remove_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_member(self, id):\n return self._api.remove_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L293_C8", "label": "return", "type": "return", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L292_C4", "vector": [13, 2, 0.8254, 0.0028, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.remove_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L295_C4", "label": "members", "type": "function", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8324, 0.0056, 1, 0.7, 0.5833, 573, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "members", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def members(self, **kargs):\n return self._api.list_members(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L295_C4", "vector": [13, 2, 0.8338, 0.0028, 2, 0.29, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_members(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L298_C4", "label": "is_member", "type": "function", "loc": [298, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8408, 0.0056, 1, 0.7, 0.6667, 677, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "is_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_member(self, id):\n return self._api.is_list_member(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L299_C8", "label": "return", "type": "return", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L298_C4", "vector": [13, 2, 0.8423, 0.0028, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.is_list_member(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L301_C4", "label": "subscribe", "type": "function", "loc": [301, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8493, 0.0056, 1, 0.7, 0.75, 915, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "subscribe", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def subscribe(self):\n return self._api.subscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L302_C8", "label": "return", "type": "return", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L301_C4", "vector": [13, 2, 0.8507, 0.0028, 2, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.subscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L304_C4", "label": "unsubscribe", "type": "function", "loc": [304, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8577, 0.0056, 1, 0.7, 0.8333, 568, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "unsubscribe", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unsubscribe(self):\n return self._api.unsubscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L304_C4", "vector": [13, 2, 0.8592, 0.0028, 2, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.unsubscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L307_C4", "label": "subscribers", "type": "function", "loc": [307, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8662, 0.0056, 1, 0.7, 0.9167, 194, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "subscribers", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def subscribers(self, **kargs):\n return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L308_C8", "label": "return", "type": "return", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L307_C4", "vector": [13, 2, 0.8676, 0.0028, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L310_C4", "label": "is_subscribed", "type": "function", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "vector": [2, 1, 0.8746, 0.0056, 1, 0.7, 1.0, 863, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "is_subscribed", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_subscribed(self, id):\n return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L311_C8", "label": "return", "type": "return", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L310_C4", "vector": [13, 2, 0.8761, 0.0028, 2, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L313_C0", "label": "JSONModel", "type": "class", "loc": [313, 320], "level": 0, "parent": null, "vector": [3, 0, 0.8915, 0.0225, 0, 0.66, 0.8, 861, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "JSONModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONModel(Model):\n\n @classmethod\n def parse(cls, api, json):\n lst = JSONModel(api)\n for k,v in json.items():\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "label": "parse", "type": "function", "loc": [316, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L313_C0", "vector": [2, 1, 0.8958, 0.0141, 1, 0.44, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n lst = JSONModel(api)\n for k,v in json.items():\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L317_C8", "label": "lst = JSONModel()", "type": "assigned_variable", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "vector": [14, 2, 0.893, 0.0028, 2, 0.55, 0.0, 564, 3, 1, 0, 0, 861, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "JSONModel", "annotation": ""}, "snippet": " lst = JSONModel(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L318_C8", "label": "for k, v", "type": "for", "loc": [318, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "vector": [6, 2, 0.8972, 0.0056, 2, 0.55, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in json.items():\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L319_C12", "label": "setattr()", "type": "expression", "loc": [319, 319], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L318_C8", "vector": [8, 3, 0.8986, 0.0028, 3, 0.41, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L320_C8", "label": "return", "type": "return", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "vector": [13, 2, 0.9014, 0.0028, 2, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L322_C0", "label": "IDSModel", "type": "class", "loc": [322, 328], "level": 0, "parent": null, "vector": [3, 0, 0.9155, 0.0197, 0, 0.66, 0.8667, 955, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "IDSModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IDSModel(Model):\n @classmethod\n def parse(cls, api, json):\n ids = IDSModel(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "label": "parse", "type": "function", "loc": [324, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L322_C0", "vector": [2, 1, 0.9183, 0.0141, 1, 0.28, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ids = IDSModel(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L325_C8", "label": "ids = IDSModel()", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "vector": [14, 2, 0.9155, 0.0028, 2, 0.93, 0.0, 202, 3, 1, 0, 0, 955, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "IDSModel", "annotation": ""}, "snippet": " ids = IDSModel(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L326_C8", "label": "for k, v", "type": "for", "loc": [326, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "vector": [6, 2, 0.9197, 0.0056, 2, 0.93, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items(): \n setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L327_C12", "label": "setattr()", "type": "expression", "loc": [327, 327], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L326_C8", "vector": [8, 3, 0.9211, 0.0028, 3, 0.63, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L328_C8", "label": "return", "type": "return", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "vector": [13, 2, 0.9239, 0.0028, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L330_C0", "label": "Counts", "type": "class", "loc": [330, 336], "level": 0, "parent": null, "vector": [3, 0, 0.938, 0.0197, 0, 0.66, 0.9333, 731, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "Counts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Counts(Model):\n @classmethod\n def parse(cls, api, json):\n ids = Counts(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "label": "parse", "type": "function", "loc": [332, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L330_C0", "vector": [2, 1, 0.9408, 0.0141, 1, 0.34, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ids = Counts(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L333_C8", "label": "ids = Counts()", "type": "assigned_variable", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "vector": [14, 2, 0.938, 0.0028, 2, 0.44, 0.0, 202, 3, 1, 0, 0, 731, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "Counts", "annotation": ""}, "snippet": " ids = Counts(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:For_L334_C8", "label": "for k, v", "type": "for", "loc": [334, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "vector": [6, 2, 0.9423, 0.0056, 2, 0.44, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items(): \n setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L335_C12", "label": "setattr()", "type": "expression", "loc": [335, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:For_L334_C8", "vector": [8, 3, 0.9437, 0.0028, 3, 0.07, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L336_C8", "label": "return", "type": "return", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "vector": [13, 2, 0.9465, 0.0028, 2, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "label": "ModelFactory", "type": "class", "loc": [338, 355], "level": 0, "parent": null, "vector": [3, 0, 0.9761, 0.0507, 0, 0.66, 1.0, 357, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "ModelFactory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModelFactory(object):\n \"\"\"\n Used by parsers for creating instances\n of models. You may subclass this factory\n to add your own extended models.\n \"\"\"\n\n status = Status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L339_C4", "label": "expression", "type": "expression", "loc": [339, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [8, 1, 0.9606, 0.0141, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Used by parsers for creating instances\n of models. You may subclass this factory\n to add your own extended models.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L345_C4", "label": "status =", "type": "assigned_variable", "loc": [345, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9718, 0.0028, 1, 0.76, 0.0909, 699, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = Status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L346_C4", "label": "comments =", "type": "assigned_variable", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9746, 0.0028, 1, 0.76, 0.1818, 122, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comments = Comments"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L347_C4", "label": "user =", "type": "assigned_variable", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9775, 0.0028, 1, 0.76, 0.2727, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L348_C4", "label": "direct_message =", "type": "assigned_variable", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9803, 0.0028, 1, 0.76, 0.3636, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " direct_message = DirectMessage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L349_C4", "label": "friendship =", "type": "assigned_variable", "loc": [349, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9831, 0.0028, 1, 0.76, 0.4545, 778, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendship = Friendship"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L350_C4", "label": "saved_search =", "type": "assigned_variable", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9859, 0.0028, 1, 0.76, 0.5455, 498, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_search = SavedSearch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L351_C4", "label": "search_result =", "type": "assigned_variable", "loc": [351, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9887, 0.0028, 1, 0.76, 0.6364, 666, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "search_result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_result = SearchResult"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L352_C4", "label": "list =", "type": "assigned_variable", "loc": [352, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9915, 0.0028, 1, 0.76, 0.7273, 430, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list = List"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L353_C4", "label": "json =", "type": "assigned_variable", "loc": [353, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9944, 0.0028, 1, 0.76, 0.8182, 463, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = JSONModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L354_C4", "label": "ids_list =", "type": "assigned_variable", "loc": [354, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 0.9972, 0.0028, 1, 0.76, 0.9091, 18, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ids_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ids_list = IDSModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L355_C4", "label": "counts =", "type": "assigned_variable", "loc": [355, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "vector": [14, 1, 1.0, 0.0028, 1, 0.76, 1.0, 560, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counts = Counts"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L48_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L47_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L53_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L54_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L56_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L59_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L97_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L126_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L125_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L130_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L129_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L134_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L133_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L136_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L131_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L209_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L238_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L240_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L239_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L242_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L268_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:If_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L270_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L283_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L286_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L304_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L318_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:For_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:For_L334_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L335_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Return_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Expr_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_144:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_144:Assign_L355_C4"}] |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import cgi
import urllib
import time
import random
import urlparse
import hmac
import binascii
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
class OAuthError(RuntimeError):
"""Generic exception class."""
def __init__(self, message='OAuth error occured.'):
self.message = message
def build_authenticate_header(realm=''):
"""Optional WWW-Authenticate header (401 error)"""
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
def escape(s):
"""Escape a URL including any /."""
return urllib.quote(s, safe='~')
def _utf8_str(s):
"""Convert unicode to utf-8."""
if isinstance(s, unicode):
return s.encode("utf-8")
else:
return str(s)
def generate_timestamp():
"""Get seconds since epoch (UTC)."""
return int(time.time())
def generate_nonce(length=8):
"""Generate pseudorandom number."""
return ''.join([str(random.randint(0, 9)) for i in range(length)])
def generate_verifier(length=8):
"""Generate pseudorandom number."""
return ''.join([str(random.randint(0, 9)) for i in range(length)])
class OAuthConsumer(object):
"""Consumer of OAuth authentication.
OAuthConsumer is a data type that represents the identity of the Consumer
via its shared secret with the Service Provider.
"""
key = None
secret = None
def __init__(self, key, secret):
self.key = key
self.secret = secret
class OAuthToken(object):
"""OAuthToken is a data type that represents an End User via either an access
or request token.
key -- the token
secret -- the token secret
"""
key = None
secret = None
callback = None
callback_confirmed = None
verifier = None
def __init__(self, key, secret):
self.key = key
self.secret = secret
def set_callback(self, callback):
self.callback = callback
self.callback_confirmed = 'true'
def set_verifier(self, verifier=None):
if verifier is not None:
self.verifier = verifier
else:
self.verifier = generate_verifier()
def get_callback_url(self):
if self.callback and self.verifier:
# Append the oauth_verifier.
parts = urlparse.urlparse(self.callback)
scheme, netloc, path, params, query, fragment = parts[:6]
if query:
query = '%s&oauth_verifier=%s' % (query, self.verifier)
else:
query = 'oauth_verifier=%s' % self.verifier
return urlparse.urlunparse((scheme, netloc, path, params,
query, fragment))
return self.callback
def to_string(self):
data = {
'oauth_token': self.key,
'oauth_token_secret': self.secret,
}
if self.callback_confirmed is not None:
data['oauth_callback_confirmed'] = self.callback_confirmed
return urllib.urlencode(data)
def from_string(s):
""" Returns a token from something like:
oauth_token_secret=xxx&oauth_token=xxx
"""
params = cgi.parse_qs(s, keep_blank_values=False)
key = params['oauth_token'][0]
secret = params['oauth_token_secret'][0]
token = OAuthToken(key, secret)
try:
token.callback_confirmed = params['oauth_callback_confirmed'][0]
except KeyError:
pass # 1.0, no callback confirmed.
return token
from_string = staticmethod(from_string)
def __str__(self):
return self.to_string()
class OAuthRequest(object):
"""OAuthRequest represents the request and can be serialized.
OAuth parameters:
- oauth_consumer_key
- oauth_token
- oauth_signature_method
- oauth_signature
- oauth_timestamp
- oauth_nonce
- oauth_version
- oauth_verifier
... any additional parameters, as defined by the Service Provider.
"""
parameters = None # OAuth parameters.
http_method = HTTP_METHOD
http_url = None
version = VERSION
def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None):
self.http_method = http_method
self.http_url = http_url
self.parameters = parameters or {}
def set_parameter(self, parameter, value):
self.parameters[parameter] = value
def get_parameter(self, parameter):
try:
return self.parameters[parameter]
except:
raise OAuthError('Parameter not found: %s' % parameter)
def _get_timestamp_nonce(self):
return self.get_parameter('oauth_timestamp'), self.get_parameter(
'oauth_nonce')
def get_nonoauth_parameters(self):
"""Get any non-OAuth parameters."""
parameters = {}
for k, v in self.parameters.iteritems():
# Ignore oauth parameters.
if k.find('oauth_') < 0:
parameters[k] = v
return parameters
def to_header(self, realm=''):
"""Serialize as a header for an HTTPAuth request."""
auth_header = 'OAuth realm="%s"' % realm
# Add the oauth parameters.
if self.parameters:
for k, v in self.parameters.iteritems():
if k[:6] == 'oauth_':
auth_header += ', %s="%s"' % (k, escape(str(v)))
return {'Authorization': auth_header}
def to_postdata(self):
"""Serialize as post data for a POST request."""
return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \
for k, v in self.parameters.iteritems()])
def to_url(self):
"""Serialize as a URL for a GET request."""
return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())
def get_normalized_parameters(self):
"""Return a string that contains the parameters that must be signed."""
params = self.parameters
try:
# Exclude the signature if it exists.
del params['oauth_signature']
except:
pass
# Escape key values before sorting.
key_values = [(escape(_utf8_str(k)), escape(_utf8_str(v))) \
for k,v in params.items()]
# Sort lexicographically, first after key, then after value.
key_values.sort()
# Combine key value pairs into a string.
return '&'.join(['%s=%s' % (k, v) for k, v in key_values])
def get_normalized_http_method(self):
"""Uppercases the http method."""
return self.http_method.upper()
def get_normalized_http_url(self):
"""Parses the URL and rebuilds it to be scheme://host/path."""
parts = urlparse.urlparse(self.http_url)
scheme, netloc, path = parts[:3]
# Exclude default port numbers.
if scheme == 'http' and netloc[-3:] == ':80':
netloc = netloc[:-3]
elif scheme == 'https' and netloc[-4:] == ':443':
netloc = netloc[:-4]
return '%s://%s%s' % (scheme, netloc, path)
def sign_request(self, signature_method, consumer, token):
"""Set the signature parameter to the result of build_signature."""
# Set the signature method.
self.set_parameter('oauth_signature_method',
signature_method.get_name())
# Set the signature.
self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token))
def build_signature(self, signature_method, consumer, token):
"""Calls the build signature method within the signature method."""
return signature_method.build_signature(self, consumer, token)
def from_request(http_method, http_url, headers=None, parameters=None,
query_string=None):
"""Combines multiple parameter sources."""
if parameters is None:
parameters = {}
# Headers
if headers and 'Authorization' in headers:
auth_header = headers['Authorization']
# Check that the authorization header is OAuth.
if auth_header[:6] == 'OAuth ':
auth_header = auth_header[6:]
try:
# Get the parameters from the header.
header_params = OAuthRequest._split_header(auth_header)
parameters.update(header_params)
except:
raise OAuthError('Unable to parse OAuth parameters from '
'Authorization header.')
# GET or POST query string.
if query_string:
query_params = OAuthRequest._split_url_string(query_string)
parameters.update(query_params)
# URL parameters.
param_str = urlparse.urlparse(http_url)[4] # query
url_params = OAuthRequest._split_url_string(param_str)
parameters.update(url_params)
if parameters:
return OAuthRequest(http_method, http_url, parameters)
return None
from_request = staticmethod(from_request)
def from_consumer_and_token(oauth_consumer, token=None,
callback=None, verifier=None, http_method=HTTP_METHOD,
http_url=None, parameters=None):
if not parameters:
parameters = {}
defaults = {
'oauth_consumer_key': oauth_consumer.key,
'oauth_timestamp': generate_timestamp(),
'oauth_nonce': generate_nonce(),
'oauth_version': OAuthRequest.version,
}
defaults.update(parameters)
parameters = defaults
if token:
parameters['oauth_token'] = token.key
if token.callback:
parameters['oauth_callback'] = token.callback
# 1.0a support for verifier.
if verifier:
parameters['oauth_verifier'] = verifier
elif callback:
# 1.0a support for callback in the request token request.
parameters['oauth_callback'] = callback
return OAuthRequest(http_method, http_url, parameters)
from_consumer_and_token = staticmethod(from_consumer_and_token)
def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD,
http_url=None, parameters=None):
if not parameters:
parameters = {}
parameters['oauth_token'] = token.key
if callback:
parameters['oauth_callback'] = callback
return OAuthRequest(http_method, http_url, parameters)
from_token_and_callback = staticmethod(from_token_and_callback)
def _split_header(header):
"""Turn Authorization: header into parameters."""
params = {}
parts = header.split(',')
for param in parts:
# Ignore realm parameter.
if param.find('realm') > -1:
continue
# Remove whitespace.
param = param.strip()
# Split key-value.
param_parts = param.split('=', 1)
# Remove quotes and unescape the value.
params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\"'))
return params
_split_header = staticmethod(_split_header)
def _split_url_string(param_str):
"""Turn URL string into parameters."""
parameters = cgi.parse_qs(param_str, keep_blank_values=False)
for k, v in parameters.iteritems():
parameters[k] = urllib.unquote(v[0])
return parameters
_split_url_string = staticmethod(_split_url_string)
class OAuthServer(object):
"""A worker to check the validity of a request against a data store."""
timestamp_threshold = 300 # In seconds, five minutes.
version = VERSION
signature_methods = None
data_store = None
def __init__(self, data_store=None, signature_methods=None):
self.data_store = data_store
self.signature_methods = signature_methods or {}
def set_data_store(self, data_store):
self.data_store = data_store
def get_data_store(self):
return self.data_store
def add_signature_method(self, signature_method):
self.signature_methods[signature_method.get_name()] = signature_method
return self.signature_methods
def fetch_request_token(self, oauth_request):
"""Processes a request_token request and returns the
request token on success.
"""
try:
# Get the request token for authorization.
token = self._get_token(oauth_request, 'request')
except OAuthError:
# No token required for the initial token request.
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
try:
callback = self.get_callback(oauth_request)
except OAuthError:
callback = None # 1.0, no callback specified.
self._check_signature(oauth_request, consumer, None)
# Fetch a new token.
token = self.data_store.fetch_request_token(consumer, callback)
return token
def fetch_access_token(self, oauth_request):
"""Processes an access_token request and returns the
access token on success.
"""
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
try:
verifier = self._get_verifier(oauth_request)
except OAuthError:
verifier = None
# Get the request token.
token = self._get_token(oauth_request, 'request')
self._check_signature(oauth_request, consumer, token)
new_token = self.data_store.fetch_access_token(consumer, token, verifier)
return new_token
def verify_request(self, oauth_request):
"""Verifies an api call and checks all the parameters."""
# -> consumer and token
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
# Get the access token.
token = self._get_token(oauth_request, 'access')
self._check_signature(oauth_request, consumer, token)
parameters = oauth_request.get_nonoauth_parameters()
return consumer, token, parameters
def authorize_token(self, token, user):
"""Authorize a request token."""
return self.data_store.authorize_request_token(token, user)
def get_callback(self, oauth_request):
"""Get the callback URL."""
return oauth_request.get_parameter('oauth_callback')
def build_authenticate_header(self, realm=''):
"""Optional support for the authenticate header."""
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
def _get_version(self, oauth_request):
"""Verify the correct version request for this server."""
try:
version = oauth_request.get_parameter('oauth_version')
except:
version = VERSION
if version and version != self.version:
raise OAuthError('OAuth version %s not supported.' % str(version))
return version
def _get_signature_method(self, oauth_request):
"""Figure out the signature with some defaults."""
try:
signature_method = oauth_request.get_parameter(
'oauth_signature_method')
except:
signature_method = SIGNATURE_METHOD
try:
# Get the signature method object.
signature_method = self.signature_methods[signature_method]
except:
signature_method_names = ', '.join(self.signature_methods.keys())
raise OAuthError('Signature method %s not supported try one of the '
'following: %s' % (signature_method, signature_method_names))
return signature_method
def _get_consumer(self, oauth_request):
consumer_key = oauth_request.get_parameter('oauth_consumer_key')
consumer = self.data_store.lookup_consumer(consumer_key)
if not consumer:
raise OAuthError('Invalid consumer.')
return consumer
def _get_token(self, oauth_request, token_type='access'):
"""Try to find the token for the provided request token key."""
token_field = oauth_request.get_parameter('oauth_token')
token = self.data_store.lookup_token(token_type, token_field)
if not token:
raise OAuthError('Invalid %s token: %s' % (token_type, token_field))
return token
def _get_verifier(self, oauth_request):
return oauth_request.get_parameter('oauth_verifier')
def _check_signature(self, oauth_request, consumer, token):
timestamp, nonce = oauth_request._get_timestamp_nonce()
self._check_timestamp(timestamp)
self._check_nonce(consumer, token, nonce)
signature_method = self._get_signature_method(oauth_request)
try:
signature = oauth_request.get_parameter('oauth_signature')
except:
raise OAuthError('Missing signature.')
# Validate the signature.
valid_sig = signature_method.check_signature(oauth_request, consumer,
token, signature)
if not valid_sig:
key, base = signature_method.build_signature_base_string(
oauth_request, consumer, token)
raise OAuthError('Invalid signature. Expected signature base '
'string: %s' % base)
built = signature_method.build_signature(oauth_request, consumer, token)
def _check_timestamp(self, timestamp):
"""Verify that timestamp is recentish."""
timestamp = int(timestamp)
now = int(time.time())
lapsed = abs(now - timestamp)
if lapsed > self.timestamp_threshold:
raise OAuthError('Expired timestamp: given %d and now %s has a '
'greater difference than threshold %d' %
(timestamp, now, self.timestamp_threshold))
def _check_nonce(self, consumer, token, nonce):
"""Verify that the nonce is uniqueish."""
nonce = self.data_store.lookup_nonce(consumer, token, nonce)
if nonce:
raise OAuthError('Nonce already used: %s' % str(nonce))
class OAuthClient(object):
"""OAuthClient is a worker to attempt to execute a request."""
consumer = None
token = None
def __init__(self, oauth_consumer, oauth_token):
self.consumer = oauth_consumer
self.token = oauth_token
def get_consumer(self):
return self.consumer
def get_token(self):
return self.token
def fetch_request_token(self, oauth_request):
"""-> OAuthToken."""
raise NotImplementedError
def fetch_access_token(self, oauth_request):
"""-> OAuthToken."""
raise NotImplementedError
def access_resource(self, oauth_request):
"""-> Some protected resource."""
raise NotImplementedError
class OAuthDataStore(object):
"""A database abstraction used to lookup consumers and tokens."""
def lookup_consumer(self, key):
"""-> OAuthConsumer."""
raise NotImplementedError
def lookup_token(self, oauth_consumer, token_type, token_token):
"""-> OAuthToken."""
raise NotImplementedError
def lookup_nonce(self, oauth_consumer, oauth_token, nonce):
"""-> OAuthToken."""
raise NotImplementedError
def fetch_request_token(self, oauth_consumer, oauth_callback):
"""-> OAuthToken."""
raise NotImplementedError
def fetch_access_token(self, oauth_consumer, oauth_token, oauth_verifier):
"""-> OAuthToken."""
raise NotImplementedError
def authorize_request_token(self, oauth_token, user):
"""-> OAuthToken."""
raise NotImplementedError
class OAuthSignatureMethod(object):
"""A strategy class that implements a signature method."""
def get_name(self):
"""-> str."""
raise NotImplementedError
def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):
"""-> str key, str raw."""
raise NotImplementedError
def build_signature(self, oauth_request, oauth_consumer, oauth_token):
"""-> str."""
raise NotImplementedError
def check_signature(self, oauth_request, consumer, token, signature):
built = self.build_signature(oauth_request, consumer, token)
return built == signature
class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod):
def get_name(self):
return 'HMAC-SHA1'
def build_signature_base_string(self, oauth_request, consumer, token):
sig = (
escape(oauth_request.get_normalized_http_method()),
escape(oauth_request.get_normalized_http_url()),
escape(oauth_request.get_normalized_parameters()),
)
key = '%s&' % escape(consumer.secret)
if token:
key += escape(token.secret)
#print "OAuth base string:" + str(sig)
raw = '&'.join(sig)
return key, raw
def build_signature(self, oauth_request, consumer, token):
"""Builds the base signature string."""
key, raw = self.build_signature_base_string(oauth_request, consumer,
token)
# HMAC object.
try:
import hashlib # 2.5
hashed = hmac.new(key, raw, hashlib.sha1)
except:
import sha # Deprecated
hashed = hmac.new(key, raw, sha)
# Calculate the digest base 64.
return binascii.b2a_base64(hashed.digest())[:-1]
class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod):
def get_name(self):
return 'PLAINTEXT'
def build_signature_base_string(self, oauth_request, consumer, token):
"""Concatenates the consumer key and secret."""
sig = '%s&' % escape(consumer.secret)
if token:
sig = sig + escape(token.secret)
return sig, sig
def build_signature(self, oauth_request, consumer, token):
key, raw = self.build_signature_base_string(oauth_request, consumer,
token)
return key | ajibawa-2023/Python-Code-Large/train/row_145 | 389 | 654 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0183, 0.0352, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThe MIT License\n\nCopyright (c) 2007 Leah Culver\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L25_C0", "label": "cgi import cgi", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0382, 0.0015, 0, 0.66, 0.0385, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L26_C0", "label": "urllib import urllib", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0398, 0.0015, 0, 0.66, 0.0769, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L27_C0", "label": "time import time", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0413, 0.0015, 0, 0.66, 0.1154, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L28_C0", "label": "random import random", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0428, 0.0015, 0, 0.66, 0.1538, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L29_C0", "label": "urlparse import urlparse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0443, 0.0015, 0, 0.66, 0.1923, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L30_C0", "label": "hmac import hmac", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.0459, 0.0015, 0, 0.66, 0.2308, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "hmac", "arg_names": [], "import_names": ["hmac"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hmac"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L31_C0", "label": "binascii import binascii", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.0474, 0.0015, 0, 0.66, 0.2692, 984, 0, 1, 0, 0, 984, 0, 0], "semantic": {"name": "binascii", "arg_names": [], "import_names": ["binascii"], "rhs_call_name": "", "annotation": ""}, "snippet": "import binascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L34_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.052, 0.0015, 0, 0.66, 0.3077, 557, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION = '1.0' # Hi Blaine!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L35_C0", "label": "HTTP_METHOD =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.0535, 0.0015, 0, 0.66, 0.3462, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "HTTP_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HTTP_METHOD = 'GET'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L36_C0", "label": "SIGNATURE_METHOD =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.055, 0.0015, 0, 0.66, 0.3846, 339, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNATURE_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNATURE_METHOD = 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "label": "OAuthError", "type": "class", "loc": [39, 42], "level": 0, "parent": null, "vector": [3, 0, 0.0619, 0.0061, 0, 0.66, 0.4231, 899, 0, 1, 0, 0, 178, 0, 0], "semantic": {"name": "OAuthError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthError(RuntimeError):\n \"\"\"Generic exception class.\"\"\"\n def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "vector": [8, 1, 0.0612, 0.0015, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generic exception class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L41_C4", "label": "__init__", "type": "function", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "vector": [2, 1, 0.0635, 0.0031, 1, 0.51, 1.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L42_C8", "label": "self.message =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L41_C4", "vector": [14, 2, 0.0642, 0.0015, 2, 0.6, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L44_C0", "label": "build_authenticate_header", "type": "function", "loc": [44, 46], "level": 0, "parent": null, "vector": [2, 0, 0.0688, 0.0046, 0, 0.66, 0.4615, 279, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def build_authenticate_header(realm=''):\n \"\"\"Optional WWW-Authenticate header (401 error)\"\"\"\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L45_C4", "label": "expression", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L44_C0", "vector": [8, 1, 0.0688, 0.0015, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Optional WWW-Authenticate header (401 error)\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L46_C4", "label": "return", "type": "return", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L44_C0", "vector": [13, 1, 0.0703, 0.0015, 1, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L48_C0", "label": "escape", "type": "function", "loc": [48, 50], "level": 0, "parent": null, "vector": [2, 0, 0.0749, 0.0046, 0, 0.66, 0.5, 494, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "escape", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(s):\n \"\"\"Escape a URL including any /.\"\"\"\n return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L49_C4", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L48_C0", "vector": [8, 1, 0.0749, 0.0015, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Escape a URL including any /.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L48_C0", "vector": [13, 1, 0.0765, 0.0015, 1, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L52_C0", "label": "_utf8_str", "type": "function", "loc": [52, 57], "level": 0, "parent": null, "vector": [2, 0, 0.0833, 0.0092, 0, 0.66, 0.5385, 730, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_utf8_str", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _utf8_str(s):\n \"\"\"Convert unicode to utf-8.\"\"\"\n if isinstance(s, unicode):\n return s.encode(\"utf-8\")\n else:\n return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L52_C0", "vector": [8, 1, 0.081, 0.0015, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convert unicode to utf-8.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4", "label": "if", "type": "if", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L52_C0", "vector": [4, 1, 0.0849, 0.0061, 1, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, unicode):\n return s.encode(\"utf-8\")\n else:\n return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4", "vector": [13, 2, 0.0841, 0.0015, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s.encode(\"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L57_C8", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4", "vector": [13, 2, 0.0872, 0.0015, 2, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L59_C0", "label": "generate_timestamp", "type": "function", "loc": [59, 61], "level": 0, "parent": null, "vector": [2, 0, 0.0917, 0.0046, 0, 0.66, 0.5769, 54, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "generate_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_timestamp():\n \"\"\"Get seconds since epoch (UTC).\"\"\"\n return int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L60_C4", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L59_C0", "vector": [8, 1, 0.0917, 0.0015, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get seconds since epoch (UTC).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L59_C0", "vector": [13, 1, 0.0933, 0.0015, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L63_C0", "label": "generate_nonce", "type": "function", "loc": [63, 65], "level": 0, "parent": null, "vector": [2, 0, 0.0979, 0.0046, 0, 0.66, 0.6154, 53, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "generate_nonce", "arg_names": ["length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_nonce(length=8):\n \"\"\"Generate pseudorandom number.\"\"\"\n return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L64_C4", "label": "expression", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L63_C0", "vector": [8, 1, 0.0979, 0.0015, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generate pseudorandom number.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L63_C0", "vector": [13, 1, 0.0994, 0.0015, 1, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L67_C0", "label": "generate_verifier", "type": "function", "loc": [67, 69], "level": 0, "parent": null, "vector": [2, 0, 0.104, 0.0046, 0, 0.66, 0.6538, 126, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "generate_verifier", "arg_names": ["length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_verifier(length=8):\n \"\"\"Generate pseudorandom number.\"\"\"\n return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L67_C0", "vector": [8, 1, 0.104, 0.0015, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generate pseudorandom number.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L69_C4", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L67_C0", "vector": [13, 1, 0.1055, 0.0015, 1, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "label": "OAuthConsumer", "type": "class", "loc": [72, 84], "level": 0, "parent": null, "vector": [3, 0, 0.1193, 0.0199, 0, 0.66, 0.6923, 660, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthConsumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthConsumer(object):\n \"\"\"Consumer of OAuth authentication.\n\n OAuthConsumer is a data type that represents the identity of the Consumer\n via its shared secret with the Service Provider.\n\n \"\"\"\n key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L73_C4", "label": "expression", "type": "expression", "loc": [73, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "vector": [8, 1, 0.1154, 0.0092, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Consumer of OAuth authentication.\n\n OAuthConsumer is a data type that represents the identity of the Consumer\n via its shared secret with the Service Provider.\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L79_C4", "label": "key =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "vector": [14, 1, 0.1208, 0.0015, 1, 0.74, 0.3333, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L80_C4", "label": "secret =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "vector": [14, 1, 0.1223, 0.0015, 1, 0.74, 0.6667, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4", "label": "__init__", "type": "function", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "vector": [2, 1, 0.1269, 0.0046, 1, 0.74, 1.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L83_C8", "label": "self.key =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4", "vector": [14, 2, 0.1269, 0.0015, 2, 0.16, 0.0, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L84_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4", "vector": [14, 2, 0.1284, 0.0015, 2, 0.16, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "label": "OAuthToken", "type": "class", "loc": [87, 153], "level": 0, "parent": null, "vector": [3, 0, 0.1835, 0.1024, 0, 0.66, 0.7308, 512, 0, 7, 0, 0, 186, 0, 8], "semantic": {"name": "OAuthToken", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthToken(object):\n \"\"\"OAuthToken is a data type that represents an End User via either an access\n or request token.\n \n key -- the token\n secret -- the token secret\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L88_C4", "label": "expression", "type": "expression", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [8, 1, 0.1391, 0.0107, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthToken is a data type that represents an End User via either an access\n or request token.\n \n key -- the token\n secret -- the token secret\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L95_C4", "label": "key =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.1453, 0.0015, 1, 0.05, 0.0769, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L96_C4", "label": "secret =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.1468, 0.0015, 1, 0.05, 0.1538, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L97_C4", "label": "callback =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.1483, 0.0015, 1, 0.05, 0.2308, 342, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L98_C4", "label": "callback_confirmed =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.1498, 0.0015, 1, 0.05, 0.3077, 187, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback_confirmed = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L99_C4", "label": "verifier =", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.1514, 0.0015, 1, 0.05, 0.3846, 629, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4", "label": "__init__", "type": "function", "loc": [101, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.156, 0.0046, 1, 0.05, 0.4615, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L102_C8", "label": "self.key =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4", "vector": [14, 2, 0.156, 0.0015, 2, 0.62, 0.0, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L103_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4", "vector": [14, 2, 0.1575, 0.0015, 2, 0.62, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4", "label": "set_callback", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.1621, 0.0046, 1, 0.05, 0.5385, 990, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_callback", "arg_names": ["self", "callback"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_callback(self, callback):\n self.callback = callback\n self.callback_confirmed = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L106_C8", "label": "self.callback =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4", "vector": [14, 2, 0.1621, 0.0015, 2, 0.72, 0.0, 236, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callback = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L107_C8", "label": "self.callback_confirmed =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4", "vector": [14, 2, 0.1636, 0.0015, 2, 0.72, 1.0, 513, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callback_confirmed = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L109_C4", "label": "set_verifier", "type": "function", "loc": [109, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.1697, 0.0076, 1, 0.05, 0.6154, 943, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_verifier", "arg_names": ["self", "verifier"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_verifier(self, verifier=None):\n if verifier is not None:\n self.verifier = verifier\n else:\n self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8", "label": "if", "type": "if", "loc": [110, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L109_C4", "vector": [4, 2, 0.1705, 0.0061, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if verifier is not None:\n self.verifier = verifier\n else:\n self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L111_C12", "label": "self.verifier =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8", "vector": [14, 3, 0.1697, 0.0015, 3, 0.74, 0.0, 54, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.verifier = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L113_C12", "label": "self.verifier = generate_verifier()", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8", "vector": [14, 3, 0.1728, 0.0015, 3, 0.74, 1.0, 54, 3, 0, 0, 0, 126, 10, 1], "semantic": {"name": "self.verifier", "arg_names": [], "import_names": [], "rhs_call_name": "generate_verifier", "annotation": ""}, "snippet": " self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4", "label": "get_callback_url", "type": "function", "loc": [115, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.1843, 0.0183, 1, 0.05, 0.6923, 417, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_callback_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_callback_url(self):\n if self.callback and self.verifier:\n # Append the oauth_verifier.\n parts = urlparse.urlparse(self.callback)\n scheme, netloc, path, params, query, fragment = parts[:6]\n if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "label": "if", "type": "if", "loc": [116, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4", "vector": [4, 2, 0.1843, 0.0153, 2, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.callback and self.verifier:\n # Append the oauth_verifier.\n parts = urlparse.urlparse(self.callback)\n scheme, netloc, path, params, query, fragment = parts[:6]\n if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:\n query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L118_C12", "label": "parts = urlparse()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "vector": [14, 3, 0.1804, 0.0015, 3, 0.76, 0.0, 13, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parts = urlparse.urlparse(self.callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L119_C12", "label": "scheme, netloc, path, params, query, fragment =", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "vector": [14, 3, 0.182, 0.0015, 3, 0.76, 0.3333, 3, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scheme, netloc, path, params, query, fragment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme, netloc, path, params, query, fragment = parts[:6]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12", "label": "if", "type": "if", "loc": [120, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "vector": [4, 3, 0.1858, 0.0061, 3, 0.76, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:\n query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L121_C16", "label": "query =", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12", "vector": [14, 4, 0.185, 0.0015, 4, 0.92, 0.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = '%s&oauth_verifier=%s' % (query, self.verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L123_C16", "label": "query =", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12", "vector": [14, 4, 0.1881, 0.0015, 4, 0.92, 1.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L124_C12", "label": "return", "type": "return", "loc": [124, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "vector": [13, 3, 0.1904, 0.0031, 3, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urlparse.urlunparse((scheme, netloc, path, params,\n query, fragment))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4", "vector": [13, 2, 0.1927, 0.0015, 2, 0.67, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "label": "to_string", "type": "function", "loc": [128, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.2011, 0.0122, 1, 0.05, 0.7692, 549, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "to_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_string(self):\n data = {\n 'oauth_token': self.key,\n 'oauth_token_secret': self.secret,\n }\n if self.callback_confirmed is not None:\n data['oauth_callback_confirmed'] = self.callback_confirmed\n return urllib.urlencode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L129_C8", "label": "data =", "type": "assigned_variable", "loc": [129, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "vector": [14, 2, 0.1995, 0.0061, 2, 0.32, 0.0, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {\n 'oauth_token': self.key,\n 'oauth_token_secret': self.secret,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L133_C8", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "vector": [4, 2, 0.2041, 0.0031, 2, 0.32, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.callback_confirmed is not None:\n data['oauth_callback_confirmed'] = self.callback_confirmed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L134_C12", "label": "assign", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L133_C8", "vector": [14, 3, 0.2049, 0.0015, 3, 0.9, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['oauth_callback_confirmed'] = self.callback_confirmed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "vector": [13, 2, 0.2064, 0.0015, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urllib.urlencode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "label": "from_string", "type": "function", "loc": [137, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.2187, 0.0199, 1, 0.05, 0.8462, 423, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "from_string", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_string(s):\n \"\"\" Returns a token from something like:\n oauth_token_secret=xxx&oauth_token=xxx\n \"\"\"\n params = cgi.parse_qs(s, keep_blank_values=False)\n key = params['oauth_token'][0]\n secret = params['oauth_token_secret'][0]\n token = OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L138_C8", "label": "expression", "type": "expression", "loc": [138, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [8, 2, 0.2125, 0.0046, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Returns a token from something like:\n oauth_token_secret=xxx&oauth_token=xxx\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L141_C8", "label": "params = parse_qs()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [14, 2, 0.2156, 0.0015, 2, 0.75, 0.1667, 206, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " params = cgi.parse_qs(s, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L142_C8", "label": "key =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [14, 2, 0.2171, 0.0015, 2, 0.75, 0.3333, 230, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = params['oauth_token'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L143_C8", "label": "secret =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [14, 2, 0.2187, 0.0015, 2, 0.75, 0.5, 189, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = params['oauth_token_secret'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L144_C8", "label": "token = OAuthToken()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [14, 2, 0.2202, 0.0015, 2, 0.75, 0.6667, 129, 3, 2, 0, 0, 512, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthToken", "annotation": ""}, "snippet": " token = OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L145_C8", "label": "try", "type": "try", "loc": [145, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [7, 2, 0.224, 0.0061, 2, 0.75, 0.8333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n token.callback_confirmed = params['oauth_callback_confirmed'][0]\n except KeyError:\n pass # 1.0, no callback confirmed."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L146_C12", "label": "token.callback_confirmed =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L145_C8", "vector": [14, 3, 0.2232, 0.0015, 3, 0.61, 0.0, 684, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "token.callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token.callback_confirmed = params['oauth_callback_confirmed'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L149_C8", "label": "return", "type": "return", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "vector": [13, 2, 0.2278, 0.0015, 2, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L150_C4", "label": "from_string = staticmethod()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [14, 1, 0.2294, 0.0015, 1, 0.05, 0.9231, 423, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_string", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_string = staticmethod(from_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L152_C4", "label": "__str__", "type": "function", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "vector": [2, 1, 0.2332, 0.0031, 1, 0.05, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L153_C8", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L152_C4", "vector": [13, 2, 0.2339, 0.0015, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "label": "OAuthRequest", "type": "class", "loc": [156, 365], "level": 0, "parent": null, "vector": [3, 0, 0.3983, 0.3211, 0, 0.66, 0.7692, 101, 0, 18, 0, 0, 186, 0, 58], "semantic": {"name": "OAuthRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthRequest(object):\n \"\"\"OAuthRequest represents the request and can be serialized.\n\n OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L157_C4", "label": "expression", "type": "expression", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [8, 1, 0.2492, 0.0199, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthRequest represents the request and can be serialized.\n\n OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature \n - oauth_timestamp "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L170_C4", "label": "parameters =", "type": "assigned_variable", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.2599, 0.0015, 1, 0.94, 0.037, 29, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = None # OAuth parameters."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L171_C4", "label": "http_method =", "type": "assigned_variable", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.2615, 0.0015, 1, 0.94, 0.0741, 19, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_method = HTTP_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L172_C4", "label": "http_url =", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.263, 0.0015, 1, 0.94, 0.1111, 630, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_url = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L173_C4", "label": "version =", "type": "assigned_variable", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.2645, 0.0015, 1, 0.94, 0.1481, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "label": "__init__", "type": "function", "loc": [175, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.2699, 0.0061, 1, 0.94, 0.1852, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None):\n self.http_method = http_method\n self.http_url = http_url\n self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L176_C8", "label": "self.http_method =", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "vector": [14, 2, 0.2691, 0.0015, 2, 0.0, 0.0, 758, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_method = http_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L177_C8", "label": "self.http_url =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "vector": [14, 2, 0.2706, 0.0015, 2, 0.0, 0.5, 654, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_url = http_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L178_C8", "label": "self.parameters =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "vector": [14, 2, 0.2722, 0.0015, 2, 0.0, 1.0, 721, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L179_C4", "label": "set_parameter", "type": "function", "loc": [179, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.2745, 0.0031, 1, 0.94, 0.2222, 310, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "set_parameter", "arg_names": ["self", "parameter", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_parameter(self, parameter, value):\n self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L180_C8", "label": "assign", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L179_C4", "vector": [14, 2, 0.2752, 0.0015, 2, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L182_C4", "label": "get_parameter", "type": "function", "loc": [182, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.2813, 0.0076, 1, 0.94, 0.2593, 386, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_parameter", "arg_names": ["self", "parameter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_parameter(self, parameter):\n try:\n return self.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L183_C8", "label": "try", "type": "try", "loc": [183, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L182_C4", "vector": [7, 2, 0.2821, 0.0061, 2, 0.79, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L184_C12", "label": "return", "type": "return", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L183_C8", "vector": [13, 3, 0.2813, 0.0015, 3, 0.48, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.parameters[parameter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L188_C4", "label": "_get_timestamp_nonce", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.289, 0.0046, 1, 0.94, 0.2963, 211, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "_get_timestamp_nonce", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_timestamp_nonce(self):\n return self.get_parameter('oauth_timestamp'), self.get_parameter(\n 'oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L189_C8", "label": "return", "type": "return", "loc": [189, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L188_C4", "vector": [13, 2, 0.2898, 0.0031, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_parameter('oauth_timestamp'), self.get_parameter(\n 'oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "label": "get_nonoauth_parameters", "type": "function", "loc": [192, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.2989, 0.0122, 1, 0.94, 0.3333, 748, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_nonoauth_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_nonoauth_parameters(self):\n \"\"\"Get any non-OAuth parameters.\"\"\"\n parameters = {}\n for k, v in self.parameters.iteritems():\n # Ignore oauth parameters.\n if k.find('oauth_') < 0:\n parameters[k] = v\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L193_C8", "label": "expression", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "vector": [8, 2, 0.2951, 0.0015, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get any non-OAuth parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L194_C8", "label": "parameters =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "vector": [14, 2, 0.2966, 0.0015, 2, 0.98, 0.3333, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:For_L195_C8", "label": "for k, v", "type": "for", "loc": [195, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "vector": [6, 2, 0.3005, 0.0061, 2, 0.98, 0.6667, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.parameters.iteritems():\n # Ignore oauth parameters.\n if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L197_C12", "label": "if", "type": "if", "loc": [197, 198], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L195_C8", "vector": [4, 3, 0.302, 0.0031, 3, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L198_C16", "label": "assign", "type": "assigned_variable", "loc": [198, 198], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L197_C12", "vector": [14, 4, 0.3028, 0.0015, 4, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L199_C8", "label": "return", "type": "return", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "vector": [13, 2, 0.3043, 0.0015, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "label": "to_header", "type": "function", "loc": [201, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3135, 0.0138, 1, 0.94, 0.3704, 578, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "to_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_header(self, realm=''):\n \"\"\"Serialize as a header for an HTTPAuth request.\"\"\"\n auth_header = 'OAuth realm=\"%s\"' % realm\n # Add the oauth parameters.\n if self.parameters:\n for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L202_C8", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "vector": [8, 2, 0.3089, 0.0015, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as a header for an HTTPAuth request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L203_C8", "label": "auth_header =", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "vector": [14, 2, 0.3104, 0.0015, 2, 0.4, 0.3333, 774, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = 'OAuth realm=\"%s\"' % realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L205_C8", "label": "if", "type": "if", "loc": [205, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "vector": [4, 2, 0.3157, 0.0061, 2, 0.4, 0.6667, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parameters:\n for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:For_L206_C12", "label": "for k, v", "type": "for", "loc": [206, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L205_C8", "vector": [6, 3, 0.3165, 0.0046, 3, 0.04, 0.0, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L207_C16", "label": "if", "type": "if", "loc": [207, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L206_C12", "vector": [4, 4, 0.3173, 0.0031, 4, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L209_C8", "label": "return", "type": "return", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "vector": [13, 2, 0.3196, 0.0015, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'Authorization': auth_header}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4", "label": "to_postdata", "type": "function", "loc": [211, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3249, 0.0061, 1, 0.94, 0.4074, 745, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "to_postdata", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_postdata(self):\n \"\"\"Serialize as post data for a POST request.\"\"\"\n return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \\\n for k, v in self.parameters.iteritems()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L212_C8", "label": "expression", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4", "vector": [8, 2, 0.3242, 0.0015, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as post data for a POST request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L213_C8", "label": "return", "type": "return", "loc": [213, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4", "vector": [13, 2, 0.3265, 0.0031, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \\\n for k, v in self.parameters.iteritems()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4", "label": "to_url", "type": "function", "loc": [216, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3318, 0.0046, 1, 0.94, 0.4444, 212, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "to_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_url(self):\n \"\"\"Serialize as a URL for a GET request.\"\"\"\n return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L217_C8", "label": "expression", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4", "vector": [8, 2, 0.3318, 0.0015, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as a URL for a GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L218_C8", "label": "return", "type": "return", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4", "vector": [13, 2, 0.3333, 0.0015, 2, 0.16, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "label": "get_normalized_parameters", "type": "function", "loc": [220, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3471, 0.0229, 1, 0.94, 0.4815, 230, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_normalized_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_parameters(self):\n \"\"\"Return a string that contains the parameters that must be signed.\"\"\"\n params = self.parameters\n try:\n # Exclude the signature if it exists.\n del params['oauth_signature']\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L221_C8", "label": "expression", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [8, 2, 0.3379, 0.0015, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a string that contains the parameters that must be signed.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L222_C8", "label": "params =", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [14, 2, 0.3394, 0.0015, 2, 0.1, 0.2, 206, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = self.parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L223_C8", "label": "try", "type": "try", "loc": [223, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [7, 2, 0.344, 0.0076, 2, 0.1, 0.4, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Exclude the signature if it exists.\n del params['oauth_signature']\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L229_C8", "label": "key_values =", "type": "assigned_variable", "loc": [229, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [14, 2, 0.3509, 0.0031, 2, 0.1, 0.6, 287, 5, 0, 0, 0, 0, 0, 5], "semantic": {"name": "key_values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_values = [(escape(_utf8_str(k)), escape(_utf8_str(v))) \\\n for k,v in params.items()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L232_C8", "label": "sort()", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [8, 2, 0.3547, 0.0015, 2, 0.1, 0.8, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " key_values.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L234_C8", "label": "return", "type": "return", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "vector": [13, 2, 0.3578, 0.0015, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join(['%s=%s' % (k, v) for k, v in key_values])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4", "label": "get_normalized_http_method", "type": "function", "loc": [236, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3624, 0.0046, 1, 0.94, 0.5185, 554, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_method", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_method(self):\n \"\"\"Uppercases the http method.\"\"\"\n return self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L237_C8", "label": "expression", "type": "expression", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4", "vector": [8, 2, 0.3624, 0.0015, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Uppercases the http method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L238_C8", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4", "vector": [13, 2, 0.3639, 0.0015, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "label": "get_normalized_http_url", "type": "function", "loc": [240, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3739, 0.0153, 1, 0.94, 0.5556, 60, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_url(self):\n \"\"\"Parses the URL and rebuilds it to be scheme://host/path.\"\"\"\n parts = urlparse.urlparse(self.http_url)\n scheme, netloc, path = parts[:3]\n # Exclude default port numbers.\n if scheme == 'http' and netloc[-3:] == ':80':\n netloc = netloc[:-3]\n elif scheme == 'https' and netloc[-4:] == ':443':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L241_C8", "label": "expression", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "vector": [8, 2, 0.3685, 0.0015, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses the URL and rebuilds it to be scheme://host/path.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L242_C8", "label": "parts = urlparse()", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "vector": [14, 2, 0.37, 0.0015, 2, 0.59, 0.25, 13, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parts = urlparse.urlparse(self.http_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L243_C8", "label": "scheme, netloc, path =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "vector": [14, 2, 0.3716, 0.0015, 2, 0.59, 0.5, 388, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scheme, netloc, path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme, netloc, path = parts[:3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8", "label": "if", "type": "if", "loc": [245, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "vector": [4, 2, 0.3769, 0.0061, 2, 0.59, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if scheme == 'http' and netloc[-3:] == ':80':\n netloc = netloc[:-3]\n elif scheme == 'https' and netloc[-4:] == ':443':\n netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L246_C12", "label": "netloc =", "type": "assigned_variable", "loc": [246, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8", "vector": [14, 3, 0.3761, 0.0015, 3, 0.96, 0.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "netloc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " netloc = netloc[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L247_C8", "label": "if", "type": "if", "loc": [247, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8", "vector": [4, 3, 0.3784, 0.0031, 3, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif scheme == 'https' and netloc[-4:] == ':443':\n netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L248_C12", "label": "netloc =", "type": "assigned_variable", "loc": [248, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L247_C8", "vector": [14, 4, 0.3792, 0.0015, 4, 0.64, 0.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "netloc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L249_C8", "label": "return", "type": "return", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "vector": [13, 2, 0.3807, 0.0015, 2, 0.59, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s://%s%s' % (scheme, netloc, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "label": "sign_request", "type": "function", "loc": [251, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3884, 0.0107, 1, 0.94, 0.5926, 817, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "sign_request", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sign_request(self, signature_method, consumer, token):\n \"\"\"Set the signature parameter to the result of build_signature.\"\"\"\n # Set the signature method.\n self.set_parameter('oauth_signature_method',\n signature_method.get_name())\n # Set the signature.\n self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L252_C8", "label": "expression", "type": "expression", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "vector": [8, 2, 0.3853, 0.0015, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Set the signature parameter to the result of build_signature.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L254_C8", "label": "set_parameter()", "type": "expression", "loc": [254, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "vector": [8, 2, 0.3891, 0.0031, 2, 0.16, 0.5, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature_method',\n signature_method.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L257_C8", "label": "set_parameter()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "vector": [8, 2, 0.393, 0.0015, 2, 0.16, 1.0, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4", "label": "build_signature", "type": "function", "loc": [259, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.3976, 0.0046, 1, 0.94, 0.6296, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, signature_method, consumer, token):\n \"\"\"Calls the build signature method within the signature method.\"\"\"\n return signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L260_C8", "label": "expression", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4", "vector": [8, 2, 0.3976, 0.0015, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls the build signature method within the signature method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L261_C8", "label": "return", "type": "return", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4", "vector": [13, 2, 0.3991, 0.0015, 2, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "label": "from_request", "type": "function", "loc": [263, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.4274, 0.052, 1, 0.94, 0.6667, 713, 0, 5, 1, 0, 0, 0, 9], "semantic": {"name": "from_request", "arg_names": ["http_method", "http_url", "headers", "parameters", "query_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_request(http_method, http_url, headers=None, parameters=None,\n query_string=None):\n \"\"\"Combines multiple parameter sources.\"\"\"\n if parameters is None:\n parameters = {}\n\n # Headers\n if headers and 'Authorization' in headers:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L265_C8", "label": "expression", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [8, 2, 0.4052, 0.0015, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Combines multiple parameter sources.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L266_C8", "label": "if", "type": "if", "loc": [266, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [4, 2, 0.4075, 0.0031, 2, 0.29, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters is None:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L267_C12", "label": "parameters =", "type": "assigned_variable", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L266_C8", "vector": [14, 3, 0.4083, 0.0015, 3, 0.79, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8", "label": "if", "type": "if", "loc": [270, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [4, 2, 0.4213, 0.0183, 2, 0.29, 0.25, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if headers and 'Authorization' in headers:\n auth_header = headers['Authorization']\n # Check that the authorization header is OAuth.\n if auth_header[:6] == 'OAuth ':\n auth_header = auth_header[6:]\n try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L271_C12", "label": "auth_header =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8", "vector": [14, 3, 0.4144, 0.0015, 3, 0.23, 0.0, 774, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = headers['Authorization']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12", "label": "if", "type": "if", "loc": [273, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8", "vector": [4, 3, 0.4235, 0.0138, 3, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_header[:6] == 'OAuth ':\n auth_header = auth_header[6:]\n try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L274_C16", "label": "auth_header =", "type": "assigned_variable", "loc": [274, 274], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12", "vector": [14, 4, 0.419, 0.0015, 4, 0.56, 0.0, 774, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = auth_header[6:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16", "label": "try", "type": "try", "loc": [275, 281], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12", "vector": [7, 4, 0.4251, 0.0107, 4, 0.56, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from '\n 'Authorization header.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L277_C20", "label": "header_params = _split_header()", "type": "assigned_variable", "loc": [277, 277], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16", "vector": [14, 5, 0.4235, 0.0015, 5, 0.56, 0.0, 121, 3, 1, 0, 0, 848, 10, 1], "semantic": {"name": "header_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_header", "annotation": ""}, "snippet": " header_params = OAuthRequest._split_header(auth_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L278_C20", "label": "update()", "type": "expression", "loc": [278, 278], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16", "vector": [8, 5, 0.4251, 0.0015, 5, 0.56, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(header_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8", "label": "if", "type": "if", "loc": [284, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [4, 2, 0.4358, 0.0046, 2, 0.29, 0.375, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if query_string:\n query_params = OAuthRequest._split_url_string(query_string)\n parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L285_C12", "label": "query_params = _split_url_string()", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8", "vector": [14, 3, 0.4358, 0.0015, 3, 0.36, 0.0, 950, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "query_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " query_params = OAuthRequest._split_url_string(query_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L286_C12", "label": "update()", "type": "expression", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8", "vector": [8, 3, 0.4373, 0.0015, 3, 0.36, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L289_C8", "label": "param_str =", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [14, 2, 0.4419, 0.0015, 2, 0.29, 0.5, 886, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "param_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " param_str = urlparse.urlparse(http_url)[4] # query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L290_C8", "label": "url_params = _split_url_string()", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [14, 2, 0.4434, 0.0015, 2, 0.29, 0.625, 664, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "url_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " url_params = OAuthRequest._split_url_string(param_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L291_C8", "label": "update()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [8, 2, 0.445, 0.0015, 2, 0.29, 0.75, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(url_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L293_C8", "label": "if", "type": "if", "loc": [293, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [4, 2, 0.4488, 0.0031, 2, 0.29, 0.875, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters:\n return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L294_C12", "label": "return", "type": "return", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L293_C8", "vector": [13, 3, 0.4495, 0.0015, 3, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "vector": [13, 2, 0.4526, 0.0015, 2, 0.29, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L297_C4", "label": "from_request = staticmethod()", "type": "assigned_variable", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.4541, 0.0015, 1, 0.94, 0.7037, 713, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_request", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_request = staticmethod(from_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "label": "from_consumer_and_token", "type": "function", "loc": [299, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.4778, 0.0428, 1, 0.94, 0.7407, 319, 0, 7, 1, 0, 0, 0, 4], "semantic": {"name": "from_consumer_and_token", "arg_names": ["oauth_consumer", "token", "callback", "verifier", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_consumer_and_token(oauth_consumer, token=None,\n callback=None, verifier=None, http_method=HTTP_METHOD,\n http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n defaults = {\n 'oauth_consumer_key': oauth_consumer.key,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L302_C8", "label": "if", "type": "if", "loc": [302, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [4, 2, 0.4625, 0.0031, 2, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L303_C12", "label": "parameters =", "type": "assigned_variable", "loc": [303, 303], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L302_C8", "vector": [14, 3, 0.4633, 0.0015, 3, 0.62, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L305_C8", "label": "defaults =", "type": "assigned_variable", "loc": [305, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [14, 2, 0.4702, 0.0092, 2, 0.02, 0.2, 233, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "defaults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " defaults = {\n 'oauth_consumer_key': oauth_consumer.key,\n 'oauth_timestamp': generate_timestamp(),\n 'oauth_nonce': generate_nonce(),\n 'oauth_version': OAuthRequest.version,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L312_C8", "label": "update()", "type": "expression", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [8, 2, 0.4771, 0.0015, 2, 0.02, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " defaults.update(parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L313_C8", "label": "parameters =", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [14, 2, 0.4786, 0.0015, 2, 0.02, 0.6, 29, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = defaults"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "label": "if", "type": "if", "loc": [315, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [4, 2, 0.4885, 0.0153, 2, 0.02, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n parameters['oauth_token'] = token.key\n if token.callback:\n parameters['oauth_callback'] = token.callback\n # 1.0a support for verifier.\n if verifier:\n parameters['oauth_verifier'] = verifier\n elif callback:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L316_C12", "label": "assign", "type": "assigned_variable", "loc": [316, 316], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "vector": [14, 3, 0.4832, 0.0015, 3, 0.55, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L317_C12", "label": "if", "type": "if", "loc": [317, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "vector": [4, 3, 0.4855, 0.0031, 3, 0.55, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token.callback:\n parameters['oauth_callback'] = token.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L318_C16", "label": "assign", "type": "assigned_variable", "loc": [318, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L317_C12", "vector": [14, 4, 0.4862, 0.0015, 4, 0.82, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = token.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L320_C12", "label": "if", "type": "if", "loc": [320, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "vector": [4, 3, 0.4901, 0.0031, 3, 0.55, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if verifier:\n parameters['oauth_verifier'] = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L321_C16", "label": "assign", "type": "assigned_variable", "loc": [321, 321], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L320_C12", "vector": [14, 4, 0.4908, 0.0015, 4, 0.83, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_verifier'] = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L322_C8", "label": "if", "type": "if", "loc": [322, 324], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "vector": [4, 3, 0.4939, 0.0046, 3, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callback:\n # 1.0a support for callback in the request token request.\n parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L324_C12", "label": "assign", "type": "assigned_variable", "loc": [324, 324], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L322_C8", "vector": [14, 4, 0.4954, 0.0015, 4, 0.42, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L326_C8", "label": "return", "type": "return", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "vector": [13, 2, 0.4985, 0.0015, 2, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L327_C4", "label": "from_consumer_and_token = staticmethod()", "type": "assigned_variable", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.5, 0.0015, 1, 0.94, 0.7778, 319, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_consumer_and_token", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_consumer_and_token = staticmethod(from_consumer_and_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "label": "from_token_and_callback", "type": "function", "loc": [329, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.5107, 0.0168, 1, 0.94, 0.8148, 823, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "from_token_and_callback", "arg_names": ["token", "callback", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD,\n http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n parameters['oauth_token'] = token.key\n\n if callback:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L331_C8", "label": "if", "type": "if", "loc": [331, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "vector": [4, 2, 0.5069, 0.0031, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L332_C12", "label": "parameters =", "type": "assigned_variable", "loc": [332, 332], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L331_C8", "vector": [14, 3, 0.5076, 0.0015, 3, 0.39, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L334_C8", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "vector": [14, 2, 0.5107, 0.0015, 2, 0.62, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L336_C8", "label": "if", "type": "if", "loc": [336, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "vector": [4, 2, 0.5145, 0.0031, 2, 0.62, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callback:\n parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L337_C12", "label": "assign", "type": "assigned_variable", "loc": [337, 337], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L336_C8", "vector": [14, 3, 0.5153, 0.0015, 3, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L339_C8", "label": "return", "type": "return", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "vector": [13, 2, 0.5183, 0.0015, 2, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L340_C4", "label": "from_token_and_callback = staticmethod()", "type": "assigned_variable", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.5199, 0.0015, 1, 0.94, 0.8519, 823, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_token_and_callback", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_token_and_callback = staticmethod(from_token_and_callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "label": "_split_header", "type": "function", "loc": [342, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.5336, 0.0229, 1, 0.94, 0.8889, 848, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_split_header", "arg_names": ["header"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_header(header):\n \"\"\"Turn Authorization: header into parameters.\"\"\"\n params = {}\n parts = header.split(',')\n for param in parts:\n # Ignore realm parameter.\n if param.find('realm') > -1:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L343_C8", "label": "expression", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "vector": [8, 2, 0.5245, 0.0015, 2, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Turn Authorization: header into parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L344_C8", "label": "params =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "vector": [14, 2, 0.526, 0.0015, 2, 0.9, 0.25, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L345_C8", "label": "parts = split()", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "vector": [14, 2, 0.5275, 0.0015, 2, 0.9, 0.5, 13, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " parts = header.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "label": "for param", "type": "for", "loc": [346, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "vector": [6, 2, 0.5359, 0.0153, 2, 0.9, 0.75, 841, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param in parts:\n # Ignore realm parameter.\n if param.find('realm') > -1:\n continue\n # Remove whitespace.\n param = param.strip()\n # Split key-value.\n param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L348_C12", "label": "if", "type": "if", "loc": [348, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "vector": [4, 3, 0.5329, 0.0031, 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 param.find('realm') > -1:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L351_C12", "label": "param = strip()", "type": "assigned_variable", "loc": [351, 351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "vector": [14, 3, 0.5367, 0.0015, 3, 0.56, 0.3333, 841, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " param = param.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L353_C12", "label": "param_parts = split()", "type": "assigned_variable", "loc": [353, 353], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "vector": [14, 3, 0.5398, 0.0015, 3, 0.56, 0.6667, 328, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "param_parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L355_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [355, 355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "vector": [14, 3, 0.5428, 0.0015, 3, 0.56, 1.0, 0, 3, 1, 0, 0, 432, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\\\"'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L356_C8", "label": "return", "type": "return", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "vector": [13, 2, 0.5443, 0.0015, 2, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L357_C4", "label": "_split_header = staticmethod()", "type": "assigned_variable", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.5459, 0.0015, 1, 0.94, 0.9259, 848, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "_split_header", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " _split_header = staticmethod(_split_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "label": "_split_url_string", "type": "function", "loc": [359, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [2, 1, 0.5528, 0.0092, 1, 0.94, 0.963, 90, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_split_url_string", "arg_names": ["param_str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_url_string(param_str):\n \"\"\"Turn URL string into parameters.\"\"\"\n parameters = cgi.parse_qs(param_str, keep_blank_values=False)\n for k, v in parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L360_C8", "label": "expression", "type": "expression", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "vector": [8, 2, 0.5505, 0.0015, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Turn URL string into parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L361_C8", "label": "parameters = parse_qs()", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "vector": [14, 2, 0.552, 0.0015, 2, 0.16, 0.3333, 29, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " parameters = cgi.parse_qs(param_str, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:For_L362_C8", "label": "for k, v", "type": "for", "loc": [362, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "vector": [6, 2, 0.5543, 0.0031, 2, 0.16, 0.6667, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L363_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [363, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:For_L362_C8", "vector": [14, 3, 0.555, 0.0015, 3, 0.18, 0.0, 0, 3, 1, 0, 0, 432, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L364_C8", "label": "return", "type": "return", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "vector": [13, 2, 0.5566, 0.0015, 2, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L365_C4", "label": "_split_url_string = staticmethod()", "type": "assigned_variable", "loc": [365, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "vector": [14, 1, 0.5581, 0.0015, 1, 0.94, 1.0, 90, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "_split_url_string", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " _split_url_string = staticmethod(_split_url_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "label": "OAuthServer", "type": "class", "loc": [367, 525], "level": 0, "parent": null, "vector": [3, 0, 0.682, 0.2431, 0, 0.66, 0.8077, 779, 0, 18, 0, 0, 186, 0, 52], "semantic": {"name": "OAuthServer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthServer(object):\n \"\"\"A worker to check the validity of a request against a data store.\"\"\"\n timestamp_threshold = 300 # In seconds, five minutes.\n version = VERSION\n signature_methods = None\n data_store = None\n\n def __init__(self, data_store=None, signature_methods=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L368_C4", "label": "expression", "type": "expression", "loc": [368, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [8, 1, 0.5627, 0.0015, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A worker to check the validity of a request against a data store.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L369_C4", "label": "timestamp_threshold =", "type": "assigned_variable", "loc": [369, 369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [14, 1, 0.5642, 0.0015, 1, 0.35, 0.0455, 129, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "timestamp_threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timestamp_threshold = 300 # In seconds, five minutes."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L370_C4", "label": "version =", "type": "assigned_variable", "loc": [370, 370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [14, 1, 0.5657, 0.0015, 1, 0.35, 0.0909, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L371_C4", "label": "signature_methods =", "type": "assigned_variable", "loc": [371, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [14, 1, 0.5673, 0.0015, 1, 0.35, 0.1364, 544, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_methods = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L372_C4", "label": "data_store =", "type": "assigned_variable", "loc": [372, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [14, 1, 0.5688, 0.0015, 1, 0.35, 0.1818, 82, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_store = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4", "label": "__init__", "type": "function", "loc": [374, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.5734, 0.0046, 1, 0.35, 0.2273, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "data_store", "signature_methods"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, data_store=None, signature_methods=None):\n self.data_store = data_store\n self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L375_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4", "vector": [14, 2, 0.5734, 0.0015, 2, 0.67, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L376_C8", "label": "self.signature_methods =", "type": "assigned_variable", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4", "vector": [14, 2, 0.5749, 0.0015, 2, 0.67, 1.0, 94, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L378_C4", "label": "set_data_store", "type": "function", "loc": [378, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.5787, 0.0031, 1, 0.35, 0.2727, 928, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_data_store", "arg_names": ["self", "data_store"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_data_store(self, data_store):\n self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L379_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L378_C4", "vector": [14, 2, 0.5795, 0.0015, 2, 0.93, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L381_C4", "label": "get_data_store", "type": "function", "loc": [381, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.5833, 0.0031, 1, 0.35, 0.3182, 473, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_data_store", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data_store(self):\n return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L382_C8", "label": "return", "type": "return", "loc": [382, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L381_C4", "vector": [13, 2, 0.5841, 0.0015, 2, 0.57, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4", "label": "add_signature_method", "type": "function", "loc": [384, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.5887, 0.0046, 1, 0.35, 0.3636, 134, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add_signature_method", "arg_names": ["self", "signature_method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_signature_method(self, signature_method):\n self.signature_methods[signature_method.get_name()] = signature_method\n return self.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L385_C8", "label": "assign", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4", "vector": [14, 2, 0.5887, 0.0015, 2, 0.8, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods[signature_method.get_name()] = signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L386_C8", "label": "return", "type": "return", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4", "vector": [13, 2, 0.5902, 0.0015, 2, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "label": "fetch_request_token", "type": "function", "loc": [388, 406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.607, 0.0291, 1, 0.35, 0.4091, 255, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n \"\"\"Processes a request_token request and returns the\n request token on success.\n \"\"\"\n try:\n # Get the request token for authorization.\n token = self._get_token(oauth_request, 'request')\n except OAuthError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L389_C8", "label": "expression", "type": "expression", "loc": [389, 391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "vector": [8, 2, 0.5963, 0.0046, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Processes a request_token request and returns the\n request token on success.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "label": "try", "type": "try", "loc": [392, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "vector": [7, 2, 0.6093, 0.0214, 2, 0.29, 0.5, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the request token for authorization.\n token = self._get_token(oauth_request, 'request')\n except OAuthError:\n # No token required for the initial token request.\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L394_C12", "label": "token = _get_token()", "type": "assigned_variable", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [14, 3, 0.6024, 0.0015, 3, 0.02, 0.0, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L397_C12", "label": "version = _get_version()", "type": "assigned_variable", "loc": [397, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [14, 3, 0.607, 0.0015, 3, 0.02, 0.0, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L398_C12", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [14, 3, 0.6086, 0.0015, 3, 0.02, 0.25, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12", "label": "try", "type": "try", "loc": [399, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [7, 3, 0.6124, 0.0061, 3, 0.02, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n callback = self.get_callback(oauth_request)\n except OAuthError:\n callback = None # 1.0, no callback specified."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L400_C16", "label": "callback = get_callback()", "type": "assigned_variable", "loc": [400, 400], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12", "vector": [14, 4, 0.6116, 0.0015, 4, 0.26, 0.0, 342, 3, 1, 0, 0, 564, 10, 1], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "get_callback", "annotation": ""}, "snippet": " callback = self.get_callback(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L402_C16", "label": "callback =", "type": "assigned_variable", "loc": [402, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12", "vector": [14, 4, 0.6147, 0.0015, 4, 0.26, 0.0, 342, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback = None # 1.0, no callback specified."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L403_C12", "label": "_check_signature()", "type": "expression", "loc": [403, 403], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [8, 3, 0.6162, 0.0015, 3, 0.02, 0.75, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L405_C12", "label": "token = fetch_request_token()", "type": "assigned_variable", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "vector": [14, 3, 0.6193, 0.0015, 3, 0.02, 1.0, 129, 3, 2, 0, 0, 255, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_request_token", "annotation": ""}, "snippet": " token = self.data_store.fetch_request_token(consumer, callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L406_C8", "label": "return", "type": "return", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "vector": [13, 2, 0.6208, 0.0015, 2, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "label": "fetch_access_token", "type": "function", "loc": [408, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6346, 0.0229, 1, 0.35, 0.4545, 413, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n \"\"\"Processes an access_token request and returns the\n access token on success.\n \"\"\"\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n try:\n verifier = self._get_verifier(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L409_C8", "label": "expression", "type": "expression", "loc": [409, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [8, 2, 0.6269, 0.0046, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Processes an access_token request and returns the\n access token on success.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L412_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [14, 2, 0.63, 0.0015, 2, 0.13, 0.1429, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L413_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [14, 2, 0.6315, 0.0015, 2, 0.13, 0.2857, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8", "label": "try", "type": "try", "loc": [414, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [7, 2, 0.6353, 0.0061, 2, 0.13, 0.4286, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n verifier = self._get_verifier(oauth_request)\n except OAuthError:\n verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L415_C12", "label": "verifier = _get_verifier()", "type": "assigned_variable", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8", "vector": [14, 3, 0.6346, 0.0015, 3, 0.65, 0.0, 629, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "_get_verifier", "annotation": ""}, "snippet": " verifier = self._get_verifier(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L417_C12", "label": "verifier =", "type": "assigned_variable", "loc": [417, 417], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8", "vector": [14, 3, 0.6376, 0.0015, 3, 0.65, 0.0, 629, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L419_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [14, 2, 0.6407, 0.0015, 2, 0.13, 0.5714, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L420_C8", "label": "_check_signature()", "type": "expression", "loc": [420, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [8, 2, 0.6422, 0.0015, 2, 0.13, 0.7143, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L421_C8", "label": "new_token = fetch_access_token()", "type": "assigned_variable", "loc": [421, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [14, 2, 0.6437, 0.0015, 2, 0.13, 0.8571, 945, 3, 3, 0, 0, 413, 10, 1], "semantic": {"name": "new_token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_access_token", "annotation": ""}, "snippet": " new_token = self.data_store.fetch_access_token(consumer, token, verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L422_C8", "label": "return", "type": "return", "loc": [422, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "vector": [13, 2, 0.6453, 0.0015, 2, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "label": "verify_request", "type": "function", "loc": [424, 433], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6552, 0.0153, 1, 0.35, 0.5, 168, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "verify_request", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_request(self, oauth_request):\n \"\"\"Verifies an api call and checks all the parameters.\"\"\"\n # -> consumer and token\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n # Get the access token.\n token = self._get_token(oauth_request, 'access')\n self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L425_C8", "label": "expression", "type": "expression", "loc": [425, 425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [8, 2, 0.6498, 0.0015, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verifies an api call and checks all the parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L427_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [14, 2, 0.6529, 0.0015, 2, 0.83, 0.1667, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L428_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [14, 2, 0.6544, 0.0015, 2, 0.83, 0.3333, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L430_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [430, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [14, 2, 0.6575, 0.0015, 2, 0.83, 0.5, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'access')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L431_C8", "label": "_check_signature()", "type": "expression", "loc": [431, 431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [8, 2, 0.659, 0.0015, 2, 0.83, 0.6667, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L432_C8", "label": "parameters = get_nonoauth_parameters()", "type": "assigned_variable", "loc": [432, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [14, 2, 0.6606, 0.0015, 2, 0.83, 0.8333, 29, 3, 0, 0, 0, 748, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "get_nonoauth_parameters", "annotation": ""}, "snippet": " parameters = oauth_request.get_nonoauth_parameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L433_C8", "label": "return", "type": "return", "loc": [433, 433], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "vector": [13, 2, 0.6621, 0.0015, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return consumer, token, parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4", "label": "authorize_token", "type": "function", "loc": [435, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6667, 0.0046, 1, 0.35, 0.5455, 36, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "authorize_token", "arg_names": ["self", "token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_token(self, token, user):\n \"\"\"Authorize a request token.\"\"\"\n return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L436_C8", "label": "expression", "type": "expression", "loc": [436, 436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4", "vector": [8, 2, 0.6667, 0.0015, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Authorize a request token.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L437_C8", "label": "return", "type": "return", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4", "vector": [13, 2, 0.6682, 0.0015, 2, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4", "label": "get_callback", "type": "function", "loc": [439, 441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6728, 0.0046, 1, 0.35, 0.5909, 564, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_callback", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_callback(self, oauth_request):\n \"\"\"Get the callback URL.\"\"\"\n return oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L440_C8", "label": "expression", "type": "expression", "loc": [440, 440], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4", "vector": [8, 2, 0.6728, 0.0015, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get the callback URL.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L441_C8", "label": "return", "type": "return", "loc": [441, 441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4", "vector": [13, 2, 0.6743, 0.0015, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4", "label": "build_authenticate_header", "type": "function", "loc": [443, 445], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6789, 0.0046, 1, 0.35, 0.6364, 279, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_authenticate_header(self, realm=''):\n \"\"\"Optional support for the authenticate header.\"\"\"\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L444_C8", "label": "expression", "type": "expression", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4", "vector": [8, 2, 0.6789, 0.0015, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Optional support for the authenticate header.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L445_C8", "label": "return", "type": "return", "loc": [445, 445], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4", "vector": [13, 2, 0.6804, 0.0015, 2, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "label": "_get_version", "type": "function", "loc": [447, 455], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.6896, 0.0138, 1, 0.35, 0.6818, 602, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_version", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_version(self, oauth_request):\n \"\"\"Verify the correct version request for this server.\"\"\"\n try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION\n if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L448_C8", "label": "expression", "type": "expression", "loc": [448, 448], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "vector": [8, 2, 0.685, 0.0015, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify the correct version request for this server.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8", "label": "try", "type": "try", "loc": [449, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "vector": [7, 2, 0.6888, 0.0061, 2, 0.19, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L450_C12", "label": "version = get_parameter()", "type": "assigned_variable", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8", "vector": [14, 3, 0.6881, 0.0015, 3, 0.46, 0.0, 623, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " version = oauth_request.get_parameter('oauth_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L452_C12", "label": "version =", "type": "assigned_variable", "loc": [452, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8", "vector": [14, 3, 0.6911, 0.0015, 3, 0.46, 0.0, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L453_C8", "label": "if", "type": "if", "loc": [453, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "vector": [4, 2, 0.6934, 0.0031, 2, 0.19, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L455_C8", "label": "return", "type": "return", "loc": [455, 455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "vector": [13, 2, 0.6957, 0.0015, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "label": "_get_signature_method", "type": "function", "loc": [457, 472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7102, 0.0245, 1, 0.35, 0.7273, 261, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_signature_method", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_signature_method(self, oauth_request):\n \"\"\"Figure out the signature with some defaults.\"\"\"\n try:\n signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L458_C8", "label": "expression", "type": "expression", "loc": [458, 458], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "vector": [8, 2, 0.7003, 0.0015, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Figure out the signature with some defaults.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8", "label": "try", "type": "try", "loc": [459, 463], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "vector": [7, 2, 0.7049, 0.0076, 2, 0.19, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L460_C12", "label": "signature_method = get_parameter()", "type": "assigned_variable", "loc": [460, 461], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8", "vector": [14, 3, 0.7041, 0.0031, 3, 0.62, 0.0, 352, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L463_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [463, 463], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8", "vector": [14, 3, 0.708, 0.0015, 3, 0.62, 0.0, 352, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8", "label": "try", "type": "try", "loc": [464, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "vector": [7, 2, 0.7141, 0.0107, 2, 0.19, 0.6667, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the signature method object.\n signature_method = self.signature_methods[signature_method]\n except:\n signature_method_names = ', '.join(self.signature_methods.keys())\n raise OAuthError('Signature method %s not supported try one of the '\n 'following: %s' % (signature_method, signature_method_names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L466_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8", "vector": [14, 3, 0.7125, 0.0015, 3, 0.63, 0.0, 352, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = self.signature_methods[signature_method]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L468_C12", "label": "signature_method_names = join()", "type": "assigned_variable", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8", "vector": [14, 3, 0.7156, 0.0015, 3, 0.63, 0.0, 896, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "signature_method_names", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " signature_method_names = ', '.join(self.signature_methods.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L472_C8", "label": "return", "type": "return", "loc": [472, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "vector": [13, 2, 0.7217, 0.0015, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "label": "_get_consumer", "type": "function", "loc": [474, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7286, 0.0092, 1, 0.35, 0.7727, 561, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_consumer", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_consumer(self, oauth_request):\n consumer_key = oauth_request.get_parameter('oauth_consumer_key')\n consumer = self.data_store.lookup_consumer(consumer_key)\n if not consumer:\n raise OAuthError('Invalid consumer.')\n return consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L475_C8", "label": "consumer_key = get_parameter()", "type": "assigned_variable", "loc": [475, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "vector": [14, 2, 0.7263, 0.0015, 2, 0.58, 0.0, 353, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " consumer_key = oauth_request.get_parameter('oauth_consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L476_C8", "label": "consumer = lookup_consumer()", "type": "assigned_variable", "loc": [476, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "vector": [14, 2, 0.7278, 0.0015, 2, 0.58, 0.3333, 352, 3, 1, 0, 0, 718, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_consumer", "annotation": ""}, "snippet": " consumer = self.data_store.lookup_consumer(consumer_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L477_C8", "label": "if", "type": "if", "loc": [477, 478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "vector": [4, 2, 0.7301, 0.0031, 2, 0.58, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer:\n raise OAuthError('Invalid consumer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L479_C8", "label": "return", "type": "return", "loc": [479, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "vector": [13, 2, 0.7324, 0.0015, 2, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "label": "_get_token", "type": "function", "loc": [481, 487], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7401, 0.0107, 1, 0.35, 0.8182, 917, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_get_token", "arg_names": ["self", "oauth_request", "token_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_token(self, oauth_request, token_type='access'):\n \"\"\"Try to find the token for the provided request token key.\"\"\"\n token_field = oauth_request.get_parameter('oauth_token')\n token = self.data_store.lookup_token(token_type, token_field)\n if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))\n return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L482_C8", "label": "expression", "type": "expression", "loc": [482, 482], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "vector": [8, 2, 0.737, 0.0015, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to find the token for the provided request token key.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L483_C8", "label": "token_field = get_parameter()", "type": "assigned_variable", "loc": [483, 483], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "vector": [14, 2, 0.7385, 0.0015, 2, 0.88, 0.25, 531, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "token_field", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " token_field = oauth_request.get_parameter('oauth_token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L484_C8", "label": "token = lookup_token()", "type": "assigned_variable", "loc": [484, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "vector": [14, 2, 0.7401, 0.0015, 2, 0.88, 0.5, 129, 3, 2, 0, 0, 87, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_token", "annotation": ""}, "snippet": " token = self.data_store.lookup_token(token_type, token_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L485_C8", "label": "if", "type": "if", "loc": [485, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "vector": [4, 2, 0.7424, 0.0031, 2, 0.88, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L487_C8", "label": "return", "type": "return", "loc": [487, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "vector": [13, 2, 0.7446, 0.0015, 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 token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L489_C4", "label": "_get_verifier", "type": "function", "loc": [489, 490], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7485, 0.0031, 1, 0.35, 0.8636, 956, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_verifier", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_verifier(self, oauth_request):\n return oauth_request.get_parameter('oauth_verifier')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L490_C8", "label": "return", "type": "return", "loc": [490, 490], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L489_C4", "vector": [13, 2, 0.7492, 0.0015, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return oauth_request.get_parameter('oauth_verifier')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "label": "_check_signature", "type": "function", "loc": [492, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7653, 0.0275, 1, 0.35, 0.9091, 740, 0, 4, 0, 0, 0, 0, 10], "semantic": {"name": "_check_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_signature(self, oauth_request, consumer, token):\n timestamp, nonce = oauth_request._get_timestamp_nonce()\n self._check_timestamp(timestamp)\n self._check_nonce(consumer, token, nonce)\n signature_method = self._get_signature_method(oauth_request)\n try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L493_C8", "label": "timestamp, nonce = _get_timestamp_nonce()", "type": "assigned_variable", "loc": [493, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [14, 2, 0.7538, 0.0015, 2, 0.12, 0.0, 88, 3, 0, 0, 0, 211, 10, 1], "semantic": {"name": "timestamp, nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_get_timestamp_nonce", "annotation": ""}, "snippet": " timestamp, nonce = oauth_request._get_timestamp_nonce()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L494_C8", "label": "_check_timestamp()", "type": "expression", "loc": [494, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [8, 2, 0.7554, 0.0015, 2, 0.12, 0.1429, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "_check_timestamp", "annotation": ""}, "snippet": " self._check_timestamp(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L495_C8", "label": "_check_nonce()", "type": "expression", "loc": [495, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [8, 2, 0.7569, 0.0015, 2, 0.12, 0.2857, 731, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_check_nonce", "annotation": ""}, "snippet": " self._check_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L496_C8", "label": "signature_method = _get_signature_method()", "type": "assigned_variable", "loc": [496, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [14, 2, 0.7584, 0.0015, 2, 0.12, 0.4286, 352, 3, 1, 0, 0, 261, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "_get_signature_method", "annotation": ""}, "snippet": " signature_method = self._get_signature_method(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L497_C8", "label": "try", "type": "try", "loc": [497, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [7, 2, 0.7622, 0.0061, 2, 0.12, 0.5714, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:\n raise OAuthError('Missing signature.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L498_C12", "label": "signature = get_parameter()", "type": "assigned_variable", "loc": [498, 498], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L497_C8", "vector": [14, 3, 0.7615, 0.0015, 3, 0.4, 0.0, 932, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature = oauth_request.get_parameter('oauth_signature')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L502_C8", "label": "valid_sig = check_signature()", "type": "assigned_variable", "loc": [502, 503], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [14, 2, 0.7683, 0.0031, 2, 0.12, 0.7143, 108, 3, 4, 0, 0, 862, 10, 1], "semantic": {"name": "valid_sig", "arg_names": [], "import_names": [], "rhs_call_name": "check_signature", "annotation": ""}, "snippet": " valid_sig = signature_method.check_signature(oauth_request, consumer,\n token, signature)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L504_C8", "label": "if", "type": "if", "loc": [504, 508], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [4, 2, 0.7737, 0.0076, 2, 0.12, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not valid_sig:\n key, base = signature_method.build_signature_base_string(\n oauth_request, consumer, token)\n raise OAuthError('Invalid signature. Expected signature base '\n 'string: %s' % base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L505_C12", "label": "key, base = build_signature_base_string()", "type": "assigned_variable", "loc": [505, 506], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L504_C8", "vector": [14, 3, 0.7729, 0.0031, 3, 0.91, 0.0, 994, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, base", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, base = signature_method.build_signature_base_string(\n oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L509_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [509, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "vector": [14, 2, 0.7783, 0.0015, 2, 0.12, 1.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = signature_method.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "label": "_check_timestamp", "type": "function", "loc": [511, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7875, 0.0138, 1, 0.35, 0.9545, 607, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "_check_timestamp", "arg_names": ["self", "timestamp"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_timestamp(self, timestamp):\n \"\"\"Verify that timestamp is recentish.\"\"\"\n timestamp = int(timestamp)\n now = int(time.time())\n lapsed = abs(now - timestamp)\n if lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a '\n 'greater difference than threshold %d' %"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L512_C8", "label": "expression", "type": "expression", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "vector": [8, 2, 0.7829, 0.0015, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify that timestamp is recentish.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L513_C8", "label": "timestamp = int()", "type": "assigned_variable", "loc": [513, 513], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "vector": [14, 2, 0.7844, 0.0015, 2, 0.33, 0.25, 834, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " timestamp = int(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L514_C8", "label": "now = int()", "type": "assigned_variable", "loc": [514, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "vector": [14, 2, 0.7859, 0.0015, 2, 0.33, 0.5, 894, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " now = int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L515_C8", "label": "lapsed = abs()", "type": "assigned_variable", "loc": [515, 515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "vector": [14, 2, 0.7875, 0.0015, 2, 0.33, 0.75, 793, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "lapsed", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " lapsed = abs(now - timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L516_C8", "label": "if", "type": "if", "loc": [516, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "vector": [4, 2, 0.7913, 0.0061, 2, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a '\n 'greater difference than threshold %d' %\n (timestamp, now, self.timestamp_threshold))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "label": "_check_nonce", "type": "function", "loc": [521, 525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "vector": [2, 1, 0.7997, 0.0076, 1, 0.35, 1.0, 731, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "_check_nonce", "arg_names": ["self", "consumer", "token", "nonce"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_nonce(self, consumer, token, nonce):\n \"\"\"Verify that the nonce is uniqueish.\"\"\"\n nonce = self.data_store.lookup_nonce(consumer, token, nonce)\n if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L522_C8", "label": "expression", "type": "expression", "loc": [522, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "vector": [8, 2, 0.7982, 0.0015, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify that the nonce is uniqueish.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L523_C8", "label": "nonce = lookup_nonce()", "type": "assigned_variable", "loc": [523, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "vector": [14, 2, 0.7997, 0.0015, 2, 0.76, 0.5, 116, 3, 3, 0, 0, 379, 10, 1], "semantic": {"name": "nonce", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_nonce", "annotation": ""}, "snippet": " nonce = self.data_store.lookup_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L524_C8", "label": "if", "type": "if", "loc": [524, 525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "vector": [4, 2, 0.802, 0.0031, 2, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "label": "OAuthClient", "type": "class", "loc": [528, 553], "level": 0, "parent": null, "vector": [3, 0, 0.8265, 0.0398, 0, 0.66, 0.8462, 840, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthClient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthClient(object):\n \"\"\"OAuthClient is a worker to attempt to execute a request.\"\"\"\n consumer = None\n token = None\n\n def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L529_C4", "label": "expression", "type": "expression", "loc": [529, 529], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [8, 1, 0.8089, 0.0015, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthClient is a worker to attempt to execute a request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L530_C4", "label": "consumer =", "type": "assigned_variable", "loc": [530, 530], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [14, 1, 0.8104, 0.0015, 1, 0.28, 0.125, 352, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L531_C4", "label": "token =", "type": "assigned_variable", "loc": [531, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [14, 1, 0.8119, 0.0015, 1, 0.28, 0.25, 129, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4", "label": "__init__", "type": "function", "loc": [533, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.8165, 0.0046, 1, 0.28, 0.375, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L534_C8", "label": "self.consumer =", "type": "assigned_variable", "loc": [534, 534], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4", "vector": [14, 2, 0.8165, 0.0015, 2, 0.36, 0.0, 33, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.consumer = oauth_consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L535_C8", "label": "self.token =", "type": "assigned_variable", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4", "vector": [14, 2, 0.818, 0.0015, 2, 0.36, 1.0, 150, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L537_C4", "label": "get_consumer", "type": "function", "loc": [537, 538], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.8219, 0.0031, 1, 0.28, 0.5, 408, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_consumer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_consumer(self):\n return self.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L538_C8", "label": "return", "type": "return", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L537_C4", "vector": [13, 2, 0.8226, 0.0015, 2, 0.53, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L540_C4", "label": "get_token", "type": "function", "loc": [540, 541], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.8265, 0.0031, 1, 0.28, 0.625, 224, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_token", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_token(self):\n return self.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L541_C8", "label": "return", "type": "return", "loc": [541, 541], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L540_C4", "vector": [13, 2, 0.8272, 0.0015, 2, 0.82, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L543_C4", "label": "fetch_request_token", "type": "function", "loc": [543, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.8318, 0.0046, 1, 0.28, 0.75, 255, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L544_C8", "label": "expression", "type": "expression", "loc": [544, 544], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L543_C4", "vector": [8, 2, 0.8318, 0.0015, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L547_C4", "label": "fetch_access_token", "type": "function", "loc": [547, 549], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.8379, 0.0046, 1, 0.28, 0.875, 413, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L548_C8", "label": "expression", "type": "expression", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L547_C4", "vector": [8, 2, 0.8379, 0.0015, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L551_C4", "label": "access_resource", "type": "function", "loc": [551, 553], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "vector": [2, 1, 0.844, 0.0046, 1, 0.28, 1.0, 654, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "access_resource", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def access_resource(self, oauth_request):\n \"\"\"-> Some protected resource.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L552_C8", "label": "expression", "type": "expression", "loc": [552, 552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L551_C4", "vector": [8, 2, 0.844, 0.0015, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> Some protected resource.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "label": "OAuthDataStore", "type": "class", "loc": [556, 581], "level": 0, "parent": null, "vector": [3, 0, 0.8693, 0.0398, 0, 0.66, 0.8846, 257, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthDataStore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthDataStore(object):\n \"\"\"A database abstraction used to lookup consumers and tokens.\"\"\"\n\n def lookup_consumer(self, key):\n \"\"\"-> OAuthConsumer.\"\"\"\n raise NotImplementedError\n\n def lookup_token(self, oauth_consumer, token_type, token_token):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L557_C4", "label": "expression", "type": "expression", "loc": [557, 557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [8, 1, 0.8517, 0.0015, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A database abstraction used to lookup consumers and tokens.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L559_C4", "label": "lookup_consumer", "type": "function", "loc": [559, 561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8563, 0.0046, 1, 0.46, 0.1667, 718, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_consumer", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_consumer(self, key):\n \"\"\"-> OAuthConsumer.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L560_C8", "label": "expression", "type": "expression", "loc": [560, 560], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L559_C4", "vector": [8, 2, 0.8563, 0.0015, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthConsumer.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L563_C4", "label": "lookup_token", "type": "function", "loc": [563, 565], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8624, 0.0046, 1, 0.46, 0.3333, 87, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_token", "arg_names": ["self", "oauth_consumer", "token_type", "token_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_token(self, oauth_consumer, token_type, token_token):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L564_C8", "label": "expression", "type": "expression", "loc": [564, 564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L563_C4", "vector": [8, 2, 0.8624, 0.0015, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L567_C4", "label": "lookup_nonce", "type": "function", "loc": [567, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8685, 0.0046, 1, 0.46, 0.5, 379, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_nonce", "arg_names": ["self", "oauth_consumer", "oauth_token", "nonce"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_nonce(self, oauth_consumer, oauth_token, nonce):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L568_C8", "label": "expression", "type": "expression", "loc": [568, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L567_C4", "vector": [8, 2, 0.8685, 0.0015, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L571_C4", "label": "fetch_request_token", "type": "function", "loc": [571, 573], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8746, 0.0046, 1, 0.46, 0.6667, 255, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_consumer", "oauth_callback"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_consumer, oauth_callback):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L572_C8", "label": "expression", "type": "expression", "loc": [572, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L571_C4", "vector": [8, 2, 0.8746, 0.0015, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L575_C4", "label": "fetch_access_token", "type": "function", "loc": [575, 577], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8807, 0.0046, 1, 0.46, 0.8333, 413, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_consumer", "oauth_token", "oauth_verifier"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_consumer, oauth_token, oauth_verifier):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L576_C8", "label": "expression", "type": "expression", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L575_C4", "vector": [8, 2, 0.8807, 0.0015, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L579_C4", "label": "authorize_request_token", "type": "function", "loc": [579, 581], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "vector": [2, 1, 0.8869, 0.0046, 1, 0.46, 1.0, 879, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "authorize_request_token", "arg_names": ["self", "oauth_token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_request_token(self, oauth_token, user):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L580_C8", "label": "expression", "type": "expression", "loc": [580, 580], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L579_C4", "vector": [8, 2, 0.8869, 0.0015, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "label": "OAuthSignatureMethod", "type": "class", "loc": [584, 600], "level": 0, "parent": null, "vector": [3, 0, 0.9052, 0.026, 0, 0.66, 0.9231, 310, 0, 4, 0, 0, 186, 0, 1], "semantic": {"name": "OAuthSignatureMethod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod(object):\n \"\"\"A strategy class that implements a signature method.\"\"\"\n def get_name(self):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError\n\n def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str key, str raw.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L585_C4", "label": "expression", "type": "expression", "loc": [585, 585], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "vector": [8, 1, 0.8945, 0.0015, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A strategy class that implements a signature method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L586_C4", "label": "get_name", "type": "function", "loc": [586, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "vector": [2, 1, 0.8976, 0.0046, 1, 0.06, 0.25, 770, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L587_C8", "label": "expression", "type": "expression", "loc": [587, 587], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L586_C4", "vector": [8, 2, 0.8976, 0.0015, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L590_C4", "label": "build_signature_base_string", "type": "function", "loc": [590, 592], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "vector": [2, 1, 0.9037, 0.0046, 1, 0.06, 0.5, 910, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str key, str raw.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L591_C8", "label": "expression", "type": "expression", "loc": [591, 591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L590_C4", "vector": [8, 2, 0.9037, 0.0015, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str key, str raw.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L594_C4", "label": "build_signature", "type": "function", "loc": [594, 596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "vector": [2, 1, 0.9098, 0.0046, 1, 0.06, 0.75, 181, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L595_C8", "label": "expression", "type": "expression", "loc": [595, 595], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L594_C4", "vector": [8, 2, 0.9098, 0.0015, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4", "label": "check_signature", "type": "function", "loc": [598, 600], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "vector": [2, 1, 0.9159, 0.0046, 1, 0.06, 1.0, 862, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "check_signature", "arg_names": ["self", "oauth_request", "consumer", "token", "signature"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_signature(self, oauth_request, consumer, token, signature):\n built = self.build_signature(oauth_request, consumer, token)\n return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L599_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [599, 599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4", "vector": [14, 2, 0.9159, 0.0015, 2, 0.39, 0.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = self.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L600_C8", "label": "return", "type": "return", "loc": [600, 600], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4", "vector": [13, 2, 0.9174, 0.0015, 2, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "label": "OAuthSignatureMethod_HMAC_SHA1", "type": "class", "loc": [603, 636], "level": 0, "parent": null, "vector": [3, 0, 0.9472, 0.052, 0, 0.66, 0.9615, 605, 0, 3, 0, 0, 310, 0, 14], "semantic": {"name": "OAuthSignatureMethod_HMAC_SHA1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod):\n\n def get_name(self):\n return 'HMAC-SHA1'\n \n def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L605_C4", "label": "get_name", "type": "function", "loc": [605, 606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "vector": [2, 1, 0.9258, 0.0031, 1, 0.59, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L606_C8", "label": "return", "type": "return", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L605_C4", "vector": [13, 2, 0.9266, 0.0015, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "label": "build_signature_base_string", "type": "function", "loc": [608, 620], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "vector": [2, 1, 0.9388, 0.0199, 1, 0.59, 0.5, 910, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )\n\n key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L609_C8", "label": "sig =", "type": "assigned_variable", "loc": [609, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "vector": [14, 2, 0.9343, 0.0076, 2, 0.64, 0.0, 899, 0, 0, 0, 0, 0, 8, 6], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L615_C8", "label": "key =", "type": "assigned_variable", "loc": [615, 615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "vector": [14, 2, 0.9404, 0.0015, 2, 0.64, 0.25, 230, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L616_C8", "label": "if", "type": "if", "loc": [616, 617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "vector": [4, 2, 0.9427, 0.0031, 2, 0.64, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n key += escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L619_C8", "label": "raw = join()", "type": "assigned_variable", "loc": [619, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "vector": [14, 2, 0.9465, 0.0015, 2, 0.64, 0.75, 23, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "raw", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " raw = '&'.join(sig)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L620_C8", "label": "return", "type": "return", "loc": [620, 620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "vector": [13, 2, 0.948, 0.0015, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key, raw"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "label": "build_signature", "type": "function", "loc": [622, 636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "vector": [2, 1, 0.9618, 0.0229, 1, 0.59, 1.0, 181, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n \"\"\"Builds the base signature string.\"\"\"\n key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)\n\n # HMAC object.\n try:\n import hashlib # 2.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L623_C8", "label": "expression", "type": "expression", "loc": [623, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "vector": [8, 2, 0.9526, 0.0015, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Builds the base signature string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L624_C8", "label": "key, raw = build_signature_base_string()", "type": "assigned_variable", "loc": [624, 625], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "vector": [14, 2, 0.9549, 0.0031, 2, 0.82, 0.3333, 864, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, raw", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "label": "try", "type": "try", "loc": [628, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "vector": [7, 2, 0.9641, 0.0092, 2, 0.82, 0.6667, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import hashlib # 2.5\n hashed = hmac.new(key, raw, hashlib.sha1)\n except:\n import sha # Deprecated\n hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L629_C12", "label": "hashlib import hashlib", "type": "import", "loc": [629, 629], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "vector": [1, 3, 0.9618, 0.0015, 3, 0.15, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hashlib # 2.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L630_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [630, 630], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "vector": [14, 3, 0.9633, 0.0015, 3, 0.15, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, hashlib.sha1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L632_C12", "label": "sha import sha", "type": "import", "loc": [632, 632], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "vector": [1, 3, 0.9664, 0.0015, 3, 0.15, 0.0, 263, 0, 1, 0, 0, 263, 0, 0], "semantic": {"name": "sha", "arg_names": [], "import_names": ["sha"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sha # Deprecated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L633_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [633, 633], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "vector": [14, 3, 0.9679, 0.0015, 3, 0.15, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L636_C8", "label": "return", "type": "return", "loc": [636, 636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "vector": [13, 2, 0.9725, 0.0015, 2, 0.82, 1.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return binascii.b2a_base64(hashed.digest())[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "label": "OAuthSignatureMethod_PLAINTEXT", "type": "class", "loc": [639, 654], "level": 0, "parent": null, "vector": [3, 0, 0.9885, 0.0245, 0, 0.66, 1.0, 935, 0, 3, 0, 0, 310, 0, 3], "semantic": {"name": "OAuthSignatureMethod_PLAINTEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod):\n\n def get_name(self):\n return 'PLAINTEXT'\n\n def build_signature_base_string(self, oauth_request, consumer, token):\n \"\"\"Concatenates the consumer key and secret.\"\"\"\n sig = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L641_C4", "label": "get_name", "type": "function", "loc": [641, 642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "vector": [2, 1, 0.9809, 0.0031, 1, 0.37, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L642_C8", "label": "return", "type": "return", "loc": [642, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L641_C4", "vector": [13, 2, 0.9817, 0.0015, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "label": "build_signature_base_string", "type": "function", "loc": [644, 649], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "vector": [2, 1, 0.9885, 0.0092, 1, 0.37, 0.5, 910, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n \"\"\"Concatenates the consumer key and secret.\"\"\"\n sig = '%s&' % escape(consumer.secret)\n if token:\n sig = sig + escape(token.secret)\n return sig, sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L645_C8", "label": "expression", "type": "expression", "loc": [645, 645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "vector": [8, 2, 0.9862, 0.0015, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Concatenates the consumer key and secret.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L646_C8", "label": "sig =", "type": "assigned_variable", "loc": [646, 646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "vector": [14, 2, 0.9878, 0.0015, 2, 0.43, 0.3333, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:If_L647_C8", "label": "if", "type": "if", "loc": [647, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "vector": [4, 2, 0.9901, 0.0031, 2, 0.43, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L648_C12", "label": "sig =", "type": "assigned_variable", "loc": [648, 648], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:If_L647_C8", "vector": [14, 3, 0.9908, 0.0015, 3, 0.04, 0.0, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L649_C8", "label": "return", "type": "return", "loc": [649, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "vector": [13, 2, 0.9924, 0.0015, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sig, sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4", "label": "build_signature", "type": "function", "loc": [651, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "vector": [2, 1, 0.9977, 0.0061, 1, 0.37, 1.0, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)\n return key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L652_C8", "label": "key, raw = build_signature_base_string()", "type": "assigned_variable", "loc": [652, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4", "vector": [14, 2, 0.9977, 0.0031, 2, 0.62, 0.0, 864, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, raw", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L654_C8", "label": "return", "type": "return", "loc": [654, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4", "vector": [13, 2, 1.0, 0.0015, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:For_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L195_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L197_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L198_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:For_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L206_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L207_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L246_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L245_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L274_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L277_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L278_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L316_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L318_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L320_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L321_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L324_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L331_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L337_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L348_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L353_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:For_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:For_L362_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L400_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L402_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L435_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L449_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L452_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L460_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L459_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L463_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L466_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L479_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L482_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L496_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L497_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L498_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L502_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L504_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L504_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L505_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L509_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L515_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L524_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L530_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L534_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L540_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L540_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L544_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L547_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L551_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L557_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L559_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L559_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L563_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L567_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L571_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L575_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L575_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L579_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L585_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L594_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L594_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L595_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L599_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L600_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L609_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L615_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L616_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L620_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L629_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L630_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Import_L632_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L633_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L641_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Expr_L645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:If_L647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:If_L647_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L648_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L649_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Assign_L652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_145:FunctionDef_L651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_145:Return_L654_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
weibo API library
"""
__version__ = '1.5'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel
from weibopy.error import WeibopError
from weibopy.api import API
from weibopy.cache import Cache, MemoryCache, FileCache
from weibopy.auth import BasicAuthHandler, OAuthHandler
from weibopy.streaming import Stream, StreamListener
from weibopy.cursor import Cursor
# Global, unauthenticated instance of API
api = API()
def debug(enable=True, level=1):
import httplib
httplib.HTTPConnection.debuglevel = level
| ajibawa-2023/Python-Code-Large/train/row_149 | 15 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_149:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.2222, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nweibo API library\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L8_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2963, 0.037, 0, 0.66, 0.0833, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '1.5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L9_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.037, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Joshua Roesslein'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L10_C0", "label": "__license__ =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3704, 0.037, 0, 0.66, 0.25, 11, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__license__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__license__ = 'MIT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L12_C0", "label": "from weibopy.models import Status, User, DirectMessage\u2026", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.4444, 0.037, 0, 0.66, 0.3333, 659, 0, 8, 0, 0, 659, 0, 0], "semantic": {"name": "weibopy.models", "arg_names": [], "import_names": ["Status", "User", "DirectMessage", "Friendship", "SavedSearch", "SearchResult", "ModelFactory", "IDSModel"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L13_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.4815, 0.037, 0, 0.66, 0.4167, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L14_C0", "label": "from weibopy.api import API", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.5185, 0.037, 0, 0.66, 0.5, 947, 0, 1, 0, 0, 947, 0, 0], "semantic": {"name": "weibopy.api", "arg_names": [], "import_names": ["API"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.api import API"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L15_C0", "label": "from weibopy.cache import Cache, MemoryCache, FileCache", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.5556, 0.037, 0, 0.66, 0.5833, 656, 0, 3, 0, 0, 656, 0, 0], "semantic": {"name": "weibopy.cache", "arg_names": [], "import_names": ["Cache", "MemoryCache", "FileCache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.cache import Cache, MemoryCache, FileCache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L16_C0", "label": "from weibopy.auth import BasicAuthHandler, OAuthHandler", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.5926, 0.037, 0, 0.66, 0.6667, 550, 0, 2, 0, 0, 550, 0, 0], "semantic": {"name": "weibopy.auth", "arg_names": [], "import_names": ["BasicAuthHandler", "OAuthHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.auth import BasicAuthHandler, OAuthHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L17_C0", "label": "from weibopy.streaming import Stream, StreamListener", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.6296, 0.037, 0, 0.66, 0.75, 523, 0, 2, 0, 0, 523, 0, 0], "semantic": {"name": "weibopy.streaming", "arg_names": [], "import_names": ["Stream", "StreamListener"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.streaming import Stream, StreamListener"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:ImportFrom_L18_C0", "label": "from weibopy.cursor import Cursor", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.037, 0, 0.66, 0.8333, 482, 0, 1, 0, 0, 482, 0, 0], "semantic": {"name": "weibopy.cursor", "arg_names": [], "import_names": ["Cursor"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.cursor import Cursor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L21_C0", "label": "api = API()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.7778, 0.037, 0, 0.66, 0.9167, 976, 3, 0, 0, 0, 839, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "API", "annotation": ""}, "snippet": "api = API()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "label": "debug", "type": "function", "loc": [23, 26], "level": 0, "parent": null, "vector": [2, 0, 0.9074, 0.1481, 0, 0.66, 1.0, 924, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "debug", "arg_names": ["enable", "level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def debug(enable=True, level=1):\n\n import httplib\n httplib.HTTPConnection.debuglevel = level"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Import_L25_C4", "label": "httplib import httplib", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "vector": [1, 1, 0.9259, 0.037, 1, 0.7, 0.0, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L26_C4", "label": "httplib.HTTPConnection.debuglevel =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "vector": [14, 1, 0.963, 0.037, 1, 0.7, 1.0, 92, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "httplib.HTTPConnection.debuglevel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " httplib.HTTPConnection.debuglevel = level"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_149:Import_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_149:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_149:Assign_L26_C4"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import os
import mimetypes
from weibopy.binder import bind_api
from weibopy.error import WeibopError
from weibopy.parsers import ModelParser
class API(object):
"""Twitter API"""
def __init__(self, auth_handler=None,
host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',
cache=None, secure=False, api_root='', search_root='',
retry_count=0, retry_delay=0, retry_errors=None,source=None,
parser=None, log = None):
self.auth = auth_handler
self.host = host
if source == None:
if auth_handler != None:
self.source = self.auth._consumer.key
else:
self.source = source
self.search_host = search_host
self.api_root = api_root
self.search_root = search_root
self.cache = cache
self.secure = secure
self.retry_count = retry_count
self.retry_delay = retry_delay
self.retry_errors = retry_errors
self.parser = parser or ModelParser()
self.log = log
""" statuses/public_timeline """
public_timeline = bind_api(
path = '/statuses/public_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = []
)
""" statuses/home_timeline """
home_timeline = bind_api(
path = '/statuses/home_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/friends_timeline """
friends_timeline = bind_api(
path = '/statuses/friends_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/comment """
comment = bind_api(
path = '/statuses/comment.json',
method = 'POST',
payload_type = 'comments',
allowed_param = ['id', 'cid', 'comment'],
require_auth = True
)
""" statuses/comment_destroy """
comment_destroy = bind_api(
path = '/statuses/comment_destroy/{id}.json',
method = 'POST',
payload_type = 'comments',
allowed_param = ['id'],
require_auth = True
)
""" statuses/comments_timeline """
comments = bind_api(
path = '/statuses/comments.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['id', 'count', 'page'],
require_auth = True
)
""" statuses/comments_timeline """
comments_timeline = bind_api(
path = '/statuses/comments_timeline.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/comments_by_me """
comments_by_me = bind_api(
path = '/statuses/comments_by_me.json',
payload_type = 'comments', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/user_timeline """
user_timeline = bind_api(
path = '/statuses/user_timeline.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'since_id',
'max_id', 'count', 'page']
)
""" statuses/mentions """
mentions = bind_api(
path = '/statuses/mentions.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/counts """
counts = bind_api(
path = '/statuses/counts.json',
payload_type = 'counts', payload_list = True,
allowed_param = ['ids'],
require_auth = True
)
""" statuses/unread """
unread = bind_api(
path = '/statuses/unread.json',
payload_type = 'counts'
)
""" statuses/retweeted_by_me """
retweeted_by_me = bind_api(
path = '/statuses/retweeted_by_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/retweeted_to_me """
retweeted_to_me = bind_api(
path = '/statuses/retweeted_to_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/retweets_of_me """
retweets_of_me = bind_api(
path = '/statuses/retweets_of_me.json',
payload_type = 'status', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" statuses/show """
get_status = bind_api(
path = '/statuses/show.json',
payload_type = 'status',
allowed_param = ['id']
)
""" statuses/update """
update_status = bind_api(
path = '/statuses/update.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['status', 'lat', 'long', 'source'],
require_auth = True
)
""" statuses/upload """
def upload(self, filename, status, lat=None, long=None, source=None):
if source is None:
source=self.source
headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname="pic")
args = [status]
allowed_param = ['status']
if lat is not None:
args.append(lat)
allowed_param.append('lat')
if long is not None:
args.append(long)
allowed_param.append('long')
if source is not None:
args.append(source)
allowed_param.append('source')
return bind_api(
path = '/statuses/upload.json',
method = 'POST',
payload_type = 'status',
require_auth = True,
allowed_param = allowed_param
)(self, *args, post_data=post_data, headers=headers)
""" statuses/reply """
reply = bind_api(
path = '/statuses/reply.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id', 'cid','comment'],
require_auth = True
)
""" statuses/repost """
repost = bind_api(
path = '/statuses/repost.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id', 'status'],
require_auth = True
)
""" statuses/destroy """
destroy_status = bind_api(
path = '/statuses/destroy/{id}.json',
method = 'DELETE',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" statuses/retweet """
retweet = bind_api(
path = '/statuses/retweet/{id}.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" statuses/retweets """
retweets = bind_api(
path = '/statuses/retweets/{id}.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'count'],
require_auth = True
)
""" users/show """
get_user = bind_api(
path = '/users/show.json',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name']
)
""" Get the authenticated user """
def me(self):
return self.get_user(screen_name=self.auth.get_username())
""" users/search """
search_users = bind_api(
path = '/users/search.json',
payload_type = 'user', payload_list = True,
require_auth = True,
allowed_param = ['q', 'per_page', 'page']
)
""" statuses/friends """
friends = bind_api(
path = '/statuses/friends.json',
payload_type = 'user', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']
)
""" statuses/followers """
followers = bind_api(
path = '/statuses/followers.json',
payload_type = 'user', payload_list = True,
allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']
)
""" direct_messages """
direct_messages = bind_api(
path = '/direct_messages.json',
payload_type = 'direct_message', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" direct_messages/sent """
sent_direct_messages = bind_api(
path = '/direct_messages/sent.json',
payload_type = 'direct_message', payload_list = True,
allowed_param = ['since_id', 'max_id', 'count', 'page'],
require_auth = True
)
""" direct_messages/new """
new_direct_message = bind_api(
path = '/direct_messages/new.json',
method = 'POST',
payload_type = 'direct_message',
allowed_param = ['id', 'screen_name', 'user_id', 'text'],
require_auth = True
)
""" direct_messages/destroy """
destroy_direct_message = bind_api(
path = '/direct_messages/destroy/{id}.json',
method = 'DELETE',
payload_type = 'direct_message',
allowed_param = ['id'],
require_auth = True
)
""" friendships/create """
create_friendship = bind_api(
path = '/friendships/create.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name', 'follow'],
require_auth = True
)
""" friendships/destroy """
destroy_friendship = bind_api(
path = '/friendships/destroy.json',
method = 'DELETE',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" friendships/exists """
exists_friendship = bind_api(
path = '/friendships/exists.json',
payload_type = 'json',
allowed_param = ['user_a', 'user_b']
)
""" friendships/show """
show_friendship = bind_api(
path = '/friendships/show.json',
payload_type = 'friendship',
allowed_param = ['source_id', 'source_screen_name',
'target_id', 'target_screen_name']
)
""" friends/ids """
friends_ids = bind_api(
path = '/friends/ids.json',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name', 'cursor', 'count'],
require_auth = True
)
""" followers/ids """
followers_ids = bind_api(
path = '/followers/ids.json',
payload_type = 'json',
allowed_param = ['id', 'page'],
)
""" account/verify_credentials """
def verify_credentials(self):
try:
return bind_api(
path = '/account/verify_credentials.json',
payload_type = 'user',
require_auth = True
)(self)
except WeibopError:
return False
""" account/rate_limit_status """
rate_limit_status = bind_api(
path = '/account/rate_limit_status.json',
payload_type = 'json'
)
""" account/update_delivery_device """
set_delivery_device = bind_api(
path = '/account/update_delivery_device.json',
method = 'POST',
allowed_param = ['device'],
payload_type = 'user',
require_auth = True
)
""" account/update_profile_colors """
update_profile_colors = bind_api(
path = '/account/update_profile_colors.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['profile_background_color', 'profile_text_color',
'profile_link_color', 'profile_sidebar_fill_color',
'profile_sidebar_border_color'],
require_auth = True
)
""" account/update_profile_image """
def update_profile_image(self, filename):
headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)
return bind_api(
path = '/account/update_profile_image.json',
method = 'POST',
payload_type = 'user',
require_auth = True
)(self, post_data=post_data, headers=headers)
""" account/update_profile_background_image """
def update_profile_background_image(self, filename, *args, **kargs):
headers, post_data = API._pack_image(filename, 800)
bind_api(
path = '/account/update_profile_background_image.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['tile'],
require_auth = True
)(self, post_data=post_data, headers=headers)
""" account/update_profile """
update_profile = bind_api(
path = '/account/update_profile.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['name', 'url', 'location', 'description'],
require_auth = True
)
""" favorites """
favorites = bind_api(
path = '/favorites/{id}.json',
payload_type = 'status', payload_list = True,
allowed_param = ['id', 'page']
)
""" favorites/create """
create_favorite = bind_api(
path = '/favorites/create/{id}.json',
method = 'POST',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" favorites/destroy """
destroy_favorite = bind_api(
path = '/favorites/destroy/{id}.json',
method = 'DELETE',
payload_type = 'status',
allowed_param = ['id'],
require_auth = True
)
""" notifications/follow """
enable_notifications = bind_api(
path = '/notifications/follow.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" notifications/leave """
disable_notifications = bind_api(
path = '/notifications/leave.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/create """
create_block = bind_api(
path = '/blocks/create.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/destroy """
destroy_block = bind_api(
path = '/blocks/destroy.json',
method = 'DELETE',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" blocks/exists """
def exists_block(self, *args, **kargs):
try:
bind_api(
path = '/blocks/exists.json',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)(self, *args, **kargs)
except WeibopError:
return False
return True
""" blocks/blocking """
blocks = bind_api(
path = '/blocks/blocking.json',
payload_type = 'user', payload_list = True,
allowed_param = ['page'],
require_auth = True
)
""" blocks/blocking/ids """
blocks_ids = bind_api(
path = '/blocks/blocking/ids.json',
payload_type = 'json',
require_auth = True
)
""" statuses/repost """
report_spam = bind_api(
path = '/report_spam.json',
method = 'POST',
payload_type = 'user',
allowed_param = ['id', 'user_id', 'screen_name'],
require_auth = True
)
""" saved_searches """
saved_searches = bind_api(
path = '/saved_searches.json',
payload_type = 'saved_search', payload_list = True,
require_auth = True
)
""" saved_searches/show """
get_saved_search = bind_api(
path = '/saved_searches/show/{id}.json',
payload_type = 'saved_search',
allowed_param = ['id'],
require_auth = True
)
""" saved_searches/create """
create_saved_search = bind_api(
path = '/saved_searches/create.json',
method = 'POST',
payload_type = 'saved_search',
allowed_param = ['query'],
require_auth = True
)
""" saved_searches/destroy """
destroy_saved_search = bind_api(
path = '/saved_searches/destroy/{id}.json',
method = 'DELETE',
payload_type = 'saved_search',
allowed_param = ['id'],
require_auth = True
)
""" help/test """
def test(self):
try:
bind_api(
path = '/help/test.json',
)(self)
except WeibopError:
return False
return True
def create_list(self, *args, **kargs):
return bind_api(
path = '/%s/lists.json' % self.auth.get_username(),
method = 'POST',
payload_type = 'list',
allowed_param = ['name', 'mode', 'description'],
require_auth = True
)(self, *args, **kargs)
def destroy_list(self, slug):
return bind_api(
path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
method = 'DELETE',
payload_type = 'list',
require_auth = True
)(self)
def update_list(self, slug, *args, **kargs):
return bind_api(
path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['name', 'mode', 'description'],
require_auth = True
)(self, *args, **kargs)
lists = bind_api(
path = '/{user}/lists.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
lists_memberships = bind_api(
path = '/{user}/lists/memberships.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
lists_subscriptions = bind_api(
path = '/{user}/lists/subscriptions.json',
payload_type = 'list', payload_list = True,
allowed_param = ['user', 'cursor'],
require_auth = True
)
list_timeline = bind_api(
path = '/{owner}/lists/{slug}/statuses.json',
payload_type = 'status', payload_list = True,
allowed_param = ['owner', 'slug', 'since_id', 'max_id', 'count', 'page']
)
get_list = bind_api(
path = '/{owner}/lists/{slug}.json',
payload_type = 'list',
allowed_param = ['owner', 'slug']
)
def add_list_member(self, slug, *args, **kargs):
return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs)
def remove_list_member(self, slug, *args, **kargs):
return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'DELETE',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs)
list_members = bind_api(
path = '/{owner}/{slug}/members.json',
payload_type = 'user', payload_list = True,
allowed_param = ['owner', 'slug', 'cursor']
)
def is_list_member(self, owner, slug, user_id):
try:
return bind_api(
path = '/%s/%s/members/%s.json' % (owner, slug, user_id),
payload_type = 'user'
)(self)
except WeibopError:
return False
subscribe_list = bind_api(
path = '/{owner}/{slug}/subscribers.json',
method = 'POST',
payload_type = 'list',
allowed_param = ['owner', 'slug'],
require_auth = True
)
unsubscribe_list = bind_api(
path = '/{owner}/{slug}/subscribers.json',
method = 'DELETE',
payload_type = 'list',
allowed_param = ['owner', 'slug'],
require_auth = True
)
list_subscribers = bind_api(
path = '/{owner}/{slug}/subscribers.json',
payload_type = 'user', payload_list = True,
allowed_param = ['owner', 'slug', 'cursor']
)
def is_subscribed_list(self, owner, slug, user_id):
try:
return bind_api(
path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),
payload_type = 'user'
)(self)
except WeibopError:
return False
""" trends/available """
trends_available = bind_api(
path = '/trends/available.json',
payload_type = 'json',
allowed_param = ['lat', 'long']
)
""" trends/location """
trends_location = bind_api(
path = '/trends/{woeid}.json',
payload_type = 'json',
allowed_param = ['woeid']
)
""" search """
search = bind_api(
search_api = True,
path = '/search.json',
payload_type = 'search_result', payload_list = True,
allowed_param = ['q', 'lang', 'locale', 'rpp', 'page', 'since_id', 'geocode', 'show_user']
)
search.pagination_mode = 'page'
""" trends """
trends = bind_api(
search_api = True,
path = '/trends.json',
payload_type = 'json'
)
""" trends/current """
trends_current = bind_api(
search_api = True,
path = '/trends/current.json',
payload_type = 'json',
allowed_param = ['exclude']
)
""" trends/daily """
trends_daily = bind_api(
search_api = True,
path = '/trends/daily.json',
payload_type = 'json',
allowed_param = ['date', 'exclude']
)
""" trends/weekly """
trends_weekly = bind_api(
search_api = True,
path = '/trends/weekly.json',
payload_type = 'json',
allowed_param = ['date', 'exclude']
)
""" Internal use only """
@staticmethod
def _pack_image(filename, max_size, source=None, status=None, lat=None, long=None, contentname="image"):
"""Pack image from file into multipart-formdata post body"""
# image must be less than 700kb in size
try:
if os.path.getsize(filename) > (max_size * 1024):
raise WeibopError('File is too big, must be less than 700kb.')
#except os.error, e:
except os.error:
raise WeibopError('Unable to access file')
# image must be gif, jpeg, or png
file_type = mimetypes.guess_type(filename)
if file_type is None:
raise WeibopError('Could not determine file type')
file_type = file_type[0]
if file_type not in ['image/gif', 'image/jpeg', 'image/png']:
raise WeibopError('Invalid file type for image: %s' % file_type)
# build the mulitpart-formdata body
fp = open(filename, 'rb')
BOUNDARY = 'Tw3ePy'
body = []
if status is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="status"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(status)
if source is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="source"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(source)
if lat is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="lat"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(lat)
if long is not None:
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="long"')
body.append('Content-Type: text/plain; charset=US-ASCII')
body.append('Content-Transfer-Encoding: 8bit')
body.append('')
body.append(long)
body.append('--' + BOUNDARY)
body.append('Content-Disposition: form-data; name="'+ contentname +'"; filename="%s"' % filename)
body.append('Content-Type: %s' % file_type)
body.append('Content-Transfer-Encoding: binary')
body.append('')
body.append(fp.read())
body.append('--' + BOUNDARY + '--')
body.append('')
fp.close()
body.append('--' + BOUNDARY + '--')
body.append('')
body = '\r\n'.join(body)
# build headers
headers = {
'Content-Type': 'multipart/form-data; boundary=Tw3ePy',
'Content-Length': len(body)
}
return headers, body
| ajibawa-2023/Python-Code-Large/train/row_151 | 273 | 811 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_151:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0012, 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_151:Import_L6_C0", "label": "mimetypes import mimetypes", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0012, 0, 0.66, 0.2, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["mimetypes"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mimetypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:ImportFrom_L8_C0", "label": "from weibopy.binder import bind_api", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0012, 0, 0.66, 0.4, 89, 0, 1, 0, 0, 89, 0, 0], "semantic": {"name": "weibopy.binder", "arg_names": [], "import_names": ["bind_api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.binder import bind_api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:ImportFrom_L9_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0111, 0.0012, 0, 0.66, 0.6, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:ImportFrom_L10_C0", "label": "from weibopy.parsers import ModelParser", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0123, 0.0012, 0, 0.66, 0.8, 699, 0, 1, 0, 0, 699, 0, 0], "semantic": {"name": "weibopy.parsers", "arg_names": [], "import_names": ["ModelParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.parsers import ModelParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "label": "API", "type": "class", "loc": [13, 810], "level": 0, "parent": null, "vector": [3, 0, 0.5074, 0.984, 0, 0.66, 1.0, 839, 0, 16, 0, 0, 186, 0, 99], "semantic": {"name": "API", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class API(object):\n \"\"\"Twitter API\"\"\"\n\n def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',\n cache=None, secure=False, api_root='', search_root='',\n retry_count=0, retry_delay=0, retry_errors=None,source=None,\n parser=None, log = None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0173, 0.0012, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Twitter API\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "label": "__init__", "type": "function", "loc": [16, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.0327, 0.0271, 1, 0.16, 0.0064, 555, 0, 14, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "auth_handler", "host", "search_host", "cache", "secure", "api_root", "search_root", "retry_count", "retry_delay", "retry_errors", "source", "parser", "log"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, auth_handler=None,\n host='api.t.sina.com.cn', search_host='api.t.sina.com.cn',\n cache=None, secure=False, api_root='', search_root='',\n retry_count=0, retry_delay=0, retry_errors=None,source=None,\n parser=None, log = None):\n self.auth = auth_handler\n self.host = host\n if source == None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L21_C8", "label": "self.auth =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0259, 0.0012, 2, 0.09, 0.0, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth = auth_handler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L22_C8", "label": "self.host =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0271, 0.0012, 2, 0.09, 0.0833, 445, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.host = host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8", "label": "if", "type": "if", "loc": [23, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [4, 2, 0.0308, 0.0062, 2, 0.09, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source == None:\n if auth_handler != None:\n self.source = self.auth._consumer.key\n else:\n self.source = source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L24_C12", "label": "if", "type": "if", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8", "vector": [4, 3, 0.0302, 0.0025, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_handler != None:\n self.source = self.auth._consumer.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L25_C16", "label": "self.source =", "type": "assigned_variable", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L24_C12", "vector": [14, 4, 0.0308, 0.0012, 4, 0.0, 0.0, 848, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.source = self.auth._consumer.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L27_C12", "label": "self.source =", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8", "vector": [14, 3, 0.0333, 0.0012, 3, 0.36, 1.0, 848, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.source = source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L28_C8", "label": "self.search_host =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0345, 0.0012, 2, 0.09, 0.25, 124, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.search_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.search_host = search_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L29_C8", "label": "self.api_root =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0358, 0.0012, 2, 0.09, 0.3333, 800, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.api_root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.api_root = api_root"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L30_C8", "label": "self.search_root =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.037, 0.0012, 2, 0.09, 0.4167, 598, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.search_root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.search_root = search_root"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L31_C8", "label": "self.cache =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0382, 0.0012, 2, 0.09, 0.5, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cache = cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L32_C8", "label": "self.secure =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0395, 0.0012, 2, 0.09, 0.5833, 9, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secure = secure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L33_C8", "label": "self.retry_count =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0407, 0.0012, 2, 0.09, 0.6667, 141, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_count = retry_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L34_C8", "label": "self.retry_delay =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0419, 0.0012, 2, 0.09, 0.75, 869, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_delay = retry_delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L35_C8", "label": "self.retry_errors =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0432, 0.0012, 2, 0.09, 0.8333, 816, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.retry_errors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.retry_errors = retry_errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L36_C8", "label": "self.parser =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0444, 0.0012, 2, 0.09, 0.9167, 980, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.parser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parser = parser or ModelParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L37_C8", "label": "self.log =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "vector": [14, 2, 0.0456, 0.0012, 2, 0.09, 1.0, 338, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.log", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.log = log"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0481, 0.0012, 1, 0.16, 0.0128, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/public_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L40_C4", "label": "public_timeline = bind_api()", "type": "assigned_variable", "loc": [40, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.0518, 0.0062, 1, 0.16, 0.0192, 203, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "public_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " public_timeline = bind_api(\n path = '/statuses/public_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = []\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L46_C4", "label": "expression", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0567, 0.0012, 1, 0.16, 0.0256, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/home_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L47_C4", "label": "home_timeline = bind_api()", "type": "assigned_variable", "loc": [47, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.061, 0.0074, 1, 0.16, 0.0321, 302, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "home_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " home_timeline = bind_api(\n path = '/statuses/home_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0666, 0.0012, 1, 0.16, 0.0385, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/friends_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L55_C4", "label": "friends_timeline = bind_api()", "type": "assigned_variable", "loc": [55, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.0709, 0.0074, 1, 0.16, 0.0449, 395, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "friends_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends_timeline = bind_api(\n path = '/statuses/friends_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L61_C4", "label": "expression", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0752, 0.0012, 1, 0.16, 0.0513, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comment \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L62_C4", "label": "comment = bind_api()", "type": "assigned_variable", "loc": [62, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.0801, 0.0086, 1, 0.16, 0.0577, 34, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comment = bind_api(\n path = '/statuses/comment.json',\n method = 'POST',\n payload_type = 'comments',\n allowed_param = ['id', 'cid', 'comment'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0863, 0.0012, 1, 0.16, 0.0641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comment_destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L71_C4", "label": "comment_destroy = bind_api()", "type": "assigned_variable", "loc": [71, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.0912, 0.0086, 1, 0.16, 0.0705, 828, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comment_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comment_destroy = bind_api(\n path = '/statuses/comment_destroy/{id}.json',\n method = 'POST',\n payload_type = 'comments',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.0974, 0.0012, 1, 0.16, 0.0769, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L80_C4", "label": "comments = bind_api()", "type": "assigned_variable", "loc": [80, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1017, 0.0074, 1, 0.16, 0.0833, 122, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments = bind_api(\n path = '/statuses/comments.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L87_C4", "label": "expression", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1073, 0.0012, 1, 0.16, 0.0897, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L88_C4", "label": "comments_timeline = bind_api()", "type": "assigned_variable", "loc": [88, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1116, 0.0074, 1, 0.16, 0.0962, 23, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments_timeline = bind_api(\n path = '/statuses/comments_timeline.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L95_C4", "label": "expression", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1171, 0.0012, 1, 0.16, 0.1026, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/comments_by_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L96_C4", "label": "comments_by_me = bind_api()", "type": "assigned_variable", "loc": [96, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1215, 0.0074, 1, 0.16, 0.109, 817, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "comments_by_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " comments_by_me = bind_api(\n path = '/statuses/comments_by_me.json',\n payload_type = 'comments', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L103_C4", "label": "expression", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.127, 0.0012, 1, 0.16, 0.1154, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/user_timeline \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L104_C4", "label": "user_timeline = bind_api()", "type": "assigned_variable", "loc": [104, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1313, 0.0074, 1, 0.16, 0.1218, 101, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "user_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " user_timeline = bind_api(\n path = '/statuses/user_timeline.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'since_id',\n 'max_id', 'count', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L111_C4", "label": "expression", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1369, 0.0012, 1, 0.16, 0.1282, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/mentions \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L112_C4", "label": "mentions = bind_api()", "type": "assigned_variable", "loc": [112, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1412, 0.0074, 1, 0.16, 0.1346, 369, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "mentions", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " mentions = bind_api(\n path = '/statuses/mentions.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L119_C4", "label": "expression", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1467, 0.0012, 1, 0.16, 0.141, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/counts \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L120_C4", "label": "counts = bind_api()", "type": "assigned_variable", "loc": [120, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.151, 0.0074, 1, 0.16, 0.1474, 560, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " counts = bind_api(\n path = '/statuses/counts.json',\n payload_type = 'counts', payload_list = True,\n allowed_param = ['ids'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L127_C4", "label": "expression", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1566, 0.0012, 1, 0.16, 0.1538, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/unread \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L128_C4", "label": "unread = bind_api()", "type": "assigned_variable", "loc": [128, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1597, 0.0049, 1, 0.16, 0.1603, 545, 3, 2, 0, 0, 446, 10, 1], "semantic": {"name": "unread", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " unread = bind_api(\n path = '/statuses/unread.json',\n payload_type = 'counts'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L133_C4", "label": "expression", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.164, 0.0012, 1, 0.16, 0.1667, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweeted_by_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L134_C4", "label": "retweeted_by_me = bind_api()", "type": "assigned_variable", "loc": [134, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1683, 0.0074, 1, 0.16, 0.1731, 618, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweeted_by_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweeted_by_me = bind_api(\n path = '/statuses/retweeted_by_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L141_C4", "label": "expression", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1739, 0.0012, 1, 0.16, 0.1795, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweeted_to_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L142_C4", "label": "retweeted_to_me = bind_api()", "type": "assigned_variable", "loc": [142, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1782, 0.0074, 1, 0.16, 0.1859, 533, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweeted_to_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweeted_to_me = bind_api(\n path = '/statuses/retweeted_to_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L149_C4", "label": "expression", "type": "expression", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1837, 0.0012, 1, 0.16, 0.1923, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweets_of_me \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L150_C4", "label": "retweets_of_me = bind_api()", "type": "assigned_variable", "loc": [150, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.188, 0.0074, 1, 0.16, 0.1987, 959, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweets_of_me", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweets_of_me = bind_api(\n path = '/statuses/retweets_of_me.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L157_C4", "label": "expression", "type": "expression", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.1936, 0.0012, 1, 0.16, 0.2051, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L158_C4", "label": "get_status = bind_api()", "type": "assigned_variable", "loc": [158, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.1973, 0.0062, 1, 0.16, 0.2115, 163, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_status = bind_api(\n path = '/statuses/show.json',\n payload_type = 'status',\n allowed_param = ['id']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L164_C4", "label": "expression", "type": "expression", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2022, 0.0012, 1, 0.16, 0.2179, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/update \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L165_C4", "label": "update_status = bind_api()", "type": "assigned_variable", "loc": [165, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2072, 0.0086, 1, 0.16, 0.2244, 715, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_status = bind_api(\n path = '/statuses/update.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['status', 'lat', 'long', 'source'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2121, 0.0012, 1, 0.16, 0.2308, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/upload \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "label": "upload", "type": "function", "loc": [173, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.2281, 0.0308, 1, 0.16, 0.2372, 920, 0, 6, 1, 0, 0, 0, 9], "semantic": {"name": "upload", "arg_names": ["self", "filename", "status", "lat", "long", "source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def upload(self, filename, status, lat=None, long=None, source=None):\n if source is None:\n source=self.source\n headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname=\"pic\")\n args = [status]\n allowed_param = ['status']\n \n if lat is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L174_C8", "label": "if", "type": "if", "loc": [174, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [4, 2, 0.2152, 0.0025, 2, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is None:\n source=self.source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L175_C12", "label": "source =", "type": "assigned_variable", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L174_C8", "vector": [14, 3, 0.2158, 0.0012, 3, 0.03, 0.0, 703, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source=self.source"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L176_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [14, 2, 0.217, 0.0012, 2, 0.58, 0.1429, 165, 3, 7, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename, 1024, source=source, status=status, lat=lat, long=long, contentname=\"pic\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L177_C8", "label": "args =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [14, 2, 0.2182, 0.0012, 2, 0.58, 0.2857, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [status]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L178_C8", "label": "allowed_param =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [14, 2, 0.2195, 0.0012, 2, 0.58, 0.4286, 992, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "allowed_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " allowed_param = ['status']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8", "label": "if", "type": "if", "loc": [180, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [4, 2, 0.2232, 0.0037, 2, 0.58, 0.5714, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lat is not None:\n args.append(lat)\n allowed_param.append('lat')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L181_C12", "label": "append()", "type": "expression", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8", "vector": [8, 3, 0.2232, 0.0012, 3, 0.75, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " args.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L182_C12", "label": "append()", "type": "expression", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8", "vector": [8, 3, 0.2244, 0.0012, 3, 0.75, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " allowed_param.append('lat')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8", "label": "if", "type": "if", "loc": [184, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [4, 2, 0.2281, 0.0037, 2, 0.58, 0.7143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if long is not None:\n args.append(long)\n allowed_param.append('long')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L185_C12", "label": "append()", "type": "expression", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8", "vector": [8, 3, 0.2281, 0.0012, 3, 0.8, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " args.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L186_C12", "label": "append()", "type": "expression", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8", "vector": [8, 3, 0.2293, 0.0012, 3, 0.8, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " allowed_param.append('long')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8", "label": "if", "type": "if", "loc": [188, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [4, 2, 0.233, 0.0037, 2, 0.58, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is not None:\n args.append(source)\n allowed_param.append('source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L189_C12", "label": "append()", "type": "expression", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8", "vector": [8, 3, 0.233, 0.0012, 3, 0.98, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " args.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L190_C12", "label": "append()", "type": "expression", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8", "vector": [8, 3, 0.2343, 0.0012, 3, 0.98, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " allowed_param.append('source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L191_C8", "label": "return", "type": "return", "loc": [191, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "vector": [13, 2, 0.2392, 0.0086, 2, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/statuses/upload.json', \n method = 'POST',\n payload_type = 'status',\n require_auth = True,\n allowed_param = allowed_param \n )(self, *args, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L199_C4", "label": "expression", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2454, 0.0012, 1, 0.16, 0.2436, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/reply \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L200_C4", "label": "reply = bind_api()", "type": "assigned_variable", "loc": [200, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2503, 0.0086, 1, 0.16, 0.25, 714, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " reply = bind_api(\n path = '/statuses/reply.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id', 'cid','comment'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L208_C4", "label": "expression", "type": "expression", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2565, 0.0012, 1, 0.16, 0.2564, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/repost \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L209_C4", "label": "repost = bind_api()", "type": "assigned_variable", "loc": [209, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2614, 0.0086, 1, 0.16, 0.2628, 412, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "repost", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " repost = bind_api(\n path = '/statuses/repost.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id', 'status'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L217_C4", "label": "expression", "type": "expression", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2676, 0.0012, 1, 0.16, 0.2692, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L218_C4", "label": "destroy_status = bind_api()", "type": "assigned_variable", "loc": [218, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2725, 0.0086, 1, 0.16, 0.2756, 103, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_status = bind_api(\n path = '/statuses/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L226_C4", "label": "expression", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2787, 0.0012, 1, 0.16, 0.2821, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweet \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L227_C4", "label": "retweet = bind_api()", "type": "assigned_variable", "loc": [227, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2836, 0.0086, 1, 0.16, 0.2885, 313, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweet", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweet = bind_api(\n path = '/statuses/retweet/{id}.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L235_C4", "label": "expression", "type": "expression", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2898, 0.0012, 1, 0.16, 0.2949, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/retweets \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L236_C4", "label": "retweets = bind_api()", "type": "assigned_variable", "loc": [236, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.2941, 0.0074, 1, 0.16, 0.3013, 728, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "retweets", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " retweets = bind_api(\n path = '/statuses/retweets/{id}.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'count'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.2996, 0.0012, 1, 0.16, 0.3077, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" users/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L244_C4", "label": "get_user = bind_api()", "type": "assigned_variable", "loc": [244, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3033, 0.0062, 1, 0.16, 0.3141, 174, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_user", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_user = bind_api(\n path = '/users/show.json',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L250_C4", "label": "expression", "type": "expression", "loc": [250, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3083, 0.0012, 1, 0.16, 0.3205, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Get the authenticated user \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L251_C4", "label": "me", "type": "function", "loc": [251, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.3101, 0.0025, 1, 0.16, 0.3269, 763, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "me", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def me(self):\n return self.get_user(screen_name=self.auth.get_username())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L252_C8", "label": "return", "type": "return", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L251_C4", "vector": [13, 2, 0.3107, 0.0012, 2, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_user(screen_name=self.auth.get_username())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L254_C4", "label": "expression", "type": "expression", "loc": [254, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3132, 0.0012, 1, 0.16, 0.3333, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" users/search \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L255_C4", "label": "search_users = bind_api()", "type": "assigned_variable", "loc": [255, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3175, 0.0074, 1, 0.16, 0.3397, 220, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "search_users", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " search_users = bind_api(\n path = '/users/search.json',\n payload_type = 'user', payload_list = True,\n require_auth = True,\n allowed_param = ['q', 'per_page', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L262_C4", "label": "expression", "type": "expression", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3231, 0.0012, 1, 0.16, 0.3462, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/friends \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L263_C4", "label": "friends = bind_api()", "type": "assigned_variable", "loc": [263, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3268, 0.0062, 1, 0.16, 0.3526, 875, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "friends", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends = bind_api(\n path = '/statuses/friends.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L269_C4", "label": "expression", "type": "expression", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3317, 0.0012, 1, 0.16, 0.359, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/followers \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L270_C4", "label": "followers = bind_api()", "type": "assigned_variable", "loc": [270, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3354, 0.0062, 1, 0.16, 0.3654, 530, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " followers = bind_api(\n path = '/statuses/followers.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['id', 'user_id', 'screen_name', 'page', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L276_C4", "label": "expression", "type": "expression", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3403, 0.0012, 1, 0.16, 0.3718, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L277_C4", "label": "direct_messages = bind_api()", "type": "assigned_variable", "loc": [277, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3446, 0.0074, 1, 0.16, 0.3782, 385, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "direct_messages", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " direct_messages = bind_api(\n path = '/direct_messages.json',\n payload_type = 'direct_message', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3502, 0.0012, 1, 0.16, 0.3846, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/sent \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L285_C4", "label": "sent_direct_messages = bind_api()", "type": "assigned_variable", "loc": [285, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3545, 0.0074, 1, 0.16, 0.391, 492, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "sent_direct_messages", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " sent_direct_messages = bind_api(\n path = '/direct_messages/sent.json',\n payload_type = 'direct_message', payload_list = True,\n allowed_param = ['since_id', 'max_id', 'count', 'page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L291_C4", "label": "expression", "type": "expression", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3588, 0.0012, 1, 0.16, 0.3974, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/new \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L292_C4", "label": "new_direct_message = bind_api()", "type": "assigned_variable", "loc": [292, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3637, 0.0086, 1, 0.16, 0.4038, 801, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "new_direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " new_direct_message = bind_api(\n path = '/direct_messages/new.json',\n method = 'POST',\n payload_type = 'direct_message',\n allowed_param = ['id', 'screen_name', 'user_id', 'text'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L300_C4", "label": "expression", "type": "expression", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3699, 0.0012, 1, 0.16, 0.4103, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" direct_messages/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L301_C4", "label": "destroy_direct_message = bind_api()", "type": "assigned_variable", "loc": [301, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3748, 0.0086, 1, 0.16, 0.4167, 777, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_direct_message = bind_api(\n path = '/direct_messages/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'direct_message',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L309_C4", "label": "expression", "type": "expression", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.381, 0.0012, 1, 0.16, 0.4231, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L310_C4", "label": "create_friendship = bind_api()", "type": "assigned_variable", "loc": [310, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.3859, 0.0086, 1, 0.16, 0.4295, 536, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_friendship = bind_api(\n path = '/friendships/create.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name', 'follow'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L318_C4", "label": "expression", "type": "expression", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.3921, 0.0012, 1, 0.16, 0.4359, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L319_C4", "label": "destroy_friendship = bind_api()", "type": "assigned_variable", "loc": [319, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.397, 0.0086, 1, 0.16, 0.4423, 506, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_friendship = bind_api(\n path = '/friendships/destroy.json',\n method = 'DELETE',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L327_C4", "label": "expression", "type": "expression", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4032, 0.0012, 1, 0.16, 0.4487, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/exists \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L328_C4", "label": "exists_friendship = bind_api()", "type": "assigned_variable", "loc": [328, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4069, 0.0062, 1, 0.16, 0.4551, 932, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "exists_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " exists_friendship = bind_api(\n path = '/friendships/exists.json',\n payload_type = 'json',\n allowed_param = ['user_a', 'user_b']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L334_C4", "label": "expression", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4118, 0.0012, 1, 0.16, 0.4615, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friendships/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L335_C4", "label": "show_friendship = bind_api()", "type": "assigned_variable", "loc": [335, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4162, 0.0074, 1, 0.16, 0.4679, 881, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "show_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " show_friendship = bind_api(\n path = '/friendships/show.json',\n payload_type = 'friendship',\n allowed_param = ['source_id', 'source_screen_name',\n 'target_id', 'target_screen_name']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L342_C4", "label": "expression", "type": "expression", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4217, 0.0012, 1, 0.16, 0.4744, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" friends/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L343_C4", "label": "friends_ids = bind_api()", "type": "assigned_variable", "loc": [343, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.426, 0.0074, 1, 0.16, 0.4808, 509, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "friends_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " friends_ids = bind_api(\n path = '/friends/ids.json',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name', 'cursor', 'count'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L350_C4", "label": "expression", "type": "expression", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4316, 0.0012, 1, 0.16, 0.4872, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" followers/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L351_C4", "label": "followers_ids = bind_api()", "type": "assigned_variable", "loc": [351, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4353, 0.0062, 1, 0.16, 0.4936, 328, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "followers_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " followers_ids = bind_api( \n path = '/followers/ids.json',\n payload_type = 'json',\n allowed_param = ['id', 'page'],\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L357_C4", "label": "expression", "type": "expression", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4402, 0.0012, 1, 0.16, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/verify_credentials \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L358_C4", "label": "verify_credentials", "type": "function", "loc": [358, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.4464, 0.0111, 1, 0.16, 0.5064, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "verify_credentials", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_credentials(self):\n try:\n return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)\n except WeibopError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8", "label": "try", "type": "try", "loc": [359, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L358_C4", "vector": [7, 2, 0.447, 0.0099, 2, 0.59, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L360_C12", "label": "return", "type": "return", "loc": [360, 364], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8", "vector": [13, 3, 0.4464, 0.0062, 3, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/account/verify_credentials.json',\n payload_type = 'user',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L366_C12", "label": "return", "type": "return", "loc": [366, 366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8", "vector": [13, 3, 0.4513, 0.0012, 3, 0.12, 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_151:Expr_L368_C4", "label": "expression", "type": "expression", "loc": [368, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4538, 0.0012, 1, 0.16, 0.5128, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/rate_limit_status \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L369_C4", "label": "rate_limit_status = bind_api()", "type": "assigned_variable", "loc": [369, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4568, 0.0049, 1, 0.16, 0.5192, 31, 3, 2, 0, 0, 446, 10, 1], "semantic": {"name": "rate_limit_status", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " rate_limit_status = bind_api(\n path = '/account/rate_limit_status.json',\n payload_type = 'json'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L374_C4", "label": "expression", "type": "expression", "loc": [374, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4612, 0.0012, 1, 0.16, 0.5256, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_delivery_device \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L375_C4", "label": "set_delivery_device = bind_api()", "type": "assigned_variable", "loc": [375, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4661, 0.0086, 1, 0.16, 0.5321, 216, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "set_delivery_device", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " set_delivery_device = bind_api(\n path = '/account/update_delivery_device.json',\n method = 'POST',\n allowed_param = ['device'],\n payload_type = 'user',\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L383_C4", "label": "expression", "type": "expression", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4723, 0.0012, 1, 0.16, 0.5385, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_colors \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L384_C4", "label": "update_profile_colors = bind_api()", "type": "assigned_variable", "loc": [384, 392], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.4784, 0.0111, 1, 0.16, 0.5449, 979, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_profile_colors", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_profile_colors = bind_api(\n path = '/account/update_profile_colors.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['profile_background_color', 'profile_text_color',\n 'profile_link_color', 'profile_sidebar_fill_color',\n 'profile_sidebar_border_color'],\n require_auth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L394_C4", "label": "expression", "type": "expression", "loc": [394, 394], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4858, 0.0012, 1, 0.16, 0.5513, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_image \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4", "label": "update_profile_image", "type": "function", "loc": [395, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.4914, 0.0099, 1, 0.16, 0.5577, 456, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "update_profile_image", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_profile_image(self, filename):\n headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)\n return bind_api(\n path = '/account/update_profile_image.json',\n method = 'POST',\n payload_type = 'user',\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L396_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [396, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4", "vector": [14, 2, 0.4883, 0.0012, 2, 0.83, 0.0, 165, 3, 3, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename=filename, max_size=700, source=self.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L397_C8", "label": "return", "type": "return", "loc": [397, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4", "vector": [13, 2, 0.4926, 0.0074, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/account/update_profile_image.json',\n method = 'POST',\n payload_type = 'user',\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L404_C4", "label": "expression", "type": "expression", "loc": [404, 404], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.4982, 0.0012, 1, 0.16, 0.5641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile_background_image \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4", "label": "update_profile_background_image", "type": "function", "loc": [405, 413], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.5043, 0.0111, 1, 0.16, 0.5705, 569, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "update_profile_background_image", "arg_names": ["self", "filename", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_profile_background_image(self, filename, *args, **kargs):\n headers, post_data = API._pack_image(filename, 800)\n bind_api(\n path = '/account/update_profile_background_image.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['tile'],\n require_auth = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L406_C8", "label": "headers, post_data = _pack_image()", "type": "assigned_variable", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4", "vector": [14, 2, 0.5006, 0.0012, 2, 0.34, 0.0, 165, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "headers, post_data", "arg_names": [], "import_names": [], "rhs_call_name": "_pack_image", "annotation": ""}, "snippet": " headers, post_data = API._pack_image(filename, 800)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L407_C8", "label": "expression", "type": "expression", "loc": [407, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4", "vector": [8, 2, 0.5055, 0.0086, 2, 0.34, 1.0, 0, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/account/update_profile_background_image.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['tile'],\n require_auth = True\n )(self, post_data=post_data, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L415_C4", "label": "expression", "type": "expression", "loc": [415, 415], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5117, 0.0012, 1, 0.16, 0.5769, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" account/update_profile \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L416_C4", "label": "update_profile = bind_api()", "type": "assigned_variable", "loc": [416, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5166, 0.0086, 1, 0.16, 0.5833, 829, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "update_profile", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " update_profile = bind_api(\n path = '/account/update_profile.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['name', 'url', 'location', 'description'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L424_C4", "label": "expression", "type": "expression", "loc": [424, 424], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5228, 0.0012, 1, 0.16, 0.5897, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L425_C4", "label": "favorites = bind_api()", "type": "assigned_variable", "loc": [425, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5265, 0.0062, 1, 0.16, 0.5962, 501, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "favorites", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " favorites = bind_api(\n path = '/favorites/{id}.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['id', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L431_C4", "label": "expression", "type": "expression", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5314, 0.0012, 1, 0.16, 0.6026, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L432_C4", "label": "create_favorite = bind_api()", "type": "assigned_variable", "loc": [432, 438], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5364, 0.0086, 1, 0.16, 0.609, 288, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_favorite", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_favorite = bind_api(\n path = '/favorites/create/{id}.json',\n method = 'POST',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L440_C4", "label": "expression", "type": "expression", "loc": [440, 440], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5425, 0.0012, 1, 0.16, 0.6154, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" favorites/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L441_C4", "label": "destroy_favorite = bind_api()", "type": "assigned_variable", "loc": [441, 447], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5475, 0.0086, 1, 0.16, 0.6218, 959, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_favorite", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_favorite = bind_api(\n path = '/favorites/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'status',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L449_C4", "label": "expression", "type": "expression", "loc": [449, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5536, 0.0012, 1, 0.16, 0.6282, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" notifications/follow \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L450_C4", "label": "enable_notifications = bind_api()", "type": "assigned_variable", "loc": [450, 456], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5586, 0.0086, 1, 0.16, 0.6346, 363, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "enable_notifications", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " enable_notifications = bind_api(\n path = '/notifications/follow.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L458_C4", "label": "expression", "type": "expression", "loc": [458, 458], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5647, 0.0012, 1, 0.16, 0.641, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" notifications/leave \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L459_C4", "label": "disable_notifications = bind_api()", "type": "assigned_variable", "loc": [459, 465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5697, 0.0086, 1, 0.16, 0.6474, 877, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "disable_notifications", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " disable_notifications = bind_api(\n path = '/notifications/leave.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L467_C4", "label": "expression", "type": "expression", "loc": [467, 467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5758, 0.0012, 1, 0.16, 0.6538, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L468_C4", "label": "create_block = bind_api()", "type": "assigned_variable", "loc": [468, 474], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5808, 0.0086, 1, 0.16, 0.6603, 826, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_block", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_block = bind_api(\n path = '/blocks/create.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L476_C4", "label": "expression", "type": "expression", "loc": [476, 476], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.5869, 0.0012, 1, 0.16, 0.6667, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L477_C4", "label": "destroy_block = bind_api()", "type": "assigned_variable", "loc": [477, 483], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.5919, 0.0086, 1, 0.16, 0.6731, 557, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_block", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_block = bind_api(\n path = '/blocks/destroy.json',\n method = 'DELETE',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L485_C4", "label": "expression", "type": "expression", "loc": [485, 485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.598, 0.0012, 1, 0.16, 0.6795, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/exists \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4", "label": "exists_block", "type": "function", "loc": [486, 495], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.6048, 0.0123, 1, 0.16, 0.6859, 234, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "exists_block", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exists_block(self, *args, **kargs):\n try:\n bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)\n except WeibopError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8", "label": "try", "type": "try", "loc": [487, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4", "vector": [7, 2, 0.6048, 0.0099, 2, 0.56, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L488_C12", "label": "expression", "type": "expression", "loc": [488, 492], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8", "vector": [8, 3, 0.6042, 0.0062, 3, 0.87, 0.0, 0, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/blocks/exists.json',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L494_C12", "label": "return", "type": "return", "loc": [494, 494], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8", "vector": [13, 3, 0.6091, 0.0012, 3, 0.87, 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_151:Return_L495_C8", "label": "return", "type": "return", "loc": [495, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4", "vector": [13, 2, 0.6104, 0.0012, 2, 0.56, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L497_C4", "label": "expression", "type": "expression", "loc": [497, 497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6128, 0.0012, 1, 0.16, 0.6923, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/blocking \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L498_C4", "label": "blocks = bind_api()", "type": "assigned_variable", "loc": [498, 503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6171, 0.0074, 1, 0.16, 0.6987, 384, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " blocks = bind_api(\n path = '/blocks/blocking.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['page'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L505_C4", "label": "expression", "type": "expression", "loc": [505, 505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6227, 0.0012, 1, 0.16, 0.7051, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" blocks/blocking/ids \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L506_C4", "label": "blocks_ids = bind_api()", "type": "assigned_variable", "loc": [506, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6264, 0.0062, 1, 0.16, 0.7115, 469, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "blocks_ids", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " blocks_ids = bind_api(\n path = '/blocks/blocking/ids.json',\n payload_type = 'json',\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L512_C4", "label": "expression", "type": "expression", "loc": [512, 512], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6313, 0.0012, 1, 0.16, 0.7179, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" statuses/repost \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L513_C4", "label": "report_spam = bind_api()", "type": "assigned_variable", "loc": [513, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6363, 0.0086, 1, 0.16, 0.7244, 138, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "report_spam", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " report_spam = bind_api(\n path = '/report_spam.json',\n method = 'POST',\n payload_type = 'user',\n allowed_param = ['id', 'user_id', 'screen_name'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L521_C4", "label": "expression", "type": "expression", "loc": [521, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6424, 0.0012, 1, 0.16, 0.7308, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L522_C4", "label": "saved_searches = bind_api()", "type": "assigned_variable", "loc": [522, 526], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6461, 0.0062, 1, 0.16, 0.7372, 36, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "saved_searches", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " saved_searches = bind_api(\n path = '/saved_searches.json',\n payload_type = 'saved_search', payload_list = True,\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L528_C4", "label": "expression", "type": "expression", "loc": [528, 528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.651, 0.0012, 1, 0.16, 0.7436, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/show \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L529_C4", "label": "get_saved_search = bind_api()", "type": "assigned_variable", "loc": [529, 534], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6554, 0.0074, 1, 0.16, 0.75, 758, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "get_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_saved_search = bind_api(\n path = '/saved_searches/show/{id}.json',\n payload_type = 'saved_search',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L536_C4", "label": "expression", "type": "expression", "loc": [536, 536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6609, 0.0012, 1, 0.16, 0.7564, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/create \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L537_C4", "label": "create_saved_search = bind_api()", "type": "assigned_variable", "loc": [537, 543], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6658, 0.0086, 1, 0.16, 0.7628, 758, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "create_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " create_saved_search = bind_api(\n path = '/saved_searches/create.json',\n method = 'POST',\n payload_type = 'saved_search',\n allowed_param = ['query'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L545_C4", "label": "expression", "type": "expression", "loc": [545, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.672, 0.0012, 1, 0.16, 0.7692, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" saved_searches/destroy \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L546_C4", "label": "destroy_saved_search = bind_api()", "type": "assigned_variable", "loc": [546, 552], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.6769, 0.0086, 1, 0.16, 0.7756, 4, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "destroy_saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " destroy_saved_search = bind_api(\n path = '/saved_searches/destroy/{id}.json',\n method = 'DELETE',\n payload_type = 'saved_search',\n allowed_param = ['id'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L554_C4", "label": "expression", "type": "expression", "loc": [554, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.6831, 0.0012, 1, 0.16, 0.7821, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" help/test \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4", "label": "test", "type": "function", "loc": [555, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.6887, 0.0099, 1, 0.16, 0.7885, 224, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test(self):\n try:\n bind_api(\n path = '/help/test.json',\n )(self)\n except WeibopError:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8", "label": "try", "type": "try", "loc": [556, 561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4", "vector": [7, 2, 0.6887, 0.0074, 2, 0.82, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n bind_api(\n path = '/help/test.json',\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L557_C12", "label": "expression", "type": "expression", "loc": [557, 559], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8", "vector": [8, 3, 0.688, 0.0037, 3, 0.38, 0.0, 0, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bind_api(\n path = '/help/test.json',\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L561_C12", "label": "return", "type": "return", "loc": [561, 561], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8", "vector": [13, 3, 0.6917, 0.0012, 3, 0.38, 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_151:Return_L562_C8", "label": "return", "type": "return", "loc": [562, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4", "vector": [13, 2, 0.693, 0.0012, 2, 0.82, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L564_C4", "label": "create_list", "type": "function", "loc": [564, 571], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.6998, 0.0099, 1, 0.16, 0.7949, 955, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "create_list", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_list(self, *args, **kargs):\n return bind_api(\n path = '/%s/lists.json' % self.auth.get_username(),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L565_C8", "label": "return", "type": "return", "loc": [565, 571], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L564_C4", "vector": [13, 2, 0.7004, 0.0086, 2, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists.json' % self.auth.get_username(),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L573_C4", "label": "destroy_list", "type": "function", "loc": [573, 579], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.7102, 0.0086, 1, 0.16, 0.8013, 679, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "destroy_list", "arg_names": ["self", "slug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy_list(self, slug):\n return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L574_C8", "label": "return", "type": "return", "loc": [574, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L573_C4", "vector": [13, 2, 0.7109, 0.0074, 2, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n require_auth = True\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L581_C4", "label": "update_list", "type": "function", "loc": [581, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.7207, 0.0099, 1, 0.16, 0.8077, 886, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "update_list", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_list(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L582_C8", "label": "return", "type": "return", "loc": [582, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L581_C4", "vector": [13, 2, 0.7213, 0.0086, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['name', 'mode', 'description'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L590_C4", "label": "lists = bind_api()", "type": "assigned_variable", "loc": [590, 595], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7306, 0.0074, 1, 0.16, 0.8141, 194, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists = bind_api(\n path = '/{user}/lists.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L597_C4", "label": "lists_memberships = bind_api()", "type": "assigned_variable", "loc": [597, 602], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7392, 0.0074, 1, 0.16, 0.8205, 262, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists_memberships", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists_memberships = bind_api(\n path = '/{user}/lists/memberships.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L604_C4", "label": "lists_subscriptions = bind_api()", "type": "assigned_variable", "loc": [604, 609], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7478, 0.0074, 1, 0.16, 0.8269, 33, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "lists_subscriptions", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " lists_subscriptions = bind_api(\n path = '/{user}/lists/subscriptions.json',\n payload_type = 'list', payload_list = True,\n allowed_param = ['user', 'cursor'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L611_C4", "label": "list_timeline = bind_api()", "type": "assigned_variable", "loc": [611, 615], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7559, 0.0062, 1, 0.16, 0.8333, 458, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_timeline", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_timeline = bind_api(\n path = '/{owner}/lists/{slug}/statuses.json',\n payload_type = 'status', payload_list = True,\n allowed_param = ['owner', 'slug', 'since_id', 'max_id', 'count', 'page']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L617_C4", "label": "get_list = bind_api()", "type": "assigned_variable", "loc": [617, 621], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7633, 0.0062, 1, 0.16, 0.8397, 868, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "get_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " get_list = bind_api(\n path = '/{owner}/lists/{slug}.json',\n payload_type = 'list',\n allowed_param = ['owner', 'slug']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L623_C4", "label": "add_list_member", "type": "function", "loc": [623, 630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.7725, 0.0099, 1, 0.16, 0.8462, 485, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "add_list_member", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_list_member(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L624_C8", "label": "return", "type": "return", "loc": [624, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L623_C4", "vector": [13, 2, 0.7731, 0.0086, 2, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L632_C4", "label": "remove_list_member", "type": "function", "loc": [632, 639], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.7836, 0.0099, 1, 0.16, 0.8526, 218, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "remove_list_member", "arg_names": ["self", "slug", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_list_member(self, slug, *args, **kargs):\n return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L633_C8", "label": "return", "type": "return", "loc": [633, 639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L632_C4", "vector": [13, 2, 0.7842, 0.0086, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members.json' % (self.auth.get_username(), slug),\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['id'],\n require_auth = True\n )(self, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L641_C4", "label": "list_members = bind_api()", "type": "assigned_variable", "loc": [641, 645], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.7928, 0.0062, 1, 0.16, 0.859, 968, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_members", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_members = bind_api(\n path = '/{owner}/{slug}/members.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['owner', 'slug', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L647_C4", "label": "is_list_member", "type": "function", "loc": [647, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.8021, 0.0099, 1, 0.16, 0.8654, 656, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "is_list_member", "arg_names": ["self", "owner", "slug", "user_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_list_member(self, owner, slug, user_id):\n try:\n return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8", "label": "try", "type": "try", "loc": [648, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L647_C4", "vector": [7, 2, 0.8027, 0.0086, 2, 0.65, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L649_C12", "label": "return", "type": "return", "loc": [649, 652], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8", "vector": [13, 3, 0.8021, 0.0049, 3, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/members/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L654_C12", "label": "return", "type": "return", "loc": [654, 654], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8", "vector": [13, 3, 0.8064, 0.0012, 3, 0.58, 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_151:Assign_L656_C4", "label": "subscribe_list = bind_api()", "type": "assigned_variable", "loc": [656, 662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8126, 0.0086, 1, 0.16, 0.8718, 65, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "subscribe_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " subscribe_list = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n method = 'POST',\n payload_type = 'list',\n allowed_param = ['owner', 'slug'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L664_C4", "label": "unsubscribe_list = bind_api()", "type": "assigned_variable", "loc": [664, 670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8224, 0.0086, 1, 0.16, 0.8782, 148, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "unsubscribe_list", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " unsubscribe_list = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n method = 'DELETE',\n payload_type = 'list',\n allowed_param = ['owner', 'slug'],\n require_auth = True\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L672_C4", "label": "list_subscribers = bind_api()", "type": "assigned_variable", "loc": [672, 676], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8311, 0.0062, 1, 0.16, 0.8846, 349, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "list_subscribers", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " list_subscribers = bind_api(\n path = '/{owner}/{slug}/subscribers.json',\n payload_type = 'user', payload_list = True,\n allowed_param = ['owner', 'slug', 'cursor']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L678_C4", "label": "is_subscribed_list", "type": "function", "loc": [678, 685], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.8403, 0.0099, 1, 0.16, 0.891, 812, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "is_subscribed_list", "arg_names": ["self", "owner", "slug", "user_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_subscribed_list(self, owner, slug, user_id):\n try:\n return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8", "label": "try", "type": "try", "loc": [679, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L678_C4", "vector": [7, 2, 0.8409, 0.0086, 2, 0.05, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)\n except WeibopError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L680_C12", "label": "return", "type": "return", "loc": [680, 683], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8", "vector": [13, 3, 0.8403, 0.0049, 3, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bind_api(\n path = '/%s/%s/subscribers/%s.json' % (owner, slug, user_id),\n payload_type = 'user'\n )(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L685_C12", "label": "return", "type": "return", "loc": [685, 685], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8", "vector": [13, 3, 0.8446, 0.0012, 3, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L687_C4", "label": "expression", "type": "expression", "loc": [687, 687], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.8471, 0.0012, 1, 0.16, 0.8974, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/available \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L688_C4", "label": "trends_available = bind_api()", "type": "assigned_variable", "loc": [688, 692], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8508, 0.0062, 1, 0.16, 0.9038, 229, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends_available", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_available = bind_api(\n path = '/trends/available.json',\n payload_type = 'json',\n allowed_param = ['lat', 'long']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L694_C4", "label": "expression", "type": "expression", "loc": [694, 694], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.8557, 0.0012, 1, 0.16, 0.9103, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/location \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L695_C4", "label": "trends_location = bind_api()", "type": "assigned_variable", "loc": [695, 699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8594, 0.0062, 1, 0.16, 0.9167, 973, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends_location", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_location = bind_api(\n path = '/trends/{woeid}.json',\n payload_type = 'json',\n allowed_param = ['woeid']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L701_C4", "label": "expression", "type": "expression", "loc": [701, 701], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.8644, 0.0012, 1, 0.16, 0.9231, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" search \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L702_C4", "label": "search = bind_api()", "type": "assigned_variable", "loc": [702, 707], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8687, 0.0074, 1, 0.16, 0.9295, 163, 3, 5, 0, 0, 446, 10, 1], "semantic": {"name": "search", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " search = bind_api(\n search_api = True,\n path = '/search.json',\n payload_type = 'search_result', payload_list = True,\n allowed_param = ['q', 'lang', 'locale', 'rpp', 'page', 'since_id', 'geocode', 'show_user']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L708_C4", "label": "search.pagination_mode =", "type": "assigned_variable", "loc": [708, 708], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.873, 0.0012, 1, 0.16, 0.9359, 773, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "search.pagination_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search.pagination_mode = 'page'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L710_C4", "label": "expression", "type": "expression", "loc": [710, 710], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.8755, 0.0012, 1, 0.16, 0.9423, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L711_C4", "label": "trends = bind_api()", "type": "assigned_variable", "loc": [711, 715], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8792, 0.0062, 1, 0.16, 0.9487, 935, 3, 3, 0, 0, 446, 10, 1], "semantic": {"name": "trends", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends = bind_api(\n search_api = True,\n path = '/trends.json',\n payload_type = 'json'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L717_C4", "label": "expression", "type": "expression", "loc": [717, 717], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.8841, 0.0012, 1, 0.16, 0.9551, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/current \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L718_C4", "label": "trends_current = bind_api()", "type": "assigned_variable", "loc": [718, 723], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8884, 0.0074, 1, 0.16, 0.9615, 235, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_current", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_current = bind_api(\n search_api = True,\n path = '/trends/current.json',\n payload_type = 'json',\n allowed_param = ['exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L725_C4", "label": "expression", "type": "expression", "loc": [725, 725], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.894, 0.0012, 1, 0.16, 0.9679, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/daily \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L726_C4", "label": "trends_daily = bind_api()", "type": "assigned_variable", "loc": [726, 731], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.8983, 0.0074, 1, 0.16, 0.9744, 634, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_daily", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_daily = bind_api(\n search_api = True,\n path = '/trends/daily.json',\n payload_type = 'json',\n allowed_param = ['date', 'exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L733_C4", "label": "expression", "type": "expression", "loc": [733, 733], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.9038, 0.0012, 1, 0.16, 0.9808, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" trends/weekly \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L734_C4", "label": "trends_weekly = bind_api()", "type": "assigned_variable", "loc": [734, 739], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [14, 1, 0.9081, 0.0074, 1, 0.16, 0.9872, 285, 3, 4, 0, 0, 446, 10, 1], "semantic": {"name": "trends_weekly", "arg_names": [], "import_names": [], "rhs_call_name": "bind_api", "annotation": ""}, "snippet": " trends_weekly = bind_api(\n search_api = True,\n path = '/trends/weekly.json',\n payload_type = 'json',\n allowed_param = ['date', 'exclude']\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L740_C4", "label": "expression", "type": "expression", "loc": [740, 740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [8, 1, 0.9125, 0.0012, 1, 0.16, 0.9936, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Internal use only \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "label": "_pack_image", "type": "function", "loc": [742, 810], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "vector": [2, 1, 0.9568, 0.0851, 1, 0.16, 1.0, 140, 0, 7, 1, 0, 0, 0, 45], "semantic": {"name": "_pack_image", "arg_names": ["filename", "max_size", "source", "status", "lat", "long", "contentname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _pack_image(filename, max_size, source=None, status=None, lat=None, long=None, contentname=\"image\"):\n \"\"\"Pack image from file into multipart-formdata post body\"\"\"\n # image must be less than 700kb in size\n try:\n if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')\n #except os.error, e:\n except os.error:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L743_C8", "label": "expression", "type": "expression", "loc": [743, 743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9162, 0.0012, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Pack image from file into multipart-formdata post body\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L745_C8", "label": "try", "type": "try", "loc": [745, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [7, 2, 0.9217, 0.0074, 2, 0.6, 0.0385, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')\n #except os.error, e:\n except os.error:\n raise WeibopError('Unable to access file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L746_C12", "label": "if", "type": "if", "loc": [746, 747], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L745_C8", "vector": [4, 3, 0.9205, 0.0025, 3, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.getsize(filename) > (max_size * 1024):\n raise WeibopError('File is too big, must be less than 700kb.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L753_C8", "label": "file_type = guess_type()", "type": "assigned_variable", "loc": [753, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9285, 0.0012, 2, 0.6, 0.0769, 402, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "file_type", "arg_names": [], "import_names": [], "rhs_call_name": "guess_type", "annotation": ""}, "snippet": " file_type = mimetypes.guess_type(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L754_C8", "label": "if", "type": "if", "loc": [754, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.9303, 0.0025, 2, 0.6, 0.1154, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file_type is None:\n raise WeibopError('Could not determine file type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L756_C8", "label": "file_type =", "type": "assigned_variable", "loc": [756, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9322, 0.0012, 2, 0.6, 0.1538, 402, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_type = file_type[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L757_C8", "label": "if", "type": "if", "loc": [757, 758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.934, 0.0025, 2, 0.6, 0.1923, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file_type not in ['image/gif', 'image/jpeg', 'image/png']:\n raise WeibopError('Invalid file type for image: %s' % file_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L761_C8", "label": "fp = open()", "type": "assigned_variable", "loc": [761, 761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9383, 0.0012, 2, 0.6, 0.2308, 392, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fp = open(filename, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L762_C8", "label": "BOUNDARY =", "type": "assigned_variable", "loc": [762, 762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9396, 0.0012, 2, 0.6, 0.2692, 677, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDARY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDARY = 'Tw3ePy'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L763_C8", "label": "body =", "type": "assigned_variable", "loc": [763, 763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9408, 0.0012, 2, 0.6, 0.3077, 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_151:If_L764_C8", "label": "if", "type": "if", "loc": [764, 770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.9457, 0.0086, 2, 0.6, 0.3462, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"status\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L765_C12", "label": "append()", "type": "expression", "loc": [765, 765], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.9433, 0.0012, 3, 0.82, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L766_C12", "label": "append()", "type": "expression", "loc": [766, 766], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.9445, 0.0012, 3, 0.82, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"status\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L767_C12", "label": "append()", "type": "expression", "loc": [767, 767], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.9457, 0.0012, 3, 0.82, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L768_C12", "label": "append()", "type": "expression", "loc": [768, 768], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.947, 0.0012, 3, 0.82, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L769_C12", "label": "append()", "type": "expression", "loc": [769, 769], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.9482, 0.0012, 3, 0.82, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L770_C12", "label": "append()", "type": "expression", "loc": [770, 770], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "vector": [8, 3, 0.9494, 0.0012, 3, 0.82, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "label": "if", "type": "if", "loc": [771, 777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.9544, 0.0086, 2, 0.6, 0.3846, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if source is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"source\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L772_C12", "label": "append()", "type": "expression", "loc": [772, 772], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9519, 0.0012, 3, 0.92, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L773_C12", "label": "append()", "type": "expression", "loc": [773, 773], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9531, 0.0012, 3, 0.92, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"source\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L774_C12", "label": "append()", "type": "expression", "loc": [774, 774], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9544, 0.0012, 3, 0.92, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L775_C12", "label": "append()", "type": "expression", "loc": [775, 775], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9556, 0.0012, 3, 0.92, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L776_C12", "label": "append()", "type": "expression", "loc": [776, 776], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9568, 0.0012, 3, 0.92, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L777_C12", "label": "append()", "type": "expression", "loc": [777, 777], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "vector": [8, 3, 0.9581, 0.0012, 3, 0.92, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "label": "if", "type": "if", "loc": [778, 784], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.963, 0.0086, 2, 0.6, 0.4231, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lat is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"lat\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L779_C12", "label": "append()", "type": "expression", "loc": [779, 779], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.9605, 0.0012, 3, 0.44, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L780_C12", "label": "append()", "type": "expression", "loc": [780, 780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.9618, 0.0012, 3, 0.44, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"lat\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L781_C12", "label": "append()", "type": "expression", "loc": [781, 781], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.963, 0.0012, 3, 0.44, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L782_C12", "label": "append()", "type": "expression", "loc": [782, 782], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.9642, 0.0012, 3, 0.44, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L783_C12", "label": "append()", "type": "expression", "loc": [783, 783], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.9655, 0.0012, 3, 0.44, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L784_C12", "label": "append()", "type": "expression", "loc": [784, 784], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "vector": [8, 3, 0.9667, 0.0012, 3, 0.44, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(lat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "label": "if", "type": "if", "loc": [785, 791], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [4, 2, 0.9716, 0.0086, 2, 0.6, 0.4615, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if long is not None: \n body.append('--' + BOUNDARY)\n body.append('Content-Disposition: form-data; name=\"long\"')\n body.append('Content-Type: text/plain; charset=US-ASCII')\n body.append('Content-Transfer-Encoding: 8bit')\n body.append('')\n body.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L786_C12", "label": "append()", "type": "expression", "loc": [786, 786], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9692, 0.0012, 3, 0.65, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L787_C12", "label": "append()", "type": "expression", "loc": [787, 787], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9704, 0.0012, 3, 0.65, 0.2, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"long\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L788_C12", "label": "append()", "type": "expression", "loc": [788, 788], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9716, 0.0012, 3, 0.65, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: text/plain; charset=US-ASCII')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L789_C12", "label": "append()", "type": "expression", "loc": [789, 789], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9729, 0.0012, 3, 0.65, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: 8bit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L790_C12", "label": "append()", "type": "expression", "loc": [790, 790], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9741, 0.0012, 3, 0.65, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L791_C12", "label": "append()", "type": "expression", "loc": [791, 791], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "vector": [8, 3, 0.9753, 0.0012, 3, 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": " body.append(long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L792_C8", "label": "append()", "type": "expression", "loc": [792, 792], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9766, 0.0012, 2, 0.6, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L793_C8", "label": "append()", "type": "expression", "loc": [793, 793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9778, 0.0012, 2, 0.6, 0.5385, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Disposition: form-data; name=\"'+ contentname +'\"; filename=\"%s\"' % filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L794_C8", "label": "append()", "type": "expression", "loc": [794, 794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.979, 0.0012, 2, 0.6, 0.5769, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Type: %s' % file_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L795_C8", "label": "append()", "type": "expression", "loc": [795, 795], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9803, 0.0012, 2, 0.6, 0.6154, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('Content-Transfer-Encoding: binary')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L796_C8", "label": "append()", "type": "expression", "loc": [796, 796], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9815, 0.0012, 2, 0.6, 0.6538, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L797_C8", "label": "append()", "type": "expression", "loc": [797, 797], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9827, 0.0012, 2, 0.6, 0.6923, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append(fp.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L798_C8", "label": "append()", "type": "expression", "loc": [798, 798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.984, 0.0012, 2, 0.6, 0.7308, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY + '--')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L799_C8", "label": "append()", "type": "expression", "loc": [799, 799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9852, 0.0012, 2, 0.6, 0.7692, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L800_C8", "label": "close()", "type": "expression", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9864, 0.0012, 2, 0.6, 0.8077, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L801_C8", "label": "append()", "type": "expression", "loc": [801, 801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9877, 0.0012, 2, 0.6, 0.8462, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('--' + BOUNDARY + '--')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L802_C8", "label": "append()", "type": "expression", "loc": [802, 802], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [8, 2, 0.9889, 0.0012, 2, 0.6, 0.8846, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " body.append('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L803_C8", "label": "body = join()", "type": "assigned_variable", "loc": [803, 803], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9901, 0.0012, 2, 0.6, 0.9231, 477, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " body = '\\r\\n'.join(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L805_C8", "label": "headers =", "type": "assigned_variable", "loc": [805, 808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [14, 2, 0.9945, 0.0049, 2, 0.6, 0.9615, 950, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'Content-Type': 'multipart/form-data; boundary=Tw3ePy',\n 'Content-Length': len(body)\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L810_C8", "label": "return", "type": "return", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "vector": [13, 2, 0.9988, 0.0012, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return headers, body"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L328_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L366_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L405_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L425_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L441_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L449_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L450_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L458_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L477_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L486_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L498_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L522_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L546_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L554_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L573_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L581_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L581_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L597_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L623_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L623_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L649_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L648_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L654_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L656_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L672_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L680_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L679_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L685_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L687_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L688_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L694_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L701_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L702_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L708_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L710_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L711_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L717_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L718_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L725_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L726_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L733_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L734_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L740_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:Try_L745_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L746_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L753_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L754_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L757_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L762_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L765_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L766_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L767_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L768_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L769_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L764_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L770_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L772_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L773_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L774_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L775_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L776_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L771_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L777_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L779_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L780_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L781_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L782_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L783_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L778_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L784_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L786_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L787_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L788_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L789_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L790_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:If_L785_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L791_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L793_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L794_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L795_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L796_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L797_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Expr_L802_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L803_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Assign_L805_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_151:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_151:Return_L810_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from weibopy.error import WeibopError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
self.iterator = CursorIterator(method, args, kargs)
else:
self.iterator = PageIterator(method, args, kargs)
else:
raise WeibopError('This method does not perform pagination')
def pages(self, limit=0):
"""Return iterator for pages"""
if limit > 0:
self.iterator.limit = limit
return self.iterator
def items(self, limit=0):
"""Return iterator for items in each page"""
i = ItemIterator(self.iterator)
i.limit = limit
return i
class BaseIterator(object):
def __init__(self, method, args, kargs):
self.method = method
self.args = args
self.kargs = kargs
self.limit = 0
def next(self):
raise NotImplementedError
def prev(self):
raise NotImplementedError
def __iter__(self):
return self
class CursorIterator(BaseIterator):
def __init__(self, method, args, kargs):
BaseIterator.__init__(self, method, args, kargs)
self.next_cursor = -1
self.prev_cursor = 0
self.count = 0
def next(self):
if self.next_cursor == 0 or (self.limit and self.count == self.limit):
raise StopIteration
data, cursors = self.method(
cursor=self.next_cursor, *self.args, **self.kargs
)
self.prev_cursor, self.next_cursor = cursors
if len(data) == 0:
raise StopIteration
self.count += 1
return data
def prev(self):
if self.prev_cursor == 0:
raise WeibopError('Can not page back more, at first page')
data, self.next_cursor, self.prev_cursor = self.method(
cursor=self.prev_cursor, *self.args, **self.kargs
)
self.count -= 1
return data
class PageIterator(BaseIterator):
def __init__(self, method, args, kargs):
BaseIterator.__init__(self, method, args, kargs)
self.current_page = 0
def next(self):
self.current_page += 1
items = self.method(page=self.current_page, *self.args, **self.kargs)
if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):
raise StopIteration
return items
def prev(self):
if (self.current_page == 1):
raise WeibopError('Can not page back more, at first page')
self.current_page -= 1
return self.method(page=self.current_page, *self.args, **self.kargs)
class ItemIterator(BaseIterator):
def __init__(self, page_iterator):
self.page_iterator = page_iterator
self.limit = 0
self.current_page = None
self.page_index = -1
self.count = 0
def next(self):
if self.limit > 0 and self.count == self.limit:
raise StopIteration
if self.current_page is None or self.page_index == len(self.current_page) - 1:
# Reached end of current page, get the next page...
self.current_page = self.page_iterator.next()
self.page_index = -1
self.page_index += 1
self.count += 1
return self.current_page[self.page_index]
def prev(self):
if self.current_page is None:
raise WeibopError('Can not go back more, at first page')
if self.page_index == 0:
# At the beginning of the current page, move to next...
self.current_page = self.page_iterator.prev()
self.page_index = len(self.current_page)
if self.page_index == 0:
raise WeibopError('No more items')
self.page_index -= 1
self.count -= 1
return self.current_page[self.page_index]
| ajibawa-2023/Python-Code-Large/train/row_152 | 75 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_152:ImportFrom_L5_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0078, 0, 0.66, 0.0, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "label": "Cursor", "type": "class", "loc": [7, 29], "level": 0, "parent": null, "vector": [3, 0, 0.1406, 0.1797, 0, 0.66, 0.2, 647, 0, 3, 0, 0, 186, 0, 5], "semantic": {"name": "Cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Cursor(object):\n \"\"\"Pagination helper class\"\"\"\n\n def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "vector": [8, 1, 0.0625, 0.0078, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Pagination helper class\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "vector": [2, 1, 0.1055, 0.0625, 1, 0.35, 0.3333, 555, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)\n else:\n raise WeibopError('This method does not perform pagination')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L11_C8", "label": "if", "type": "if", "loc": [11, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L10_C4", "vector": [4, 2, 0.1094, 0.0547, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)\n else:\n raise WeibopError('This method does not perform pagination')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12", "label": "if", "type": "if", "loc": [12, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L11_C8", "vector": [4, 3, 0.1055, 0.0312, 3, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args, kargs)\n else:\n self.iterator = PageIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L13_C16", "label": "self.iterator = CursorIterator()", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12", "vector": [14, 4, 0.1016, 0.0078, 4, 0.23, 0.0, 313, 3, 3, 0, 0, 41, 10, 1], "semantic": {"name": "self.iterator", "arg_names": [], "import_names": [], "rhs_call_name": "CursorIterator", "annotation": ""}, "snippet": " self.iterator = CursorIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L15_C16", "label": "self.iterator = PageIterator()", "type": "assigned_variable", "loc": [15, 15], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12", "vector": [14, 4, 0.1172, 0.0078, 4, 0.23, 1.0, 313, 3, 3, 0, 0, 539, 10, 1], "semantic": {"name": "self.iterator", "arg_names": [], "import_names": [], "rhs_call_name": "PageIterator", "annotation": ""}, "snippet": " self.iterator = PageIterator(method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "label": "pages", "type": "function", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "vector": [2, 1, 0.1641, 0.0391, 1, 0.35, 0.6667, 125, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "pages", "arg_names": ["self", "limit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pages(self, limit=0):\n \"\"\"Return iterator for pages\"\"\"\n if limit > 0:\n self.iterator.limit = limit\n return self.iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L20_C8", "label": "expression", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "vector": [8, 2, 0.1562, 0.0078, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return iterator for pages\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "vector": [4, 2, 0.168, 0.0156, 2, 0.05, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if limit > 0:\n self.iterator.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L22_C12", "label": "self.iterator.limit =", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L21_C8", "vector": [14, 3, 0.1719, 0.0078, 3, 0.32, 0.0, 908, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.iterator.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.iterator.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L23_C8", "label": "return", "type": "return", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "vector": [13, 2, 0.1797, 0.0078, 2, 0.05, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "label": "items", "type": "function", "loc": [25, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "vector": [2, 1, 0.2109, 0.0391, 1, 0.35, 1.0, 339, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self", "limit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, limit=0):\n \"\"\"Return iterator for items in each page\"\"\"\n i = ItemIterator(self.iterator)\n i.limit = limit\n return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "vector": [8, 2, 0.2031, 0.0078, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return iterator for items in each page\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L27_C8", "label": "i = ItemIterator()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "vector": [14, 2, 0.2109, 0.0078, 2, 0.3, 0.3333, 826, 3, 1, 0, 0, 198, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "ItemIterator", "annotation": ""}, "snippet": " i = ItemIterator(self.iterator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L28_C8", "label": "i.limit =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "vector": [14, 2, 0.2188, 0.0078, 2, 0.3, 0.6667, 151, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i.limit = limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "vector": [13, 2, 0.2266, 0.0078, 2, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "label": "BaseIterator", "type": "class", "loc": [31, 46], "level": 0, "parent": null, "vector": [3, 0, 0.3008, 0.125, 0, 0.66, 0.4, 890, 0, 4, 0, 0, 186, 0, 0], "semantic": {"name": "BaseIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseIterator(object):\n\n def __init__(self, method, args, kargs):\n self.method = method\n self.args = args\n self.kargs = kargs\n self.limit = 0\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "label": "__init__", "type": "function", "loc": [33, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "vector": [2, 1, 0.2734, 0.0391, 1, 0.6, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n self.method = method\n self.args = args\n self.kargs = kargs\n self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L34_C8", "label": "self.method =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "vector": [14, 2, 0.2656, 0.0078, 2, 0.85, 0.0, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L35_C8", "label": "self.args =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "vector": [14, 2, 0.2734, 0.0078, 2, 0.85, 0.3333, 640, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.args = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L36_C8", "label": "self.kargs =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "vector": [14, 2, 0.2812, 0.0078, 2, 0.85, 0.6667, 182, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kargs = kargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L37_C8", "label": "self.limit =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "vector": [14, 2, 0.2891, 0.0078, 2, 0.85, 1.0, 467, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L39_C4", "label": "next", "type": "function", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "vector": [2, 1, 0.3086, 0.0156, 1, 0.6, 0.3333, 11, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def next(self):\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L42_C4", "label": "prev", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "vector": [2, 1, 0.332, 0.0156, 1, 0.6, 0.6667, 749, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L45_C4", "label": "__iter__", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "vector": [2, 1, 0.3555, 0.0156, 1, 0.6, 1.0, 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_152:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L45_C4", "vector": [13, 2, 0.3594, 0.0078, 2, 0.3, 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_152:ClassDef_L48_C0", "label": "CursorIterator", "type": "class", "loc": [48, 75], "level": 0, "parent": null, "vector": [3, 0, 0.4805, 0.2188, 0, 0.66, 0.6, 41, 0, 3, 0, 0, 890, 0, 5], "semantic": {"name": "CursorIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CursorIterator(BaseIterator):\n\n def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.next_cursor = -1\n self.prev_cursor = 0\n self.count = 0\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "label": "__init__", "type": "function", "loc": [50, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "vector": [2, 1, 0.4062, 0.0391, 1, 0.59, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.next_cursor = -1\n self.prev_cursor = 0\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L51_C8", "label": "__init__()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "vector": [8, 2, 0.3984, 0.0078, 2, 0.6, 0.0, 555, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " BaseIterator.__init__(self, method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L52_C8", "label": "self.next_cursor =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "vector": [14, 2, 0.4062, 0.0078, 2, 0.6, 0.3333, 650, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.next_cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.next_cursor = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L53_C8", "label": "self.prev_cursor =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "vector": [14, 2, 0.4141, 0.0078, 2, 0.6, 0.6667, 209, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.prev_cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prev_cursor = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L54_C8", "label": "self.count =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "vector": [14, 2, 0.4219, 0.0078, 2, 0.6, 1.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_152:FunctionDef_L56_C4", "label": "next", "type": "function", "loc": [56, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "vector": [2, 1, 0.4766, 0.0859, 1, 0.59, 0.5, 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.next_cursor == 0 or (self.limit and self.count == self.limit):\n raise StopIteration\n data, cursors = self.method(\n cursor=self.next_cursor, *self.args, **self.kargs\n )\n self.prev_cursor, self.next_cursor = cursors\n if len(data) == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L57_C8", "label": "if", "type": "if", "loc": [57, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "vector": [4, 2, 0.4492, 0.0156, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.next_cursor == 0 or (self.limit and self.count == self.limit):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L59_C8", "label": "data, cursors = method()", "type": "assigned_variable", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "vector": [14, 2, 0.4688, 0.0234, 2, 0.64, 0.25, 413, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "data, cursors", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " data, cursors = self.method(\n cursor=self.next_cursor, *self.args, **self.kargs\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L62_C8", "label": "assign", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "vector": [14, 2, 0.4844, 0.0078, 2, 0.64, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prev_cursor, self.next_cursor = cursors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "vector": [4, 2, 0.4961, 0.0156, 2, 0.64, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(data) == 0:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "vector": [13, 2, 0.5156, 0.0078, 2, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "label": "prev", "type": "function", "loc": [68, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "vector": [2, 1, 0.5586, 0.0625, 1, 0.59, 1.0, 749, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if self.prev_cursor == 0:\n raise WeibopError('Can not page back more, at first page')\n data, self.next_cursor, self.prev_cursor = self.method(\n cursor=self.prev_cursor, *self.args, **self.kargs\n )\n self.count -= 1\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L69_C8", "label": "if", "type": "if", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "vector": [4, 2, 0.543, 0.0156, 2, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.prev_cursor == 0:\n raise WeibopError('Can not page back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L71_C8", "label": "data = method()", "type": "assigned_variable", "loc": [71, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "vector": [14, 2, 0.5625, 0.0234, 2, 0.98, 0.5, 929, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " data, self.next_cursor, self.prev_cursor = self.method(\n cursor=self.prev_cursor, *self.args, **self.kargs\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "vector": [13, 2, 0.5859, 0.0078, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "label": "PageIterator", "type": "class", "loc": [77, 94], "level": 0, "parent": null, "vector": [3, 0, 0.668, 0.1406, 0, 0.66, 0.8, 539, 0, 3, 0, 0, 890, 0, 5], "semantic": {"name": "PageIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PageIterator(BaseIterator):\n\n def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.current_page = 0\n\n def next(self):\n self.current_page += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4", "label": "__init__", "type": "function", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "vector": [2, 1, 0.625, 0.0234, 1, 0.09, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "method", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, args, kargs):\n BaseIterator.__init__(self, method, args, kargs)\n self.current_page = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L80_C8", "label": "__init__()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4", "vector": [8, 2, 0.625, 0.0078, 2, 0.73, 0.0, 555, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " BaseIterator.__init__(self, method, args, kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L81_C8", "label": "self.current_page =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4", "vector": [14, 2, 0.6328, 0.0078, 2, 0.73, 1.0, 384, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_page = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "label": "next", "type": "function", "loc": [83, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "vector": [2, 1, 0.668, 0.0469, 1, 0.09, 0.5, 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 self.current_page += 1\n items = self.method(page=self.current_page, *self.args, **self.kargs)\n if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):\n raise StopIteration\n return items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L85_C8", "label": "items = method()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "vector": [14, 2, 0.6641, 0.0078, 2, 0.16, 0.0, 339, 3, 3, 0, 0, 445, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "method", "annotation": ""}, "snippet": " items = self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L86_C8", "label": "if", "type": "if", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "vector": [4, 2, 0.6758, 0.0156, 2, 0.16, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) == 0 or (self.limit > 0 and self.current_page > self.limit):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L88_C8", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "vector": [13, 2, 0.6875, 0.0078, 2, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4", "label": "prev", "type": "function", "loc": [90, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "vector": [2, 1, 0.7188, 0.0391, 1, 0.09, 1.0, 749, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if (self.current_page == 1):\n raise WeibopError('Can not page back more, at first page')\n self.current_page -= 1\n return self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L91_C8", "label": "if", "type": "if", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4", "vector": [4, 2, 0.7148, 0.0156, 2, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.current_page == 1):\n raise WeibopError('Can not page back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4", "vector": [13, 2, 0.7344, 0.0078, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.method(page=self.current_page, *self.args, **self.kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "label": "ItemIterator", "type": "class", "loc": [96, 127], "level": 0, "parent": null, "vector": [3, 0, 0.8711, 0.25, 0, 0.66, 1.0, 198, 0, 3, 0, 0, 890, 0, 6], "semantic": {"name": "ItemIterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ItemIterator(BaseIterator):\n\n def __init__(self, page_iterator):\n self.page_iterator = page_iterator\n self.limit = 0\n self.current_page = None\n self.page_index = -1\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "vector": [2, 1, 0.7852, 0.0469, 1, 0.89, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "page_iterator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, page_iterator):\n self.page_iterator = page_iterator\n self.limit = 0\n self.current_page = None\n self.page_index = -1\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L99_C8", "label": "self.page_iterator =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "vector": [14, 2, 0.7734, 0.0078, 2, 0.14, 0.0, 79, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_iterator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_iterator = page_iterator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L100_C8", "label": "self.limit =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "vector": [14, 2, 0.7812, 0.0078, 2, 0.14, 0.25, 467, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.limit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L101_C8", "label": "self.current_page =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "vector": [14, 2, 0.7891, 0.0078, 2, 0.14, 0.5, 384, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_page = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L102_C8", "label": "self.page_index =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "vector": [14, 2, 0.7969, 0.0078, 2, 0.14, 0.75, 502, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L103_C8", "label": "self.count =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "vector": [14, 2, 0.8047, 0.0078, 2, 0.14, 1.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_152:FunctionDef_L105_C4", "label": "next", "type": "function", "loc": [105, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "vector": [2, 1, 0.8555, 0.0781, 1, 0.89, 0.5, 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.limit > 0 and self.count == self.limit:\n raise StopIteration\n if self.current_page is None or self.page_index == len(self.current_page) - 1:\n # Reached end of current page, get the next page...\n self.current_page = self.page_iterator.next()\n self.page_index = -1\n self.page_index += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L106_C8", "label": "if", "type": "if", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "vector": [4, 2, 0.832, 0.0156, 2, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.limit > 0 and self.count == self.limit:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8", "label": "if", "type": "if", "loc": [108, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "vector": [4, 2, 0.8555, 0.0312, 2, 0.09, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_page is None or self.page_index == len(self.current_page) - 1:\n # Reached end of current page, get the next page...\n self.current_page = self.page_iterator.next()\n self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L110_C12", "label": "self.current_page = next()", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8", "vector": [14, 3, 0.8594, 0.0078, 3, 0.97, 0.0, 384, 3, 0, 0, 0, 11, 10, 1], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " self.current_page = self.page_iterator.next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L111_C12", "label": "self.page_index =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8", "vector": [14, 3, 0.8672, 0.0078, 3, 0.97, 1.0, 502, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.page_index = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "vector": [13, 2, 0.8906, 0.0078, 2, 0.09, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.current_page[self.page_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "label": "prev", "type": "function", "loc": [116, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "vector": [2, 1, 0.9492, 0.0938, 1, 0.89, 1.0, 749, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "prev", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prev(self):\n if self.current_page is None:\n raise WeibopError('Can not go back more, at first page')\n if self.page_index == 0:\n # At the beginning of the current page, move to next...\n self.current_page = self.page_iterator.prev()\n self.page_index = len(self.current_page)\n if self.page_index == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L117_C8", "label": "if", "type": "if", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "vector": [4, 2, 0.918, 0.0156, 2, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_page is None:\n raise WeibopError('Can not go back more, at first page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "label": "if", "type": "if", "loc": [119, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "vector": [4, 2, 0.9492, 0.0469, 2, 0.08, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.page_index == 0:\n # At the beginning of the current page, move to next...\n self.current_page = self.page_iterator.prev()\n self.page_index = len(self.current_page)\n if self.page_index == 0:\n raise WeibopError('No more items')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L121_C12", "label": "self.current_page = prev()", "type": "assigned_variable", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "vector": [14, 3, 0.9453, 0.0078, 3, 0.89, 0.0, 384, 3, 0, 0, 0, 749, 10, 1], "semantic": {"name": "self.current_page", "arg_names": [], "import_names": [], "rhs_call_name": "prev", "annotation": ""}, "snippet": " self.current_page = self.page_iterator.prev()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L122_C12", "label": "self.page_index = len()", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "vector": [14, 3, 0.9531, 0.0078, 3, 0.89, 0.5, 502, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.page_index", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.page_index = len(self.current_page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:If_L123_C12", "label": "if", "type": "if", "loc": [123, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "vector": [4, 3, 0.9648, 0.0156, 3, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.page_index == 0:\n raise WeibopError('No more items')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "vector": [13, 2, 0.9922, 0.0078, 2, 0.08, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.current_page[self.page_index]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L13_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L15_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_152:If_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_152:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_152:Return_L127_C8"}] |
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
import cPickle as pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
# Probably on a windows system
# TODO: use win32file
pass
class Cache(object):
"""Cache interface"""
def __init__(self, timeout=60):
"""Initialize the cache
timeout: number of seconds to keep a cached entry
"""
self.timeout = timeout
def store(self, key, value):
"""Add new record to cache
key: entry key
value: data of entry
"""
raise NotImplementedError
def get(self, key, timeout=None):
"""Get cached entry if exists and not expired
key: which entry to get
timeout: override timeout with this value [optional]
"""
raise NotImplementedError
def count(self):
"""Get count of entries currently stored in cache"""
raise NotImplementedError
def cleanup(self):
"""Delete any expired entries in cache."""
raise NotImplementedError
def flush(self):
"""Delete all cached entries"""
raise NotImplementedError
class MemoryCache(Cache):
"""In-memory cache"""
def __init__(self, timeout=60):
Cache.__init__(self, timeout)
self._entries = {}
self.lock = threading.Lock()
def __getstate__(self):
# pickle
return {'entries': self._entries, 'timeout': self.timeout}
def __setstate__(self, state):
# unpickle
self.lock = threading.Lock()
self._entries = state['entries']
self.timeout = state['timeout']
def _is_expired(self, entry, timeout):
return timeout > 0 and (time.time() - entry[0]) >= timeout
def store(self, key, value):
self.lock.acquire()
self._entries[key] = (time.time(), value)
self.lock.release()
def get(self, key, timeout=None):
self.lock.acquire()
try:
# check to see if we have this key
entry = self._entries.get(key)
if not entry:
# no hit, return nothing
return None
# use provided timeout in arguments if provided
# otherwise use the one provided during init.
if timeout is None:
timeout = self.timeout
# make sure entry is not expired
if self._is_expired(entry, timeout):
# entry expired, delete and return nothing
del self._entries[key]
return None
# entry found and not expired, return it
return entry[1]
finally:
self.lock.release()
def count(self):
return len(self._entries)
def cleanup(self):
self.lock.acquire()
try:
for k, v in self._entries.items():
if self._is_expired(v, self.timeout):
del self._entries[k]
finally:
self.lock.release()
def flush(self):
self.lock.acquire()
self._entries.clear()
self.lock.release()
class FileCache(Cache):
"""File-based cache"""
# locks used to make cache thread-safe
cache_locks = {}
def __init__(self, cache_dir, timeout=60):
Cache.__init__(self, timeout)
if os.path.exists(cache_dir) is False:
os.mkdir(cache_dir)
self.cache_dir = cache_dir
if cache_dir in FileCache.cache_locks:
self.lock = FileCache.cache_locks[cache_dir]
else:
self.lock = threading.Lock()
FileCache.cache_locks[cache_dir] = self.lock
if os.name == 'posix':
self._lock_file = self._lock_file_posix
self._unlock_file = self._unlock_file_posix
elif os.name == 'nt':
self._lock_file = self._lock_file_win32
self._unlock_file = self._unlock_file_win32
else:
print 'Warning! FileCache locking not supported on this system!'
self._lock_file = self._lock_file_dummy
self._unlock_file = self._unlock_file_dummy
def _get_path(self, key):
md5 = hashlib.md5()
md5.update(key)
return os.path.join(self.cache_dir, md5.hexdigest())
def _lock_file_dummy(self, path, exclusive=True):
return None
def _unlock_file_dummy(self, lock):
return
def _lock_file_posix(self, path, exclusive=True):
lock_path = path + '.lock'
if exclusive is True:
f_lock = open(lock_path, 'w')
fcntl.lockf(f_lock, fcntl.LOCK_EX)
else:
f_lock = open(lock_path, 'r')
fcntl.lockf(f_lock, fcntl.LOCK_SH)
if os.path.exists(lock_path) is False:
f_lock.close()
return None
return f_lock
def _unlock_file_posix(self, lock):
lock.close()
def _lock_file_win32(self, path, exclusive=True):
# TODO: implement
return None
def _unlock_file_win32(self, lock):
# TODO: implement
return
def _delete_file(self, path):
os.remove(path)
if os.path.exists(path + '.lock'):
os.remove(path + '.lock')
def store(self, key, value):
path = self._get_path(key)
self.lock.acquire()
try:
# acquire lock and open file
f_lock = self._lock_file(path)
datafile = open(path, 'wb')
# write data
pickle.dump((time.time(), value), datafile)
# close and unlock file
datafile.close()
self._unlock_file(f_lock)
finally:
self.lock.release()
def get(self, key, timeout=None):
return self._get(self._get_path(key), timeout)
def _get(self, path, timeout):
if os.path.exists(path) is False:
# no record
return None
self.lock.acquire()
try:
# acquire lock and open
f_lock = self._lock_file(path, False)
datafile = open(path, 'rb')
# read pickled object
created_time, value = pickle.load(datafile)
datafile.close()
# check if value is expired
if timeout is None:
timeout = self.timeout
if timeout > 0 and (time.time() - created_time) >= timeout:
# expired! delete from cache
value = None
self._delete_file(path)
# unlock and return result
self._unlock_file(f_lock)
return value
finally:
self.lock.release()
def count(self):
c = 0
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
c += 1
return c
def cleanup(self):
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
self._get(os.path.join(self.cache_dir, entry), None)
def flush(self):
for entry in os.listdir(self.cache_dir):
if entry.endswith('.lock'):
continue
self._delete_file(os.path.join(self.cache_dir, entry))
| ajibawa-2023/Python-Code-Large/train/row_153 | 158 | 264 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L5_C0", "label": "time import time", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0038, 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_153:Import_L6_C0", "label": "threading import threading", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0038, 0, 0.66, 0.125, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L7_C0", "label": "os import os", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0265, 0.0038, 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_153:Import_L8_C0", "label": "cPickle import pickle", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0038, 0, 0.66, 0.375, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "label": "try", "type": "try", "loc": [10, 14], "level": 0, "parent": null, "vector": [7, 0, 0.0455, 0.0189, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import hashlib\nexcept ImportError:\n # python 2.4\n import md5 as hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L11_C4", "label": "hashlib import hashlib", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "vector": [1, 1, 0.0417, 0.0038, 1, 0.99, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L14_C4", "label": "md5 import hashlib", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "vector": [1, 1, 0.053, 0.0038, 1, 0.99, 0.0, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "md5", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import md5 as hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L16_C0", "label": "try", "type": "try", "loc": [16, 21], "level": 0, "parent": null, "vector": [7, 0, 0.0701, 0.0227, 0, 0.66, 0.625, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import fcntl\nexcept ImportError:\n # Probably on a windows system\n # TODO: use win32file\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L17_C4", "label": "fcntl import fcntl", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L16_C0", "vector": [1, 1, 0.0644, 0.0038, 1, 0.4, 0.0, 488, 0, 1, 0, 0, 488, 0, 0], "semantic": {"name": "fcntl", "arg_names": [], "import_names": ["fcntl"], "rhs_call_name": "", "annotation": ""}, "snippet": " import fcntl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "label": "Cache", "type": "class", "loc": [24, 57], "level": 0, "parent": null, "vector": [3, 0, 0.1534, 0.1288, 0, 0.66, 0.75, 419, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "Cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Cache(object):\n \"\"\"Cache interface\"\"\"\n\n def __init__(self, timeout=60):\n \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\"\n self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [8, 1, 0.0947, 0.0038, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Cache interface\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4", "label": "__init__", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.1098, 0.0189, 1, 0.52, 0.1667, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, timeout=60):\n \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\"\n self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L28_C8", "label": "expression", "type": "expression", "loc": [28, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4", "vector": [8, 2, 0.1098, 0.0114, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize the cache\n timeout: number of seconds to keep a cached entry\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L31_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4", "vector": [14, 2, 0.1174, 0.0038, 2, 0.06, 1.0, 621, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L33_C4", "label": "store", "type": "function", "loc": [33, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.1345, 0.0227, 1, 0.52, 0.3333, 354, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n \"\"\"Add new record to cache\n key: entry key\n value: data of entry\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L34_C8", "label": "expression", "type": "expression", "loc": [34, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L33_C4", "vector": [8, 2, 0.1345, 0.0152, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Add new record to cache\n key: entry key\n value: data of entry\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L40_C4", "label": "get", "type": "function", "loc": [40, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.161, 0.0227, 1, 0.52, 0.5, 607, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n \"\"\"Get cached entry if exists and not expired\n key: which entry to get\n timeout: override timeout with this value [optional]\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L40_C4", "vector": [8, 2, 0.161, 0.0152, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get cached entry if exists and not expired\n key: which entry to get\n timeout: override timeout with this value [optional]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L47_C4", "label": "count", "type": "function", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.1818, 0.0114, 1, 0.52, 0.6667, 778, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n \"\"\"Get count of entries currently stored in cache\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L48_C8", "label": "expression", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L47_C4", "vector": [8, 2, 0.1818, 0.0038, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get count of entries currently stored in cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L51_C4", "label": "cleanup", "type": "function", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.197, 0.0114, 1, 0.52, 0.8333, 656, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n \"\"\"Delete any expired entries in cache.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L51_C4", "vector": [8, 2, 0.197, 0.0038, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete any expired entries in cache.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L55_C4", "label": "flush", "type": "function", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "vector": [2, 1, 0.2121, 0.0114, 1, 0.52, 1.0, 439, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n \"\"\"Delete all cached entries\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L55_C4", "vector": [8, 2, 0.2121, 0.0038, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete all cached entries\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "label": "MemoryCache", "type": "class", "loc": [60, 126], "level": 0, "parent": null, "vector": [3, 0, 0.3523, 0.2538, 0, 0.66, 0.875, 322, 0, 9, 0, 0, 419, 0, 19], "semantic": {"name": "MemoryCache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MemoryCache(Cache):\n \"\"\"In-memory cache\"\"\"\n\n def __init__(self, timeout=60):\n Cache.__init__(self, timeout)\n self._entries = {}\n self.lock = threading.Lock()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L61_C4", "label": "expression", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [8, 1, 0.2311, 0.0038, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"In-memory cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "label": "__init__", "type": "function", "loc": [63, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.2443, 0.0152, 1, 0.9, 0.1111, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, timeout=60):\n Cache.__init__(self, timeout)\n self._entries = {}\n self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L64_C8", "label": "__init__()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "vector": [8, 2, 0.2424, 0.0038, 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": " Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L65_C8", "label": "self._entries =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "vector": [14, 2, 0.2462, 0.0038, 2, 0.02, 0.5, 710, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._entries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L66_C8", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "vector": [14, 2, 0.25, 0.0038, 2, 0.02, 1.0, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L68_C4", "label": "__getstate__", "type": "function", "loc": [68, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.2614, 0.0114, 1, 0.9, 0.2222, 250, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n # pickle\n return {'entries': self._entries, 'timeout': self.timeout}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L68_C4", "vector": [13, 2, 0.2652, 0.0038, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'entries': self._entries, 'timeout': self.timeout}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "label": "__setstate__", "type": "function", "loc": [72, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.2803, 0.0189, 1, 0.9, 0.3333, 698, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__setstate__", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setstate__(self, state):\n # unpickle\n self.lock = threading.Lock()\n self._entries = state['entries']\n self.timeout = state['timeout']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L74_C8", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "vector": [14, 2, 0.2803, 0.0038, 2, 0.09, 0.0, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L75_C8", "label": "self._entries =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "vector": [14, 2, 0.2841, 0.0038, 2, 0.09, 0.5, 710, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._entries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries = state['entries']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L76_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "vector": [14, 2, 0.2879, 0.0038, 2, 0.09, 1.0, 621, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = state['timeout']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L78_C4", "label": "_is_expired", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.2973, 0.0076, 1, 0.9, 0.4444, 501, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_is_expired", "arg_names": ["self", "entry", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _is_expired(self, entry, timeout):\n return timeout > 0 and (time.time() - entry[0]) >= timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L78_C4", "vector": [13, 2, 0.2992, 0.0038, 2, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return timeout > 0 and (time.time() - entry[0]) >= timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "label": "store", "type": "function", "loc": [81, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.3125, 0.0152, 1, 0.9, 0.5556, 354, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n self.lock.acquire()\n self._entries[key] = (time.time(), value)\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L82_C8", "label": "acquire()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "vector": [8, 2, 0.3106, 0.0038, 2, 0.53, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L83_C8", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "vector": [14, 2, 0.3144, 0.0038, 2, 0.53, 0.5, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._entries[key] = (time.time(), value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L84_C8", "label": "release()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "vector": [8, 2, 0.3182, 0.0038, 2, 0.53, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4", "label": "get", "type": "function", "loc": [86, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.3693, 0.0909, 1, 0.9, 0.6667, 607, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n self.lock.acquire()\n try:\n # check to see if we have this key\n entry = self._entries.get(key)\n if not entry:\n # no hit, return nothing\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L87_C8", "label": "acquire()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4", "vector": [8, 2, 0.3295, 0.0038, 2, 0.8, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "label": "try", "type": "try", "loc": [88, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4", "vector": [7, 2, 0.3731, 0.0833, 2, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # check to see if we have this key\n entry = self._entries.get(key)\n if not entry:\n # no hit, return nothing\n return None\n\n # use provided timeout in arguments if provided"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L90_C12", "label": "entry = get()", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [14, 3, 0.3409, 0.0038, 3, 0.06, 0.0, 812, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " entry = self._entries.get(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L91_C12", "label": "if", "type": "if", "loc": [91, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [4, 3, 0.3485, 0.0114, 3, 0.06, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not entry:\n # no hit, return nothing\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L93_C16", "label": "return", "type": "return", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L91_C12", "vector": [13, 4, 0.3523, 0.0038, 4, 0.44, 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_153:If_L97_C12", "label": "if", "type": "if", "loc": [97, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [4, 3, 0.3693, 0.0076, 3, 0.06, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout is None:\n timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L98_C16", "label": "timeout =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L97_C12", "vector": [14, 4, 0.3712, 0.0038, 4, 0.3, 0.0, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L101_C12", "label": "if", "type": "if", "loc": [101, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [4, 3, 0.3883, 0.0152, 3, 0.06, 0.6, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._is_expired(entry, timeout):\n # entry expired, delete and return nothing\n del self._entries[key]\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L104_C16", "label": "return", "type": "return", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L101_C12", "vector": [13, 4, 0.3939, 0.0038, 4, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L107_C12", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [13, 3, 0.4053, 0.0038, 3, 0.06, 0.8, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return entry[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L109_C12", "label": "release()", "type": "expression", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "vector": [8, 3, 0.4129, 0.0038, 3, 0.06, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L111_C4", "label": "count", "type": "function", "loc": [111, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.4223, 0.0076, 1, 0.9, 0.7778, 778, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n return len(self._entries)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L111_C4", "vector": [13, 2, 0.4242, 0.0038, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._entries)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4", "label": "cleanup", "type": "function", "loc": [114, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.4451, 0.0303, 1, 0.9, 0.8889, 656, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n self.lock.acquire()\n try:\n for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]\n finally:\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L115_C8", "label": "acquire()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4", "vector": [8, 2, 0.4356, 0.0038, 2, 0.21, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8", "label": "try", "type": "try", "loc": [116, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4", "vector": [7, 2, 0.4489, 0.0227, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]\n finally:\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:For_L117_C12", "label": "for k, v", "type": "for", "loc": [117, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8", "vector": [6, 3, 0.447, 0.0114, 3, 0.64, 0.0, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self._entries.items():\n if self._is_expired(v, self.timeout):\n del self._entries[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L118_C16", "label": "if", "type": "if", "loc": [118, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L117_C12", "vector": [4, 4, 0.4489, 0.0076, 4, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._is_expired(v, self.timeout):\n del self._entries[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L121_C12", "label": "release()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8", "vector": [8, 3, 0.4583, 0.0038, 3, 0.64, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "label": "flush", "type": "function", "loc": [123, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "vector": [2, 1, 0.4716, 0.0152, 1, 0.9, 1.0, 439, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n self.lock.acquire()\n self._entries.clear()\n self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L124_C8", "label": "acquire()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "vector": [8, 2, 0.4697, 0.0038, 2, 0.15, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L125_C8", "label": "clear()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "vector": [8, 2, 0.4735, 0.0038, 2, 0.15, 0.5, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self._entries.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L126_C8", "label": "release()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "vector": [8, 2, 0.4773, 0.0038, 2, 0.15, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "label": "FileCache", "type": "class", "loc": [129, 263], "level": 0, "parent": null, "vector": [3, 0, 0.7424, 0.5114, 0, 0.66, 1.0, 315, 0, 15, 0, 0, 419, 0, 50], "semantic": {"name": "FileCache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileCache(Cache):\n \"\"\"File-based cache\"\"\"\n\n # locks used to make cache thread-safe\n cache_locks = {}\n\n def __init__(self, cache_dir, timeout=60):\n Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L130_C4", "label": "expression", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [8, 1, 0.4924, 0.0038, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"File-based cache\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L133_C4", "label": "cache_locks =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [14, 1, 0.5038, 0.0038, 1, 0.78, 0.0625, 629, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cache_locks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cache_locks = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "label": "__init__", "type": "function", "loc": [135, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.5492, 0.0795, 1, 0.78, 0.125, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "cache_dir", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, cache_dir, timeout=60):\n Cache.__init__(self, timeout)\n if os.path.exists(cache_dir) is False:\n os.mkdir(cache_dir)\n self.cache_dir = cache_dir\n if cache_dir in FileCache.cache_locks:\n self.lock = FileCache.cache_locks[cache_dir]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L136_C8", "label": "__init__()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "vector": [8, 2, 0.5152, 0.0038, 2, 0.89, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Cache.__init__(self, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L137_C8", "label": "if", "type": "if", "loc": [137, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "vector": [4, 2, 0.5208, 0.0076, 2, 0.89, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(cache_dir) is False:\n os.mkdir(cache_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L138_C12", "label": "mkdir()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L137_C8", "vector": [8, 3, 0.5227, 0.0038, 3, 0.16, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(cache_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L139_C8", "label": "self.cache_dir =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "vector": [14, 2, 0.5265, 0.0038, 2, 0.89, 0.5, 977, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cache_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cache_dir = cache_dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "label": "if", "type": "if", "loc": [140, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "vector": [4, 2, 0.5379, 0.0189, 2, 0.89, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cache_dir in FileCache.cache_locks:\n self.lock = FileCache.cache_locks[cache_dir]\n else:\n self.lock = threading.Lock()\n FileCache.cache_locks[cache_dir] = self.lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L141_C12", "label": "self.lock =", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "vector": [14, 3, 0.5341, 0.0038, 3, 0.31, 0.0, 45, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lock = FileCache.cache_locks[cache_dir]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L143_C12", "label": "self.lock = Lock()", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "vector": [14, 3, 0.5417, 0.0038, 3, 0.31, 0.5, 45, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.lock = threading.Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L144_C12", "label": "assign", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "vector": [14, 3, 0.5455, 0.0038, 3, 0.31, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FileCache.cache_locks[cache_dir] = self.lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "label": "if", "type": "if", "loc": [146, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "vector": [4, 2, 0.5701, 0.0379, 2, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'posix':\n self._lock_file = self._lock_file_posix\n self._unlock_file = self._unlock_file_posix\n elif os.name == 'nt':\n self._lock_file = self._lock_file_win32\n self._unlock_file = self._unlock_file_win32\n else:\n print('Warning! FileCache locking not supported on this system!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L147_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "vector": [14, 3, 0.5568, 0.0038, 3, 0.51, 0.0, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_posix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L148_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "vector": [14, 3, 0.5606, 0.0038, 3, 0.51, 0.5, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_posix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "label": "if", "type": "if", "loc": [149, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "vector": [4, 3, 0.5758, 0.0265, 3, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif os.name == 'nt':\n self._lock_file = self._lock_file_win32\n self._unlock_file = self._unlock_file_win32\n else:\n print('Warning! FileCache locking not supported on this system!')\n self._lock_file = self._lock_file_dummy\n self._unlock_file = self._unlock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L150_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "vector": [14, 4, 0.5682, 0.0038, 4, 0.25, 0.0, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_win32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L151_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "vector": [14, 4, 0.572, 0.0038, 4, 0.25, 0.25, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_win32"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L153_C12", "label": "print()", "type": "expression", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "vector": [8, 4, 0.5795, 0.0038, 4, 0.25, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Warning! FileCache locking not supported on this system!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L154_C12", "label": "self._lock_file =", "type": "assigned_variable", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "vector": [14, 4, 0.5833, 0.0038, 4, 0.25, 0.75, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lock_file = self._lock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L155_C12", "label": "self._unlock_file =", "type": "assigned_variable", "loc": [155, 155], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "vector": [14, 4, 0.5871, 0.0038, 4, 0.25, 1.0, 186, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._unlock_file = self._unlock_file_dummy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "label": "_get_path", "type": "function", "loc": [157, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.6004, 0.0152, 1, 0.78, 0.1875, 771, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_path", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_path(self, key):\n md5 = hashlib.md5()\n md5.update(key)\n return os.path.join(self.cache_dir, md5.hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L158_C8", "label": "md5 = md5()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "vector": [14, 2, 0.5985, 0.0038, 2, 0.47, 0.0, 604, 3, 0, 0, 0, 604, 10, 1], "semantic": {"name": "md5", "arg_names": [], "import_names": [], "rhs_call_name": "md5", "annotation": ""}, "snippet": " md5 = hashlib.md5()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L159_C8", "label": "update()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "vector": [8, 2, 0.6023, 0.0038, 2, 0.47, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " md5.update(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "vector": [13, 2, 0.6061, 0.0038, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(self.cache_dir, md5.hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L162_C4", "label": "_lock_file_dummy", "type": "function", "loc": [162, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.6155, 0.0076, 1, 0.78, 0.25, 13, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_lock_file_dummy", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_dummy(self, path, exclusive=True):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L163_C8", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L162_C4", "vector": [13, 2, 0.6174, 0.0038, 2, 0.31, 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_153:FunctionDef_L165_C4", "label": "_unlock_file_dummy", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.6269, 0.0076, 1, 0.78, 0.3125, 709, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_unlock_file_dummy", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_dummy(self, lock):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L165_C4", "vector": [13, 2, 0.6288, 0.0038, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "label": "_lock_file_posix", "type": "function", "loc": [168, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.6572, 0.0455, 1, 0.78, 0.375, 523, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "_lock_file_posix", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_posix(self, path, exclusive=True):\n lock_path = path + '.lock'\n if exclusive is True:\n f_lock = open(lock_path, 'w')\n fcntl.lockf(f_lock, fcntl.LOCK_EX)\n else:\n f_lock = open(lock_path, 'r')\n fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L169_C8", "label": "lock_path =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "vector": [14, 2, 0.6402, 0.0038, 2, 0.66, 0.0, 496, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lock_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lock_path = path + '.lock'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "label": "if", "type": "if", "loc": [170, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "vector": [4, 2, 0.6534, 0.0227, 2, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exclusive is True:\n f_lock = open(lock_path, 'w')\n fcntl.lockf(f_lock, fcntl.LOCK_EX)\n else:\n f_lock = open(lock_path, 'r')\n fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L171_C12", "label": "f_lock = open()", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "vector": [14, 3, 0.6477, 0.0038, 3, 0.98, 0.0, 815, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f_lock = open(lock_path, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L172_C12", "label": "lockf()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "vector": [8, 3, 0.6515, 0.0038, 3, 0.98, 0.3333, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lockf", "arg_names": [], "import_names": [], "rhs_call_name": "lockf", "annotation": ""}, "snippet": " fcntl.lockf(f_lock, fcntl.LOCK_EX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L174_C12", "label": "f_lock = open()", "type": "assigned_variable", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "vector": [14, 3, 0.6591, 0.0038, 3, 0.98, 0.6667, 815, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f_lock = open(lock_path, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L175_C12", "label": "lockf()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "vector": [8, 3, 0.6629, 0.0038, 3, 0.98, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lockf", "arg_names": [], "import_names": [], "rhs_call_name": "lockf", "annotation": ""}, "snippet": " fcntl.lockf(f_lock, fcntl.LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8", "label": "if", "type": "if", "loc": [176, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "vector": [4, 2, 0.6705, 0.0114, 2, 0.66, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(lock_path) is False:\n f_lock.close()\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L177_C12", "label": "close()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8", "vector": [8, 3, 0.6705, 0.0038, 3, 0.13, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f_lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L178_C12", "label": "return", "type": "return", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8", "vector": [13, 3, 0.6742, 0.0038, 3, 0.13, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "vector": [13, 2, 0.678, 0.0038, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f_lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L181_C4", "label": "_unlock_file_posix", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.6875, 0.0076, 1, 0.78, 0.4375, 341, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file_posix", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_posix(self, lock):\n lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L182_C8", "label": "close()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L181_C4", "vector": [8, 2, 0.6894, 0.0038, 2, 0.4, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " lock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L184_C4", "label": "_lock_file_win32", "type": "function", "loc": [184, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.7008, 0.0114, 1, 0.78, 0.5, 190, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_lock_file_win32", "arg_names": ["self", "path", "exclusive"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lock_file_win32(self, path, exclusive=True):\n # TODO: implement\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L186_C8", "label": "return", "type": "return", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L184_C4", "vector": [13, 2, 0.7045, 0.0038, 2, 0.32, 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_153:FunctionDef_L188_C4", "label": "_unlock_file_win32", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.7159, 0.0114, 1, 0.78, 0.5625, 14, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_unlock_file_win32", "arg_names": ["self", "lock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unlock_file_win32(self, lock):\n # TODO: implement\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L190_C8", "label": "return", "type": "return", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L188_C4", "vector": [13, 2, 0.7197, 0.0038, 2, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4", "label": "_delete_file", "type": "function", "loc": [192, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.733, 0.0152, 1, 0.78, 0.625, 237, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_delete_file", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_file(self, path):\n os.remove(path)\n if os.path.exists(path + '.lock'):\n os.remove(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L193_C8", "label": "remove()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4", "vector": [8, 2, 0.7311, 0.0038, 2, 0.85, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L194_C8", "label": "if", "type": "if", "loc": [194, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4", "vector": [4, 2, 0.7367, 0.0076, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path + '.lock'):\n os.remove(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L195_C12", "label": "remove()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L194_C8", "vector": [8, 3, 0.7386, 0.0038, 3, 0.78, 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(path + '.lock')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "label": "store", "type": "function", "loc": [197, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.7746, 0.0606, 1, 0.78, 0.6875, 354, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "store", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def store(self, key, value):\n path = self._get_path(key)\n self.lock.acquire()\n try:\n # acquire lock and open file\n f_lock = self._lock_file(path)\n datafile = open(path, 'wb')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L198_C8", "label": "path = _get_path()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "vector": [14, 2, 0.75, 0.0038, 2, 0.75, 0.0, 358, 3, 1, 0, 0, 771, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "_get_path", "annotation": ""}, "snippet": " path = self._get_path(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L199_C8", "label": "acquire()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "vector": [8, 2, 0.7538, 0.0038, 2, 0.75, 0.5, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "label": "try", "type": "try", "loc": [200, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "vector": [7, 2, 0.7803, 0.0492, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # acquire lock and open file\n f_lock = self._lock_file(path)\n datafile = open(path, 'wb')\n\n # write data\n pickle.dump((time.time(), value), datafile)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L202_C12", "label": "f_lock = _lock_file()", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [14, 3, 0.7652, 0.0038, 3, 0.27, 0.0, 815, 3, 1, 0, 0, 732, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_lock_file", "annotation": ""}, "snippet": " f_lock = self._lock_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L203_C12", "label": "datafile = open()", "type": "assigned_variable", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [14, 3, 0.7689, 0.0038, 3, 0.27, 0.2, 14, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "datafile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " datafile = open(path, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L206_C12", "label": "dump()", "type": "expression", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [8, 3, 0.7803, 0.0038, 3, 0.27, 0.4, 952, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " pickle.dump((time.time(), value), datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L209_C12", "label": "close()", "type": "expression", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [8, 3, 0.7917, 0.0038, 3, 0.27, 0.6, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L210_C12", "label": "_unlock_file()", "type": "expression", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [8, 3, 0.7955, 0.0038, 3, 0.27, 0.8, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "_unlock_file", "annotation": ""}, "snippet": " self._unlock_file(f_lock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L212_C12", "label": "release()", "type": "expression", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "vector": [8, 3, 0.803, 0.0038, 3, 0.27, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L214_C4", "label": "get", "type": "function", "loc": [214, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.8125, 0.0076, 1, 0.78, 0.75, 607, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self", "key", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, timeout=None):\n return self._get(self._get_path(key), timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L215_C8", "label": "return", "type": "return", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L214_C4", "vector": [13, 2, 0.8144, 0.0038, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get(self._get_path(key), timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "label": "_get", "type": "function", "loc": [217, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.8712, 0.1023, 1, 0.78, 0.8125, 342, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "_get", "arg_names": ["self", "path", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get(self, path, timeout):\n if os.path.exists(path) is False:\n # no record\n return None\n self.lock.acquire()\n try:\n # acquire lock and open\n f_lock = self._lock_file(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L218_C8", "label": "if", "type": "if", "loc": [218, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "vector": [4, 2, 0.8295, 0.0114, 2, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path) is False:\n # no record\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L220_C12", "label": "return", "type": "return", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L218_C8", "vector": [13, 3, 0.8333, 0.0038, 3, 0.95, 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_153:Expr_L221_C8", "label": "acquire()", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "vector": [8, 2, 0.8371, 0.0038, 2, 0.08, 0.5, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "label": "try", "type": "try", "loc": [222, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "vector": [7, 2, 0.8807, 0.0833, 2, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # acquire lock and open\n f_lock = self._lock_file(path, False)\n datafile = open(path, 'rb')\n\n # read pickled object\n created_time, value = pickle.load(datafile)\n datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L224_C12", "label": "f_lock = _lock_file()", "type": "assigned_variable", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [14, 3, 0.8485, 0.0038, 3, 0.14, 0.0, 815, 3, 2, 0, 0, 732, 10, 1], "semantic": {"name": "f_lock", "arg_names": [], "import_names": [], "rhs_call_name": "_lock_file", "annotation": ""}, "snippet": " f_lock = self._lock_file(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L225_C12", "label": "datafile = open()", "type": "assigned_variable", "loc": [225, 225], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [14, 3, 0.8523, 0.0038, 3, 0.14, 0.125, 14, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "datafile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " datafile = open(path, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L228_C12", "label": "created_time, value = load()", "type": "assigned_variable", "loc": [228, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [14, 3, 0.8636, 0.0038, 3, 0.14, 0.25, 678, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "created_time, value", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " created_time, value = pickle.load(datafile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L229_C12", "label": "close()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [8, 3, 0.8674, 0.0038, 3, 0.14, 0.375, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " datafile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L232_C12", "label": "if", "type": "if", "loc": [232, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [4, 3, 0.8807, 0.0076, 3, 0.14, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout is None:\n timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L233_C16", "label": "timeout =", "type": "assigned_variable", "loc": [233, 233], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L232_C12", "vector": [14, 4, 0.8826, 0.0038, 4, 0.15, 0.0, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeout = self.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [4, 3, 0.892, 0.0152, 3, 0.14, 0.625, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout > 0 and (time.time() - created_time) >= timeout:\n # expired! delete from cache\n value = None\n self._delete_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L236_C16", "label": "value =", "type": "assigned_variable", "loc": [236, 236], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12", "vector": [14, 4, 0.8939, 0.0038, 4, 0.31, 0.0, 441, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L237_C16", "label": "_delete_file()", "type": "expression", "loc": [237, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12", "vector": [8, 4, 0.8977, 0.0038, 4, 0.31, 1.0, 237, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_file", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_file", "annotation": ""}, "snippet": " self._delete_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L240_C12", "label": "_unlock_file()", "type": "expression", "loc": [240, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [8, 3, 0.9091, 0.0038, 3, 0.14, 0.75, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_unlock_file", "arg_names": [], "import_names": [], "rhs_call_name": "_unlock_file", "annotation": ""}, "snippet": " self._unlock_file(f_lock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L241_C12", "label": "return", "type": "return", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [13, 3, 0.9129, 0.0038, 3, 0.14, 0.875, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L243_C12", "label": "release()", "type": "expression", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "vector": [8, 3, 0.9205, 0.0038, 3, 0.14, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "label": "count", "type": "function", "loc": [245, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.9394, 0.0265, 1, 0.78, 0.875, 778, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n c = 0\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n c += 1\n return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L246_C8", "label": "c =", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "vector": [14, 2, 0.9318, 0.0038, 2, 0.81, 0.0, 411, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:For_L247_C8", "label": "for entry", "type": "for", "loc": [247, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "vector": [6, 2, 0.9413, 0.0152, 2, 0.81, 0.5, 812, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n c += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L248_C12", "label": "if", "type": "if", "loc": [248, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L247_C8", "vector": [4, 3, 0.9413, 0.0076, 3, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L251_C8", "label": "return", "type": "return", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "vector": [13, 2, 0.9508, 0.0038, 2, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L253_C4", "label": "cleanup", "type": "function", "loc": [253, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.9659, 0.0189, 1, 0.78, 0.9375, 656, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cleanup(self):\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8", "label": "for entry", "type": "for", "loc": [254, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L253_C4", "vector": [6, 2, 0.9678, 0.0152, 2, 0.43, 0.0, 812, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L255_C12", "label": "if", "type": "if", "loc": [255, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8", "vector": [4, 3, 0.9678, 0.0076, 3, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L257_C12", "label": "_get()", "type": "expression", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8", "vector": [8, 3, 0.9735, 0.0038, 3, 0.03, 1.0, 342, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_get", "arg_names": [], "import_names": [], "rhs_call_name": "_get", "annotation": ""}, "snippet": " self._get(os.path.join(self.cache_dir, entry), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L259_C4", "label": "flush", "type": "function", "loc": [259, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "vector": [2, 1, 0.9886, 0.0189, 1, 0.78, 1.0, 439, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._delete_file(os.path.join(self.cache_dir, entry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8", "label": "for entry", "type": "for", "loc": [260, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L259_C4", "vector": [6, 2, 0.9905, 0.0152, 2, 0.0, 0.0, 812, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in os.listdir(self.cache_dir):\n if entry.endswith('.lock'):\n continue\n self._delete_file(os.path.join(self.cache_dir, entry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:If_L261_C12", "label": "if", "type": "if", "loc": [261, 262], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8", "vector": [4, 3, 0.9905, 0.0076, 3, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if entry.endswith('.lock'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L263_C12", "label": "_delete_file()", "type": "expression", "loc": [263, 263], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8", "vector": [8, 3, 0.9962, 0.0038, 3, 0.66, 1.0, 237, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_file", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_file", "annotation": ""}, "snippet": " self._delete_file(os.path.join(self.cache_dir, entry))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Import_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:For_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L214_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L218_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L225_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L228_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L236_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L240_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:Try_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:For_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Return_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L255_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L254_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:If_L261_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_153:For_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_153:Expr_L263_C12"}] |
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
PyMining.Init(config, "__global__", True)
matCreater = ClassifierMatrix(config, "__matrix__", True)
chiFilter = ChiSquareFilter(config, "__filter__", True)
nbModel = NaiveBayes(config, "naive_bayes", True)
[testx, testy] = matCreater.CreatePredictMatrix("data/test.txt")
[testx, testy] = chiFilter.MatrixFilter(testx, testy)
[resultY, precision] = nbModel.Test(testx, testy)
print precision
| ajibawa-2023/Python-Code-Large/train/row_155 | 17 | 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_155:ImportFrom_L1_C0", "label": "from matrix import Matrix", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L2_C0", "label": "from classifier_matrix import ClassifierMatrix", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.1429, 3, 0, 1, 0, 0, 3, 0, 0], "semantic": {"name": "classifier_matrix", "arg_names": [], "import_names": ["ClassifierMatrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier_matrix import ClassifierMatrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L3_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.2857, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L4_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1905, 0.0476, 0, 0.66, 0.4286, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L5_C0", "label": "from configuration import Configuration", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2381, 0.0476, 0, 0.66, 0.5714, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L6_C0", "label": "from chisquare_filter import ChiSquareFilter", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0476, 0, 0.66, 0.7143, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "chisquare_filter", "arg_names": [], "import_names": ["ChiSquareFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from chisquare_filter import ChiSquareFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:ImportFrom_L7_C0", "label": "from naive_bayes import NaiveBayes", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0476, 0, 0.66, 0.8571, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "naive_bayes", "arg_names": [], "import_names": ["NaiveBayes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from naive_bayes import NaiveBayes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "label": "if", "type": "if", "loc": [9, 21], "level": 0, "parent": null, "vector": [4, 0, 0.7143, 0.619, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n config = Configuration.FromFile(\"conf/test.xml\")\n PyMining.Init(config, \"__global__\", True)\n matCreater = ClassifierMatrix(config, \"__matrix__\", True)\n chiFilter = ChiSquareFilter(config, \"__filter__\", True)\n\n nbModel = NaiveBayes(config, \"naive_bayes\", True)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L10_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.4762, 0.0476, 1, 0.26, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Expr_L11_C4", "label": "Init()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [8, 1, 0.5238, 0.0476, 1, 0.26, 0.125, 44, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\", True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L12_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.5714, 0.0476, 1, 0.26, 0.25, 798, 3, 3, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\", True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L13_C4", "label": "chiFilter = ChiSquareFilter()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.619, 0.0476, 1, 0.26, 0.375, 663, 3, 3, 0, 0, 1, 10, 1], "semantic": {"name": "chiFilter", "arg_names": [], "import_names": [], "rhs_call_name": "ChiSquareFilter", "annotation": ""}, "snippet": " chiFilter = ChiSquareFilter(config, \"__filter__\", True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L15_C4", "label": "nbModel = NaiveBayes()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.7143, 0.0476, 1, 0.26, 0.5, 711, 3, 3, 0, 0, 828, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "NaiveBayes", "annotation": ""}, "snippet": " nbModel = NaiveBayes(config, \"naive_bayes\", True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L17_C4", "label": " = CreatePredictMatrix()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.8095, 0.0476, 1, 0.26, 0.625, 0, 3, 1, 0, 0, 391, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictMatrix", "annotation": ""}, "snippet": " [testx, testy] = matCreater.CreatePredictMatrix(\"data/test.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L18_C4", "label": " = MatrixFilter()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.8571, 0.0476, 1, 0.26, 0.75, 0, 3, 2, 0, 0, 81, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "MatrixFilter", "annotation": ""}, "snippet": " [testx, testy] = chiFilter.MatrixFilter(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L19_C4", "label": " = Test()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [14, 1, 0.9048, 0.0476, 1, 0.26, 0.875, 0, 3, 2, 0, 0, 786, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "Test", "annotation": ""}, "snippet": " [resultY, precision] = nbModel.Test(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_155:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "vector": [8, 1, 1.0, 0.0476, 1, 0.26, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(precision)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_155:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_155:Expr_L21_C4"}] |
import math
from segmenter import Segmenter
from matrix import Matrix
from py_mining import PyMining
from configuration import Configuration
class ClassifierMatrix:
def __init__(self, config, nodeName, loadFromFile = False):
self.node = config.GetChild(nodeName)
self.segmenter = Segmenter(config, "__segmenter__")
self.trained = loadFromFile
PyMining.Init(config, "__global__", loadFromFile)
"""
create train matrix:
fill dict in PyMining, record:
1)termToId
2)idToTerm
3)termToDocCount
4)classToDocCount
and save mat-x using csr, save mat-y using list
"""
def CreateTrainMatrix(self, path = ""):
#get input-path
inputPath = path
if (inputPath == ""):
inputPath = self.node.GetChild("train_input").GetValue()
f = open(inputPath, "r")
uid = 0
rows = [0]
cols = []
vals = []
y = []
#fill the matrix's cols and rows
for line in f:
vec = line.split("\t")
line = vec[0]
target = int(vec[1])
y.append(target)
wordList = self.segmenter.Split(line.decode("utf-8"))
#store current row's cols
partCols = []
#create dicts and fill partCol
#calculate term-frequent in this loop
curWordCount = 0
termFres = {}
for word in wordList:
curWordCount += 1
if (not PyMining.termToId.has_key(word)):
PyMining.termToId[word] = uid
PyMining.idToTerm[uid] = word
uid += 1
termId = PyMining.termToId[word]
partCols.append(termId)
if (not termFres.has_key(termId)):
termFres[termId] = 1
else:
termFres[termId] += 1
#fill partCol
partCols = set(partCols)
partCols = list(partCols)
partCols.sort()
#fill cols and vals, fill termToDocCount
for col in partCols:
cols.append(col)
#fill vals with termFrequent
vals.append(termFres[col])
#fill idToDocCount
if (not PyMining.idToDocCount.has_key(col)):
PyMining.idToDocCount[col] = 1
else:
PyMining.idToDocCount[col] += 1
#fill rows
rows.append(rows[len(rows) - 1] + \
len(partCols))
#fill classToDocCount
if (not PyMining.classToDocCount.has_key(target)):
PyMining.classToDocCount[target] = 1
else:
PyMining.classToDocCount[target] += 1
#fill PyMining's idToIdf
for termId in PyMining.idToTerm.keys():
PyMining.idToIdf[termId] = math.log(float(len(rows) - 1) / (PyMining.idToDocCount[termId] + 1))
#NOTE: now, not mul idf to vals, because not all algorithms need tf * idf
#change matrix's vals using tf-idf represent
#for r in range(len(rows) - 1):
# for c in range(rows[r], rows[r + 1]):
# termId = cols[c]
# #idf(i) = log(|D| / |{d (ti included)}| + 1
# vals[c] = vals[c] * PyMining.idToIdf[termId]
#close file
f.close()
#write dicts out
PyMining.Write()
self.trained = True
return [Matrix(rows, cols, vals), y]
def CreatePredictSample(self, src):
print src
if (not self.trained):
print "train Classifier Matrix before predict"
#split sentence
#if src is read from utf-8 file directly,
# should using CreatePredictSample(src.decode("utf-8"))
wordList = self.segmenter.Split(src)
cols = []
vals = []
#fill partCols, and create csr
partCols = []
termFreqs = {}
for word in wordList:
if (PyMining.termToId.has_key(word)):
termId = PyMining.termToId[word]
partCols.append(termId)
if (not termFreqs.has_key(termId)):
termFreqs[termId] = 1
else:
termFreqs[termId] += 1
partCols = set(partCols)
partCols = list(partCols)
partCols.sort()
for col in partCols:
cols.append(col)
vals.append(termFreqs[col])
return [cols, vals]
"""
create predict matrix using previous dict
"""
def CreatePredictMatrix(self, path = ""):
if (not self.trained):
print "train ClassifierMatrix before predict"
return False
#get input path
inputPath = path
if (inputPath == ""):
inputPath = self.curNode.GetChild("test_input")
f = open(inputPath, "r")
rows = [0]
cols = []
vals = []
y = []
for line in f:
vec = line.split("\t")
line = vec[0]
y.append(int(vec[1]))
#split sentence
wordList = self.segmenter.Split(line.decode("utf-8"))
#fill partCols, and create csr
partCols = []
termFreqs = {}
curWordCount = 0
for word in wordList:
curWordCount += 1
if (PyMining.termToId.has_key(word)):
termId = PyMining.termToId[word]
partCols.append(termId)
if (not termFreqs.has_key(termId)):
termFreqs[termId] = 1
else:
termFreqs[termId] += 1
partCols = set(partCols)
partCols = list(partCols)
partCols.sort()
for col in partCols:
cols.append(col)
vals.append(termFreqs[col])
rows.append(rows[len(rows) - 1] + \
len(partCols))
#close file
f.close()
return [Matrix(rows, cols, vals), y]
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainMat, ty] = matCreater.CreateTrainMatrix("data/tuangou_titles3.txt")
[predictMat, py] = matCreater.CreatePredictMatrix("data/tuangou_titles3.txt")
print py
print predictMat.rows
print predictMat.cols
print predictMat.vals
| ajibawa-2023/Python-Code-Large/train/row_156 | 123 | 203 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_156:Import_L1_C0", "label": "math import math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:ImportFrom_L2_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0049, 0, 0.66, 0.1667, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:ImportFrom_L3_C0", "label": "from matrix import Matrix", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0148, 0.0049, 0, 0.66, 0.3333, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:ImportFrom_L4_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0197, 0.0049, 0, 0.66, 0.5, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:ImportFrom_L5_C0", "label": "from configuration import Configuration", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0246, 0.0049, 0, 0.66, 0.6667, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "label": "ClassifierMatrix", "type": "class", "loc": [7, 193], "level": 0, "parent": null, "vector": [3, 0, 0.4926, 0.9212, 0, 0.66, 0.8333, 725, 0, 4, 0, 0, 0, 0, 63], "semantic": {"name": "ClassifierMatrix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ClassifierMatrix:\n def __init__(self, config, nodeName, loadFromFile = False):\n self.node = config.GetChild(nodeName)\n self.segmenter = Segmenter(config, \"__segmenter__\")\n self.trained = loadFromFile\n PyMining.Init(config, \"__global__\", loadFromFile)\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [2, 1, 0.0493, 0.0246, 1, 0.89, 0.0, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "config", "nodeName", "loadFromFile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, config, nodeName, loadFromFile = False):\n self.node = config.GetChild(nodeName)\n self.segmenter = Segmenter(config, \"__segmenter__\")\n self.trained = loadFromFile\n PyMining.Init(config, \"__global__\", loadFromFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L9_C8", "label": "self.node = GetChild()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "vector": [14, 2, 0.0443, 0.0049, 2, 0.86, 0.0, 981, 3, 1, 0, 0, 508, 10, 1], "semantic": {"name": "self.node", "arg_names": [], "import_names": [], "rhs_call_name": "GetChild", "annotation": ""}, "snippet": " self.node = config.GetChild(nodeName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L10_C8", "label": "self.segmenter = Segmenter()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "vector": [14, 2, 0.0493, 0.0049, 2, 0.86, 0.3333, 300, 3, 2, 0, 0, 461, 10, 1], "semantic": {"name": "self.segmenter", "arg_names": [], "import_names": [], "rhs_call_name": "Segmenter", "annotation": ""}, "snippet": " self.segmenter = Segmenter(config, \"__segmenter__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L11_C8", "label": "self.trained =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "vector": [14, 2, 0.0542, 0.0049, 2, 0.86, 0.6667, 789, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.trained", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.trained = loadFromFile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L12_C8", "label": "Init()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "vector": [8, 2, 0.0591, 0.0049, 2, 0.86, 1.0, 44, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\", loadFromFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [8, 1, 0.0887, 0.0443, 1, 0.89, 0.2, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n create train matrix:\n fill dict in PyMining, record:\n 1)termToId\n 2)idToTerm\n 3)termToDocCount\n 4)classToDocCount\n and save mat-x using csr, save mat-y using list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "label": "CreateTrainMatrix", "type": "function", "loc": [23, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [2, 1, 0.3251, 0.4286, 1, 0.89, 0.4, 478, 0, 2, 1, 0, 0, 0, 28], "semantic": {"name": "CreateTrainMatrix", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def CreateTrainMatrix(self, path = \"\"):\n #get input-path\n inputPath = path\n if (inputPath == \"\"):\n inputPath = self.node.GetChild(\"train_input\").GetValue()\n\n f = open(inputPath, \"r\")\n uid = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L25_C8", "label": "inputPath =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1232, 0.0049, 2, 0.1, 0.0, 111, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "inputPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inputPath = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [4, 2, 0.1305, 0.0099, 2, 0.1, 0.0769, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (inputPath == \"\"):\n inputPath = self.node.GetChild(\"train_input\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L27_C12", "label": "inputPath = GetValue()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L26_C8", "vector": [14, 3, 0.133, 0.0049, 3, 0.91, 0.0, 111, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "inputPath", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " inputPath = self.node.GetChild(\"train_input\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L29_C8", "label": "f = open()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1429, 0.0049, 2, 0.1, 0.1538, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(inputPath, \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L30_C8", "label": "uid =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1478, 0.0049, 2, 0.1, 0.2308, 127, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "uid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " uid = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L31_C8", "label": "rows =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1527, 0.0049, 2, 0.1, 0.3077, 275, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows = [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L32_C8", "label": "cols =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1576, 0.0049, 2, 0.1, 0.3846, 876, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L33_C8", "label": "vals =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1626, 0.0049, 2, 0.1, 0.4615, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L34_C8", "label": "y =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.1675, 0.0049, 2, 0.1, 0.5385, 304, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "label": "for line", "type": "for", "loc": [37, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [6, 2, 0.3054, 0.2512, 2, 0.1, 0.6154, 373, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n vec = line.split(\"\\t\")\n line = vec[0]\n target = int(vec[1])\n y.append(target)\n wordList = self.segmenter.Split(line.decode(\"utf-8\"))\n\n #store current row's cols"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L38_C12", "label": "vec = split()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.1872, 0.0049, 3, 0.24, 0.0, 132, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "vec", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " vec = line.split(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L39_C12", "label": "line =", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.1921, 0.0049, 3, 0.24, 0.0714, 373, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = vec[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L40_C12", "label": "target = int()", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.197, 0.0049, 3, 0.24, 0.1429, 766, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " target = int(vec[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L41_C12", "label": "append()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [8, 3, 0.202, 0.0049, 3, 0.24, 0.2143, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " y.append(target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L42_C12", "label": "wordList = Split()", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.2069, 0.0049, 3, 0.24, 0.2857, 49, 3, 1, 0, 0, 551, 10, 2], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " wordList = self.segmenter.Split(line.decode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L45_C12", "label": "partCols =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.2217, 0.0049, 3, 0.24, 0.3571, 512, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partCols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L49_C12", "label": "curWordCount =", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.2414, 0.0049, 3, 0.24, 0.4286, 422, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "curWordCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curWordCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L50_C12", "label": "termFres =", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.2463, 0.0049, 3, 0.24, 0.5, 496, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "termFres", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFres = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "label": "for word", "type": "for", "loc": [51, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [6, 3, 0.2783, 0.0591, 3, 0.24, 0.5714, 107, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in wordList:\n curWordCount += 1\n if (not PyMining.termToId.has_key(word)):\n PyMining.termToId[word] = uid\n PyMining.idToTerm[uid] = word\n uid += 1\n termId = PyMining.termToId[word]\n partCols.append(termId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16", "label": "if", "type": "if", "loc": [53, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "vector": [4, 4, 0.2685, 0.0197, 4, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.termToId.has_key(word)):\n PyMining.termToId[word] = uid\n PyMining.idToTerm[uid] = word\n uid += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L54_C20", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16", "vector": [14, 5, 0.266, 0.0049, 5, 0.06, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.termToId[word] = uid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L55_C20", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16", "vector": [14, 5, 0.2709, 0.0049, 5, 0.06, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.idToTerm[uid] = word"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L57_C16", "label": "termId =", "type": "assigned_variable", "loc": [57, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "vector": [14, 4, 0.2808, 0.0049, 4, 0.83, 0.3333, 583, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "termId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termId = PyMining.termToId[word]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L58_C16", "label": "append()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "vector": [8, 4, 0.2857, 0.0049, 4, 0.83, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " partCols.append(termId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L59_C16", "label": "if", "type": "if", "loc": [59, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "vector": [4, 4, 0.298, 0.0197, 4, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not termFres.has_key(termId)):\n termFres[termId] = 1\n else:\n termFres[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L60_C20", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L59_C16", "vector": [14, 5, 0.2956, 0.0049, 5, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFres[termId] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L64_C12", "label": "partCols = set()", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.3153, 0.0049, 3, 0.24, 0.6429, 512, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " partCols = set(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L65_C12", "label": "partCols = list()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [14, 3, 0.3202, 0.0049, 3, 0.24, 0.7143, 512, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " partCols = list(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L66_C12", "label": "sort()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [8, 3, 0.3251, 0.0049, 3, 0.24, 0.7857, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " partCols.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "label": "for col", "type": "for", "loc": [69, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [6, 3, 0.3596, 0.0443, 3, 0.24, 0.8571, 157, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in partCols:\n cols.append(col)\n #fill vals with termFrequent\n vals.append(termFres[col])\n #fill idToDocCount\n if (not PyMining.idToDocCount.has_key(col)):\n PyMining.idToDocCount[col] = 1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L70_C16", "label": "append()", "type": "expression", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "vector": [8, 4, 0.3448, 0.0049, 4, 0.56, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cols.append(col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L72_C16", "label": "append()", "type": "expression", "loc": [72, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "vector": [8, 4, 0.3547, 0.0049, 4, 0.56, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " vals.append(termFres[col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L74_C16", "label": "if", "type": "if", "loc": [74, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "vector": [4, 4, 0.3719, 0.0197, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.idToDocCount.has_key(col)):\n PyMining.idToDocCount[col] = 1\n else:\n PyMining.idToDocCount[col] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L75_C20", "label": "assign", "type": "assigned_variable", "loc": [75, 75], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L74_C16", "vector": [14, 5, 0.3695, 0.0049, 5, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.idToDocCount[col] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L80_C12", "label": "append()", "type": "expression", "loc": [80, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [8, 3, 0.3966, 0.0099, 3, 0.24, 0.9286, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append(rows[len(rows) - 1] + \\\n len(partCols))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L84_C12", "label": "if", "type": "if", "loc": [84, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "vector": [4, 3, 0.4212, 0.0197, 3, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.classToDocCount.has_key(target)):\n PyMining.classToDocCount[target] = 1\n else:\n PyMining.classToDocCount[target] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L85_C16", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L84_C12", "vector": [14, 4, 0.4187, 0.0049, 4, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.classToDocCount[target] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L90_C8", "label": "for termId", "type": "for", "loc": [90, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [6, 2, 0.4458, 0.0099, 2, 0.1, 0.6923, 583, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "termId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for termId in PyMining.idToTerm.keys():\n PyMining.idToIdf[termId] = math.log(float(len(rows) - 1) / (PyMining.idToDocCount[termId] + 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L91_C12", "label": " = log()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L90_C8", "vector": [14, 3, 0.4483, 0.0049, 3, 0.6, 0.0, 0, 3, 1, 0, 0, 432, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " PyMining.idToIdf[termId] = math.log(float(len(rows) - 1) / (PyMining.idToDocCount[termId] + 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L102_C8", "label": "close()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [8, 2, 0.5025, 0.0049, 2, 0.1, 0.7692, 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_156:Expr_L105_C8", "label": "Write()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [8, 2, 0.5172, 0.0049, 2, 0.1, 0.8462, 919, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Write", "arg_names": [], "import_names": [], "rhs_call_name": "Write", "annotation": ""}, "snippet": " PyMining.Write()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L107_C8", "label": "self.trained =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [14, 2, 0.5271, 0.0049, 2, 0.1, 0.9231, 789, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.trained", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.trained = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L109_C8", "label": "return", "type": "return", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "vector": [13, 2, 0.5369, 0.0049, 2, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [Matrix(rows, cols, vals), y] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "label": "CreatePredictSample", "type": "function", "loc": [111, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [2, 1, 0.6182, 0.1478, 1, 0.89, 0.6, 771, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "CreatePredictSample", "arg_names": ["self", "src"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def CreatePredictSample(self, src):\n print(src)\n if (not self.trained):\n print(\"train Classifier Matrix before predict\")\n \n #split sentence\n #if src is read from utf-8 file directly, \n # should using CreatePredictSample(src.decode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L112_C8", "label": "print()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [8, 2, 0.5517, 0.0049, 2, 0.38, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L113_C8", "label": "if", "type": "if", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [4, 2, 0.5591, 0.0099, 2, 0.38, 0.0833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not self.trained):\n print(\"train Classifier Matrix before predict\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L114_C12", "label": "print()", "type": "expression", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L113_C8", "vector": [8, 3, 0.5616, 0.0049, 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(\"train Classifier Matrix before predict\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L119_C8", "label": "wordList = Split()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.5862, 0.0049, 2, 0.38, 0.1667, 49, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " wordList = self.segmenter.Split(src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L120_C8", "label": "cols =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.5911, 0.0049, 2, 0.38, 0.25, 876, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L121_C8", "label": "vals =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.5961, 0.0049, 2, 0.38, 0.3333, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L123_C8", "label": "partCols =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.6059, 0.0049, 2, 0.38, 0.4167, 512, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partCols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L124_C8", "label": "termFreqs =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.6108, 0.0049, 2, 0.38, 0.5, 771, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "termFreqs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFreqs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L125_C8", "label": "for word", "type": "for", "loc": [125, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [6, 2, 0.633, 0.0394, 2, 0.38, 0.5833, 107, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in wordList:\n if (PyMining.termToId.has_key(word)):\n termId = PyMining.termToId[word]\n partCols.append(termId)\n if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:\n termFreqs[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "label": "if", "type": "if", "loc": [126, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L125_C8", "vector": [4, 3, 0.6355, 0.0345, 3, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (PyMining.termToId.has_key(word)):\n termId = PyMining.termToId[word]\n partCols.append(termId)\n if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:\n termFreqs[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L127_C16", "label": "termId =", "type": "assigned_variable", "loc": [127, 127], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "vector": [14, 4, 0.6256, 0.0049, 4, 0.65, 0.0, 583, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "termId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termId = PyMining.termToId[word]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L128_C16", "label": "append()", "type": "expression", "loc": [128, 128], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "vector": [8, 4, 0.6305, 0.0049, 4, 0.65, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " partCols.append(termId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L129_C16", "label": "if", "type": "if", "loc": [129, 132], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "vector": [4, 4, 0.6429, 0.0197, 4, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:\n termFreqs[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L130_C20", "label": "assign", "type": "assigned_variable", "loc": [130, 130], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L129_C16", "vector": [14, 5, 0.6404, 0.0049, 5, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFreqs[termId] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L133_C8", "label": "partCols = set()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.6552, 0.0049, 2, 0.38, 0.6667, 512, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " partCols = set(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L134_C8", "label": "partCols = list()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [14, 2, 0.6601, 0.0049, 2, 0.38, 0.75, 512, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " partCols = list(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L135_C8", "label": "sort()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [8, 2, 0.665, 0.0049, 2, 0.38, 0.8333, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " partCols.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8", "label": "for col", "type": "for", "loc": [136, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [6, 2, 0.6749, 0.0148, 2, 0.38, 0.9167, 157, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in partCols:\n cols.append(col)\n vals.append(termFreqs[col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L137_C12", "label": "append()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8", "vector": [8, 3, 0.6749, 0.0049, 3, 0.37, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cols.append(col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L138_C12", "label": "append()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8", "vector": [8, 3, 0.6798, 0.0049, 3, 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": " vals.append(termFreqs[col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L140_C8", "label": "return", "type": "return", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "vector": [13, 2, 0.6897, 0.0049, 2, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [cols, vals]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L142_C4", "label": "expression", "type": "expression", "loc": [142, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [8, 1, 0.7044, 0.0148, 1, 0.89, 0.8, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n create predict matrix using previous dict\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "label": "CreatePredictMatrix", "type": "function", "loc": [145, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "vector": [2, 1, 0.8325, 0.2414, 1, 0.89, 1.0, 391, 0, 2, 1, 0, 0, 0, 21], "semantic": {"name": "CreatePredictMatrix", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def CreatePredictMatrix(self, path = \"\"):\n if (not self.trained):\n print(\"train ClassifierMatrix before predict\")\n return False\n\n #get input path\n inputPath = path\n if (inputPath == \"\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8", "label": "if", "type": "if", "loc": [146, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [4, 2, 0.7241, 0.0148, 2, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not self.trained):\n print(\"train ClassifierMatrix before predict\")\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L147_C12", "label": "print()", "type": "expression", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8", "vector": [8, 3, 0.7241, 0.0049, 3, 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(\"train ClassifierMatrix before predict\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L148_C12", "label": "return", "type": "return", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8", "vector": [13, 3, 0.7291, 0.0049, 3, 0.91, 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_156:Assign_L151_C8", "label": "inputPath =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7438, 0.0049, 2, 0.39, 0.1, 111, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "inputPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inputPath = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [4, 2, 0.7512, 0.0099, 2, 0.39, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (inputPath == \"\"):\n inputPath = self.curNode.GetChild(\"test_input\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L153_C12", "label": "inputPath = GetChild()", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L152_C8", "vector": [14, 3, 0.7537, 0.0049, 3, 0.55, 0.0, 111, 3, 1, 0, 0, 508, 10, 1], "semantic": {"name": "inputPath", "arg_names": [], "import_names": [], "rhs_call_name": "GetChild", "annotation": ""}, "snippet": " inputPath = self.curNode.GetChild(\"test_input\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L155_C8", "label": "f = open()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7635, 0.0049, 2, 0.39, 0.3, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(inputPath, \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L156_C8", "label": "rows =", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7685, 0.0049, 2, 0.39, 0.4, 275, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows = [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L157_C8", "label": "cols =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7734, 0.0049, 2, 0.39, 0.5, 876, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L158_C8", "label": "vals =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7783, 0.0049, 2, 0.39, 0.6, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L159_C8", "label": "y =", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [14, 2, 0.7833, 0.0049, 2, 0.39, 0.7, 304, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "label": "for line", "type": "for", "loc": [160, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [6, 2, 0.8596, 0.1478, 2, 0.39, 0.8, 373, 2, 0, 0, 0, 0, 0, 16], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n vec = line.split(\"\\t\")\n line = vec[0]\n y.append(int(vec[1]))\n\n #split sentence\n wordList = self.segmenter.Split(line.decode(\"utf-8\"))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L161_C12", "label": "vec = split()", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.7931, 0.0049, 3, 0.9, 0.0, 132, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "vec", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " vec = line.split(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L162_C12", "label": "line =", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.798, 0.0049, 3, 0.9, 0.0833, 373, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = vec[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L163_C12", "label": "append()", "type": "expression", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [8, 3, 0.803, 0.0049, 3, 0.9, 0.1667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " y.append(int(vec[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L166_C12", "label": "wordList = Split()", "type": "assigned_variable", "loc": [166, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.8177, 0.0049, 3, 0.9, 0.25, 49, 3, 1, 0, 0, 551, 10, 2], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " wordList = self.segmenter.Split(line.decode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L169_C12", "label": "partCols =", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.8325, 0.0049, 3, 0.9, 0.3333, 512, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partCols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L170_C12", "label": "termFreqs =", "type": "assigned_variable", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.8374, 0.0049, 3, 0.9, 0.4167, 771, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "termFreqs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFreqs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L171_C12", "label": "curWordCount =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.8424, 0.0049, 3, 0.9, 0.5, 422, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "curWordCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curWordCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L172_C12", "label": "for word", "type": "for", "loc": [172, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [6, 3, 0.867, 0.0443, 3, 0.9, 0.5833, 107, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in wordList:\n curWordCount += 1\n if (PyMining.termToId.has_key(word)):\n termId = PyMining.termToId[word]\n partCols.append(termId)\n if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "label": "if", "type": "if", "loc": [174, 180], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L172_C12", "vector": [4, 4, 0.8719, 0.0345, 4, 0.72, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (PyMining.termToId.has_key(word)):\n termId = PyMining.termToId[word]\n partCols.append(termId)\n if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:\n termFreqs[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L175_C20", "label": "termId =", "type": "assigned_variable", "loc": [175, 175], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "vector": [14, 5, 0.8621, 0.0049, 5, 0.14, 0.0, 583, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "termId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termId = PyMining.termToId[word]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L176_C20", "label": "append()", "type": "expression", "loc": [176, 176], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "vector": [8, 5, 0.867, 0.0049, 5, 0.14, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " partCols.append(termId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L177_C20", "label": "if", "type": "if", "loc": [177, 180], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "vector": [4, 5, 0.8793, 0.0197, 5, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not termFreqs.has_key(termId)):\n termFreqs[termId] = 1\n else:\n termFreqs[termId] += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L178_C24", "label": "assign", "type": "assigned_variable", "loc": [178, 178], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L177_C20", "vector": [14, 6, 0.8768, 0.0049, 6, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termFreqs[termId] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L182_C12", "label": "partCols = set()", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.8966, 0.0049, 3, 0.9, 0.6667, 512, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " partCols = set(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L183_C12", "label": "partCols = list()", "type": "assigned_variable", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [14, 3, 0.9015, 0.0049, 3, 0.9, 0.75, 512, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "partCols", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " partCols = list(partCols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L184_C12", "label": "sort()", "type": "expression", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [8, 3, 0.9064, 0.0049, 3, 0.9, 0.8333, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " partCols.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12", "label": "for col", "type": "for", "loc": [185, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [6, 3, 0.9163, 0.0148, 3, 0.9, 0.9167, 157, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in partCols:\n cols.append(col)\n vals.append(termFreqs[col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L186_C16", "label": "append()", "type": "expression", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12", "vector": [8, 4, 0.9163, 0.0049, 4, 0.06, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cols.append(col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L187_C16", "label": "append()", "type": "expression", "loc": [187, 187], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12", "vector": [8, 4, 0.9212, 0.0049, 4, 0.06, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " vals.append(termFreqs[col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L188_C12", "label": "append()", "type": "expression", "loc": [188, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "vector": [8, 3, 0.9286, 0.0099, 3, 0.9, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append(rows[len(rows) - 1] + \\\n len(partCols))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L192_C8", "label": "close()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [8, 2, 0.9458, 0.0049, 2, 0.39, 0.9, 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_156:Return_L193_C8", "label": "return", "type": "return", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "vector": [13, 2, 0.9507, 0.0049, 2, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [Matrix(rows, cols, vals), y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "label": "if", "type": "if", "loc": [195, 203], "level": 0, "parent": null, "vector": [4, 0, 0.9803, 0.0443, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n config = Configuration.FromFile(\"conf/test.xml\")\n matCreater = ClassifierMatrix(config, \"__matrix__\")\n [trainMat, ty] = matCreater.CreateTrainMatrix(\"data/tuangou_titles3.txt\")\n [predictMat, py] = matCreater.CreatePredictMatrix(\"data/tuangou_titles3.txt\")\n print(py)\n print(predictMat.rows)\n print(predictMat.cols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L196_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [14, 1, 0.9655, 0.0049, 1, 0.7, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L197_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [14, 1, 0.9704, 0.0049, 1, 0.7, 0.1429, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L198_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [14, 1, 0.9754, 0.0049, 1, 0.7, 0.2857, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainMat, ty] = matCreater.CreateTrainMatrix(\"data/tuangou_titles3.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L199_C4", "label": " = CreatePredictMatrix()", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [14, 1, 0.9803, 0.0049, 1, 0.7, 0.4286, 0, 3, 1, 0, 0, 391, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictMatrix", "annotation": ""}, "snippet": " [predictMat, py] = matCreater.CreatePredictMatrix(\"data/tuangou_titles3.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L200_C4", "label": "print()", "type": "expression", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [8, 1, 0.9852, 0.0049, 1, 0.7, 0.5714, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(py)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L201_C4", "label": "print()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [8, 1, 0.9901, 0.0049, 1, 0.7, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(predictMat.rows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L202_C4", "label": "print()", "type": "expression", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [8, 1, 0.9951, 0.0049, 1, 0.7, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(predictMat.cols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L203_C4", "label": "print()", "type": "expression", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "vector": [8, 1, 1.0, 0.0049, 1, 0.7, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(predictMat.vals)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L54_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L53_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L55_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L57_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L59_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L72_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L74_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L74_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L75_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L125_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L127_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L126_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L129_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L129_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L130_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L172_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L175_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L176_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L174_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_156:If_L177_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L177_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L178_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L186_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Return_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_156:If_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_156:Expr_L203_C4"}] |
if __name__ == "__main__":
"""
train
"""
#init dm platfrom, include segmenter..
config = Configuration.FromFile("test.conf")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("train.txt")
#or using matCreater.CreateTrainMatrix(), train corpus will read from config
chiFilter = ChiSquareFilter(config, "__filter__")
chiFilter.TrainFilter(trainx, trainy)
#or using chiFilter.Create(trainx, trainy) get default setting in config
nbModel = NaiveBayes(config, "naive_bayes")
nbModel.Train(trainx, trainy)
"""
test
"""
# config = Configuration.FromFile("test.conf")
# PyMining.Init(config, "__global__", True), True means load from previos file
# matCreater = ClassifierMatrix(config, "__matrix__", True)
[testx, testy] = matCreater.CreateTestMatrix("test.txt")
#chiFilter = ChiSquareFilter(config, "__filter__", True)
[testx, testy] = chiFilter.MatrixFilter(testx, testy)
#nbModel = NaiveBayes(config, "naive_bayes", True)
[predicty, precision] = nbModel.Predict(testx, testy)
print precision
| ajibawa-2023/Python-Code-Large/train/row_157 | 15 | 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_157:If_L1_C0", "label": "if", "type": "if", "loc": [1, 36], "level": 0, "parent": null, "vector": [4, 0, 0.5139, 1.0, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n \"\"\"\n train\n \"\"\"\n #init dm platfrom, include segmenter..\n config = Configuration.FromFile(\"test.conf\")\n\n PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L2_C4", "label": "expression", "type": "expression", "loc": [2, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 0.0833, 0.0833, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n train\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L6_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.1667, 0.0278, 1, 0.56, 0.0769, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"test.conf\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L8_C4", "label": "Init()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 0.2222, 0.0278, 1, 0.56, 0.1538, 44, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L10_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.2778, 0.0278, 1, 0.56, 0.2308, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L11_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.3056, 0.0278, 1, 0.56, 0.3077, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainx, trainy] = matCreater.CreateTrainMatrix(\"train.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L14_C4", "label": "chiFilter = ChiSquareFilter()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.3889, 0.0278, 1, 0.56, 0.3846, 663, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chiFilter", "arg_names": [], "import_names": [], "rhs_call_name": "ChiSquareFilter", "annotation": ""}, "snippet": " chiFilter = ChiSquareFilter(config, \"__filter__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L15_C4", "label": "TrainFilter()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 0.4167, 0.0278, 1, 0.56, 0.4615, 144, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "TrainFilter", "arg_names": [], "import_names": [], "rhs_call_name": "TrainFilter", "annotation": ""}, "snippet": " chiFilter.TrainFilter(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L18_C4", "label": "nbModel = NaiveBayes()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.5, 0.0278, 1, 0.56, 0.5385, 711, 3, 2, 0, 0, 828, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "NaiveBayes", "annotation": ""}, "snippet": " nbModel = NaiveBayes(config, \"naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L19_C4", "label": "Train()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 0.5278, 0.0278, 1, 0.56, 0.6154, 55, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Train", "arg_names": [], "import_names": [], "rhs_call_name": "Train", "annotation": ""}, "snippet": " nbModel.Train(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 0.6111, 0.0833, 1, 0.56, 0.6923, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n test\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L29_C4", "label": " = CreateTestMatrix()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.8056, 0.0278, 1, 0.56, 0.7692, 0, 3, 1, 0, 0, 19, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTestMatrix", "annotation": ""}, "snippet": " [testx, testy] = matCreater.CreateTestMatrix(\"test.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L32_C4", "label": " = MatrixFilter()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.8889, 0.0278, 1, 0.56, 0.8462, 0, 3, 2, 0, 0, 81, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "MatrixFilter", "annotation": ""}, "snippet": " [testx, testy] = chiFilter.MatrixFilter(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L35_C4", "label": " = Predict()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [14, 1, 0.9722, 0.0278, 1, 0.56, 0.9231, 0, 3, 2, 0, 0, 361, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "Predict", "annotation": ""}, "snippet": " [predicty, precision] = nbModel.Predict(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L36_C4", "label": "print()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "vector": [8, 1, 1.0, 0.0278, 1, 0.56, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(precision)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_157:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_157:Expr_L36_C4"}] |
#encoding=utf-8
import math
import pickle
import sys
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from twc_naive_bayes import TwcNaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("data/train.txt")
nbModel = TwcNaiveBayes(config, "twc_naive_bayes")
nbModel.Train(trainx, trainy)
inputStr = "仅售59元!原价108元的花园巴西烤肉自助餐一人次任吃(蛇口店、购物公园店全时段通用),另赠送两张10元现金抵用券!邀请好友返利10元!"
[cols, vals] = matCreater.CreatePredictSample(inputStr.decode("utf-8"))
retY = nbModel.TestSample(cols, vals)
print retY
| ajibawa-2023/Python-Code-Large/train/row_158 | 21 | 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_158:Import_L3_C0", "label": "math import math", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Import_L4_C0", "label": "pickle import pickle", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.1, 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_158: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.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_158:ImportFrom_L7_C0", "label": "from matrix import Matrix", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2593, 0.037, 0, 0.66, 0.3, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L8_C0", "label": "from classifier_matrix import ClassifierMatrix", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2963, 0.037, 0, 0.66, 0.4, 3, 0, 1, 0, 0, 3, 0, 0], "semantic": {"name": "classifier_matrix", "arg_names": [], "import_names": ["ClassifierMatrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier_matrix import ClassifierMatrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L9_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.037, 0, 0.66, 0.5, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L10_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.3704, 0.037, 0, 0.66, 0.6, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L11_C0", "label": "from configuration import Configuration", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.4074, 0.037, 0, 0.66, 0.7, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L12_C0", "label": "from chisquare_filter import ChiSquareFilter", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.4444, 0.037, 0, 0.66, 0.8, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "chisquare_filter", "arg_names": [], "import_names": ["ChiSquareFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from chisquare_filter import ChiSquareFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:ImportFrom_L13_C0", "label": "from twc_naive_bayes import TwcNaiveBayes", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.4815, 0.037, 0, 0.66, 0.9, 578, 0, 1, 0, 0, 578, 0, 0], "semantic": {"name": "twc_naive_bayes", "arg_names": [], "import_names": ["TwcNaiveBayes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twc_naive_bayes import TwcNaiveBayes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "label": "if", "type": "if", "loc": [16, 27], "level": 0, "parent": null, "vector": [4, 0, 0.7963, 0.4444, 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 config = Configuration.FromFile(\"conf/test.xml\")\n PyMining.Init(config, \"__global__\")\n matCreater = ClassifierMatrix(config, \"__matrix__\")\n [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")\n nbModel = TwcNaiveBayes(config, \"twc_naive_bayes\")\n nbModel.Train(trainx, trainy)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L17_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.6296, 0.037, 1, 0.96, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L18_C4", "label": "Init()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [8, 1, 0.6667, 0.037, 1, 0.96, 0.1111, 44, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L19_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.7037, 0.037, 1, 0.96, 0.2222, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L20_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.7407, 0.037, 1, 0.96, 0.3333, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L21_C4", "label": "nbModel = TwcNaiveBayes()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.7778, 0.037, 1, 0.96, 0.4444, 711, 3, 2, 0, 0, 980, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "TwcNaiveBayes", "annotation": ""}, "snippet": " nbModel = TwcNaiveBayes(config, \"twc_naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L22_C4", "label": "Train()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [8, 1, 0.8148, 0.037, 1, 0.96, 0.5556, 55, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Train", "arg_names": [], "import_names": [], "rhs_call_name": "Train", "annotation": ""}, "snippet": " nbModel.Train(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L24_C4", "label": "inputStr =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.8889, 0.037, 1, 0.96, 0.6667, 227, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "inputStr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inputStr = \"\u4ec5\u552e59\u5143\uff01\u539f\u4ef7108\u5143\u7684\u82b1\u56ed\u5df4\u897f\u70e4\u8089\u81ea\u52a9\u9910\u4e00\u4eba\u6b21\u4efb\u5403\uff08\u86c7\u53e3\u5e97\u3001\u8d2d\u7269\u516c\u56ed\u5e97\u5168\u65f6\u6bb5\u901a\u7528\uff09\uff0c\u53e6\u8d60\u9001\u4e24\u5f2010\u5143\u73b0\u91d1\u62b5\u7528\u5238\uff01\u9080\u8bf7\u597d\u53cb\u8fd4\u522910\u5143\uff01\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L25_C4", "label": " = CreatePredictSample()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.9259, 0.037, 1, 0.96, 0.7778, 0, 3, 1, 0, 0, 771, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictSample", "annotation": ""}, "snippet": " [cols, vals] = matCreater.CreatePredictSample(inputStr.decode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L26_C4", "label": "retY = TestSample()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [14, 1, 0.963, 0.037, 1, 0.96, 0.8889, 140, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "retY", "arg_names": [], "import_names": [], "rhs_call_name": "TestSample", "annotation": ""}, "snippet": " retY = nbModel.TestSample(cols, vals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L27_C4", "label": "print()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "vector": [8, 1, 1.0, 0.037, 1, 0.96, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(retY)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_158:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_158:Expr_L27_C4"}] |
from xml.dom import minidom
class Configuration:
mCurNode = None
def __init__(self, node):
self.mCurNode = node
"""
get first child
"""
def GetChild(self, name):
for node in self.mCurNode.childNodes:
if node.nodeName == name:
return Configuration(node)
return None
def GetChilds(self, name):
nodes = []
for node in self.mCurNode.childNodes:
if node.nodeName == name:
nodes.append(Configuration(node))
return nodes
def GetName(self):
return self.mCurNode.nodeName
def GetValue(self):
return self.mCurNode.firstChild.data
@staticmethod
def FromFile(path):
return Configuration(minidom.parse(path).childNodes[0])
if __name__ == "__main__":
cfg = Configuration.FromFile("sandbox/test.xml")
print cfg.GetName()
print cfg.GetValue()
cfg1 = cfg.GetChild("hello")
print cfg1.GetName()
print cfg1.GetValue()
cfgs = cfg.GetChilds("world")
for c in cfgs:
print c.GetName()
print c.GetValue()
| ajibawa-2023/Python-Code-Large/train/row_159 | 34 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_159:ImportFrom_L1_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 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_159:ClassDef_L3_C0", "label": "Configuration", "type": "class", "loc": [3, 34], "level": 0, "parent": null, "vector": [3, 0, 0.4022, 0.6957, 0, 0.66, 0.5, 618, 0, 6, 0, 0, 0, 0, 5], "semantic": {"name": "Configuration", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Configuration:\n mCurNode = None\n\n def __init__(self, node):\n self.mCurNode = node\n\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L4_C4", "label": "mCurNode =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [14, 1, 0.087, 0.0217, 1, 0.45, 0.0, 928, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "mCurNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mCurNode = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.1413, 0.0435, 1, 0.45, 0.1429, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, node):\n self.mCurNode = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L7_C8", "label": "self.mCurNode =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L6_C4", "vector": [14, 2, 0.1522, 0.0217, 2, 0.11, 0.0, 367, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mCurNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mCurNode = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [8, 1, 0.2391, 0.0652, 1, 0.45, 0.2857, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n get first child\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4", "label": "GetChild", "type": "function", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.3261, 0.1087, 1, 0.45, 0.4286, 508, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "GetChild", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetChild(self, name):\n for node in self.mCurNode.childNodes:\n if node.nodeName == name:\n return Configuration(node)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:For_L14_C8", "label": "for node", "type": "for", "loc": [14, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4", "vector": [6, 2, 0.3261, 0.0652, 2, 0.28, 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 self.mCurNode.childNodes:\n if node.nodeName == name:\n return Configuration(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:If_L15_C12", "label": "if", "type": "if", "loc": [15, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:For_L14_C8", "vector": [4, 3, 0.337, 0.0435, 3, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.nodeName == name:\n return Configuration(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L16_C16", "label": "return", "type": "return", "loc": [16, 16], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L15_C12", "vector": [13, 4, 0.3478, 0.0217, 4, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Configuration(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4", "vector": [13, 2, 0.3696, 0.0217, 2, 0.28, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "label": "GetChilds", "type": "function", "loc": [19, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.4674, 0.1304, 1, 0.45, 0.5714, 367, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "GetChilds", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetChilds(self, name):\n nodes = []\n for node in self.mCurNode.childNodes:\n if node.nodeName == name:\n nodes.append(Configuration(node))\n return nodes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L20_C8", "label": "nodes =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "vector": [14, 2, 0.4348, 0.0217, 2, 0.39, 0.0, 696, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:For_L21_C8", "label": "for node", "type": "for", "loc": [21, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "vector": [6, 2, 0.4783, 0.0652, 2, 0.39, 0.5, 772, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in self.mCurNode.childNodes:\n if node.nodeName == name:\n nodes.append(Configuration(node))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:If_L22_C12", "label": "if", "type": "if", "loc": [22, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:For_L21_C8", "vector": [4, 3, 0.4891, 0.0435, 3, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.nodeName == name:\n nodes.append(Configuration(node))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L23_C16", "label": "append()", "type": "expression", "loc": [23, 23], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L22_C12", "vector": [8, 4, 0.5, 0.0217, 4, 0.91, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " nodes.append(Configuration(node))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "vector": [13, 2, 0.5217, 0.0217, 2, 0.39, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nodes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L26_C4", "label": "GetName", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.5761, 0.0435, 1, 0.45, 0.7143, 58, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "GetName", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetName(self):\n return self.mCurNode.nodeName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L26_C4", "vector": [13, 2, 0.587, 0.0217, 2, 0.5, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mCurNode.nodeName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L29_C4", "label": "GetValue", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.6413, 0.0435, 1, 0.45, 0.8571, 515, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "GetValue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetValue(self):\n return self.mCurNode.firstChild.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L29_C4", "vector": [13, 2, 0.6522, 0.0217, 2, 0.28, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mCurNode.firstChild.data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L33_C4", "label": "FromFile", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "vector": [2, 1, 0.7283, 0.0435, 1, 0.45, 1.0, 887, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "FromFile", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def FromFile(path):\n return Configuration(minidom.parse(path).childNodes[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L33_C4", "vector": [13, 2, 0.7391, 0.0217, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Configuration(minidom.parse(path).childNodes[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "label": "if", "type": "if", "loc": [36, 46], "level": 0, "parent": null, "vector": [4, 0, 0.8913, 0.2391, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n cfg = Configuration.FromFile(\"sandbox/test.xml\")\n print(cfg.GetName())\n print(cfg.GetValue())\n cfg1 = cfg.GetChild(\"hello\")\n print(cfg1.GetName())\n print(cfg1.GetValue())\n cfgs = cfg.GetChilds(\"world\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L37_C4", "label": "cfg = FromFile()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [14, 1, 0.8043, 0.0217, 1, 0.82, 0.0, 46, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "cfg", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " cfg = Configuration.FromFile(\"sandbox/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L38_C4", "label": "print()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [8, 1, 0.8261, 0.0217, 1, 0.82, 0.1429, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cfg.GetName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L39_C4", "label": "print()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [8, 1, 0.8478, 0.0217, 1, 0.82, 0.2857, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cfg.GetValue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L40_C4", "label": "cfg1 = GetChild()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [14, 1, 0.8696, 0.0217, 1, 0.82, 0.4286, 966, 3, 1, 0, 0, 508, 10, 1], "semantic": {"name": "cfg1", "arg_names": [], "import_names": [], "rhs_call_name": "GetChild", "annotation": ""}, "snippet": " cfg1 = cfg.GetChild(\"hello\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L41_C4", "label": "print()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [8, 1, 0.8913, 0.0217, 1, 0.82, 0.5714, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cfg1.GetName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L42_C4", "label": "print()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [8, 1, 0.913, 0.0217, 1, 0.82, 0.7143, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cfg1.GetValue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L43_C4", "label": "cfgs = GetChilds()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [14, 1, 0.9348, 0.0217, 1, 0.82, 0.8571, 813, 3, 1, 0, 0, 367, 10, 1], "semantic": {"name": "cfgs", "arg_names": [], "import_names": [], "rhs_call_name": "GetChilds", "annotation": ""}, "snippet": " cfgs = cfg.GetChilds(\"world\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4", "label": "for c", "type": "for", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "vector": [6, 1, 0.9783, 0.0652, 1, 0.82, 1.0, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in cfgs:\n print(c.GetName())\n print(c.GetValue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L45_C8", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4", "vector": [8, 2, 0.9783, 0.0217, 2, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(c.GetName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4", "vector": [8, 2, 1.0, 0.0217, 2, 0.53, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(c.GetValue())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:For_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:For_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_159:If_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L15_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L16_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:For_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:For_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_159:If_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L22_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L23_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_159:For_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_159:Expr_L46_C8"}] |
#save materials produced during data-mining
class PyMining:
#dict store term -> id
termToId = {}
#dict store id -> term
idToTerm = {}
#dict store term -> how-many-docs-have-term
idToDocCount = {}
#dict store class -> how-many-docs-contained
classToDocCount = {}
#inverse document frequent of termId
idToIdf = {}
#filename of above
nameTermToId = ""
nameIdToTerm = ""
nameIdToDocCount = ""
nameClassToDocCount = ""
nameIdToIdf = ""
#isInit
isInit = False
#curNode
curNode = None
@staticmethod
def Init(config, nodeName, loadFromFile = False):
PyMining.termToId = {}
PyMining.idToTerm = {}
PyMining.idToDocCount = {}
PyMining.classToDocCount = {}
PyMining.idToIdf = {}
PyMining.curNode = config.GetChild(nodeName)
PyMining.nameTermToId = PyMining.curNode.GetChild("term_to_id").GetValue()
PyMining.nameIdToTerm = PyMining.curNode.GetChild("id_to_term").GetValue()
PyMining.nameIdToDocCount = PyMining.curNode.GetChild("id_to_doc_count").GetValue()
PyMining.nameClassToDocCount = PyMining.curNode.GetChild("class_to_doc_count").GetValue()
PyMining.nameIdToIdf = PyMining.curNode.GetChild("id_to_idf").GetValue()
if (loadFromFile):
PyMining.__ReadDict(PyMining.termToId, PyMining.nameTermToId, "str", "int")
PyMining.__ReadDict(PyMining.idToTerm, PyMining.nameIdToTerm, "int", "str")
PyMining.__ReadDict(PyMining.idToDocCount, PyMining.nameIdToDocCount, "int", "int")
PyMining.__ReadDict(PyMining.classToDocCount, PyMining.nameClassToDocCount, "int", "int")
PyMining.__ReadDict(PyMining.idToIdf, PyMining.nameIdToIdf, "int", "float")
PyMining.isInit = True
@staticmethod
def Write():
if (not PyMining.isInit):
print "call init before write()"
return False
PyMining.__WriteDict(PyMining.termToId, PyMining.nameTermToId)
PyMining.__WriteDict(PyMining.idToTerm, PyMining.nameIdToTerm)
PyMining.__WriteDict(PyMining.idToDocCount, PyMining.nameIdToDocCount)
PyMining.__WriteDict(PyMining.classToDocCount, PyMining.nameClassToDocCount)
PyMining.__WriteDict(PyMining.idToIdf, PyMining.nameIdToIdf)
return True
@staticmethod
def __ReadDict(dic, filename, typeK, typeV):
f = open(filename, "r")
for line in f:
line = line.decode("utf-8")
vec = line.split("\t")
k = vec[0]
v = vec[1]
if (typeK == "int"):
k = int(k)
if (typeV == "int"):
v = int(v)
elif (typeV == "float"):
v= float(v)
dic[k] = v
f.close()
@staticmethod
def __WriteDict(dic, filename):
f = open(filename, "w")
for k,v in dic.iteritems():
if isinstance(k, (str, unicode)):
f.write(k.encode("utf-8"))
else:
f.write(str(k))
f.write("\t")
if isinstance(v, (str, unicode)):
f.write(v.encode("utf-8"))
else:
f.write(str(v))
f.write("\n")
f.close()
@staticmethod
def ReadDict(dic, nodeName):
if (not PyMining.isInit):
print "init PyMining before using"
path = PyMining.curNode.GetChild(nodeName).GetValue()
PyMining.__ReadDict(dic, path)
@staticmethod
def WriteDict(dic, nodeName):
if (not PyMining.isInit):
print "init PyMining before using"
path = PyMining.curNode.GetChild(nodeName).GetValue()
PyMining.__WriteDict(dic, path)
| ajibawa-2023/Python-Code-Large/train/row_160 | 79 | 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_160:ClassDef_L2_C0", "label": "PyMining", "type": "class", "loc": [2, 110], "level": 0, "parent": null, "vector": [3, 0, 0.5091, 0.9909, 0, 0.66, 0.0, 518, 0, 6, 0, 0, 0, 0, 52], "semantic": {"name": "PyMining", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PyMining:\n #dict store term -> id\n termToId = {} \n #dict store id -> term\n idToTerm = {}\n #dict store term -> how-many-docs-have-term\n idToDocCount = {}\n #dict store class -> how-many-docs-contained"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L4_C4", "label": "termToId =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.0364, 0.0091, 1, 0.45, 0.0, 256, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "termToId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " termToId = {} "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L6_C4", "label": "idToTerm =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.0545, 0.0091, 1, 0.45, 0.0588, 469, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "idToTerm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idToTerm = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L8_C4", "label": "idToDocCount =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.0727, 0.0091, 1, 0.45, 0.1176, 591, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "idToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idToDocCount = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L10_C4", "label": "classToDocCount =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.0909, 0.0091, 1, 0.45, 0.1765, 785, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "classToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " classToDocCount = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L12_C4", "label": "idToIdf =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1091, 0.0091, 1, 0.45, 0.2353, 53, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "idToIdf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idToIdf = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L15_C4", "label": "nameTermToId =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1364, 0.0091, 1, 0.45, 0.2941, 141, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nameTermToId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nameTermToId = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L16_C4", "label": "nameIdToTerm =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1455, 0.0091, 1, 0.45, 0.3529, 387, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nameIdToTerm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nameIdToTerm = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L17_C4", "label": "nameIdToDocCount =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1545, 0.0091, 1, 0.45, 0.4118, 749, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nameIdToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nameIdToDocCount = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L18_C4", "label": "nameClassToDocCount =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1636, 0.0091, 1, 0.45, 0.4706, 271, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nameClassToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nameClassToDocCount = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L19_C4", "label": "nameIdToIdf =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.1727, 0.0091, 1, 0.45, 0.5294, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nameIdToIdf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nameIdToIdf = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L22_C4", "label": "isInit =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.2, 0.0091, 1, 0.45, 0.5882, 140, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isInit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " isInit = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L25_C4", "label": "curNode =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [14, 1, 0.2273, 0.0091, 1, 0.45, 0.6471, 106, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "curNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curNode = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "label": "Init", "type": "function", "loc": [28, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.35, 0.2, 1, 0.45, 0.7059, 44, 0, 3, 0, 0, 0, 0, 16], "semantic": {"name": "Init", "arg_names": ["config", "nodeName", "loadFromFile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Init(config, nodeName, loadFromFile = False):\n PyMining.termToId = {}\n PyMining.idToTerm = {}\n PyMining.idToDocCount = {}\n PyMining.classToDocCount = {}\n PyMining.idToIdf = {}\n\n PyMining.curNode = config.GetChild(nodeName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L29_C8", "label": "PyMining.termToId =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.2636, 0.0091, 2, 0.81, 0.0, 983, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PyMining.termToId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.termToId = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L30_C8", "label": "PyMining.idToTerm =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.2727, 0.0091, 2, 0.81, 0.0833, 164, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PyMining.idToTerm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.idToTerm = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L31_C8", "label": "PyMining.idToDocCount =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.2818, 0.0091, 2, 0.81, 0.1667, 700, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PyMining.idToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.idToDocCount = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L32_C8", "label": "PyMining.classToDocCount =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.2909, 0.0091, 2, 0.81, 0.25, 795, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PyMining.classToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.classToDocCount = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L33_C8", "label": "PyMining.idToIdf =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3, 0.0091, 2, 0.81, 0.3333, 245, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "PyMining.idToIdf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.idToIdf = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L35_C8", "label": "PyMining.curNode = GetChild()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3182, 0.0091, 2, 0.81, 0.4167, 258, 3, 1, 0, 0, 508, 10, 1], "semantic": {"name": "PyMining.curNode", "arg_names": [], "import_names": [], "rhs_call_name": "GetChild", "annotation": ""}, "snippet": " PyMining.curNode = config.GetChild(nodeName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L36_C8", "label": "PyMining.nameTermToId = GetValue()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3273, 0.0091, 2, 0.81, 0.5, 543, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "PyMining.nameTermToId", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " PyMining.nameTermToId = PyMining.curNode.GetChild(\"term_to_id\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L37_C8", "label": "PyMining.nameIdToTerm = GetValue()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3364, 0.0091, 2, 0.81, 0.5833, 132, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "PyMining.nameIdToTerm", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " PyMining.nameIdToTerm = PyMining.curNode.GetChild(\"id_to_term\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L38_C8", "label": "PyMining.nameIdToDocCount = GetValue()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3455, 0.0091, 2, 0.81, 0.6667, 834, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "PyMining.nameIdToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " PyMining.nameIdToDocCount = PyMining.curNode.GetChild(\"id_to_doc_count\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L39_C8", "label": "PyMining.nameClassToDocCount = GetValue()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3545, 0.0091, 2, 0.81, 0.75, 859, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "PyMining.nameClassToDocCount", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " PyMining.nameClassToDocCount = PyMining.curNode.GetChild(\"class_to_doc_count\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L40_C8", "label": "PyMining.nameIdToIdf = GetValue()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.3636, 0.0091, 2, 0.81, 0.8333, 974, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "PyMining.nameIdToIdf", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " PyMining.nameIdToIdf = PyMining.curNode.GetChild(\"id_to_idf\").GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "label": "if", "type": "if", "loc": [42, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [4, 2, 0.4045, 0.0545, 2, 0.81, 0.9167, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (loadFromFile):\n PyMining.__ReadDict(PyMining.termToId, PyMining.nameTermToId, \"str\", \"int\")\n PyMining.__ReadDict(PyMining.idToTerm, PyMining.nameIdToTerm, \"int\", \"str\")\n PyMining.__ReadDict(PyMining.idToDocCount, PyMining.nameIdToDocCount, \"int\", \"int\")\n PyMining.__ReadDict(PyMining.classToDocCount, PyMining.nameClassToDocCount, \"int\", \"int\")\n PyMining.__ReadDict(PyMining.idToIdf, PyMining.nameIdToIdf, \"int\", \"float\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L43_C12", "label": "__ReadDict()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "vector": [8, 3, 0.3909, 0.0091, 3, 0.14, 0.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(PyMining.termToId, PyMining.nameTermToId, \"str\", \"int\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L44_C12", "label": "__ReadDict()", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "vector": [8, 3, 0.4, 0.0091, 3, 0.14, 0.25, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(PyMining.idToTerm, PyMining.nameIdToTerm, \"int\", \"str\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L45_C12", "label": "__ReadDict()", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "vector": [8, 3, 0.4091, 0.0091, 3, 0.14, 0.5, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(PyMining.idToDocCount, PyMining.nameIdToDocCount, \"int\", \"int\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L46_C12", "label": "__ReadDict()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "vector": [8, 3, 0.4182, 0.0091, 3, 0.14, 0.75, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(PyMining.classToDocCount, PyMining.nameClassToDocCount, \"int\", \"int\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L47_C12", "label": "__ReadDict()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "vector": [8, 3, 0.4273, 0.0091, 3, 0.14, 1.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(PyMining.idToIdf, PyMining.nameIdToIdf, \"int\", \"float\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L49_C8", "label": "PyMining.isInit =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "vector": [14, 2, 0.4455, 0.0091, 2, 0.81, 1.0, 218, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "PyMining.isInit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PyMining.isInit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "label": "Write", "type": "function", "loc": [52, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.5136, 0.0909, 1, 0.45, 0.7647, 919, 0, 0, 1, 0, 0, 0, 6], "semantic": {"name": "Write", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Write():\n if (not PyMining.isInit):\n print(\"call init before write()\")\n return False\n PyMining.__WriteDict(PyMining.termToId, PyMining.nameTermToId)\n PyMining.__WriteDict(PyMining.idToTerm, PyMining.nameIdToTerm)\n PyMining.__WriteDict(PyMining.idToDocCount, PyMining.nameIdToDocCount)\n PyMining.__WriteDict(PyMining.classToDocCount, PyMining.nameClassToDocCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8", "label": "if", "type": "if", "loc": [53, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [4, 2, 0.4909, 0.0273, 2, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.isInit):\n print(\"call init before write()\")\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L54_C12", "label": "print()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8", "vector": [8, 3, 0.4909, 0.0091, 3, 0.64, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"call init before write()\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8", "vector": [13, 3, 0.5, 0.0091, 3, 0.64, 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_160:Expr_L56_C8", "label": "__WriteDict()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [8, 2, 0.5091, 0.0091, 2, 0.83, 0.1667, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(PyMining.termToId, PyMining.nameTermToId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L57_C8", "label": "__WriteDict()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [8, 2, 0.5182, 0.0091, 2, 0.83, 0.3333, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(PyMining.idToTerm, PyMining.nameIdToTerm)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L58_C8", "label": "__WriteDict()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [8, 2, 0.5273, 0.0091, 2, 0.83, 0.5, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(PyMining.idToDocCount, PyMining.nameIdToDocCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L59_C8", "label": "__WriteDict()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [8, 2, 0.5364, 0.0091, 2, 0.83, 0.6667, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(PyMining.classToDocCount, PyMining.nameClassToDocCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L60_C8", "label": "__WriteDict()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [8, 2, 0.5455, 0.0091, 2, 0.83, 0.8333, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(PyMining.idToIdf, PyMining.nameIdToIdf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Return_L61_C8", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "vector": [13, 2, 0.5545, 0.0091, 2, 0.83, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "label": "__ReadDict", "type": "function", "loc": [64, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.6545, 0.1545, 1, 0.45, 0.8235, 256, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "__ReadDict", "arg_names": ["dic", "filename", "typeK", "typeV"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ReadDict(dic, filename, typeK, typeV):\n f = open(filename, \"r\")\n for line in f:\n line = line.decode(\"utf-8\")\n vec = line.split(\"\\t\")\n k = vec[0]\n v = vec[1]\n if (typeK == \"int\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L65_C8", "label": "f = open()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "vector": [14, 2, 0.5909, 0.0091, 2, 0.54, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "label": "for line", "type": "for", "loc": [66, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "vector": [6, 2, 0.6591, 0.1273, 2, 0.54, 0.5, 373, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n line = line.decode(\"utf-8\")\n vec = line.split(\"\\t\")\n k = vec[0]\n v = vec[1]\n if (typeK == \"int\"):\n k = int(k)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L67_C12", "label": "line = decode()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [14, 3, 0.6091, 0.0091, 3, 0.61, 0.0, 373, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " line = line.decode(\"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L68_C12", "label": "vec = split()", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [14, 3, 0.6182, 0.0091, 3, 0.61, 0.1667, 132, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "vec", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " vec = line.split(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L69_C12", "label": "k =", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [14, 3, 0.6273, 0.0091, 3, 0.61, 0.3333, 954, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k = vec[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L70_C12", "label": "v =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [14, 3, 0.6364, 0.0091, 3, 0.61, 0.5, 553, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " v = vec[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L71_C12", "label": "if", "type": "if", "loc": [71, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [4, 3, 0.65, 0.0182, 3, 0.61, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (typeK == \"int\"):\n k = int(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L72_C16", "label": "k = int()", "type": "assigned_variable", "loc": [72, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L71_C12", "vector": [14, 4, 0.6545, 0.0091, 4, 0.17, 0.0, 954, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " k = int(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12", "label": "if", "type": "if", "loc": [74, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [4, 3, 0.6864, 0.0364, 3, 0.61, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (typeV == \"int\"):\n v = int(v)\n elif (typeV == \"float\"):\n v= float(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L75_C16", "label": "v = int()", "type": "assigned_variable", "loc": [75, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12", "vector": [14, 4, 0.6818, 0.0091, 4, 0.49, 0.0, 553, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " v = int(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L76_C12", "label": "if", "type": "if", "loc": [76, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12", "vector": [4, 4, 0.6955, 0.0182, 4, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (typeV == \"float\"):\n v= float(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L77_C16", "label": "v = float()", "type": "assigned_variable", "loc": [77, 77], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L76_C12", "vector": [14, 5, 0.7, 0.0091, 5, 0.64, 0.0, 553, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " v= float(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L79_C12", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "vector": [14, 3, 0.7182, 0.0091, 3, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dic[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L80_C8", "label": "close()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "vector": [8, 2, 0.7273, 0.0091, 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": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "label": "__WriteDict", "type": "function", "loc": [83, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.8136, 0.1273, 1, 0.45, 0.8824, 446, 0, 2, 0, 0, 0, 0, 15], "semantic": {"name": "__WriteDict", "arg_names": ["dic", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __WriteDict(dic, filename):\n f = open(filename, \"w\")\n for k,v in dic.iteritems():\n if isinstance(k, (str, unicode)):\n f.write(k.encode(\"utf-8\"))\n else:\n f.write(str(k))\n f.write(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L84_C8", "label": "f = open()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "vector": [14, 2, 0.7636, 0.0091, 2, 0.37, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "label": "for k, v", "type": "for", "loc": [85, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "vector": [6, 2, 0.8182, 0.1, 2, 0.37, 0.5, 867, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in dic.iteritems():\n if isinstance(k, (str, unicode)):\n f.write(k.encode(\"utf-8\"))\n else:\n f.write(str(k))\n f.write(\"\\t\")\n if isinstance(v, (str, unicode)):\n f.write(v.encode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12", "label": "if", "type": "if", "loc": [86, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "vector": [4, 3, 0.7955, 0.0364, 3, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(k, (str, unicode)):\n f.write(k.encode(\"utf-8\"))\n else:\n f.write(str(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L87_C16", "label": "write()", "type": "expression", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12", "vector": [8, 4, 0.7909, 0.0091, 4, 0.23, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(k.encode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L89_C16", "label": "write()", "type": "expression", "loc": [89, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12", "vector": [8, 4, 0.8091, 0.0091, 4, 0.23, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(str(k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L90_C12", "label": "write()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "vector": [8, 3, 0.8182, 0.0091, 3, 0.71, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12", "label": "if", "type": "if", "loc": [91, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "vector": [4, 3, 0.8409, 0.0364, 3, 0.71, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(v, (str, unicode)):\n f.write(v.encode(\"utf-8\"))\n else:\n f.write(str(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L92_C16", "label": "write()", "type": "expression", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12", "vector": [8, 4, 0.8364, 0.0091, 4, 0.86, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(v.encode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L94_C16", "label": "write()", "type": "expression", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12", "vector": [8, 4, 0.8545, 0.0091, 4, 0.86, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(str(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L95_C12", "label": "write()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "vector": [8, 3, 0.8636, 0.0091, 3, 0.71, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L96_C8", "label": "close()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "vector": [8, 2, 0.8727, 0.0091, 2, 0.37, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "label": "ReadDict", "type": "function", "loc": [99, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.9182, 0.0455, 1, 0.45, 0.9412, 294, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "ReadDict", "arg_names": ["dic", "nodeName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ReadDict(dic, nodeName):\n if (not PyMining.isInit):\n print(\"init PyMining before using\")\n path = PyMining.curNode.GetChild(nodeName).GetValue()\n PyMining.__ReadDict(dic, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L100_C8", "label": "if", "type": "if", "loc": [100, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "vector": [4, 2, 0.9136, 0.0182, 2, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.isInit):\n print(\"init PyMining before using\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L101_C12", "label": "print()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L100_C8", "vector": [8, 3, 0.9182, 0.0091, 3, 0.92, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"init PyMining before using\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L102_C8", "label": "path = GetValue()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "vector": [14, 2, 0.9273, 0.0091, 2, 0.87, 0.5, 358, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " path = PyMining.curNode.GetChild(nodeName).GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L103_C8", "label": "__ReadDict()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "vector": [8, 2, 0.9364, 0.0091, 2, 0.87, 1.0, 256, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__ReadDict", "arg_names": [], "import_names": [], "rhs_call_name": "__ReadDict", "annotation": ""}, "snippet": " PyMining.__ReadDict(dic, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "label": "WriteDict", "type": "function", "loc": [106, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "vector": [2, 1, 0.9818, 0.0455, 1, 0.45, 1.0, 278, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "WriteDict", "arg_names": ["dic", "nodeName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def WriteDict(dic, nodeName):\n if (not PyMining.isInit):\n print(\"init PyMining before using\")\n path = PyMining.curNode.GetChild(nodeName).GetValue()\n PyMining.__WriteDict(dic, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:If_L107_C8", "label": "if", "type": "if", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "vector": [4, 2, 0.9773, 0.0182, 2, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not PyMining.isInit):\n print(\"init PyMining before using\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L108_C12", "label": "print()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:If_L107_C8", "vector": [8, 3, 0.9818, 0.0091, 3, 0.65, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"init PyMining before using\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L109_C8", "label": "path = GetValue()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "vector": [14, 2, 0.9909, 0.0091, 2, 0.29, 0.5, 358, 3, 0, 0, 0, 515, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "GetValue", "annotation": ""}, "snippet": " path = PyMining.curNode.GetChild(nodeName).GetValue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L110_C8", "label": "__WriteDict()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "vector": [8, 2, 1.0, 0.0091, 2, 0.29, 1.0, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__WriteDict", "arg_names": [], "import_names": [], "rhs_call_name": "__WriteDict", "annotation": ""}, "snippet": " PyMining.__WriteDict(dic, path)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Return_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L71_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L72_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L75_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L100_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_160:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_160:Expr_L110_C8"}] |
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("data/sogou.train.txt")
chiFilter = ChiSquareFilter(config, "__filter__")
chiFilter.TrainFilter(trainx, trainy)
nbModel = NaiveBayes(config, "naive_bayes")
nbModel.Train(trainx, trainy)
[testx, testy] = matCreater.CreatePredictMatrix("data/sogou.test.txt")
[testx, testy] = chiFilter.MatrixFilter(testx, testy)
[resultY, precision] = nbModel.Test(testx, testy)
print precision
| ajibawa-2023/Python-Code-Large/train/row_161 | 20 | 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_161:ImportFrom_L1_C0", "label": "from matrix import Matrix", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L2_C0", "label": "from classifier_matrix import ClassifierMatrix", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.1429, 3, 0, 1, 0, 0, 3, 0, 0], "semantic": {"name": "classifier_matrix", "arg_names": [], "import_names": ["ClassifierMatrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier_matrix import ClassifierMatrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L3_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0417, 0, 0.66, 0.2857, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L4_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0417, 0, 0.66, 0.4286, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L5_C0", "label": "from configuration import Configuration", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2083, 0.0417, 0, 0.66, 0.5714, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L6_C0", "label": "from chisquare_filter import ChiSquareFilter", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0417, 0, 0.66, 0.7143, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "chisquare_filter", "arg_names": [], "import_names": ["ChiSquareFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from chisquare_filter import ChiSquareFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:ImportFrom_L7_C0", "label": "from naive_bayes import NaiveBayes", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2917, 0.0417, 0, 0.66, 0.8571, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "naive_bayes", "arg_names": [], "import_names": ["NaiveBayes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from naive_bayes import NaiveBayes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "label": "if", "type": "if", "loc": [9, 24], "level": 0, "parent": null, "vector": [4, 0, 0.6875, 0.6667, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n config = Configuration.FromFile(\"conf/test.xml\")\n PyMining.Init(config, \"__global__\")\n matCreater = ClassifierMatrix(config, \"__matrix__\")\n [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/sogou.train.txt\")\n chiFilter = ChiSquareFilter(config, \"__filter__\")\n chiFilter.TrainFilter(trainx, trainy)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L10_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.4167, 0.0417, 1, 0.93, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L11_C4", "label": "Init()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [8, 1, 0.4583, 0.0417, 1, 0.93, 0.0909, 44, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L12_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.5, 0.0417, 1, 0.93, 0.1818, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L13_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.5417, 0.0417, 1, 0.93, 0.2727, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/sogou.train.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L14_C4", "label": "chiFilter = ChiSquareFilter()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.5833, 0.0417, 1, 0.93, 0.3636, 663, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chiFilter", "arg_names": [], "import_names": [], "rhs_call_name": "ChiSquareFilter", "annotation": ""}, "snippet": " chiFilter = ChiSquareFilter(config, \"__filter__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L15_C4", "label": "TrainFilter()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [8, 1, 0.625, 0.0417, 1, 0.93, 0.4545, 144, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "TrainFilter", "arg_names": [], "import_names": [], "rhs_call_name": "TrainFilter", "annotation": ""}, "snippet": " chiFilter.TrainFilter(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L17_C4", "label": "nbModel = NaiveBayes()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.7083, 0.0417, 1, 0.93, 0.5455, 711, 3, 2, 0, 0, 828, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "NaiveBayes", "annotation": ""}, "snippet": " nbModel = NaiveBayes(config, \"naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L18_C4", "label": "Train()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [8, 1, 0.75, 0.0417, 1, 0.93, 0.6364, 55, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Train", "arg_names": [], "import_names": [], "rhs_call_name": "Train", "annotation": ""}, "snippet": " nbModel.Train(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L20_C4", "label": " = CreatePredictMatrix()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.8333, 0.0417, 1, 0.93, 0.7273, 0, 3, 1, 0, 0, 391, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictMatrix", "annotation": ""}, "snippet": " [testx, testy] = matCreater.CreatePredictMatrix(\"data/sogou.test.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L21_C4", "label": " = MatrixFilter()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.875, 0.0417, 1, 0.93, 0.8182, 0, 3, 2, 0, 0, 81, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "MatrixFilter", "annotation": ""}, "snippet": " [testx, testy] = chiFilter.MatrixFilter(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L22_C4", "label": " = Test()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [14, 1, 0.9167, 0.0417, 1, 0.93, 0.9091, 0, 3, 2, 0, 0, 786, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "Test", "annotation": ""}, "snippet": " [resultY, precision] = nbModel.Test(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L24_C4", "label": "print()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "vector": [8, 1, 1.0, 0.0417, 1, 0.93, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(precision)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_161:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_161:Expr_L24_C4"}] |
import random
import bisect
class Tripple:
def __init__(self, row, col, val):
self.row = row
self.col = col
self.val = val
def Transpose(self):
tmp = self.row
self.row = self.col
self.col = tmp
return self
def TrippleCmp(t1, t2):
if (t1.row < t2.row):
return -1
elif (t1.row > t2.row):
return 1
else:
return t1.col < t2.col
class Matrix:
#init a matrix, using csr, and dimensions
def __init__(self, rows, cols, vals):
self.rows = rows
self.cols = cols
self.vals = vals
self.nRow = len(rows) - 1
maxCol = -1
for col in cols:
if (col > maxCol):
maxCol = col
self.nCol = maxCol + 1
#get element @(x,y), if no element, return 0, if range error, return -1
def Get(self, x, y):
if (x < 0) or (x >= self.nRow):
return 0
index = bisect.bisect_left(self.cols, y, self.rows[x], self.rows[x + 1])
if index < len(self.cols) and index >= 0 and self.cols[index] == y:
return 1
else:
return 0
def Transpose(self, nNewRow):
#make transposed-tripple from csr
triList = []
for r in range(0, len(self.rows) - 1):
for c in range(self.rows[r], self.rows[r + 1]):
t = Tripple(r, self.cols[c], self.vals[c])
t.Transpose()
triList.append(t)
#sort tripple
#for t in triList:
# print t.row, " ", t.col, " ", t.val
#print "====="
#sorted(triList, cmp = TrippleCmp)
triList.sort(cmp = TrippleCmp)
#for t in triList:
# print t.row, " ", t.col, " ", t.val
#make tripple back to csr
newRows = [0]
newCols = []
newVals = []
lastRow = 0
for i in range(0, len(triList)):
#add a new row
if triList[i].row != lastRow:
lastRowsLen = len(newRows)
for j in range(lastRow, triList[i].row - 1):
newRows.append(newRows[lastRowsLen - 1])
newRows.append(i)
lastRow = triList[i].row
#add a new col and val
newCols.append(triList[i].col)
newVals.append(triList[i].val)
for i in range(triList[len(triList) - 1].row, nNewRow - 1):
newRows.append(newRows[len(newRows) - 1])
newRows.append(len(triList))
return Matrix(newRows, newCols, newVals)
@staticmethod
def BaggingFromMatrix(mat, m):
#print "bagging", m
rows = [0]
cols = []
vals = []
maxCol = -1
baggingDict = {}
for i in range(0, m):
ratio = random.random()
index = int(ratio * mat.nRow)
baggingDict[i] = index
#print "add elements to new mat:", mat.rows[index + 1] - mat.rows[index]
rows.append(rows[len(rows) - 1] + (mat.rows[index + 1] - mat.rows[index]))
for j in range(mat.rows[index], mat.rows[index + 1]):
cols.append(mat.cols[j])
if (j > maxCol):
maxCol = j
vals.append(mat.vals[j])
newMat = Matrix(rows, cols, vals)
#print "after bagging:"
#print rows
#print cols
return [newMat.Transpose(mat.nCol), baggingDict]
#if __name__ == "__main__":
#rows = [0, 3, 4, 5, 6]
#cols = [0, 1, 2, 3, 4, 4]
#vals = [1, 1, 1, 1, 1, 1]
#mat = Matrix(rows, cols, vals, 4, 5)
#tMat = mat.Transpose()
#print tMat.rows
#print tMat.cols
#print tMat.vals
#sample = Matrix.BaggingFromMatrix(mat, 2)
#print sample.rows
#print sample.cols
#print sample.vals
#sample = Matrix.BaggingFromMatrix(mat, 2)
#print sample.rows
#print sample.cols
#print sample.vals
| ajibawa-2023/Python-Code-Large/train/row_162 | 79 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_162:Import_L1_C0", "label": "random import random", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 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_162:Import_L2_C0", "label": "bisect import bisect", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0077, 0, 0.66, 0.25, 325, 0, 1, 0, 0, 325, 0, 0], "semantic": {"name": "bisect", "arg_names": [], "import_names": ["bisect"], "rhs_call_name": "", "annotation": ""}, "snippet": "import bisect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "label": "Tripple", "type": "class", "loc": [4, 14], "level": 0, "parent": null, "vector": [3, 0, 0.0692, 0.0846, 0, 0.66, 0.5, 42, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "Tripple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Tripple:\n def __init__(self, row, col, val):\n self.row = row\n self.col = col\n self.val = val\n \n def Transpose(self):\n tmp = self.row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "label": "__init__", "type": "function", "loc": [5, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "vector": [2, 1, 0.05, 0.0308, 1, 0.07, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "row", "col", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, row, col, val):\n self.row = row\n self.col = col\n self.val = val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L6_C8", "label": "self.row =", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "vector": [14, 2, 0.0462, 0.0077, 2, 0.36, 0.0, 644, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row = row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L7_C8", "label": "self.col =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "vector": [14, 2, 0.0538, 0.0077, 2, 0.36, 0.5, 11, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.col = col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L8_C8", "label": "self.val =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "vector": [14, 2, 0.0615, 0.0077, 2, 0.36, 1.0, 305, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.val = val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "label": "Transpose", "type": "function", "loc": [10, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "vector": [2, 1, 0.0923, 0.0385, 1, 0.07, 1.0, 275, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "Transpose", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Transpose(self):\n tmp = self.row\n self.row = self.col\n self.col = tmp\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L11_C8", "label": "tmp =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "vector": [14, 2, 0.0846, 0.0077, 2, 0.77, 0.0, 517, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = self.row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L12_C8", "label": "self.row =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "vector": [14, 2, 0.0923, 0.0077, 2, 0.77, 0.3333, 644, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row = self.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L13_C8", "label": "self.col =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "vector": [14, 2, 0.1, 0.0077, 2, 0.77, 0.6667, 11, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.col = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "vector": [13, 2, 0.1077, 0.0077, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L16_C0", "label": "TrippleCmp", "type": "function", "loc": [16, 22], "level": 0, "parent": null, "vector": [2, 0, 0.1462, 0.0538, 0, 0.66, 0.75, 13, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "TrippleCmp", "arg_names": ["t1", "t2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def TrippleCmp(t1, t2):\n if (t1.row < t2.row):\n return -1\n elif (t1.row > t2.row):\n return 1\n else:\n return t1.col < t2.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4", "label": "if", "type": "if", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L16_C0", "vector": [4, 1, 0.15, 0.0462, 1, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (t1.row < t2.row):\n return -1\n elif (t1.row > t2.row):\n return 1\n else:\n return t1.col < t2.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4", "vector": [13, 2, 0.1385, 0.0077, 2, 0.15, 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_162:If_L19_C4", "label": "if", "type": "if", "loc": [19, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4", "vector": [4, 2, 0.1577, 0.0308, 2, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (t1.row > t2.row):\n return 1\n else:\n return t1.col < t2.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L19_C4", "vector": [13, 3, 0.1538, 0.0077, 3, 0.61, 0.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_162:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L19_C4", "vector": [13, 3, 0.1692, 0.0077, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return t1.col < t2.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "label": "Matrix", "type": "class", "loc": [24, 109], "level": 0, "parent": null, "vector": [3, 0, 0.5115, 0.6615, 0, 0.66, 1.0, 519, 0, 4, 0, 0, 0, 0, 35], "semantic": {"name": "Matrix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Matrix:\n #init a matrix, using csr, and dimensions\n def __init__(self, rows, cols, vals):\n self.rows = rows\n self.cols = cols\n self.vals = vals\n self.nRow = len(rows) - 1\n maxCol = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "label": "__init__", "type": "function", "loc": [26, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "vector": [2, 1, 0.2346, 0.0769, 1, 0.54, 0.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "rows", "cols", "vals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, rows, cols, vals):\n self.rows = rows\n self.cols = cols\n self.vals = vals\n self.nRow = len(rows) - 1\n maxCol = -1\n for col in cols:\n if (col > maxCol):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L27_C8", "label": "self.rows =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2077, 0.0077, 2, 0.54, 0.0, 881, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rows = rows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L28_C8", "label": "self.cols =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2154, 0.0077, 2, 0.54, 0.1667, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cols = cols"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L29_C8", "label": "self.vals =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2231, 0.0077, 2, 0.54, 0.3333, 108, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.vals = vals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L30_C8", "label": "self.nRow =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2308, 0.0077, 2, 0.54, 0.5, 280, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.nRow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nRow = len(rows) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L31_C8", "label": "maxCol =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2385, 0.0077, 2, 0.54, 0.6667, 75, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maxCol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxCol = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L32_C8", "label": "for col", "type": "for", "loc": [32, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [6, 2, 0.2538, 0.0231, 2, 0.54, 0.8333, 157, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in cols:\n if (col > maxCol):\n maxCol = col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L33_C12", "label": "if", "type": "if", "loc": [33, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L32_C8", "vector": [4, 3, 0.2577, 0.0154, 3, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (col > maxCol):\n maxCol = col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L34_C16", "label": "maxCol =", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L33_C12", "vector": [14, 4, 0.2615, 0.0077, 4, 0.56, 0.0, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maxCol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxCol = col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L35_C8", "label": "self.nCol =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "vector": [14, 2, 0.2692, 0.0077, 2, 0.54, 1.0, 431, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.nCol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nCol = maxCol + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "label": "Get", "type": "function", "loc": [38, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "vector": [2, 1, 0.3192, 0.0615, 1, 0.54, 0.3333, 922, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "Get", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Get(self, x, y):\n if (x < 0) or (x >= self.nRow):\n return 0\n index = bisect.bisect_left(self.cols, y, self.rows[x], self.rows[x + 1])\n if index < len(self.cols) and index >= 0 and self.cols[index] == y:\n return 1\n else:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L39_C8", "label": "if", "type": "if", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "vector": [4, 2, 0.3038, 0.0154, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (x < 0) or (x >= self.nRow):\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L39_C8", "vector": [13, 3, 0.3077, 0.0077, 3, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L41_C8", "label": "index = bisect_left()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "vector": [14, 2, 0.3154, 0.0077, 2, 0.31, 0.5, 780, 3, 4, 0, 0, 523, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "bisect_left", "annotation": ""}, "snippet": " index = bisect.bisect_left(self.cols, y, self.rows[x], self.rows[x + 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8", "label": "if", "type": "if", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "vector": [4, 2, 0.3346, 0.0308, 2, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < len(self.cols) and index >= 0 and self.cols[index] == y:\n return 1\n else:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L43_C12", "label": "return", "type": "return", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8", "vector": [13, 3, 0.3308, 0.0077, 3, 0.48, 0.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_162:Return_L45_C12", "label": "return", "type": "return", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8", "vector": [13, 3, 0.3462, 0.0077, 3, 0.48, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "label": "Transpose", "type": "function", "loc": [47, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "vector": [2, 1, 0.5038, 0.2923, 1, 0.54, 0.6667, 275, 0, 2, 1, 0, 0, 0, 22], "semantic": {"name": "Transpose", "arg_names": ["self", "nNewRow"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Transpose(self, nNewRow):\n #make transposed-tripple from csr\n triList = []\n for r in range(0, len(self.rows) - 1):\n for c in range(self.rows[r], self.rows[r + 1]):\n t = Tripple(r, self.cols[c], self.vals[c])\n t.Transpose()\n triList.append(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L49_C8", "label": "triList =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [14, 2, 0.3769, 0.0077, 2, 0.42, 0.0, 281, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "triList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " triList = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L50_C8", "label": "for r", "type": "for", "loc": [50, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [6, 2, 0.4, 0.0385, 2, 0.42, 0.1, 436, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in range(0, len(self.rows) - 1):\n for c in range(self.rows[r], self.rows[r + 1]):\n t = Tripple(r, self.cols[c], self.vals[c])\n t.Transpose()\n triList.append(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "label": "for c", "type": "for", "loc": [51, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L50_C8", "vector": [6, 3, 0.4038, 0.0308, 3, 0.36, 0.0, 411, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in range(self.rows[r], self.rows[r + 1]):\n t = Tripple(r, self.cols[c], self.vals[c])\n t.Transpose()\n triList.append(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L52_C16", "label": "t = Tripple()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "vector": [14, 4, 0.4, 0.0077, 4, 0.85, 0.0, 15, 3, 3, 0, 0, 42, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Tripple", "annotation": ""}, "snippet": " t = Tripple(r, self.cols[c], self.vals[c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L53_C16", "label": "Transpose()", "type": "expression", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "vector": [8, 4, 0.4077, 0.0077, 4, 0.85, 0.5, 275, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Transpose", "arg_names": [], "import_names": [], "rhs_call_name": "Transpose", "annotation": ""}, "snippet": " t.Transpose()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L54_C16", "label": "append()", "type": "expression", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "vector": [8, 4, 0.4154, 0.0077, 4, 0.85, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " triList.append(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L61_C8", "label": "sort()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [8, 2, 0.4692, 0.0077, 2, 0.42, 0.2, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " triList.sort(cmp = TrippleCmp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L66_C8", "label": "newRows =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [14, 2, 0.5077, 0.0077, 2, 0.42, 0.3, 746, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "newRows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newRows = [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L67_C8", "label": "newCols =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [14, 2, 0.5154, 0.0077, 2, 0.42, 0.4, 236, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "newCols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newCols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L68_C8", "label": "newVals =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [14, 2, 0.5231, 0.0077, 2, 0.42, 0.5, 227, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "newVals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newVals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L69_C8", "label": "lastRow =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [14, 2, 0.5308, 0.0077, 2, 0.42, 0.6, 364, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "lastRow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lastRow = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "label": "for i", "type": "for", "loc": [70, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [6, 2, 0.5769, 0.0846, 2, 0.42, 0.7, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(0, len(triList)):\n #add a new row\n if triList[i].row != lastRow:\n lastRowsLen = len(newRows)\n for j in range(lastRow, triList[i].row - 1):\n newRows.append(newRows[lastRowsLen - 1])\n newRows.append(i)\n lastRow = triList[i].row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "label": "if", "type": "if", "loc": [72, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "vector": [4, 3, 0.5731, 0.0462, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if triList[i].row != lastRow:\n lastRowsLen = len(newRows)\n for j in range(lastRow, triList[i].row - 1):\n newRows.append(newRows[lastRowsLen - 1])\n newRows.append(i)\n lastRow = triList[i].row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L73_C16", "label": "lastRowsLen = len()", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "vector": [14, 4, 0.5615, 0.0077, 4, 0.61, 0.0, 289, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "lastRowsLen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " lastRowsLen = len(newRows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L74_C16", "label": "for j", "type": "for", "loc": [74, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "vector": [6, 4, 0.5731, 0.0154, 4, 0.61, 0.3333, 100, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(lastRow, triList[i].row - 1):\n newRows.append(newRows[lastRowsLen - 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L75_C20", "label": "append()", "type": "expression", "loc": [75, 75], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L74_C16", "vector": [8, 5, 0.5769, 0.0077, 5, 0.2, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newRows.append(newRows[lastRowsLen - 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L76_C16", "label": "append()", "type": "expression", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "vector": [8, 4, 0.5846, 0.0077, 4, 0.61, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newRows.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L77_C16", "label": "lastRow =", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "vector": [14, 4, 0.5923, 0.0077, 4, 0.61, 1.0, 364, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lastRow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lastRow = triList[i].row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L79_C12", "label": "append()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "vector": [8, 3, 0.6077, 0.0077, 3, 0.73, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newCols.append(triList[i].col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L80_C12", "label": "append()", "type": "expression", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "vector": [8, 3, 0.6154, 0.0077, 3, 0.73, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newVals.append(triList[i].val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L81_C8", "label": "for i", "type": "for", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [6, 2, 0.6269, 0.0154, 2, 0.42, 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(triList[len(triList) - 1].row, nNewRow - 1):\n newRows.append(newRows[len(newRows) - 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L82_C12", "label": "append()", "type": "expression", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L81_C8", "vector": [8, 3, 0.6308, 0.0077, 3, 0.94, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newRows.append(newRows[len(newRows) - 1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L83_C8", "label": "append()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [8, 2, 0.6385, 0.0077, 2, 0.42, 0.9, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newRows.append(len(triList))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "vector": [13, 2, 0.6462, 0.0077, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Matrix(newRows, newCols, newVals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "label": "BaggingFromMatrix", "type": "function", "loc": [87, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "vector": [2, 1, 0.7538, 0.1769, 1, 0.54, 1.0, 690, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "BaggingFromMatrix", "arg_names": ["mat", "m"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def BaggingFromMatrix(mat, m):\n #print \"bagging\", m\n rows = [0]\n cols = []\n vals = []\n maxCol = -1\n baggingDict = {}\n for i in range(0, m):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L89_C8", "label": "rows =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.6846, 0.0077, 2, 0.47, 0.0, 275, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows = [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L90_C8", "label": "cols =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.6923, 0.0077, 2, 0.47, 0.1429, 876, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "cols", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cols = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L91_C8", "label": "vals =", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.7, 0.0077, 2, 0.47, 0.2857, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L92_C8", "label": "maxCol =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.7077, 0.0077, 2, 0.47, 0.4286, 75, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maxCol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxCol = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L93_C8", "label": "baggingDict =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.7154, 0.0077, 2, 0.47, 0.5714, 452, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "baggingDict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " baggingDict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "label": "for i", "type": "for", "loc": [94, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [6, 2, 0.7615, 0.0846, 2, 0.47, 0.7143, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(0, m):\n ratio = random.random()\n index = int(ratio * mat.nRow)\n baggingDict[i] = index\n #print \"add elements to new mat:\", mat.rows[index + 1] - mat.rows[index]\n rows.append(rows[len(rows) - 1] + (mat.rows[index + 1] - mat.rows[index]))\n for j in range(mat.rows[index], mat.rows[index + 1]):\n cols.append(mat.cols[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L95_C12", "label": "ratio = random()", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "vector": [14, 3, 0.7308, 0.0077, 3, 0.58, 0.0, 188, 3, 0, 0, 0, 715, 10, 1], "semantic": {"name": "ratio", "arg_names": [], "import_names": [], "rhs_call_name": "random", "annotation": ""}, "snippet": " ratio = random.random()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L96_C12", "label": "index = int()", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "vector": [14, 3, 0.7385, 0.0077, 3, 0.58, 0.25, 780, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " index = int(ratio * mat.nRow)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L97_C12", "label": "assign", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "vector": [14, 3, 0.7462, 0.0077, 3, 0.58, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " baggingDict[i] = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L99_C12", "label": "append()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "vector": [8, 3, 0.7615, 0.0077, 3, 0.58, 0.75, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append(rows[len(rows) - 1] + (mat.rows[index + 1] - mat.rows[index]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "label": "for j", "type": "for", "loc": [100, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "vector": [6, 3, 0.7846, 0.0385, 3, 0.58, 1.0, 100, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(mat.rows[index], mat.rows[index + 1]):\n cols.append(mat.cols[j])\n if (j > maxCol):\n maxCol = j\n vals.append(mat.vals[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L101_C16", "label": "append()", "type": "expression", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "vector": [8, 4, 0.7769, 0.0077, 4, 0.07, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " cols.append(mat.cols[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:If_L102_C16", "label": "if", "type": "if", "loc": [102, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "vector": [4, 4, 0.7885, 0.0154, 4, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (j > maxCol):\n maxCol = j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L103_C20", "label": "maxCol =", "type": "assigned_variable", "loc": [103, 103], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:If_L102_C16", "vector": [14, 5, 0.7923, 0.0077, 5, 0.12, 0.0, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "maxCol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxCol = j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L104_C16", "label": "append()", "type": "expression", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "vector": [8, 4, 0.8, 0.0077, 4, 0.07, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " vals.append(mat.vals[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L105_C8", "label": "newMat = Matrix()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [14, 2, 0.8077, 0.0077, 2, 0.47, 0.8571, 73, 3, 3, 0, 0, 519, 10, 1], "semantic": {"name": "newMat", "arg_names": [], "import_names": [], "rhs_call_name": "Matrix", "annotation": ""}, "snippet": " newMat = Matrix(rows, cols, vals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L109_C8", "label": "return", "type": "return", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "vector": [13, 2, 0.8385, 0.0077, 2, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [newMat.Transpose(mat.nCol), baggingDict]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L33_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L74_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L74_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L75_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L101_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:If_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:If_L102_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L103_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:For_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Expr_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_162:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_162:Return_L109_C8"}] |
#coding=utf8=
#mmseg
from configuration import Configuration
class Segmenter:
def __init__(self, config, nodeName):
curNode = config.GetChild(nodeName)
self.mainDict = self.LoadMainDict(curNode.GetChild("main_dict").GetValue())
def Split(self, line):
line = line.lower()
index = 0
wordList = []
while index < len(line):
finded = False
for i in range(1, 5, 1) [::-1]:
if (i + index <= len(line)):
curWord = line[index : i + index]
if (self.mainDict.has_key(curWord) and curWord not in wordList):
wordList.append(curWord)
index += i
finded = True
break
if (finded):
continue
index += 1
return wordList
def LoadMainDict(self, path):
f = open(path, "r")
dicts = {}
for line in f:
line = line.decode("utf-8")
if (line.find("\n") >= 0):
line = line[0:line.find("\n")]
dicts[line] = 1
f.close()
return dicts
if __name__ == "__main__":
cfg = Configuration.FromFile("conf/test.xml")
segmenter = Segmenter(cfg, "segmenter")
f = open("result.txt")
for line in f:
wordList = segmenter.Split(line.decode("utf-8"))
for word in wordList:
print word.encode("mbcs")
| ajibawa-2023/Python-Code-Large/train/row_163 | 37 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_163:ImportFrom_L4_C0", "label": "from configuration import Configuration", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0208, 0, 0.66, 0.0, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "label": "Segmenter", "type": "class", "loc": [6, 39], "level": 0, "parent": null, "vector": [3, 0, 0.4688, 0.7083, 0, 0.66, 0.5, 461, 0, 3, 0, 0, 0, 0, 15], "semantic": {"name": "Segmenter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Segmenter:\n def __init__(self, config, nodeName):\n curNode = config.GetChild(nodeName)\n self.mainDict = self.LoadMainDict(curNode.GetChild(\"main_dict\").GetValue())\n\n def Split(self, line):\n line = line.lower()\n index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "label": "__init__", "type": "function", "loc": [7, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "vector": [2, 1, 0.1667, 0.0625, 1, 0.02, 0.0, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "config", "nodeName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, config, nodeName):\n curNode = config.GetChild(nodeName)\n self.mainDict = self.LoadMainDict(curNode.GetChild(\"main_dict\").GetValue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L8_C8", "label": "curNode = GetChild()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "vector": [14, 2, 0.1667, 0.0208, 2, 0.47, 0.0, 106, 3, 1, 0, 0, 508, 10, 1], "semantic": {"name": "curNode", "arg_names": [], "import_names": [], "rhs_call_name": "GetChild", "annotation": ""}, "snippet": " curNode = config.GetChild(nodeName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L9_C8", "label": "self.mainDict = LoadMainDict()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "vector": [14, 2, 0.1875, 0.0208, 2, 0.47, 1.0, 16, 3, 1, 0, 0, 351, 10, 3], "semantic": {"name": "self.mainDict", "arg_names": [], "import_names": [], "rhs_call_name": "LoadMainDict", "annotation": ""}, "snippet": " self.mainDict = self.LoadMainDict(curNode.GetChild(\"main_dict\").GetValue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "label": "Split", "type": "function", "loc": [11, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "vector": [2, 1, 0.4062, 0.375, 1, 0.02, 0.5, 551, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "Split", "arg_names": ["self", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Split(self, line):\n line = line.lower()\n index = 0\n wordList = []\n while index < len(line):\n finded = False\n for i in range(1, 5, 1) [::-1]:\n if (i + index <= len(line)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L12_C8", "label": "line = lower()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "vector": [14, 2, 0.25, 0.0208, 2, 0.61, 0.0, 373, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " line = line.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L13_C8", "label": "index =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "vector": [14, 2, 0.2708, 0.0208, 2, 0.61, 0.25, 780, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L14_C8", "label": "wordList =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "vector": [14, 2, 0.2917, 0.0208, 2, 0.61, 0.5, 49, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wordList = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "label": "while", "type": "while", "loc": [15, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "vector": [5, 2, 0.4375, 0.2708, 2, 0.61, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while index < len(line):\n finded = False\n for i in range(1, 5, 1) [::-1]:\n if (i + index <= len(line)):\n curWord = line[index : i + index]\n if (self.mainDict.has_key(curWord) and curWord not in wordList):\n wordList.append(curWord)\n index += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L16_C12", "label": "finded =", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "vector": [14, 3, 0.3333, 0.0208, 3, 0.88, 0.0, 341, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "finded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " finded = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:For_L17_C12", "label": "for i", "type": "for", "loc": [17, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "vector": [6, 3, 0.4271, 0.1667, 3, 0.88, 0.5, 826, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1, 5, 1) [::-1]:\n if (i + index <= len(line)):\n curWord = line[index : i + index]\n if (self.mainDict.has_key(curWord) and curWord not in wordList):\n wordList.append(curWord)\n index += i\n finded = True\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16", "label": "if", "type": "if", "loc": [18, 24], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L17_C12", "vector": [4, 4, 0.4375, 0.1458, 4, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (i + index <= len(line)):\n curWord = line[index : i + index]\n if (self.mainDict.has_key(curWord) and curWord not in wordList):\n wordList.append(curWord)\n index += i\n finded = True\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L19_C20", "label": "curWord =", "type": "assigned_variable", "loc": [19, 19], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16", "vector": [14, 5, 0.3958, 0.0208, 5, 0.02, 0.0, 260, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curWord", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curWord = line[index : i + index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20", "label": "if", "type": "if", "loc": [20, 24], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16", "vector": [4, 5, 0.4583, 0.1042, 5, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.mainDict.has_key(curWord) and curWord not in wordList):\n wordList.append(curWord)\n index += i\n finded = True\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L21_C24", "label": "append()", "type": "expression", "loc": [21, 21], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20", "vector": [8, 6, 0.4375, 0.0208, 6, 0.67, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " wordList.append(curWord)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L23_C24", "label": "finded =", "type": "assigned_variable", "loc": [23, 23], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20", "vector": [14, 6, 0.4792, 0.0208, 6, 0.67, 1.0, 341, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "finded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " finded = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:If_L25_C12", "label": "if", "type": "if", "loc": [25, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "vector": [4, 3, 0.5312, 0.0417, 3, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (finded):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "vector": [13, 2, 0.5833, 0.0208, 2, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordList"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "label": "LoadMainDict", "type": "function", "loc": [30, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "vector": [2, 1, 0.7188, 0.2083, 1, 0.02, 1.0, 351, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "LoadMainDict", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def LoadMainDict(self, path):\n f = open(path, \"r\")\n dicts = {}\n for line in f:\n line = line.decode(\"utf-8\")\n if (line.find(\"\\n\") >= 0):\n line = line[0:line.find(\"\\n\")]\n dicts[line] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L31_C8", "label": "f = open()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "vector": [14, 2, 0.6458, 0.0208, 2, 0.05, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(path, \"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L32_C8", "label": "dicts =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "vector": [14, 2, 0.6667, 0.0208, 2, 0.05, 0.25, 546, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dicts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dicts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "label": "for line", "type": "for", "loc": [33, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "vector": [6, 2, 0.7292, 0.1042, 2, 0.05, 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 f:\n line = line.decode(\"utf-8\")\n if (line.find(\"\\n\") >= 0):\n line = line[0:line.find(\"\\n\")]\n dicts[line] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L34_C12", "label": "line = decode()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "vector": [14, 3, 0.7083, 0.0208, 3, 0.88, 0.0, 373, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " line = line.decode(\"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:If_L35_C12", "label": "if", "type": "if", "loc": [35, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "vector": [4, 3, 0.7396, 0.0417, 3, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (line.find(\"\\n\") >= 0):\n line = line[0:line.find(\"\\n\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L36_C16", "label": "line =", "type": "assigned_variable", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L35_C12", "vector": [14, 4, 0.75, 0.0208, 4, 0.66, 0.0, 373, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = line[0:line.find(\"\\n\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L37_C12", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "vector": [14, 3, 0.7708, 0.0208, 3, 0.88, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dicts[line] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L38_C8", "label": "close()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "vector": [8, 2, 0.7917, 0.0208, 2, 0.05, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "vector": [13, 2, 0.8125, 0.0208, 2, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dicts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "label": "if", "type": "if", "loc": [41, 48], "level": 0, "parent": null, "vector": [4, 0, 0.9271, 0.1667, 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 cfg = Configuration.FromFile(\"conf/test.xml\")\n segmenter = Segmenter(cfg, \"segmenter\")\n f = open(\"result.txt\")\n for line in f:\n wordList = segmenter.Split(line.decode(\"utf-8\"))\n for word in wordList:\n print(word.encode(\"mbcs\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L42_C4", "label": "cfg = FromFile()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "vector": [14, 1, 0.875, 0.0208, 1, 0.13, 0.0, 46, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "cfg", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " cfg = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L43_C4", "label": "segmenter = Segmenter()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "vector": [14, 1, 0.8958, 0.0208, 1, 0.13, 0.3333, 404, 3, 2, 0, 0, 461, 10, 1], "semantic": {"name": "segmenter", "arg_names": [], "import_names": [], "rhs_call_name": "Segmenter", "annotation": ""}, "snippet": " segmenter = Segmenter(cfg, \"segmenter\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L44_C4", "label": "f = open()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "vector": [14, 1, 0.9167, 0.0208, 1, 0.13, 0.6667, 899, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(\"result.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4", "label": "for line", "type": "for", "loc": [45, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "vector": [6, 1, 0.9688, 0.0833, 1, 0.13, 1.0, 373, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n wordList = segmenter.Split(line.decode(\"utf-8\"))\n for word in wordList:\n print(word.encode(\"mbcs\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L46_C8", "label": "wordList = Split()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4", "vector": [14, 2, 0.9583, 0.0208, 2, 0.76, 0.0, 49, 3, 1, 0, 0, 551, 10, 2], "semantic": {"name": "wordList", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": " wordList = segmenter.Split(line.decode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:For_L47_C8", "label": "for word", "type": "for", "loc": [47, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4", "vector": [6, 2, 0.9896, 0.0417, 2, 0.76, 1.0, 107, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in wordList:\n print(word.encode(\"mbcs\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L48_C12", "label": "print()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_163:For_L47_C8", "vector": [8, 3, 1.0, 0.0208, 3, 0.98, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word.encode(\"mbcs\"))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:For_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L19_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L18_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L21_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L20_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L23_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:While_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:If_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:If_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L35_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:If_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_163:For_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_163:For_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_163:Expr_L48_C12"}] |
#encoding=utf8
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from naive_bayes import NaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("data/train.txt")
chiFilter = ChiSquareFilter(config, "__filter__")
chiFilter.TrainFilter(trainx, trainy)
nbModel = NaiveBayes(config, "naive_bayes")
nbModel.Train(trainx, trainy)
inputStr = "仅售28元!原价698元的康迩福韩国美容美体中心的韩国特色美容套餐1份(紫莱花园店、时代奥城店2店通用):韩国特色面部SPA护理1次+韩国特色面部瘦脸加毛孔净化1次+韩国特色水"
[cols, vals] = matCreater.CreatePredictSample(inputStr)
[cols, vals] = chiFilter.SampleFilter(cols, vals)
probTuple = nbModel.TestSample(cols, vals)
print probTuple
| ajibawa-2023/Python-Code-Large/train/row_164 | 21 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L3_C0", "label": "from matrix import Matrix", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0385, 0, 0.66, 0.0, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L4_C0", "label": "from classifier_matrix import ClassifierMatrix", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0385, 0, 0.66, 0.1429, 3, 0, 1, 0, 0, 3, 0, 0], "semantic": {"name": "classifier_matrix", "arg_names": [], "import_names": ["ClassifierMatrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier_matrix import ClassifierMatrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L5_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1923, 0.0385, 0, 0.66, 0.2857, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L6_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0385, 0, 0.66, 0.4286, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L7_C0", "label": "from configuration import Configuration", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2692, 0.0385, 0, 0.66, 0.5714, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L8_C0", "label": "from chisquare_filter import ChiSquareFilter", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.3077, 0.0385, 0, 0.66, 0.7143, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "chisquare_filter", "arg_names": [], "import_names": ["ChiSquareFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from chisquare_filter import ChiSquareFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:ImportFrom_L9_C0", "label": "from naive_bayes import NaiveBayes", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.3462, 0.0385, 0, 0.66, 0.8571, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "naive_bayes", "arg_names": [], "import_names": ["NaiveBayes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from naive_bayes import NaiveBayes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "label": "if", "type": "if", "loc": [11, 26], "level": 0, "parent": null, "vector": [4, 0, 0.7115, 0.6154, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n config = Configuration.FromFile(\"conf/test.xml\")\n PyMining.Init(config, \"__global__\")\n matCreater = ClassifierMatrix(config, \"__matrix__\")\n [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")\n chiFilter = ChiSquareFilter(config, \"__filter__\")\n chiFilter.TrainFilter(trainx, trainy)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L12_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.4615, 0.0385, 1, 0.59, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L13_C4", "label": "Init()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [8, 1, 0.5, 0.0385, 1, 0.59, 0.0833, 44, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L14_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.5385, 0.0385, 1, 0.59, 0.1667, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L15_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.5769, 0.0385, 1, 0.59, 0.25, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L16_C4", "label": "chiFilter = ChiSquareFilter()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.6154, 0.0385, 1, 0.59, 0.3333, 663, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chiFilter", "arg_names": [], "import_names": [], "rhs_call_name": "ChiSquareFilter", "annotation": ""}, "snippet": " chiFilter = ChiSquareFilter(config, \"__filter__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L17_C4", "label": "TrainFilter()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [8, 1, 0.6538, 0.0385, 1, 0.59, 0.4167, 144, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "TrainFilter", "arg_names": [], "import_names": [], "rhs_call_name": "TrainFilter", "annotation": ""}, "snippet": " chiFilter.TrainFilter(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L19_C4", "label": "nbModel = NaiveBayes()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.7308, 0.0385, 1, 0.59, 0.5, 711, 3, 2, 0, 0, 828, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "NaiveBayes", "annotation": ""}, "snippet": " nbModel = NaiveBayes(config, \"naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L20_C4", "label": "Train()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [8, 1, 0.7692, 0.0385, 1, 0.59, 0.5833, 55, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Train", "arg_names": [], "import_names": [], "rhs_call_name": "Train", "annotation": ""}, "snippet": " nbModel.Train(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L22_C4", "label": "inputStr =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.8462, 0.0385, 1, 0.59, 0.6667, 227, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "inputStr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inputStr = \"\u4ec5\u552e28\u5143\uff01\u539f\u4ef7698\u5143\u7684\u5eb7\u8fe9\u798f\u97e9\u56fd\u7f8e\u5bb9\u7f8e\u4f53\u4e2d\u5fc3\u7684\u97e9\u56fd\u7279\u8272\u7f8e\u5bb9\u5957\u99101\u4efd\uff08\u7d2b\u83b1\u82b1\u56ed\u5e97\u3001\u65f6\u4ee3\u5965\u57ce\u5e972\u5e97\u901a\u7528\uff09\uff1a\u97e9\u56fd\u7279\u8272\u9762\u90e8SPA\u62a4\u74061\u6b21+\u97e9\u56fd\u7279\u8272\u9762\u90e8\u7626\u8138\u52a0\u6bdb\u5b54\u51c0\u53161\u6b21+\u97e9\u56fd\u7279\u8272\u6c34\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L23_C4", "label": " = CreatePredictSample()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.8846, 0.0385, 1, 0.59, 0.75, 0, 3, 1, 0, 0, 771, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictSample", "annotation": ""}, "snippet": " [cols, vals] = matCreater.CreatePredictSample(inputStr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L24_C4", "label": " = SampleFilter()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.9231, 0.0385, 1, 0.59, 0.8333, 0, 3, 2, 0, 0, 405, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "SampleFilter", "annotation": ""}, "snippet": " [cols, vals] = chiFilter.SampleFilter(cols, vals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L25_C4", "label": "probTuple = TestSample()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [14, 1, 0.9615, 0.0385, 1, 0.59, 0.9167, 419, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "probTuple", "arg_names": [], "import_names": [], "rhs_call_name": "TestSample", "annotation": ""}, "snippet": " probTuple = nbModel.TestSample(cols, vals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L26_C4", "label": "print()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "vector": [8, 1, 1.0, 0.0385, 1, 0.59, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(probTuple)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_164:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_164:Expr_L26_C4"}] |
import math
import pickle
import sys
from matrix import Matrix
from classifier_matrix import ClassifierMatrix
from segmenter import Segmenter
from py_mining import PyMining
from configuration import Configuration
from chisquare_filter import ChiSquareFilter
from twc_naive_bayes import TwcNaiveBayes
if __name__ == "__main__":
config = Configuration.FromFile("conf/test.xml")
PyMining.Init(config, "__global__")
matCreater = ClassifierMatrix(config, "__matrix__")
[trainx, trainy] = matCreater.CreateTrainMatrix("data/train.txt")
chiFilter = ChiSquareFilter(config, "__filter__")
chiFilter.TrainFilter(trainx, trainy)
nbModel = TwcNaiveBayes(config, "twc_naive_bayes")
nbModel.Train(trainx, trainy)
[testx, testy] = matCreater.CreatePredictMatrix("data/test.txt")
[testx, testy] = chiFilter.MatrixFilter(testx, testy)
retY = nbModel.TestMatrix(testx, testy)
| ajibawa-2023/Python-Code-Large/train/row_167 | 22 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_167:Import_L1_C0", "label": "math import math", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Import_L2_C0", "label": "pickle import pickle", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0385, 0, 0.66, 0.1, 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_167:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1154, 0.0385, 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_167:ImportFrom_L5_C0", "label": "from matrix import Matrix", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1923, 0.0385, 0, 0.66, 0.3, 162, 0, 1, 0, 0, 162, 0, 0], "semantic": {"name": "matrix", "arg_names": [], "import_names": ["Matrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from matrix import Matrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L6_C0", "label": "from classifier_matrix import ClassifierMatrix", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0385, 0, 0.66, 0.4, 3, 0, 1, 0, 0, 3, 0, 0], "semantic": {"name": "classifier_matrix", "arg_names": [], "import_names": ["ClassifierMatrix"], "rhs_call_name": "", "annotation": ""}, "snippet": "from classifier_matrix import ClassifierMatrix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L7_C0", "label": "from segmenter import Segmenter", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2692, 0.0385, 0, 0.66, 0.5, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "segmenter", "arg_names": [], "import_names": ["Segmenter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from segmenter import Segmenter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L8_C0", "label": "from py_mining import PyMining", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.3077, 0.0385, 0, 0.66, 0.6, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "py_mining", "arg_names": [], "import_names": ["PyMining"], "rhs_call_name": "", "annotation": ""}, "snippet": "from py_mining import PyMining"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L9_C0", "label": "from configuration import Configuration", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.3462, 0.0385, 0, 0.66, 0.7, 627, 0, 1, 0, 0, 627, 0, 0], "semantic": {"name": "configuration", "arg_names": [], "import_names": ["Configuration"], "rhs_call_name": "", "annotation": ""}, "snippet": "from configuration import Configuration "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L10_C0", "label": "from chisquare_filter import ChiSquareFilter", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.3846, 0.0385, 0, 0.66, 0.8, 170, 0, 1, 0, 0, 170, 0, 0], "semantic": {"name": "chisquare_filter", "arg_names": [], "import_names": ["ChiSquareFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from chisquare_filter import ChiSquareFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:ImportFrom_L11_C0", "label": "from twc_naive_bayes import TwcNaiveBayes", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.4231, 0.0385, 0, 0.66, 0.9, 578, 0, 1, 0, 0, 578, 0, 0], "semantic": {"name": "twc_naive_bayes", "arg_names": [], "import_names": ["TwcNaiveBayes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twc_naive_bayes import TwcNaiveBayes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "label": "if", "type": "if", "loc": [14, 26], "level": 0, "parent": null, "vector": [4, 0, 0.7692, 0.5, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n config = Configuration.FromFile(\"conf/test.xml\")\n PyMining.Init(config, \"__global__\")\n matCreater = ClassifierMatrix(config, \"__matrix__\")\n [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")\n chiFilter = ChiSquareFilter(config, \"__filter__\")\n chiFilter.TrainFilter(trainx, trainy)\n nbModel = TwcNaiveBayes(config, \"twc_naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L15_C4", "label": "config = FromFile()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.5769, 0.0385, 1, 0.31, 0.0, 308, 3, 1, 0, 0, 887, 10, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "FromFile", "annotation": ""}, "snippet": " config = Configuration.FromFile(\"conf/test.xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L16_C4", "label": "Init()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [8, 1, 0.6154, 0.0385, 1, 0.31, 0.1, 44, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Init", "arg_names": [], "import_names": [], "rhs_call_name": "Init", "annotation": ""}, "snippet": " PyMining.Init(config, \"__global__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L17_C4", "label": "matCreater = ClassifierMatrix()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.6538, 0.0385, 1, 0.31, 0.2, 798, 3, 2, 0, 0, 725, 10, 1], "semantic": {"name": "matCreater", "arg_names": [], "import_names": [], "rhs_call_name": "ClassifierMatrix", "annotation": ""}, "snippet": " matCreater = ClassifierMatrix(config, \"__matrix__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L18_C4", "label": " = CreateTrainMatrix()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.6923, 0.0385, 1, 0.31, 0.3, 0, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreateTrainMatrix", "annotation": ""}, "snippet": " [trainx, trainy] = matCreater.CreateTrainMatrix(\"data/train.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L19_C4", "label": "chiFilter = ChiSquareFilter()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.7308, 0.0385, 1, 0.31, 0.4, 663, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chiFilter", "arg_names": [], "import_names": [], "rhs_call_name": "ChiSquareFilter", "annotation": ""}, "snippet": " chiFilter = ChiSquareFilter(config, \"__filter__\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L20_C4", "label": "TrainFilter()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [8, 1, 0.7692, 0.0385, 1, 0.31, 0.5, 144, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "TrainFilter", "arg_names": [], "import_names": [], "rhs_call_name": "TrainFilter", "annotation": ""}, "snippet": " chiFilter.TrainFilter(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L21_C4", "label": "nbModel = TwcNaiveBayes()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.8077, 0.0385, 1, 0.31, 0.6, 711, 3, 2, 0, 0, 980, 10, 1], "semantic": {"name": "nbModel", "arg_names": [], "import_names": [], "rhs_call_name": "TwcNaiveBayes", "annotation": ""}, "snippet": " nbModel = TwcNaiveBayes(config, \"twc_naive_bayes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L22_C4", "label": "Train()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [8, 1, 0.8462, 0.0385, 1, 0.31, 0.7, 55, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Train", "arg_names": [], "import_names": [], "rhs_call_name": "Train", "annotation": ""}, "snippet": " nbModel.Train(trainx, trainy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L24_C4", "label": " = CreatePredictMatrix()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.9231, 0.0385, 1, 0.31, 0.8, 0, 3, 1, 0, 0, 391, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "CreatePredictMatrix", "annotation": ""}, "snippet": " [testx, testy] = matCreater.CreatePredictMatrix(\"data/test.txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L25_C4", "label": " = MatrixFilter()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 0.9615, 0.0385, 1, 0.31, 0.9, 0, 3, 2, 0, 0, 81, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "MatrixFilter", "annotation": ""}, "snippet": " [testx, testy] = chiFilter.MatrixFilter(testx, testy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L26_C4", "label": "retY = TestMatrix()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "vector": [14, 1, 1.0, 0.0385, 1, 0.31, 1.0, 140, 3, 2, 0, 0, 125, 10, 1], "semantic": {"name": "retY", "arg_names": [], "import_names": [], "rhs_call_name": "TestMatrix", "annotation": ""}, "snippet": " retY = nbModel.TestMatrix(testx, testy)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_167:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_167:Assign_L26_C4"}] |
#coding:utf-8
import sys
a=u"""3 工程师 Done.
1 php Done.
5 php 工程师 Done.
2 设计师 Done.
6 视觉设计 Done.
7 产品经理 Done.
9 web Done.
10 编辑 Done.
11 实习生 Done.
12 产品 Done.
13 交互设计 Done.
8 产品设计 Done.
18 java Done.
19 UI Done.
22 销售 Done.
25 医药代表 Done.
24 java php Done.
29 gongzhuo Done.
17 c++ Done.
30 css Done.
39 程序架构师 Done.
41 SUNCR2008 Done.
38 百图 Done.
43 张彦路 Done.
40 百图互动传媒,重金诚聘PHP/.NET程序架构师多名。百图,意味着凭借所知所能所作所为,在新的领域,以新的方式,为您诠释固有的产品。 所知、所能、所作、所为,无所不在,无所不能――百图(PATO) Done.
42 策划 Done.
44 百度 Done.
45 北京 运营 Done.
47 脱发 Done.
49 ued Done.
50 广州 生物 Done.
48 我是一名软、硬件网络全能工程师。。涉及领域:asp.net Java php等语言技术 Done.
52 应届生 Done.
53 陈莹 Done.
54 elya Done.
36 助理 Done.
37 兼职 Done.
59 长春 Done.
56 视频编辑 Done.
58 校园招聘 Done.
46 招聘经理 Done.
57 视频 Done.
51 生物 Done.
60 移动 Done.
55 悲剧 Done.
65 呼叫中心运营经理 Done.
64 呼叫中心 Done.
66 运营经理 Done.
63 产品专员 Done.
71 管家婆 Done.
69 PHP工程师 Done.
72 数据库 Done.
73 瀹炰範鐢 Done.
70 用友 Done.
61 深圳 Done.
74 广告传播 Done.
80 策划 成都 Done.
78 出国劳务 Done.
81 成都 Done.
77 出国 Done.
76 linux 运维 Done.
75 linux Done.
79 运维 Done.
83 央视 Done.
82 JS Done.
87 百度无线 Done.
86 前端 Done.
62 产品助理 Done.
90 shenzhen Done.
91 groovy Done.
93 金山 PHP Done.
92 金山 Done.
84 cgi Done.
89 阿里巴巴 Done.
97 前端工程师 厦门 Done.
94 支付宝 Done.
98 UI设计 上海 Done.
85 动漫 Done.
88 长乐 Done.
95 开发经理 Done.
99 网页设计 Done.
100 网页设计 兼职 Done.
96 经理 Done.
101 pmcaff Done.
105 UI,视觉设计 Done.
103 gps Done.
106 UI设计 Done.
107 UI设计 北京 Done.
104 qt Done.
108 淘宝 Done.
109 excel Done.
110 工程师 C# Done.
112 ruby Done.
111 产品 招聘 Done.
113 UI设计师 Done.
114 UE Done.
115 产品经理助理 Done.
120 博彦科技 Done.
119 搜狐 Done.
121 c# Done.
123 寻ui+制作高手兼职 Done.
117 汽车 模型 Done.
116 汽车 Done.
118 搜狗 Done.
122 工业设计 Done.
126 缂栬緫 Done.
125 深圳+ui Done.
124 深圳 ui Done.
127 机器人 招聘 Done.
129 机器人 Done.
130 盛大创新院 Done.
134 17huryfnf hfgfhdgt Done.
128 招聘 机器人 Done.
133 糖衣炮弹 Done.
135 17huryfnf hfgfhdgt$ Done.
131 机械 Done.
139 what? Done.
140 jj Done.
141 瀹炰範鐢 Done.
142 交互设计UI Done.
143 city:深圳 cate:产品经理 Done.
145 fdsa Done.
146 包子 Done.
144 实习生 北京 Done.
136 前端开发 Done.
102 gis Done.
137 2 Done.
138 xxx Done.
147 首席架构师 Done.
151 解放碑 Done.
153 交互设计+上海 Done.
149 广州 销售 Done.
148 广州 产品经理 Done.
152 广州 Done.
150 内容编辑 Done.
155 视觉设计 杭州 Done.
154 python Done.
161 应聘JS Done.
162 瀹炰範鐢 Done.
160 数据仓库 java Done.
159 数据仓库 Done.
157 clothhr@163.com Done.
158 深圳 java Done.
164 佳木斯 Done.
169 erp Done.
168 seo Done.
156 产品+招聘 Done.
167 采购 Done.
165 策划 上海 Done.
166 物流 Done.
170 div+css Done.
171 你好 Done.
173 天津 seo Done.
172 浜や簰璁捐? Done.
175 天津 网络推广 Done.
174 天津 Done.
178 兼职 客服 Done.
177 东莞 招聘 Done.
176 市场 Done.
179 律师 Done.
181 设计 Done.
183 ruby on rails Done.
182 龙元建设 Done.
187 科技记者 Done.
186 科技编辑 Done.
163 职业欠钱 Done.
180 中国 Done.
184 翻译 Done.
185 产品经理 上海 Done.
190 网站策划 上海 Done.
193 BA Done.
195 business Done.
194 business ana Done.
196 analyst Done.
191 腾讯 Done.
198 建筑软件 Done.
192 技术总监 Done.
188 科技 Done.
189 产品策划 上海 Done.
197 分析 Done.
204 IT Done.
203 伟大公关 Done.
200 应届生 运维 Done.
201 中华英才网 Done.
208 英语 Done.
202 建筑 Done.
207 公关 Done.
209 系统分析 Done.
199 sap Done.
205 伟达公关 Done.
206 分析师 Done.
215 蓝驰 Done.
216 .net Done.
210 产品经理 深圳 Done.
217 技术经理 Done.
211 seo 福州 Done.
219 找工作就来这里吧。 Done.
214 手机 Done.
218 游戏策划 Done.
221 深圳外贸业务员 Done.
212 青岛 Done.
224 数字出版 Done.
225 出版 Done.
226 BD Done.
227 长沙 Done.
228 金融 Done.
230 微伯乐 Done.
222 .net 工程师 Done.
213 JavaScript Done.
220 外贸业务员 Done.
223 网络工程师 Done.
232 宁波 Done.
229 视觉设计 宁波 Done.
236 招聘 Done.
234 优客 Done.
237 魅族 Done.
235 生物信息 Done.
231 运维工程师 Done.
239 UI经理 Done.
240 UI总监 Done.
242 社区运营 Done.
241 室内 Done.
233 运维工程师 sina Done.
244 交互 Done.
245 卡乐购 Done.
238 iphone Done.
243 社区 Done.
250 上海团购网 Done.
246 盛大在线 Done.
249 本多 Done.
251 音乐 Done.
256 邮局 Done.
252 网站分析 Done.
247 Flash Done.
254 分析 上海 Done.
248 手办 Done.
253 医疗 Done.
257 企业邮箱 Done.
259 sa Done.
262 售前 Done.
258 会计 Done.
263 邮件 Done.
261 软件售前 Done.
267 产品经理 广州 Done.
260 系统管理员 Done.
265 环保 Done.
255 财务 Done.
269 flash lite Done.
264 广州 java Done.
272 校园 产品经理 Done.
266 环境工程 Done.
274 上海 Done.
270 北京 Done.
276 ccna Done.
278 威海 Done.
277 济南 Done.
279 HCI Done.
268 网站美工 Done.
280 django Done.
281 租房 Done.
282 出租 Done.
284 房源 Done.
283 as Done.
285 广州 市场 Done.
275 产品总监 Done.
287 php 深圳 Done.
289 ued 上海 Done.
288 php 上海 Done.
291 新浪微博招聘PHP高级开发工程师!!! Done.
273 產品 Done.
290 ued 北京 Done.
292 ror Done.
271 微博 Done.
297 婚礼策划 Done.
298 婚礼 Done.
294 新鲁尼 Done.
296 心理学 Done.
293 电子商务 Done.
299 婚策 Done.
295 心理 Done.
302 新浪薪水 Done.
303 软件测试 Done.
305 杭州 Done.
307 苏州 Done.
300 酒店销售 Done.
304 上海 java Done.
301 新浪产品薪水 Done.
308 国泰君安 Done.
306 网络工程 Done.
286 php 北京 Done.
313 外贸 Done.
312 人力资源 Done.
311 薪资主管 Done.
310 薪酬主管 Done.
315 沈阳 Done.
314 百度 php Done.
316 fsf Done.
320 city:北京;cate:网站编辑 Done.
318 兰州新东方 Done.
319 city:北京 cate:网站编辑 Done.
317 兰州新东方招聘 Done.
309 诚聘t.163.com的PM Done.
325 callcenter Done.
322 产品经理 招聘 Done.
323 北京 网站编辑 Done.
321 为获新知闯天下 Done.
324 df Done.
327 20k Done.
326 15k Done.
328 南京实习生 Done.
333 北京 php Done.
334 产品经理 助理 Done.
337 配置管理 Done.
335 东莞 Done.
336 搜索研发 Done.
331 产品经理 北京 Done.
339 版本管理 Done.
341 12580 Done.
340 应届 Done.
338 管理 Done.
342 平面设计 Done.
330 瀹炰範鐢 Done.
343 杭州 前端 Done.
345 诚聘:韩语技术支持工程师-上海/北京/天津/大连 Done.
347 sohu Done.
348 网易 Done.
349 掰断 Done.
346 新浪 Done.
344 总监 Done.
350 测试 Done.
332 记者 Done.
354 上海 产品 Done.
352 淘米 Done.
353 实习 Done.
357 新浪微博API2 Done.
358 招聘工程师 Done.
359 招聘 工程师 Done.
355 活动 策划 Done.
356 数据挖掘 Done.
360 建筑建模 Done.
351 郑州 Done.
363 mysql Done.
365 前台 Done.
361 缴费 Done.
367 abc Done.
366 小姐 Done.
368 外包 网站 Done.
364 项目 网站 Done.
369 招标 网站 Done.
362 非 Done.
373 event manager Done.
372 event Done.
370 招标 Done.
376 峰会 Done.
371 外包 Done.
379 软件开发 Done.
377 插画助理 Done.
374 会议 Done.
380 物流 上海 Done.
375 论坛 Done.
384 常州 Done.
383 大连 Done.
385 e-learning Done.
381 福州 php Done.
382 交互 北京 Done.
386 学习 Done.
329 南京 Done.
378 数据 挖掘 Done.
391 窝窝团 Done.
390 上海 前端 Done.
388 产品运营 Done.
392 产品规划 Done.
393 广东 Done.
387 木匠 Done.
395 青岛 产品经理 Done.
396 厦门 Done.
400 数码印花 Done.
401 hr Done.
394 ajax Done.
399 老罗 Done.
397 教育 Done.
398 新东方 Done.
402 网站市场推广 Done.
404 android Done.
405 一起手游 Done.
389 交互设计师 Done.
407 马云 Done.
408 c Done.
409 基金 Done.
412 服装设计 Done.
406 李刚 Done.
410 投资 Done.
403 市场推广 Done.
411 股票 Done.
419 city:深圳 cate:程序员 Done.
418 hiall Done.
420 city:北京 cate:程序员 Done.
422 city:北京 cate:产品经理 Done.
421 city:北京 cate:c 程序员 Done.
414 体育经纪 Done.
423 实习生 阿里 Done.
417 重庆 Done.
425 王菲 Done.
426 斯蒂芬 Done.
427 愚公移山 Done.
428 工业控制 plc Done.
429 plc Done.
431 外贸业务iyuan Done.
430 西门子 Done.
424 实习生 淘宝 Done.
413 体育 Done.
434 微博运营实习生 Done.
435 二手房 Done.
436 php,北京 Done.
432 广告产品经理 Done.
433 新浪微博运营实习生 Done.
415 记者 媒体 Done.
416 媒体 Done.
437 php+北京 Done.
440 傻逼 Done.
444 寒假 实习 Done.
445 寒假 Done.
442 惠州 Done.
443 游戏 Done.
439 CCNP Done.
438 王微 Done.
450 啊狸 Done.
447 北京 实习 Done.
448 武汉 新闻 Done.
452 phpppp Done.
451 marcom Done.
446 假期 Done.
441 惠诈 Done.
449 新闻 Done.
456 熙康 Done.
458 嵌入式 Done.
455 杭州 UI Done.
457 东软 Done.
454 杭州 GUI Done.
461 主编 Done.
463 南京 UI Done.
464 法律 Done.
465 f Done.
466 招聘 电视记者 Done.
462 内容 Done.
467 招聘 mac Done.
471 创新工场 Done.
470 法语 Done.
460 新媒体 Done.
459 后台开发 Done.
469 php 杭州 Done.
476 兼职 杭州 Done.
474 达彼思 Done.
472 美工 Done.
473 4A Done.
475 google Done.
479 格力 Done.
478 微简历 Done.
477 #求职# Done.
481 北京 媒体 Done.
483 北京 无线 Done.
484 北京 杂志 Done.
482 北京 新媒体 Done.
485 化工 Done.
486 培训生 Done.
487 管理培训生 Done.
488 销售经理 Done.
468 招聘 苹果 Done.
480 总监 北京 Done.
489 Mac Done.
492 海南 Done.
494 博鳌 Done.
493 海口 Done.
495 大师 Done.
496 老沉 Done.
491 卫生 Done.
453 网络安全 Done.
490 预防医学 Done.
499 web前端 杭州 Done.
497 宽连十方 Done.
502 数据产品经理 Done.
505 工作营 Done.
498 web前端 Done.
503 lucene Done.
507 求职 交互设计 Done.
506 应聘 交互设计 Done.
504 搜索 Done.
500 前端 杭州 Done.
512 环评 Done.
509 oracle Done.
508 上海 交互设计师 Done.
510 营销 Done.
501 网络营销 Done.
515 音樂 Done.
517 凡客诚品 Done.
518 秘书 Done.
514 射频 Done.
519 图书 Done.
511 杂志 Done.
516 音 Done.
524 上海 媒体 Done.
522 社会化媒体营销 Done.
523 媒体 ps 影视制作 Done.
525 无锡 Done.
526 财务总监 Done.
527 人力资源经理 Done.
521 法务 Done.
513 交通 Done.
520 猎头 Done.
532 无线产品经理 Done.
533 移动产品经理 Done.
534 客户端 产品经理 Done.
535 长沙 招聘 Done.
536 手机 产品经理 Done.
537 安全 Done.
539 PROE Done.
540 Pro/E Done.
538 机械设计 Done.
530 KA Done.
543 平面设计 无锡 Done.
541 乳 Done.
542 运营 Done.
531 美容编辑 Done.
544 绍兴 Done.
545 cate:java工程师 city:北京 Done.
549 南通 Done.
550 实习生 南京 Done.
547 delphi Done.
548 自动化 Done.
553 绵阳 Done.
551 证券 Done.
546 数值 Done.
552 推广 Done.
554 保险 Done.
557 asdfsf Done.
560 深圳 网站 Done.
558 搜索引擎 Done.
556 美丽 Done.
555 园林 Done.
564 广州 市场经理 Done.
563 广州市场经理 Done.
561 深圳 网站编辑 Done.
559 网站 Done.
565 电商运营 Done.
566 韩国语 Done.
567 韩语 Done.
569 酒店 Done.
571 IT业 Done.
570 本地化 Done.
568 校园 Done.
572 元器件 Done.
575 smm Done.
574 软件 Done.
573 芯片 Done.
562 市场经理 Done.
528 技术支持 Done.
529 模特 Done.
577 长沙求职 Done.
581 微博求职 Done.
580 求职 Done.
582 日本 Done.
576 sns Done.
583 测试工程师 Done.
578 交互设计师 北京 Done.
579 社会化 Done.
587 剪辑师 Done.
586 99 Done.
588 北京 java Done.
585 sem Done.
592 实习生 插画 Done.
590 上海 助理 Done.
591 电子 Done.
595 手机游戏 广州 Done.
584 AE Done.
594 画师 Done.
597 人设 Done.
596 图书馆 Done.
599 人物设计师 Done.
598 人 设 Done.
603 maya Done.
589 开放 Done.
593 插画 Done.
605 NLP Done.
606 sueveannal@theknot.com Done.
604 动画 Done.
607 商务智能 Done.
609 上海 大专 Done.
610 记者站 Done.
611 记者 广州 Done.
608 BI Done.
613 西安 机械 Done.
614 互动营销客户经理 Done.
616 互动媒介经理 Done.
600 实习生 原画 插画 人物设计 Done.
617 互动客户经理 Done.
612 西安 Done.
618 互动 客户经理 Done.
621 房地产 Done.
615 互动营销媒介经理 Done.
619 业务员 Done.
623 asp.net Done.
624 实习生 媒体 Done.
622 房地产 广州 Done.
625 实习生 新闻 Done.
601 3D Done.
627 实习生 报社 Done.
628 实习生 报纸 Done.
629 asp.net 深圳 Done.
630 旅游策划 Done.
631 旅游 Done.
633 腾讯nlp Done.
634 asd Done.
632 美女 Done.
626 实习生 网站 Done.
620 163 Done.
636 公务员 Done.
637 模特儿 Done.
639 徐中一 Done.
638 掌上百度 Done.
641 招聘 四川 Done.
640 壁虎 Done.
644 空姐 Done.
642 交互实习生 Done.
643 苍井空 Done.
645 快乐的阅读 Done.
647 大连 地产 Done.
635 教师 Done.
650 test Done.
646 快乐阅读 Done.
648 信息安全 Done.
649 自然语言处理 Done.
652 广州 电子商务 Done.
654 内容处理 Done.
656 招聘 北京大麦网 前端工程师 Done.
655 内容分析 Done.
653 世界地图 Done.
658 产品经理 财经 Done.
659 产品经理 证券 Done.
651 网页设计师 Done.
660 产品经理 股票 Done.
662 实习生 土木工程 Done.
663 实习生 土木 Done.
657 策划 无线 Done.
665 实习生建筑 Done.
668 哈尔滨 实习 Done.
664 实习生 建筑 Done.
666 土木工程 Done.
670 福州 Done.
667 PHP 广州 Done.
669 新闻 实习 Done.
673 VC 投资 Done.
675 德语 Done.
672 VC Done.
661 杭州招聘 Done.
671 数据 Done.
676 红枣 Done.
678 交互设计 北京 Done.
679 网易招聘 Done.
681 腾讯扎好哦品 Done.
683 新浪招聘 Done.
682 腾讯招聘 Done.
684 百度招聘 Done.
674 笔译 Done.
680 招产品 Done.
685 招聘主管 Done.
677 榆林 Done.
687 实施经理 Done.
690 cate:交互设计师,city:上海 Done.
686 eam Done.
689 cate:交互设计师 city:上海 Done.
693 泰语 Done.
692 客户经理 Done.
691 高级产品经理 Done.
694 实习生 汽车 Done.
688 项目经理 Done.
698 福建 酒 Done.
695 泰国 Done.
697 松江 Done.
701 dba Done.
699 福建 营销经理 Done.
700 福建 销售经理 Done.
703 移动通信 Done.
702 页面制作 Done.
704 投资 证券 Done.
708 风水师 Done.
707 武汉 Done.
709 太原 Done.
696 人事 Done.
706 投资 分析师 Done.
712 广告公司实习 Done.
713 实习 广州 Done.
714 肉丝 Done.
711 广告公司 Done.
716 安利 Done.
717 宝洁 Done.
715 医药 Done.
719 药品注册 Done.
718 交互设计 实习 Done.
721 数据库管理员 Done.
722 网络 Done.
705 投资 经理 Done.
720 注册 Done.
724 cisco Done.
723 思科 Done.
728 芜湖 Done.
729 自动化测试 Done.
727 andriod Done.
725 广告 Done.
726 模具 Done.
602 全部招聘 php 编辑 产品经理 交互设计 视觉设计 实习生 产品 产品设计 java Done.
732 山西 实习生 Done.
730 QTP Done.
731 自动测试 Done.
737 二书 Done.
738 豆豆猫 Done.
736 美容师 Done.
739 statusnet Done.
740 景观设计 Done.
741 园林设计 Done.
742 平面媒体 Done.
733 广州地区 Done.
710 公司名称:北京数字天堂信息科技有限责任公司 职位名称:UI设计师 人数:2人 薪资:面谈 职位要求:偏手机界面UI设计,要求会网页设计。 Done.
735 敢死队 Done.
744 内容总监 Done.
748 纳米 Done.
749 oracl Done.
750 广州 实习 linux Done.
747 上海 金融 Done.
746 前端 上海 Done.
734 会计 泉州 Done.
753 rtsp Done.
752 live555 Done.
751 广州 实习 Done.
754 视频流 Done.
755 流媒体 Done.
756 特殊工作 Done.
758 倒萨 Done.
760 ‘ Done.
757 工作 Done.
745 摄影 Done.
743 媒体 网站 Done.
776 大同 Done.
778 人人呢 Done.
779 人人 Done.
774 交互设计 北京 三元桥 Done.
781 应届生 深圳 Done.
775 交互设计 太阳宫 Done.
780 应届生 广州 Done.
782 南宁 Done.
783 媒介经理 Done.
786 a Done.
787 b Done.
785 游戏 媒介经理 Done.
784 游戏媒介经理 Done.
773 mtk Done.
788 HR伴侣 Done.
794 我们都是好孩子 Done.
795 设计师 深圳 Done.
790 %你好% Done.
797 云阳 Done.
777 jsp Done.
798 万州 Done.
800 上海 策划 Done.
799 沙坪坝 Done.
802 主编经验 Done.
801 宽途 Done.
803 大刊 Done.
805 时尚 Done.
806 著名互联网公司、nadaq上市,LAMP工程师招聘,工作地点:北京 Done.
796 产品总监 北京 Done.
804 时尚杂志 Done.
807 研发工程师 Done.
810 士大夫 Done.
812 nadaq Done.
809 豆腐干 Done.
816 机器视觉 Done.
811 发 Done.
815 计算机视觉 Done.
814 java工程师 Done.
808 热 Done.
813 服务员 Done.
817 模式识别 Done.
824 用户体验 北京 朝阳 Done.
823 IBM Done.
822 会展 Done.
825 用户体验 朝阳 Done.
827 英语 南京 Done.
820 创业 Done.
828 lbs Done.
829 峰会策划 Done.
831 会议策划 Done.
832 会议 上海 Done.
826 英语流利 Done.
819 年薪 Done.
821 银行 Done.
830 活动策划 Done.
836 编辑 成都 Done.
834 photoshop Done.
840 应届硕士 Done.
835 导游 Done.
839 成都编辑 Done.
838 成都 编辑 Done.
837 人事主管 Done.
841 应届硕士招聘 Done.
844 深圳文案 Done.
846 程序员 Done.
845 大姚 Done.
843 文案 Done.
847 java 上海 Done.
849 biostatistician Done.
851 sas Done.
850 药物经济 Done.
848 ue 80 Done.
842 旅游记者 Done.
854 android 百度 Done.
855 广州 记者 Done.
856 android 实习生 Done.
833 产品 实习生 Done.
859 翻译 长沙 Done.
858 审计 Done.
860 交互 设计师 Done.
862 销售 空调 Done.
863 产品 经理 Done.
853 微博推广专员5名,专职月薪2000元 提成,兼职月薪1000元 提成。要求:注册微博客1年以上,关注100人以上,粉丝数1000以上,经常上网,泡论坛、写博客;有过公关公司、媒体公司、营销公司工作经验优先。邮件:uvw002@163.com Done.
789 全部招聘 php 编辑 产品经理 交互设计 视觉设计 实习生 产品 产品设计 Done.
852 统计 Done.
867 rails Done.
868 编辑 西安 Done.
865 自然语言 处理 Done.
866 cate : 营销 经理 city 北京 Done.
871 西安 行政 Done.
870 西安行政 Done.
872 西安 网站 Done.
873 咨询顾问 Done.
874 交互 设计 Done.
869 网站 业务 Done.
875 新东方 招聘 产品 经理 Done.
876 新东方 产品 经理 Done.
880 生物 医学 工程师 Done.
877 臧知昶 Done.
882 leed Done.
879 招聘信息 Done.
881 搜索 研发 工程师 Done.
878 iOS 系统 招聘 导航 软件开发 人员 Done.
857 会计师 Done.
885 架构师 Done.
886 娱乐 Done.
861 请 各位 帮忙 转播 推荐 呀 Done.
891 广州 助理 Done.
890 广州助理 Done.
888 文员 广州 Done.
889 广州 行政 Done.
892 怀旧 Done.
887 文员 Done.
893 飞机 Done.
894 营销 经理 Done.
864 界面 设计师 一名 请 各位 帮忙 转播 推荐 呀 Done.
902 supporting Done.
903 法律 实习生 Done.
905 web 前端 Done.
904 招聘:b2b销售经理,有电子商务销售管理经验优先,联系qq:408378857 e-mai:tianxf@gasgoo.com Done.
906 经济学 Done.
907 硕士 Done.
901 英语助教 Done.
900 新浪网 php 工程师 系统 架构 师 Done.
909 郑州 迪士尼 儿童 15938737424 地点 富田 太阳城 一站 站 广场 Done.
899 php 程序员 Done.
911 工业 工程师 Done.
908 用户体验 Done.
912 商务 Done.
914 聯網 Done.
913 彩铃运营 Done.
919 英语 广州 Done.
916 客户端 产品 经理 Done.
920 英语 八级 Done.
918 网站推广 Done.
915 无线 手机 产品 Done.
917 手机 产品 经理 Done.
921 izenesoft Done.
926 实习生 会计 Done.
922 电气 Done.
924 核工程 Done.
923 地球化学 Done.
925 交互设计 上海 Done.
928 外贸 厦门 Done.
927 会计 上海 Done.
929 互联网 分析师 Done.
930 商业 分析师 Done.
932 系统维护 Done.
934 @ Done.
883 产品 经理 一名 市场推广 SEO 方向 文案 策划 前端 设计师 时尚 健康 类 的 电子 商场 项目 招聘 Done.
931 网页 设计师 Done.
933 937 bambook Done.
转发 Done.
935 市场营销 Done.
936 网站运营 Done.
942 汉语 Done.
910 迪士尼 儿童 15938737424 地点 郑州 富田 太阳城 一站 站 广场 Done.
945 平面 设计师 Done.
940 project manager Done.
939 acca Done.
941 对外汉语 Done.
943 计算语言 Done.
949 lsb Done.
950 网页前台 Done.
951 前台设计 Done.
948 运营助理 Done.
944 系统 工程师 Done.
952 诚聘 Done.
946 系统架构 Done.
955 民生银行 Done.
956 阜新 Done.
957 坪山 Done.
958 深圳龙岗 Done.
959 龙岗 Done.
954 文案策划 Done.
962 java 杭州 Done.
963 依娃璇子 Done.
953 俱乐部 Done.
938 品牌经理 Done.
961 产品 经理 客户端 Done.
960 JAVA 架构 师 Done.
964 找c 服务器端开发人员,windows平台,熟悉分布式设计,流处理设计,薪水从优 Done.
966 公司招聘 设计师 Done.
967 OpenGL 实习生 Done.
968 OpenGL Done.
965 江青 Done.
969 android 北京 Done.
974 网络兼职 Done.
975 储运经理 Done.
973 j2ee Done.
972 市场专员 Done.
970 微博招聘 Done.
971 风险 Done.
947 系统 架构 师 Done.
978 java 工程师 Done.
981 巨人 Done.
979 王国 Done.
982 文理兼通 Done.
983 文理 Done.
985 姜沈励 Done.
986 苏州采购 Done.
984 逻辑 Done.
976 售后 Done.
977 等等 Done.
980 五 Done.
989 精算师 Done.
992 twitter Done.
993 珠海 Done.
987 供应链 Done.
995 温州 Done.
991 网站编辑 Done.
990 英才网 Done.
994 ios Done.
997 金华 Done.
988 北京 会计 Done.
999 防盗门 Done.
1000 三国 Done.
1003 analytics Done.
1002 google analytics Done.
1001 青岛招聘 Done.
1004 市场尽力 Done.
1005 scala Done.
1008 公关总监 Done.
1007 安踏 Done.
996 义乌 Done.
1006 什么 Done.
1009 江 Done.
1014 #招聘# Done.
1013 seo 广州 Done.
998 scooter Done.
1010 WPF Done.
1012 的 Done.
1011 silverlight Done.
1021 广州 SEO Done.
1020 360 Done.
1016 #光谷# Done.
1018 net Done.
1019 php 郑州 Done.
1017 456 Done.
1015 高级 Done.
1024 sns 杭州 Done.
1026 关心网 Done.
1030 设计员 Done.
1029 网游 Done.
1025 自然语言 Done.
1027 杭州 实习生 Done.
1022 公司 Done.
1031 设计员 南京 Done.
1023 人力资源 经理 Done.
1032 实习生 郑州 Done.
1028 玉米 Done.
1036 开心网 Done.
1034 新浪微博 Done.
1035 人人网 Done.
1037 文员 北京 Done.
1038 厦门 php Done.
1033 惠城 Done.
1041 and 1 Done.
1042 order by 10 Done.
1043 1 and Done.
1044 <> Done.
1046 script alert a Done.
1040 sdgf Done.
1048 新浪 交互 设计师 了 Done.
1049 联发科技 Done.
1052 recruiting Done.
1051 产品 专员 上海 Done.
1050 报关 Done.
1055 广州 校园招聘 Done.
1057 插画师 Done.
1056 见 Done.
1053 应聘 设计师 Done.
1054 产品 经理助理 Done.
1045 script Done.
1047 新浪 交互 设计师 Done.
1058 广州 文员 Done.
1060 net 成都 Done.
1061 艺助 Done.
1062 艺人助理 Done.
1065 足浴技师 Done.
1059 广州文员 Done.
1064 产品 设计师 Done.
1069 会计 大连 Done.
1070 到底 Done.
1066 足浴 Done.
1073 深圳 Symbian Done.
1067 足疗 Done.
1071 君隆 Done.
1075 北京 公关 Done.
1077 时尚集团 Done.
1074 深圳 php Done.
1072 人力 Done.
1076 总编 Done.
1078 现代传播 Done.
1079 瑞丽 Done.
1082 PR Done.
1084 平媒 Done.
1080 桦榭 Done.
1083 平媒经历 Done.
1088 solr Done.
1087 cate Done.
1086 斯坦尼康 Done.
1085 PD Done.
1081 周刊 Done.
1090 广州 新浪 Done.
1092 2011、 Done.
1094 d Done.
1095 们公 Done.
1089 山东浪潮齐鲁软件产业股份有限公司诚聘优秀软件工程师应届毕业生,资深软件工程师、软件测试工程师、嵌入式软件工程师、GIS/GPS软件工程师、单片机软件工程师、数据库开发工程师、网络工程师、高级JAVA软件工程师、高级.NET软件工程师、高级C 软件工程师、项目经理、销售总监 Done.
1093 2011 Done.
1096 1-2 Done.
1099 信社区产 Done.
1100 信共 Done.
1101 动互联 Done.
1091 上海 交互 Done.
1103 银联 Done.
1104 内容运营 Done.
1105 互联网 产品 Done.
1102 急招 Done.
1106 残疾 Done.
1068 界面 设计师 一名 请 帮忙 Done.
1107 网页设计 广州 Done.
1108 人事 广州 Done.
1110 网页 设计师 广州 Done.
1109 行政 广州 Done.
1111 56 Done.
1112 家具设计 Done.
1113 arm Done.
1116 360安全 Done.
1115 新葵互动 Done.
1114 人民 Done.
1063 区域 经理 市场营销 人员 人 项目 河南 许继 仪表 有限公司 详情 请 http db dqjob 88 com vvip cm 1277951335735 2 更多 信息 www job 1001 查看 Done.
1117 分布式 Done.
1118 说 Done.
1121 网络 工程师 Done.
1122 阿里巴巴 产品 Done.
1120 c 方向 Done.
1119 实习生 java Done.
1123 淘宝 产品 Done.
1125 广州 外企 Done.
1126 广州 媒 Done.
1127 产品 广州 Done.
1128 情报学 Done.
1124 产品设计 上海 Done.
1133 产品 上海 Done.
1130 产品 经理 北京 Done.
1129 北京 交互 Done.
1134 移动支付 Done.
1136 sheying Done.
1138 nike Done.
1137 北京 产品 经理 Done.
1132 实习生 杭州 Done.
1135 互联网 Done.
1098 有没有 弟弟 妹妹 软件开发 要 找工作 Done.
1139 nike 6.0 Done.
1140 hjghj Done.
1142 河南 Done.
1143 监理 Done.
1146 chanpin Done.
1141 flex Done.
1145 隧道 Done.
1144 隧道监理 Done.
1097 有没有 弟弟 妹妹 软件开发 需要 找工作 Done.
1147 chanpinsh Done.
1152 南昌那个 Done.
1151 实习生 上海 Done.
1153 南昌 Done.
1148 chanping Done.
1149 风水 Done.
1150 产品 经理 上海 Done.
1156 模拟设计 Done.
1159 美国 Done.
1158 传播学 Done.
1160 上海 php Done.
1157 模拟 Done.
1163 塘沽 Done.
1155 日文 Done.
1161 奇虎360 Done.
1162 副总 Done.
1168 交互 天津 Done.
1165 电脑 Done.
1164 电脑技术 Done.
1166 雕蜡 Done.
1167 北京 net Done.
1169 焊接 Done.
1172 wordpress Done.
1171 北京 机械 Done.
1174 许利雄 Done.
1170 北京 类 Done.
1173 模具设计 Done.
1175 百纳 Done.
1178 北京 手机 gui Done.
1179 北京 gui Done.
1180 台湾 Done.
1176 gui Done.
1181 php 经理 北京 Done.
1177 手机 gui Done.
1154 汽车 上海 Done.
1183 微软中国 Done.
1186 重庆 网站 Done.
1187 品质管理 Done.
1185 adobe Done.
1190 实习生 山西 Done.
1188 老师 Done.
1182 微软 Done.
1191 山西 Done.
1189 运营总监 Done.
1195 电视 广州 Done.
1192 bs Done.
1194 广州 媒体 Done.
1193 阿里巴巴 国际 站 Done.
1196 电视广州 Done.
1197 广州 电视 Done.
1200 上海 设计师 Done.
1199 上海 前端 设计师 Done.
1198 广州电视 Done.
1201 北京 C Done.
1203 北京 ajax Done.
1205 UED 经理 Done.
1204 marketing Done.
1206 北京 android Done.
1184 飞信 Done.
1202 山东 Done.
1207 上海 android Done.
1209 广州 手机游戏 Done.
1131 全音 乐组 的人 人去 嗨歌 歌 耶耶 给 队长 过 生日 Done.
1214 webex Done.
1210 广州 儿童 Done.
1208 广州 手机 Done.
1217 编辑 北京 Done.
1218 Lotus Done.
1216 彳 Done.
1212 腾讯微博 Done.
1211 广州 产品 经理 Done.
1213 hadoop Done.
1215 新浪 编辑 Done.
1220 Domino Done.
1224 用户 上海 Done.
1223 交互 上海 Done.
1219 Notes Done.
1226 yoka Done.
1222 优视 Done.
1225 编辑 济南 Done.
1227 新浪编辑 Done.
1230 季 Done.
1221 UC Done.
1232 福建 Done.
1235 编辑 广州 Done.
1231 招贤纳士 Done.
1229 投资银行 Done.
1239 枫华创益 Done.
1233 微博 博 招聘网 Done.
1234 李开复 Done.
1236 投资经理 Done.
1228 信托 Done.
1242 xhso Done.
1243 kl Done.
1238 百事 Done.
1240 明星 Done.
1245 poMars Zheng Done.
1241 歌手 Done.
1244 po Done.
1249 缸/淋浴 Done.
1251 青岛 暖 Done.
1250 宝 Done.
1246 perl Done.
1237 联合利华 Done.
1252 胡锦涛 Done.
1256 上海会计 Done.
1255 上海财务 Done.
1258 上海 设备 工程师 Done.
1254 android 广州 Done.
1257 设备 工程师 Done.
1260 上海 设备工程师 Done.
1259 分析员 Done.
1247 语言 Done.
1253 采购经理 Done.
1265 建安大 Done.
1264 瑞典 Done.
1263 瑞士 Done.
1262 法国 Done.
1266 加拿大 Done.
1267 比利时 Done.
1269 芬兰 Done.
1268 卢森堡 Done.
1270 北欧 Done.
1272 西班牙 Done.
1261 osgi Done.
1271 意大利 Done.
1277 网站管理 Done.
1276 外贸 广州 Done.
1274 外貿 Done.
1279 网络管理员 Done.
1278 网管 Done.
1281 广东 php Done.
1280 春 分立 秋冬 至 Done.
1273 公益 Done.
1282 甘肃 php Done.
1275 外贸 州 Done.
1283 新疆 php Done.
1248 丁香 数据库 工程师 MySQL DBA Done.
1284 揭阳 php Done.
1289 Mars Zheng Done.
1291 桂林 Done.
1288 39健康网 Done.
1287 游戏 工程师 广州 Done.
1290 北京 产品 设计师 Done.
1295 用户研究 Done.
1292 中山 Done.
1296 iphone 深圳 Done.
1297 mba Done.
1299 dresses Done.
1300 groupon Done.
1298 lashou Done.
1301 51job Done.
1305 city 杭州 Done.
1302 lightinthebox Done.
1294 d 5 Done.
1285 广东 php 工程师 Done.
1307 mongodb Done.
1306 nosql Done.
1308 监测 Done.
1304 cate 软件测试 city 杭州 Done.
1310 客服 Done.
1303 b2c Done.
1286 游戏 工程师 Done.
1313 实习生 佛山 Done.
1314 实习生 广州 Done.
1311 生 北京 Done.
1318 深圳 实习生 Done.
1317 护士 Done.
1312 北京 生 Done.
1319 电子商务 深圳 Done.
1320 深圳 电子商务 Done.
1323 低碳 Done.
1325 haha Done.
1324 新能源 Done.
1321 网络营销 深圳 Done.
1309 环境 Done.
1316 京东 Done.
1315 派代 Done.
1330 上海 公关 Done.
1328 广州兼职 Done.
1329 浏览器 Done.
1326 互联网 产品 经理 Done.
1332 新浪 微博 博 Done.
1322 CDM Done.
1331 新浪 微博 Done.
1327 摄影师 Done.
1335 c# 苏州 Done.
1338 123 Done.
1339 研究所 Done.
1337 c# 苏 州 Done.
1333 学徒 Done.
1336 播音 Done.
1340 新加坡 Done.
1344 rhce Done.
1345 OCP Done.
1342 农民 Done.
1346 济南 操作工 Done.
1347 操作工 山东 Done.
1341 劳务 Done.
1348 山东 操作工 Done.
1343 操作工 Done.
1351 产品经历 Done.
1352 csico Done.
1353 江门 Done.
1349 商河 Done.
1350 生产副总 Done.
1356 奕惠嘉 Done.
1359 2131 Done.
1357 暑期工 Done.
1358 页面重构 Done.
1355 希捷 Done.
1361 冶金 Done.
1360 微薄 Done.
1364 游戏 媒介 经理 Done.
1363 CEO Done.
1362 程序 Done.
1365 英语翻译 Done.
1366 网页美工 Done.
1371 baidu Done.
1370 珍爱网 Done.
1367 重构 Done.
1372 商业地产 Done.
1354 Java Senior Software Engineer 软件 工程师 Done.
1374 java 北京 Done.
1334 服务器 Done.
1369 百合网 Done.
1368 世纪佳缘 Done.
1378 大熊 Done.
1373 社交 Done.
1379 eclipse Done.
1381 广州 实习生 Done.
1383 沈阳 韩语 翻译 Done.
1382 木兰设计 Done.
1380 客户服务 Done.
1384 沈阳翻译 Done.
1385 周熙 Done.
1377 深圳 互联网 Done.
1389 制片人 Done.
1387 数字图像 Done.
1388 图像 Done.
1390 识别 Done.
1391 建筑动画 Done.
1386 照片 Done.
1392 相机 Done.
1395 设计学徒 Done.
1393 执行主编 Done.
1396 CAD Done.
1399 电厂 Done.
1394 sarft net Done.
1398 医学 Done.
1401 垃圾 Done.
1402 神经病 Done.
1400 工资 Done.
1376 安全工程 Done.
1375 空调 Done.
1397 力推 上海 淮海 新日铁 招 JAVA 日语 要 学校 211 Done.
1406 蛋白质 Done.
1405 发酵 Done.
1410 律师 南宁 Done.
1412 临沂 Done.
1403 好玩 Done.
1408 广州实习 Done.
1404 纯化 Done.
1411 婚纱 Done.
1409 安全测试 Done.
1415 上海 美术 Done.
1417 交互 深圳 Done.
1413 soho Done.
1418 礼宾员 Done.
1407 游戏开发 Done.
1414 视觉 Done.
1419 talend Done.
1423 郑州 法语 Done.
1422 美团 Done.
1424 郑州 英语 Done.
1425 郑州 外语 Done.
1420 网站设计 Done.
1427 jobkoo Done.
1426 sales Done.
1429 媒介 北京 Done.
1416 产品策划 Done.
1432 sharepoint Done.
1434 fles Done.
1431 moss Done.
1433 开心 Done.
1435 汽修 Done.
1437 c/c Done.
1440 上海 oracle Done.
1438 新疆 Done.
1439 北京 产品 Done.
1430 媒介执行 Done.
1441 net 软件 工程师 Done.
1442 深圳 net 软件 工程师 Done.
1443 qqqqr Done.
1436 猎头职位 Done.
1446 北京保安 Done.
1428 媒介 Done.
1445 视觉设计 是飞 Done.
1447 php 围绕 Done.
1452 call center Done.
1453 呼叫中心 北京 Done.
1450 net 北京 Done.
1454 建筑 哈尔滨 Done.
1457 郑州 房产 人员 Done.
1451 宝马 Done.
1449 深圳 行政 Done.
1459 电气销售 Done.
1460 宁夏销售 Done.
1461 城市规划 Done.
1444 保安 Done.
1458 房产销售 Done.
1464 杭州 电子商务 产业园 Done.
1462 网络推广 Done.
1463 asp net 程序员 Done.
1448 兼 Done.
1467 虾米网 Done.
1468 CAD 机械 设计师 Done.
1469 CAD 机械 Done.
1466 唯你网 Done.
1470 zhonghuayantu Done.
1473 CAD 员 大学生 Done.
1472 CAD 大学生 Done.
1465 杭州 电子商务 Done.
1455 cate 视频 编辑 city 济南 Done.
1478 郑德明 Done.
1479 交互 杭州 Done.
1477 公关策划 Done.
1476 策划经理 Done.
1475 技术 Done.
1481 视觉设计 北京 Done.
1474 行政助理 Done.
1482 网页设计 北京 Done.
1485 珠海司机 Done.
1483 北京 游戏公司 Done.
1488 网络推广 长沙 Done.
1484 网站策划 Done.
1486 司机 Done.
1471 大学生 Done.
1490 samwang jobkoo com Done.
1492 职酷 Done.
1480 电话回访 Done.
1491 jobkoo com Done.
1489 职酷网 Done.
1493 深深深 Done.
1497 国际贸易 上海 Done.
1498 上海 英语翻译 Done.
1499 上海 日语 翻译 Done.
1495 华为 Done.
1501 160 深圳 Done.
1500 上海翻译 Done.
1502 160深圳 Done.
1504 影视 设计类 Done.
1503 数据分析 Done.
1506 北京影视 Done.
1507 快递 Done.
1496 国际贸易 Done.
1494 北京 大麦 网 前端 工程师 Done.
1487 网络编辑 Done.
1510 马鞍山 Done.
1511 保时捷 Done.
1512 杭州 园林 Done.
1508 charming lu sina cn Done.
1509 交互 新蛋 Done.
1505 影视 Done.
1518 897720084 Done.
1517 交互 实习生 Done.
1516 网页 设计师 北京 Done.
1515 北京 seo Done.
1520 嘉定 Done.
1522 wangjiayun11 Done.
1521 深圳 包装设计 Done.
1513 团购 Done.
1525 1122 Done.
1524 厦门、 Done.
1527 景德镇 Done.
1526 asp net Done.
1514 city 重庆 文案 助理 要求 英语 专业 Done.
1528 农药 Done.
1519 摄影助理 Done.
1530 上海 宝 Done.
1529 result Done.
1531 新蛋 Done.
1532 java 广州 Done.
1535 fdsafdsa Done.
1534 成都 java 架构 师 Done.
1536 地产中介 Done.
1533 中文 Done.
1523 前端 工程师 Done.
1538 杭州 虾米 Done.
1539 北京百度 Done.
1542 北京 豆瓣 Done.
1541 上海 pplive Done.
1543 广州 网页设计 Done.
1545 dsfasdf Done.
1540 北京 百度 Done.
1546 outlook Done.
1548 vba Done.
1544 东北 Done.
1547 网页设计 深圳 Done.
1550 海归 Done.
1549 河北 Done.
1552 江苏 Done.
1554 广州 新浪 微博 Done.
1555 南京 实习生 Done.
1537 地产 Done.
1556 动漫助理 Done.
1553 江明炜 Done.
1557 seo 推文 Done.
1558 帝网 络 Done.
1561 1 Done.
1559 ss Done.
1560 22 3 Done.
1562 12 Done.
1565 童装 设计师 Done.
1566 上海 产品 经理 Done.
1568 网络 编辑 Done.
1563 3 Done.
1564 服装 设计师 Done.
1572 合肥 Done.
1570 行政 Done.
1551 国外 Done.
1569 招聘专员 Done.
1567 美术编辑 Done.
1571 产品 经理 无线 Done.
1456 南京 天 天加 加 空调设备 有限公司 硬件 工程师 人 商用机 产品 等等 详情 请 http www ntjob 88 com vvip cm 1294213192877 更多 信息 暖通 英才 网 Done.
1576 设计 北京 Done.
1580 阿里 Done.
1577 银时代 Done.
1579 将爱 Done.
1578 传统文化 网络 编辑 Done.
1573 方正 Done.
1575 测试 工程师 Done.
1582 金鹰 Done.
1584 销售助理 Done.
1583 天翼 Done.
1586 上海策划 Done.
1585 上海企划 Done.
1581 beij Done.
1574 运维 维 工程师 Done.
1588 广州 外贸 跟 单员 Done.
1589 广州 跟 单员 Done.
1591 重庆 网站 编辑 Done.
1594 快消品 Done.
1592 搜狐微博 Done.
1587 广州 外贸 Done.
1598 实习 天津 Done.
1597 广州 PHP Done.
1593 n8 Done.
1600 长沙 net Done.
1599 求职 实习生 Done.
1602 实习生 天津 Done.
1604 安智网 Done.
1601 实习生 招聘 Done.
1595 net 工程师 Done.
1605 贾琪 Done.
1606 诺亚 Done.
1603 北京 金融 Done.
1607 研华 Done.
1608 制药 Done.
1590 电影剪辑 Done.
1610 实习 金融 专业 Done.
1596 39健康 Done.
1614 asp Done.
1613 nihao Done.
1615 聚能灶 Done.
1616 groupon hr sina com Done.
1609 昆明 Done.
1620 procurement Done.
1621 广州 服务员 Done.
1617 ljb 115 com Done.
1619 汽车之家 Done.
1624 杭州 赛博 创业 工场 Done.
1612 企划 Done.
1618 开发 Done.
1611 杭州 招聘 产品设计 人员 Done.
1626 杭州 创业 Done.
1628 豆瓣招聘 Done.
1630 xiaolinzou Done.
1622 网页 Done.
1631 网络 编辑 重庆 Done.
1623 研发 Done.
1632 重庆 网站 设计师 Done.
1633 重庆 网页 设计师 Done.
1625 赛博 创业 工场 Done.
1636 重庆 文案 策划 Done.
1635 重庆 产品 设计师 Done.
1627 香港 Done.
1638 通訊 Done.
1629 caoyang corp the 9 com Done.
1637 engineer Done.
1640 通信维护 Done.
1643 校园能人 Done.
1644 阜阳 师范学院 Done.
1639 光缆维护 Done.
1645 阜师院 Done.
1641 通信 Done.
1642 通信技术 Done.
1634 重庆 设计师 Done.
1647 交互 设计 实习生 Done.
1648 广州招聘 Done.
1649 用户 研究员 Done.
1653 北京 平面设计 Done.
1652 北京 求职 平面设计 Done.
1651 摄影招聘 Done.
1655 厦门司机 Done.
1657 律师助理 Done.
1658 奢侈品 Done.
1659 GUCCI Done.
1656 店长 Done.
1661 安全管理 Done.
1660 LV Done.
1663 新浪体育 Done.
1666 北京 减排 Done.
1664 zhangjing Done.
1665 深圳 运营 Done.
1662 张玉铭 Done.
1667 项目 经理 北京 Done.
1669 广州 编辑 Done.
1671 ui 设计 杭州 Done.
1672 大麦 Done.
1673 大麦 上海 Done.
1670 华为 孙亚芳 Done.
1668 诺基亚 Done.
1674 UED 经理 上海 Done.
1676 upipi pi Done.
1677 厦门兼职 Done.
1680 测试研发 Done.
1678 证券分析 Done.
1675 记者 编辑 Done.
1679 人力资源 总监 Done.
1682 郑州 实习生 Done.
1681 火花网 Done.
1683 郑州 java Done.
1685 质控 Done.
1654 系统 Done.
1687 内容 管理系统 Done.
1689 深圳 自动化 Done.
1688 广东招聘 Done.
1684 QC Done.
1686 液相 Done.
1646 维修电工 Done.
1693 兼职运营 Done.
1692 侯子爱 吃 桃子 Done.
1691 手机游戏 Done.
1694 软件开发 工程师 Done.
1699 架构 师 上海 Done.
1690 陈列 Done.
1696 手工 Done.
1697 生活馆 Done.
1700 软件 架构 师 北京 Done.
1701 云吞 Done.
1702 13916086091 Done.
1695 产品 实习 Done.
1698 软件 架构 师 Done.
1704 杭州 动漫 Done.
1706 理想 哥 产品 经理 Done.
1703 阳江 Done.
1708 中国 国际 动漫 节 Done.
1709 动漫节 Done.
1705 北京 动漫 Done.
1707 项目 经理 Done.
1712 货代 Done.
1714 郑州 外贸 跟 单员 Done.
1715 浙江 Done.
1716 策划 北京 Done.
1713 外贸 跟 单员 Done.
1710 佛山 Done.
1720 产品 经理 手机 Done.
1717 淘宝房产 Done.
1721 binarylee Done.
1719 树苗 Done.
1711 日语 Done.
1725 舞蹈招聘 Done.
1723 生 广州 Done.
1726 界面外包 Done.
1724 舞蹈 Done.
1727 界面 外包 Done.
1718 树 Done.
1722 无线 产品 经理 北京 Done.
1728 UI 外包 Done.
1731 深圳 产品 经历 Done.
1729 深圳 产品 设计师 Done.
1732 深圳 产品 经理 Done.
1730 深圳 产品 Done.
1733 交互 实习 北京 Done.
1734 实习 交互 北京 Done.
1737 faxtee Done.
1736 创业 北京 Done.
1740 联系售后 Done.
1738 成都 市场 Done.
1742 联想电脑 Done.
1741 联系 售后服务 Done.
1739 cic Done.
1746 深圳 设计 Done.
1743 毕业生 Done.
1745 测试经理 Done.
1748 测试 工程师 上海 Done.
1744 guoli1 Done.
1749 三五互联 Done.
1750 沈阳 机械 Done.
1747 兰亭集势 Done.
1751 求职 ios Done.
1753 深圳 管理咨询 Done.
1754 hr duohuwai com Done.
1756 农商 Done.
1755 宝宝教育 Done.
1752 市场总监 Done.
1760 化学 Done.
1758 材化 Done.
1759 材化 Done.
1763 全段 Done.
1761 mysql DBA Done.
1764 兼职客服 Done.
1757 材料 Done.
1765 珠海招聘 Done.
1766 成都 ui Done.
1767 建筑设计 Done.
1771 助理 天津 Done.
1770 遥感 Done.
1769 当当 Done.
1768 建筑 设计 Done.
1735 项目管理 Done.
1772 助理 北京 Done.
1773 招 实习 广州 Done.
1774 北京 移动 互联网 Done.
1777 招实习 广州 Done.
1776 idg Done.
1781 郑州 实习 Done.
1775 深圳 android Done.
1780 酷狗 Done.
1782 后期 Done.
1783 lingxue 1985 h Done.
1785 guangz Done.
1778 生 天津 Done.
1779 服务端 Done.
1786 asp net 成都 Done.
1788 aasdf Done.
1787 ffff Done.
1790 再发 发 围脖 征募 Done.
1792 瓦力 Done.
1793 DKM Done.
1794 武汉 java Done.
1789 MM Done.
1791 求职信息 Done.
1795 产品实习 Done.
1797 renderman Done.
1798 php 方面 职位 Done.
1796 天 Done.
1799 北京 交互 设计 Done.
1801 大专 学历 女孩子 做 Done.
1800 交互 设计 北京 Done.
1804 24券团购 Done.
1802 Goso Done.
1805 24券 Done.
1803 融众网 Done.
1807 前台 北京 Done.
1810 视觉设计 阿里 Done.
1808 市场 运营 助理 Done.
1809 深圳 网页 设计师 Done.
1811 销售 深圳 Done.
1812 深圳 销售 Done.
1813 太原 编辑 Done.
1762 实习生 北京 交互 设计 Done.
1784 lingxue 1985 hotmail com Done.
1806 网站技术 经理 Done.
1818 厦门 平面 Done.
1816 爱库 Done.
1820 厦门 实习 Done.
1814 杂志 编辑 Done.
1821 鄂尔多斯 Done.
1819 文字录入 Done.
1815 音乐 编辑 Done.
1817 厦门 ui Done.
1822 建筑工程 设计 Done.
1829 中演 票务 通 Done.
1827 广东汕头 Done.
1830 凯业必达 Done.
1831 GUI 设计师 Done.
1823 建筑工程 技术 Done.
1832 呼叫中心 运营 经理 Done.
1833 康琴伢 Done.
1834 13657439572 Done.
1825 数值策划 Done.
1828 化妆师 Done.
1835 产品 北京 Done.
1826 凡客 Done.
1840 新浪 商务 拓展 Done.
1839 上海兼职 Done.
1838 上海 兼职 Done.
1824 杭州 实习 Done.
1842 新浪 前端 Done.
1845 美会 Done.
1844 亿贝 Done.
1841 山东 前端 Done.
1843 ebay Done.
1836 产品 经理 无限 Done.
1837 20万 Done.
1850 风险投资 Done.
1852 麦包包 Done.
1851 风投 Done.
1849 associate Done.
1848 investment Done.
1853 用友 商务 Done.
1856 编辑 郑州 Done.
1858 网易 含 资格 Done.
1857 上海 支付 宝 Done.
1855 俄语翻译 Done.
1859 网易杭州 Done.
1860 西宁 Done.
1862 杭州 音乐 Done.
1861 用友北京 Done.
1854 北京招聘 Done.
1846 惠普 Done.
1863 音乐 杭州 Done.
1866 青岛 交互 设计 Done.
1867 大连 前端 Done.
1865 13326657232 Done.
1864 丁允 Done.
1871 运城 Done.
1869 长沙 java Done.
1872 北京 销售 Done.
1875 1985 Done.
1876 杭州 法律 Done.
1873 android 上海 Done.
1874 drupal Done.
1877 杭州 法学 Done.
1870 统计分析 Done.
1878 天津滨海 Done.
1868 市场 北京 Done.
1882 广州 客户端 Done.
1879 asdfasdfasd Done.
1886 微盘 Done.
1883 社区 运营 Done.
1884 游戏测试 Done.
1881 客户端 Done.
1885 数据库 工程师 Done.
1880 数据库 开发 工程师 Done.
1888 成都 经营 Done.
1889 成都 运营 Done.
1892 成都 经理 Done.
1891 成都 经理 Done.
1893 成都 产品 Done.
1896 厦门 界面 Done.
1895 汽车 南京 Done.
1894 汽车 检测员 Done.
1890 成都 经理 Done.
1898 超经 Done.
1897 建筑 工程师 Done.
1899 经纪人 Done.
1847 万 Done.
1900 北京 网页 设计师 Done.
1903 seo 工程师 Done.
1905 ls Done.
1904 产品 总监 北京 Done.
1902 市场北京 Done.
1906 环艺 Done.
1887 罗兰 科技发展 有限公司 Done.
1907 重庆销售 Done.
1910 广州 投资 经理 Done.
1901 用户 Done.
1912 中文分词 Done.
1911 产品 经理 广州 Done.
1908 led Done.
1909 杭州 php Done.
1916 @小马拓 Done.
1913 广州 互动 Done.
1915 交互 设计 上海 Done.
1919 北京 平面设计 实习生 Done.
1914 设计经理 Done.
1918 平面设计 实习生 Done.
1921 徐小平 Done.
1917 上 Done.
1922 盛大 Done.
1924 运维 维 工程师 sina Done.
1925 sina Done.
1927 产品设计 实习 Done.
1928 bet Done.
1929 BJBET CN Done.
1931 玉林 Done.
1930 android java Done.
1934 产品 经理 深圳 Done.
1935 lvyulin 20082163 com Done.
1933 java python Done.
1932 兼职 北京 Done.
1936 lvyulin 2008 163 com Done.
1938 加盟招商 Done.
1926 king Done.
1939 ux Done.
1940 系统开发 Done.
1941 有奖 Done.
1937 拓展 Done.
1920 city 北京 cate 程序员 Done.
1923 平面 Done.
1946 ggggggggggaaaaa Done.
1943 伯乐奖 Done.
1944 php 厦门 Done.
1951 goldengate Done.
1950 安徽 司机 Done.
1949 幕墙 销售 经理 职位 Done.
1952 容灾 Done.
1953 灾备 Done.
1945 工商 Done.
1948 总经理 Done.
1955 uspv Done.
1954 hds Done.
1957 易到用车 Done.
1956 网页 设计师 兼职 Done.
1958 BD 广州 Done.
1947 上海 生 Done.
1942 伯乐 Done.
"""
b=a.split('\n')
e=[]
for c in b:
d=" ".join(c.split()[:-1])
e+=[d]
g="\r\n".join(e).encode('utf-8')
f = open("tbole.txt", "w")
f.write(g)
f.close()
print "Wrote results."
| ajibawa-2023/Python-Code-Large/train/row_168 | 11 | 1,927 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_168:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.001, 0.0005, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L3_C0", "label": "a =", "type": "assigned_variable", "loc": [3, 1917], "level": 0, "parent": null, "vector": [14, 0, 0.4982, 0.9938, 0, 0.66, 0.1111, 475, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "a=u\"\"\"3 \u5de5\u7a0b\u5e08 Done.\n1 php Done.\n5 php \u5de5\u7a0b\u5e08 Done.\n2 \u8bbe\u8ba1\u5e08 Done.\n6 \u89c6\u89c9\u8bbe\u8ba1 Done.\n7 \u4ea7\u54c1\u7ecf\u7406 Done.\n9 web Done.\n10 \u7f16\u8f91 Done."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1918_C0", "label": "b = split()", "type": "assigned_variable", "loc": [1918, 1918], "level": 0, "parent": null, "vector": [14, 0, 0.9953, 0.0005, 0, 0.66, 0.2222, 756, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "b=a.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1919_C0", "label": "e =", "type": "assigned_variable", "loc": [1919, 1919], "level": 0, "parent": null, "vector": [14, 0, 0.9958, 0.0005, 0, 0.66, 0.3333, 175, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "e=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:For_L1920_C0", "label": "for c", "type": "for", "loc": [1920, 1922], "level": 0, "parent": null, "vector": [6, 0, 0.9969, 0.0016, 0, 0.66, 0.4444, 411, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for c in b:\n d=\" \".join(c.split()[:-1])\n e+=[d]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1921_C4", "label": "d = join()", "type": "assigned_variable", "loc": [1921, 1921], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_168:For_L1920_C0", "vector": [14, 1, 0.9969, 0.0005, 1, 0.1, 0.0, 355, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " d=\" \".join(c.split()[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1923_C0", "label": "g = encode()", "type": "assigned_variable", "loc": [1923, 1923], "level": 0, "parent": null, "vector": [14, 0, 0.9979, 0.0005, 0, 0.66, 0.5556, 384, 3, 1, 0, 0, 623, 10, 2], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": "g=\"\\r\\n\".join(e).encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1924_C0", "label": "f = open()", "type": "assigned_variable", "loc": [1924, 1924], "level": 0, "parent": null, "vector": [14, 0, 0.9984, 0.0005, 0, 0.66, 0.6667, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"tbole.txt\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Expr_L1925_C0", "label": "write()", "type": "expression", "loc": [1925, 1925], "level": 0, "parent": null, "vector": [8, 0, 0.999, 0.0005, 0, 0.66, 0.7778, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(g)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Expr_L1926_C0", "label": "close()", "type": "expression", "loc": [1926, 1926], "level": 0, "parent": null, "vector": [8, 0, 0.9995, 0.0005, 0, 0.66, 0.8889, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_168:Expr_L1927_C0", "label": "print()", "type": "expression", "loc": [1927, 1927], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0005, 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(\"Wrote results.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_168:For_L1920_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_168:Assign_L1921_C4"}] |
#!/usr/bin/env python
#coding=utf-8
catelist = [
(1, u"传统网络Internet"),
(2, u"移动互联"),
(3, u"网游"),
(4, u"电子商务_B2C/团购"),
(5, u"软件、电信"),
(6, u"新媒体"),
(7, u"风投/投行"),
(8, u"其他外企"),
]
idlist = [
[1, (u"超超Sandy", "d11c25990634d0e486235f1b42a55f9f", "89859ba49065135017b894df5e5a9089")],
[1, (u"传统网络2", "9257d982dcbc26d21fa4f0afb16a54be", "e99c1ae713e14edc3ec3abb7e2344be3")],
[2, (u"冬冬Billy", "f6449dd703d66cf2be5274f321416958", "31c47db4cd79e43a9196871a554d0847")],
[2, (u"新潮-独", "e17cec5e79cd81704aa4b73d15caf639", "983582e2b4b880cc35caa7ac38ce3449")],
[2, (u"移动互联2", "6193a010668f5dcc106e671babf4fbe1", "605e4449590b2c3d96d34b049f96fdbd")],
[3, (u"田田July", "032ec596fa363aa9bd3e5e5917f6aea4", "9e0c243fa3ff3515765510ba4010c411")],
[3, (u"网游2", "743700d7ec385d0b740ecc9a4ef519d4", "b89c6d406e235ab3c49ccea1d82b5622")],
[4, (u"田田Lily", "3ef7fc951a66918dd1cd722485fe1686", "74f524fe376ce995703e73e63407684f")],
[4, (u"电子商务临2", "669001d16b1641a2138d529b435eaefb", "13f58a73995fd2b80bc0aa875ad363f0")],
[5, (u"小朱Linda", "0c10534f393fe08451edb140e3b1150d", "423fd333a2542dbf6e2a38119a6e7e04")],
[5, (u"软件电信2", "f577ad7699dc1a74330bc41329c2ce71", "20cc173dbb46a6784588767e71de03ef")],
[6, (u"小王trueman", "1f8f7db82cdbc346a91840cef2bc1cb9", "a16ead9ee3b6b3f43e601de127275ddc")],
[6, (u"新媒体2", "fc565ccfa32bdb962becc8d49a5a37d3", "8504469c6cad83cde0998299aca8b2fa")],
[7, (u"小毕Simon", "4151efe34301f5fddb9d34fc72e5f4a4", "dc4a07e8b7936d688726604a7442e4bc")],
[7, (u"风投2", "b14cbaaae5e46079770ea77feeaa0c91", "2dd7a1e5bb6036d69b2c983aa3f2a682")],
[8, (u"小黄Lily", "8ee871ac7d18e0141b54077fefd58af6", "dc5cda5a9a4ab5c5a5cd53f85f1f7915")],
[8, (u"外企名企2", "6712203ce54da88930f72014a0ef90bd", "d97779c02d60cacbabd0c398cb8acd93")],
]
| ajibawa-2023/Python-Code-Large/train/row_169 | 2 | 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_169:Assign_L4_C0", "label": "catelist =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.2656, 0.3125, 0, 0.66, 0.0, 219, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "catelist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "catelist = [\n (1, u\"\u4f20\u7edf\u7f51\u7edcInternet\"),\n (2, u\"\u79fb\u52a8\u4e92\u8054\"),\n (3, u\"\u7f51\u6e38\"),\n (4, u\"\u7535\u5b50\u5546\u52a1_B2C/\u56e2\u8d2d\"),\n (5, u\"\u8f6f\u4ef6\u3001\u7535\u4fe1\"),\n (6, u\"\u65b0\u5a92\u4f53\"),\n (7, u\"\u98ce\u6295/\u6295\u884c\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_169:Assign_L14_C0", "label": "idlist =", "type": "assigned_variable", "loc": [14, 32], "level": 0, "parent": null, "vector": [14, 0, 0.7188, 0.5938, 0, 0.66, 1.0, 77, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "idlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "idlist = [\n [1, (u\"\u8d85\u8d85Sandy\", \"d11c25990634d0e486235f1b42a55f9f\", \"89859ba49065135017b894df5e5a9089\")],\n [1, (u\"\u4f20\u7edf\u7f51\u7edc2\", \"9257d982dcbc26d21fa4f0afb16a54be\", \"e99c1ae713e14edc3ec3abb7e2344be3\")],\n [2, (u\"\u51ac\u51acBilly\", \"f6449dd703d66cf2be5274f321416958\", \"31c47db4cd79e43a9196871a554d0847\")],\n [2, (u\"\u65b0\u6f6e-\u72ec\", \"e17cec5e79cd81704aa4b73d15caf639\", \"983582e2b4b880cc35caa7ac38ce3449\")],\n [2, (u\"\u79fb\u52a8\u4e92\u80542\", \"6193a010668f5dcc106e671babf4fbe1\", \"605e4449590b2c3d96d34b049f96fdbd\")],\n [3, (u\"\u7530\u7530July\", \"032ec596fa363aa9bd3e5e5917f6aea4\", \"9e0c243fa3ff3515765510ba4010c411\")],\n [3, (u\"\u7f51\u6e382\", \"743700d7ec385d0b740ecc9a4ef519d4\", \"b89c6d406e235ab3c49ccea1d82b5622\")],"}] | [] |
# -*- coding: utf-8 -*-
from ragendja.settings_pre import *
# Increase this when you update your on the production site, so users
# don't have to refresh their cache. By setting this your MEDIA_URL
# automatically becomes /media/MEDIA_VERSION/
MEDIA_VERSION = 1
# By hosting media on a different domain we can get a speedup (more parallel
# browser connections).
#if on_production_server or not have_appserver:
# MEDIA_URL = 'http://media.mydomain.com/media/%d/'
# Add base media (jquery can be easily added via INSTALLED_APPS)
COMBINE_MEDIA = {
'combined-%(LANGUAGE_CODE)s.js': (
# See documentation why site_data can be useful:
# http://code.google.com/p/app-engine-patch/wiki/MediaGenerator
'.site_data.js',
),
'combined-%(LANGUAGE_DIR)s.css': (
'global/look.css',
),
}
# Change your email settings
if on_production_server:
DEFAULT_FROM_EMAIL = 'drkkojima@gmail.com'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Make this unique, and don't share it with anybody.
SECRET_KEY = '19720403'
#ENABLE_PROFILER = True
#ONLY_FORCED_PROFILE = True
#PROFILE_PERCENTAGE = 25
#SORT_PROFILE_RESULTS_BY = 'cumulative' # default is 'time'
# Profile only datastore calls
#PROFILE_PATTERN = 'ext.db..+\((?:get|get_by_key_name|fetch|count|put)\)'
# Enable I18N and set default language to 'en'
USE_I18N = True
TIME_ZONE = 'Asia/Tokyo'
LANGUAGE_CODE = 'en'
# Restrict supported languages (and JS media generation)
LANGUAGES = (
# ('de', 'German'),
('en', 'English'),
# ('ja', 'Japanese'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.core.context_processors.i18n',
)
MIDDLEWARE_CLASSES = (
'ragendja.middleware.ErrorMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'httpauth.Middleware',
# Django authentication
'django.contrib.auth.middleware.AuthenticationMiddleware',
# Google authentication
#'ragendja.auth.middleware.GoogleAuthenticationMiddleware',
# Hybrid Django/Google authentication
#'ragendja.auth.middleware.HybridAuthenticationMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.locale.LocaleMiddleware',
'ragendja.sites.dynamicsite.DynamicSiteIDMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
)
# Google authentication
#AUTH_USER_MODULE = 'ragendja.auth.google_models'
#AUTH_ADMIN_MODULE = 'ragendja.auth.google_admin'
# Hybrid Django/Google authentication
#AUTH_USER_MODULE = 'ragendja.auth.hybrid_models'
LOGIN_URL = '/account/login/'
LOGOUT_URL = '/account/logout/'
LOGIN_REDIRECT_URL = '/haco/report/'
INSTALLED_APPS = (
# Add jquery support (app is in "common" folder). This automatically
# adds jquery to your COMBINE_MEDIA['combined-%(LANGUAGE_CODE)s.js']
# Note: the order of your INSTALLED_APPS specifies the order in which
# your app-specific media files get combined, so jquery should normally
# come first.
'jquery',
# Add blueprint CSS (http://blueprintcss.org/)
'blueprintcss',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.webdesign',
'django.contrib.flatpages',
'django.contrib.redirects',
'django.contrib.sites',
'appenginepatcher',
'ragendja',
'myapp',
'registration',
'mediautils',
'haco',
)
# List apps which should be left out from app settings and urlsauto loading
IGNORE_APP_SETTINGS = IGNORE_APP_URLSAUTO = (
# Example:
# 'django.contrib.admin',
# 'django.contrib.auth',
# 'yetanotherapp',
)
# Remote access to production server (e.g., via manage.py shell --remote)
DATABASE_OPTIONS = {
# Override remoteapi handler's path (default: '/remote_api').
# This is a good idea, so you make it not too easy for hackers. ;)
# Don't forget to also update your app.yaml!
#'remote_url': '/remote-secret-url',
# !!!Normally, the following settings should not be used!!!
# Always use remoteapi (no need to add manage.py --remote option)
#'use_remote': True,
# Change appid for remote connection (by default it's the same as in
# your app.yaml)
#'remote_id': 'otherappid',
# Change domain (default: <remoteid>.appspot.com)
#'remote_host': 'bla.com',
}
import sys, os
rootdir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(rootdir, "lib"))
from ragendja.settings_post import *
| ajibawa-2023/Python-Code-Large/train/row_170 | 23 | 154 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_170:ImportFrom_L2_C0", "label": "from ragendja.settings_pre import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.0065, 0, 0.66, 0.0, 978, 0, 1, 0, 0, 978, 0, 0], "semantic": {"name": "ragendja.settings_pre", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_pre import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L7_C0", "label": "MEDIA_VERSION =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0455, 0.0065, 0, 0.66, 0.05, 130, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MEDIA_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_VERSION = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L15_C0", "label": "COMBINE_MEDIA =", "type": "assigned_variable", "loc": [15, 24], "level": 0, "parent": null, "vector": [14, 0, 0.1266, 0.0649, 0, 0.66, 0.1, 188, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "COMBINE_MEDIA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMBINE_MEDIA = {\n 'combined-%(LANGUAGE_CODE)s.js': (\n # See documentation why site_data can be useful:\n # http://code.google.com/p/app-engine-patch/wiki/MediaGenerator\n '.site_data.js',\n ),\n 'combined-%(LANGUAGE_DIR)s.css': (\n 'global/look.css',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "label": "if", "type": "if", "loc": [27, 29], "level": 0, "parent": null, "vector": [4, 0, 0.1818, 0.0195, 0, 0.66, 0.15, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if on_production_server:\n DEFAULT_FROM_EMAIL = 'drkkojima@gmail.com'\n SERVER_EMAIL = DEFAULT_FROM_EMAIL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L28_C4", "label": "DEFAULT_FROM_EMAIL =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "vector": [14, 1, 0.1818, 0.0065, 1, 0.36, 0.0, 396, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DEFAULT_FROM_EMAIL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " DEFAULT_FROM_EMAIL = 'drkkojima@gmail.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L29_C4", "label": "SERVER_EMAIL =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "vector": [14, 1, 0.1883, 0.0065, 1, 0.36, 1.0, 177, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SERVER_EMAIL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SERVER_EMAIL = DEFAULT_FROM_EMAIL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L32_C0", "label": "SECRET_KEY =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.2078, 0.0065, 0, 0.66, 0.2, 112, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SECRET_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SECRET_KEY = '19720403'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L42_C0", "label": "USE_I18N =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0065, 0, 0.66, 0.25, 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_170:Assign_L43_C0", "label": "TIME_ZONE =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.2792, 0.0065, 0, 0.66, 0.3, 774, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TIME_ZONE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TIME_ZONE = 'Asia/Tokyo'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L44_C0", "label": "LANGUAGE_CODE =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.2857, 0.0065, 0, 0.66, 0.35, 450, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LANGUAGE_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LANGUAGE_CODE = 'en'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L47_C0", "label": "LANGUAGES =", "type": "assigned_variable", "loc": [47, 51], "level": 0, "parent": null, "vector": [14, 0, 0.3182, 0.0325, 0, 0.66, 0.4, 598, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "LANGUAGES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LANGUAGES = (\n# ('de', 'German'),\n ('en', 'English'),\n# ('ja', 'Japanese'),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L53_C0", "label": "TEMPLATE_CONTEXT_PROCESSORS =", "type": "assigned_variable", "loc": [53, 58], "level": 0, "parent": null, "vector": [14, 0, 0.3604, 0.039, 0, 0.66, 0.45, 470, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "TEMPLATE_CONTEXT_PROCESSORS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_CONTEXT_PROCESSORS = (\n 'django.core.context_processors.auth',\n 'django.core.context_processors.media',\n 'django.core.context_processors.request',\n 'django.core.context_processors.i18n',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L60_C0", "label": "MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [60, 77], "level": 0, "parent": null, "vector": [14, 0, 0.4448, 0.1169, 0, 0.66, 0.5, 641, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIDDLEWARE_CLASSES = (\n 'ragendja.middleware.ErrorMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n\n 'httpauth.Middleware',\n\n # Django authentication\n 'django.contrib.auth.middleware.AuthenticationMiddleware',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L85_C0", "label": "LOGIN_URL =", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.5519, 0.0065, 0, 0.66, 0.55, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOGIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGIN_URL = '/account/login/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L86_C0", "label": "LOGOUT_URL =", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.5584, 0.0065, 0, 0.66, 0.6, 834, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOGOUT_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGOUT_URL = '/account/logout/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L87_C0", "label": "LOGIN_REDIRECT_URL =", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.5649, 0.0065, 0, 0.66, 0.65, 901, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOGIN_REDIRECT_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGIN_REDIRECT_URL = '/haco/report/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L89_C0", "label": "INSTALLED_APPS =", "type": "assigned_variable", "loc": [89, 114], "level": 0, "parent": null, "vector": [14, 0, 0.6591, 0.1688, 0, 0.66, 0.7, 648, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INSTALLED_APPS = (\n # Add jquery support (app is in \"common\" folder). This automatically\n # adds jquery to your COMBINE_MEDIA['combined-%(LANGUAGE_CODE)s.js']\n # Note: the order of your INSTALLED_APPS specifies the order in which\n # your app-specific media files get combined, so jquery should normally\n # come first.\n 'jquery',\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L117_C0", "label": "IGNORE_APP_SETTINGS =", "type": "assigned_variable", "loc": [117, 122], "level": 0, "parent": null, "vector": [14, 0, 0.776, 0.039, 0, 0.66, 0.75, 686, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "IGNORE_APP_SETTINGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "IGNORE_APP_SETTINGS = IGNORE_APP_URLSAUTO = (\n # Example:\n # 'django.contrib.admin',\n # 'django.contrib.auth',\n # 'yetanotherapp',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L125_C0", "label": "DATABASE_OPTIONS =", "type": "assigned_variable", "loc": [125, 142], "level": 0, "parent": null, "vector": [14, 0, 0.8669, 0.1169, 0, 0.66, 0.8, 18, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "DATABASE_OPTIONS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_OPTIONS = {\n # Override remoteapi handler's path (default: '/remote_api').\n # This is a good idea, so you make it not too easy for hackers. ;)\n # Don't forget to also update your app.yaml!\n #'remote_url': '/remote-secret-url',\n\n # !!!Normally, the following settings should not be used!!!\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Import_L144_C0", "label": "sys import sys, os", "type": "import", "loc": [144, 144], "level": 0, "parent": null, "vector": [1, 0, 0.9351, 0.0065, 0, 0.66, 0.85, 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_170:Assign_L145_C0", "label": "rootdir = dirname()", "type": "assigned_variable", "loc": [145, 145], "level": 0, "parent": null, "vector": [14, 0, 0.9416, 0.0065, 0, 0.66, 0.9, 237, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "rootdir", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "rootdir = os.path.dirname(__file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:Expr_L146_C0", "label": "insert()", "type": "expression", "loc": [146, 146], "level": 0, "parent": null, "vector": [8, 0, 0.9481, 0.0065, 0, 0.66, 0.95, 368, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": "sys.path.insert(0, os.path.join(rootdir, \"lib\")) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_170:ImportFrom_L149_C0", "label": "from ragendja.settings_post import *", "type": "import", "loc": [149, 149], "level": 0, "parent": null, "vector": [1, 0, 0.9675, 0.0065, 0, 0.66, 1.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_post import *"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_170:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_170:Assign_L29_C4"}] |
from ragendja.settings_post import settings
settings.add_app_media('combined-%(LANGUAGE_CODE)s.js',
'myapp/code.js',
)
| ajibawa-2023/Python-Code-Large/train/row_171 | 2 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_171:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_post import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_171:Expr_L2_C0", "label": "add_app_media()", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.75, 0, 0.66, 1.0, 197, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_app_media", "arg_names": [], "import_names": [], "rhs_call_name": "add_app_media", "annotation": ""}, "snippet": "settings.add_app_media('combined-%(LANGUAGE_CODE)s.js',\n 'myapp/code.js',\n)"}] | [] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^person/', include('myapp.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_172 | 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_172:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.1667, 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_172:Assign_L4_C0", "label": "rootpatterns = patterns()", "type": "assigned_variable", "loc": [4, 6], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.5, 0, 0.66, 1.0, 319, 3, 2, 0, 0, 75, 10, 2], "semantic": {"name": "rootpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "rootpatterns = patterns('',\n (r'^person/', include('myapp.urls')),\n)"}] | [] |
# -*- coding: utf-8 -*-
from django.db.models import permalink, signals
from google.appengine.ext import db
from ragendja.dbutils import cleanup_relations
class Person(db.Model):
"""Basic user profile with personal details."""
first_name = db.StringProperty(required=True)
last_name = db.StringProperty(required=True)
def __unicode__(self):
return '%s %s' % (self.first_name, self.last_name)
@permalink
def get_absolute_url(self):
return ('myapp.views.show_person', (), {'key': self.key()})
signals.pre_delete.connect(cleanup_relations, sender=Person)
class File(db.Model):
owner = db.ReferenceProperty(Person, required=True, collection_name='file_set')
name = db.StringProperty(required=True)
file = db.BlobProperty(required=True)
@permalink
def get_absolute_url(self):
return ('myapp.views.download_file', (), {'key': self.key(),
'name': self.name})
def __unicode__(self):
return u'File: %s' % self.name
class Contract(db.Model):
employer = db.ReferenceProperty(Person, required=True, collection_name='employee_contract_set')
employee = db.ReferenceProperty(Person, required=True, collection_name='employer_contract_set')
start_date = db.DateTimeProperty()
end_date = db.DateTimeProperty()
| ajibawa-2023/Python-Code-Large/train/row_173 | 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_173:ImportFrom_L2_C0", "label": "from django.db.models import permalink, signals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0541, 0.027, 0, 0.66, 0.0, 680, 0, 2, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["permalink", "signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import permalink, signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0811, 0.027, 0, 0.66, 0.1667, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:ImportFrom_L4_C0", "label": "from ragendja.dbutils import cleanup_relations", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1081, 0.027, 0, 0.66, 0.3333, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["cleanup_relations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import cleanup_relations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "label": "Person", "type": "class", "loc": [6, 16], "level": 0, "parent": null, "vector": [3, 0, 0.2973, 0.2973, 0, 0.66, 0.5, 362, 0, 2, 0, 0, 697, 0, 3], "semantic": {"name": "Person", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Person(db.Model):\n \"\"\"Basic user profile with personal details.\"\"\"\n first_name = db.StringProperty(required=True)\n last_name = db.StringProperty(required=True)\n\n def __unicode__(self):\n return '%s %s' % (self.first_name, self.last_name)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Expr_L7_C4", "label": "expression", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "vector": [8, 1, 0.1892, 0.027, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Basic user profile with personal details.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L8_C4", "label": "first_name = StringProperty()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "vector": [14, 1, 0.2162, 0.027, 1, 0.93, 0.25, 185, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "first_name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " first_name = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L9_C4", "label": "last_name = StringProperty()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "vector": [14, 1, 0.2432, 0.027, 1, 0.93, 0.5, 578, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "last_name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " last_name = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L11_C4", "label": "__unicode__", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "vector": [2, 1, 0.3108, 0.0541, 1, 0.93, 0.75, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return '%s %s' % (self.first_name, self.last_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L11_C4", "vector": [13, 2, 0.3243, 0.027, 2, 0.93, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s %s' % (self.first_name, self.last_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L15_C4", "label": "get_absolute_url", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "vector": [2, 1, 0.4189, 0.0541, 1, 0.93, 1.0, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_absolute_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_absolute_url(self):\n return ('myapp.views.show_person', (), {'key': self.key()})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L16_C8", "label": "return", "type": "return", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L15_C4", "vector": [13, 2, 0.4324, 0.027, 2, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ('myapp.views.show_person', (), {'key': self.key()})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Expr_L18_C0", "label": "connect()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4865, 0.027, 0, 0.66, 0.6667, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "signals.pre_delete.connect(cleanup_relations, sender=Person)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "label": "File", "type": "class", "loc": [20, 31], "level": 0, "parent": null, "vector": [3, 0, 0.6892, 0.3243, 0, 0.66, 0.8333, 491, 0, 2, 0, 0, 697, 0, 4], "semantic": {"name": "File", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class File(db.Model):\n owner = db.ReferenceProperty(Person, required=True, collection_name='file_set')\n name = db.StringProperty(required=True)\n file = db.BlobProperty(required=True)\n\n @permalink\n def get_absolute_url(self):\n return ('myapp.views.download_file', (), {'key': self.key(),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L21_C4", "label": "owner = ReferenceProperty()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "vector": [14, 1, 0.5676, 0.027, 1, 0.62, 0.0, 365, 3, 3, 0, 0, 167, 10, 1], "semantic": {"name": "owner", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " owner = db.ReferenceProperty(Person, required=True, collection_name='file_set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L22_C4", "label": "name = StringProperty()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "vector": [14, 1, 0.5946, 0.027, 1, 0.62, 0.25, 57, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " name = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L23_C4", "label": "file = BlobProperty()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "vector": [14, 1, 0.6216, 0.027, 1, 0.62, 0.5, 107, 3, 1, 0, 0, 928, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "BlobProperty", "annotation": ""}, "snippet": " file = db.BlobProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L26_C4", "label": "get_absolute_url", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "vector": [2, 1, 0.7297, 0.0811, 1, 0.62, 0.75, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_absolute_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_absolute_url(self):\n return ('myapp.views.download_file', (), {'key': self.key(),\n 'name': self.name})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L26_C4", "vector": [13, 2, 0.7432, 0.0541, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ('myapp.views.download_file', (), {'key': self.key(),\n 'name': self.name})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L30_C4", "label": "__unicode__", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "vector": [2, 1, 0.8243, 0.0541, 1, 0.62, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return u'File: %s' % self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L31_C8", "label": "return", "type": "return", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L30_C4", "vector": [13, 2, 0.8378, 0.027, 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 u'File: %s' % self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "label": "Contract", "type": "class", "loc": [33, 37], "level": 0, "parent": null, "vector": [3, 0, 0.9459, 0.1351, 0, 0.66, 1.0, 729, 0, 0, 0, 0, 697, 0, 4], "semantic": {"name": "Contract", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Contract(db.Model):\n employer = db.ReferenceProperty(Person, required=True, collection_name='employee_contract_set')\n employee = db.ReferenceProperty(Person, required=True, collection_name='employer_contract_set')\n start_date = db.DateTimeProperty()\n end_date = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L34_C4", "label": "employer = ReferenceProperty()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "vector": [14, 1, 0.9189, 0.027, 1, 0.94, 0.0, 680, 3, 3, 0, 0, 167, 10, 1], "semantic": {"name": "employer", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " employer = db.ReferenceProperty(Person, required=True, collection_name='employee_contract_set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L35_C4", "label": "employee = ReferenceProperty()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "vector": [14, 1, 0.9459, 0.027, 1, 0.94, 0.3333, 70, 3, 3, 0, 0, 167, 10, 1], "semantic": {"name": "employee", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " employee = db.ReferenceProperty(Person, required=True, collection_name='employer_contract_set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L36_C4", "label": "start_date = DateTimeProperty()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "vector": [14, 1, 0.973, 0.027, 1, 0.94, 0.6667, 89, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "start_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " start_date = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L37_C4", "label": "end_date = DateTimeProperty()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "vector": [14, 1, 1.0, 0.027, 1, 0.94, 1.0, 843, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "end_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " end_date = db.DateTimeProperty()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Return_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_173:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_173:Assign_L37_C4"}] |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import ugettext_lazy as _, ugettext as __
from myapp.models import Person, File, Contract
from ragendja.auth.models import UserTraits
from ragendja.forms import FormWithSets, FormSetField
from registration.forms import RegistrationForm, RegistrationFormUniqueEmail
from registration.models import RegistrationProfile
class UserRegistrationForm(forms.ModelForm):
username = forms.RegexField(regex=r'^\w+$', max_length=30,
label=_(u'Username'))
email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),
label=_(u'Email address'))
city =forms.RegexField(regex=r'^\w+$', max_length=30,
label=_(u'city'))
password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'Password'))
password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'Password (again)'))
def clean_username(self):
"""
Validate that the username is alphanumeric and is not already
in use.
"""
user = User.get_by_key_name("key_"+self.cleaned_data['username'].lower())
if user and user.is_active:
raise forms.ValidationError(__(u'This username is already taken. Please choose another.'))
return self.cleaned_data['username']
def clean(self):
"""
Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field.
"""
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(__(u'You must type the same password each time'))
return self.cleaned_data
def save(self, domain_override=""):
"""
Create the new ``User`` and ``RegistrationProfile``, and
returns the ``User``.
This is essentially a light wrapper around
``RegistrationProfile.objects.create_inactive_user()``,
feeding it the form data and a profile callback (see the
documentation on ``create_inactive_user()`` for details) if
supplied.
"""
new_user = RegistrationProfile.objects.create_inactive_user(
username=self.cleaned_data['username'],
password=self.cleaned_data['password1'],
email=self.cleaned_data['email'],
domain_override=domain_override)
self.instance = new_user
return super(UserRegistrationForm, self).save()
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
email = self.cleaned_data['email'].lower()
if User.all().filter('email =', email).filter(
'is_active =', True).count(1):
raise forms.ValidationError(__(u'This email address is already in use. Please supply a different email address.'))
return email
class Meta:
model = User
exclude = UserTraits.properties().keys()
class FileForm(forms.ModelForm):
name = forms.CharField(required=False, label='Name (set automatically)')
def clean(self):
file = self.cleaned_data.get('file')
if not self.cleaned_data.get('name'):
if isinstance(file, UploadedFile):
self.cleaned_data['name'] = file.name
else:
del self.cleaned_data['name']
return self.cleaned_data
class Meta:
model = File
class PersonForm(forms.ModelForm):
files = FormSetField(File, form=FileForm, exclude='content_type')
employers = FormSetField(Contract, fk_name='employee')
employees = FormSetField(Contract, fk_name='employer')
class Meta:
model = Person
PersonForm = FormWithSets(PersonForm)
| ajibawa-2023/Python-Code-Large/train/row_174 | 55 | 108 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L2_C0", "label": "from django import forms", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0093, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L3_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0093, 0, 0.66, 0.0833, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L4_C0", "label": "from django.core.files.uploadedfile import UploadedFile", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0093, 0, 0.66, 0.1667, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.core.files.uploadedfile", "arg_names": [], "import_names": ["UploadedFile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.files.uploadedfile import UploadedFile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L5_C0", "label": "from django.utils.translation import _, __", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0463, 0.0093, 0, 0.66, 0.25, 389, 0, 2, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_", "__"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _, ugettext as __"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L6_C0", "label": "from myapp.models import Person, File, Contract", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0093, 0, 0.66, 0.3333, 0, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "myapp.models", "arg_names": [], "import_names": ["Person", "File", "Contract"], "rhs_call_name": "", "annotation": ""}, "snippet": "from myapp.models import Person, File, Contract"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L7_C0", "label": "from ragendja.auth.models import UserTraits", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0648, 0.0093, 0, 0.66, 0.4167, 7, 0, 1, 0, 0, 7, 0, 0], "semantic": {"name": "ragendja.auth.models", "arg_names": [], "import_names": ["UserTraits"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.models import UserTraits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L8_C0", "label": "from ragendja.forms import FormWithSets, FormSetField", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.0093, 0, 0.66, 0.5, 305, 0, 2, 0, 0, 305, 0, 0], "semantic": {"name": "ragendja.forms", "arg_names": [], "import_names": ["FormWithSets", "FormSetField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.forms import FormWithSets, FormSetField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L9_C0", "label": "from registration.forms import RegistrationForm, RegistrationFormUniqueEmail", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0093, 0, 0.66, 0.5833, 823, 0, 2, 0, 0, 823, 0, 0], "semantic": {"name": "registration.forms", "arg_names": [], "import_names": ["RegistrationForm", "RegistrationFormUniqueEmail"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.forms import RegistrationForm, RegistrationFormUniqueEmail"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ImportFrom_L10_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0926, 0.0093, 0, 0.66, 0.6667, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "label": "UserRegistrationForm", "type": "class", "loc": [12, 84], "level": 0, "parent": null, "vector": [3, 0, 0.4444, 0.6759, 0, 0.66, 0.75, 677, 0, 4, 0, 0, 445, 0, 32], "semantic": {"name": "UserRegistrationForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UserRegistrationForm(forms.ModelForm):\n username = forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'Username'))\n email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),\n label=_(u'Email address')) \n\n city =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'city'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L13_C4", "label": "username = RegexField()", "type": "assigned_variable", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [14, 1, 0.125, 0.0185, 1, 0.24, 0.0, 718, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " username = forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'Username'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L15_C4", "label": "email = EmailField()", "type": "assigned_variable", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [14, 1, 0.1435, 0.0185, 1, 0.24, 0.1111, 413, 3, 2, 0, 0, 767, 10, 4], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "EmailField", "annotation": ""}, "snippet": " email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),\n label=_(u'Email address')) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L18_C4", "label": "city = RegexField()", "type": "assigned_variable", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [14, 1, 0.1713, 0.0185, 1, 0.24, 0.2222, 825, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "city", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " city =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'city'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L21_C4", "label": "password1 = CharField()", "type": "assigned_variable", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [14, 1, 0.1991, 0.0185, 1, 0.24, 0.3333, 374, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password1", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L23_C4", "label": "password2 = CharField()", "type": "assigned_variable", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [14, 1, 0.2176, 0.0185, 1, 0.24, 0.4444, 314, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password2", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password (again)'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "label": "clean_username", "type": "function", "loc": [26, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [2, 1, 0.2824, 0.0926, 1, 0.24, 0.5556, 629, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "clean_username", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_username(self):\n \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\"\n user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())\n if user and user.is_active:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L27_C8", "label": "expression", "type": "expression", "loc": [27, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "vector": [8, 2, 0.2685, 0.0463, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L32_C8", "label": "user = get_by_key_name()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "vector": [14, 2, 0.2963, 0.0093, 2, 0.33, 0.3333, 503, 3, 1, 0, 0, 899, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L33_C8", "label": "if", "type": "if", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "vector": [4, 2, 0.3102, 0.0185, 2, 0.33, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user and user.is_active:\n raise forms.ValidationError(__(u'This username is already taken. Please choose another.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "vector": [13, 2, 0.3241, 0.0093, 2, 0.33, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data['username']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "label": "clean", "type": "function", "loc": [37, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [2, 1, 0.3935, 0.1111, 1, 0.24, 0.6667, 517, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n \"\"\"\n Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L38_C8", "label": "expression", "type": "expression", "loc": [38, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "vector": [8, 2, 0.3796, 0.0648, 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 Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L45_C8", "label": "if", "type": "if", "loc": [45, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "vector": [4, 2, 0.4259, 0.0278, 2, 0.91, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(__(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L46_C12", "label": "if", "type": "if", "loc": [46, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:If_L45_C8", "vector": [4, 3, 0.4306, 0.0185, 3, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(__(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "vector": [13, 2, 0.4444, 0.0093, 2, 0.91, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "label": "save", "type": "function", "loc": [50, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [2, 1, 0.5463, 0.1759, 1, 0.24, 0.7778, 928, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "save", "arg_names": ["self", "domain_override"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, domain_override=\"\"):\n \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User``.\n \n This is essentially a light wrapper around\n ``RegistrationProfile.objects.create_inactive_user()``,\n feeding it the form data and a profile callback (see the"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L51_C8", "label": "expression", "type": "expression", "loc": [51, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "vector": [8, 2, 0.5185, 0.1019, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User``.\n \n This is essentially a light wrapper around\n ``RegistrationProfile.objects.create_inactive_user()``,\n feeding it the form data and a profile callback (see the\n documentation on ``create_inactive_user()`` for details) if"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L62_C8", "label": "new_user = create_inactive_user()", "type": "assigned_variable", "loc": [62, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "vector": [14, 2, 0.5926, 0.0463, 2, 0.45, 0.3333, 932, 3, 4, 0, 0, 686, 10, 1], "semantic": {"name": "new_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " new_user = RegistrationProfile.objects.create_inactive_user(\n username=self.cleaned_data['username'],\n password=self.cleaned_data['password1'],\n email=self.cleaned_data['email'],\n domain_override=domain_override)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L67_C8", "label": "self.instance =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "vector": [14, 2, 0.6204, 0.0093, 2, 0.45, 0.6667, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.instance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.instance = new_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "vector": [13, 2, 0.6296, 0.0093, 2, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(UserRegistrationForm, self).save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "label": "clean_email", "type": "function", "loc": [70, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [2, 1, 0.6944, 0.1019, 1, 0.24, 0.8889, 160, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "clean_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_email(self):\n \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\"\n email = self.cleaned_data['email'].lower()\n if User.all().filter('email =', email).filter("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L71_C8", "label": "expression", "type": "expression", "loc": [71, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "vector": [8, 2, 0.6759, 0.0463, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L76_C8", "label": "email = lower()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "vector": [14, 2, 0.7037, 0.0093, 2, 0.7, 0.3333, 413, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " email = self.cleaned_data['email'].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L77_C8", "label": "if", "type": "if", "loc": [77, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "vector": [4, 2, 0.7222, 0.0278, 2, 0.7, 0.6667, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if User.all().filter('email =', email).filter(\n 'is_active =', True).count(1):\n raise forms.ValidationError(__(u'This email address is already in use. Please supply a different email address.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L80_C8", "label": "return", "type": "return", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "vector": [13, 2, 0.7407, 0.0093, 2, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4", "label": "Meta", "type": "class", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "vector": [3, 1, 0.7685, 0.0278, 1, 0.24, 1.0, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n model = User\n exclude = UserTraits.properties().keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L83_C8", "label": "model =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4", "vector": [14, 2, 0.7685, 0.0093, 2, 0.89, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L84_C8", "label": "exclude = keys()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4", "vector": [14, 2, 0.7778, 0.0093, 2, 0.89, 1.0, 739, 3, 0, 0, 0, 204, 10, 2], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " exclude = UserTraits.properties().keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "label": "FileForm", "type": "class", "loc": [86, 99], "level": 0, "parent": null, "vector": [3, 0, 0.8565, 0.1296, 0, 0.66, 0.8333, 549, 0, 1, 0, 0, 445, 0, 4], "semantic": {"name": "FileForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileForm(forms.ModelForm):\n name = forms.CharField(required=False, label='Name (set automatically)')\n\n def clean(self):\n file = self.cleaned_data.get('file')\n if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L87_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "vector": [14, 1, 0.8056, 0.0093, 1, 0.41, 0.0, 57, 3, 2, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = forms.CharField(required=False, label='Name (set automatically)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "label": "clean", "type": "function", "loc": [89, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "vector": [2, 1, 0.8565, 0.0741, 1, 0.41, 0.5, 517, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n file = self.cleaned_data.get('file')\n if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']\n return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L90_C8", "label": "file = get()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "vector": [14, 2, 0.8333, 0.0093, 2, 0.62, 0.0, 107, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " file = self.cleaned_data.get('file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L91_C8", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "vector": [4, 2, 0.8611, 0.0463, 2, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:If_L92_C12", "label": "if", "type": "if", "loc": [92, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:If_L91_C8", "vector": [4, 3, 0.8657, 0.037, 3, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L93_C16", "label": "assign", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:If_L92_C12", "vector": [14, 4, 0.8611, 0.0093, 4, 0.32, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cleaned_data['name'] = file.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L96_C8", "label": "return", "type": "return", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "vector": [13, 2, 0.8889, 0.0093, 2, 0.62, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L98_C4", "label": "Meta", "type": "class", "loc": [98, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "vector": [3, 1, 0.912, 0.0185, 1, 0.41, 1.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n model = File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L99_C8", "label": "model =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L98_C4", "vector": [14, 2, 0.9167, 0.0093, 2, 0.75, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "label": "PersonForm", "type": "class", "loc": [101, 107], "level": 0, "parent": null, "vector": [3, 0, 0.963, 0.0648, 0, 0.66, 0.9167, 512, 0, 0, 0, 0, 445, 0, 3], "semantic": {"name": "PersonForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PersonForm(forms.ModelForm):\n files = FormSetField(File, form=FileForm, exclude='content_type')\n employers = FormSetField(Contract, fk_name='employee')\n employees = FormSetField(Contract, fk_name='employer')\n\n class Meta:\n model = Person"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L102_C4", "label": "files = FormSetField()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "vector": [14, 1, 0.9444, 0.0093, 1, 0.35, 0.0, 598, 3, 3, 0, 0, 780, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "FormSetField", "annotation": ""}, "snippet": " files = FormSetField(File, form=FileForm, exclude='content_type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L103_C4", "label": "employers = FormSetField()", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "vector": [14, 1, 0.9537, 0.0093, 1, 0.35, 0.3333, 917, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "employers", "arg_names": [], "import_names": [], "rhs_call_name": "FormSetField", "annotation": ""}, "snippet": " employers = FormSetField(Contract, fk_name='employee')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L104_C4", "label": "employees = FormSetField()", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "vector": [14, 1, 0.963, 0.0093, 1, 0.35, 0.6667, 670, 3, 2, 0, 0, 780, 10, 1], "semantic": {"name": "employees", "arg_names": [], "import_names": [], "rhs_call_name": "FormSetField", "annotation": ""}, "snippet": " employees = FormSetField(Contract, fk_name='employer')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L106_C4", "label": "Meta", "type": "class", "loc": [106, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "vector": [3, 1, 0.9861, 0.0185, 1, 0.35, 1.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n model = Person"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L107_C8", "label": "model =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L106_C4", "vector": [14, 2, 0.9907, 0.0093, 2, 0.31, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = Person"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L108_C0", "label": "PersonForm = FormWithSets()", "type": "assigned_variable", "loc": [108, 108], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0093, 0, 0.66, 1.0, 512, 3, 1, 0, 0, 650, 10, 1], "semantic": {"name": "PersonForm", "arg_names": [], "import_names": [], "rhs_call_name": "FormWithSets", "annotation": ""}, "snippet": "PersonForm = FormWithSets(PersonForm)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_174:If_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Return_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_174:ClassDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_174:Assign_L107_C8"}] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
urlpatterns = patterns('myapp.views',
(r'^create_admin_user$', 'create_admin_user'),
(r'^$', 'list_people'),
(r'^create/$', 'add_person'),
(r'^show/(?P<key>.+)$', 'show_person'),
(r'^edit/(?P<key>.+)$', 'edit_person'),
(r'^delete/(?P<key>.+)$', 'delete_person'),
(r'^download/(?P<key>.+)/(?P<name>.+)$', 'download_file'),
)
| ajibawa-2023/Python-Code-Large/train/row_175 | 2 | 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_175:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 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_175:Assign_L4_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [4, 12], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.75, 0, 0.66, 1.0, 990, 3, 8, 0, 0, 75, 10, 1], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('myapp.views',\n (r'^create_admin_user$', 'create_admin_user'),\n (r'^$', 'list_people'),\n (r'^create/$', 'add_person'),\n (r'^show/(?P<key>.+)$', 'show_person'),\n (r'^edit/(?P<key>.+)$', 'edit_person'),\n (r'^delete/(?P<key>.+)$', 'delete_person'),\n (r'^download/(?P<key>.+)/(?P<name>.+)$', 'download_file'),"}] | [] |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.http import HttpResponse, Http404
from django.views.generic.list_detail import object_list, object_detail
from django.views.generic.create_update import create_object, delete_object, \
update_object
from google.appengine.ext import db
from mimetypes import guess_type
from myapp.forms import PersonForm
from myapp.models import Contract, File, Person
from ragendja.dbutils import get_object_or_404
from ragendja.template import render_to_response
def list_people(request):
return object_list(request, Person.all(), paginate_by=10)
def show_person(request, key):
return object_detail(request, Person.all(), key)
def add_person(request):
return create_object(request, form_class=PersonForm,
post_save_redirect=reverse('myapp.views.show_person',
kwargs=dict(key='%(key)s')))
def edit_person(request, key):
return update_object(request, object_id=key, form_class=PersonForm)
def delete_person(request, key):
return delete_object(request, Person, object_id=key,
post_delete_redirect=reverse('myapp.views.list_people'))
def download_file(request, key, name):
file = get_object_or_404(File, key)
if file.name != name:
raise Http404('Could not find file with this name!')
return HttpResponse(file.file,
content_type=guess_type(file.name)[0] or 'application/octet-stream')
def create_admin_user(request):
user = User.get_by_key_name('admin')
if not user or user.username != 'admin' or not (user.is_active and
user.is_staff and user.is_superuser and
user.check_password('admin')):
user = User(key_name='admin', username='admin',
email='admin@localhost', first_name='Boss', last_name='Admin',
is_active=True, is_staff=True, is_superuser=True)
user.set_password('admin')
user.put()
return render_to_response(request, 'myapp/admin_created.html')
| ajibawa-2023/Python-Code-Large/train/row_176 | 32 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L2_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.02, 0, 0.66, 0.0, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L3_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.06, 0.02, 0, 0.66, 0.0588, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L4_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.02, 0, 0.66, 0.1176, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponse", "Http404"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponse, Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L5_C0", "label": "from django.views.generic.list_detail import object_list, object_detail", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.02, 0, 0.66, 0.1765, 992, 0, 2, 0, 0, 992, 0, 0], "semantic": {"name": "django.views.generic.list_detail", "arg_names": [], "import_names": ["object_list", "object_detail"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.list_detail import object_list, object_detail"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L6_C0", "label": "from django.views.generic.create_update import create_object, delete_object, update_object", "type": "import", "loc": [6, 7], "level": 0, "parent": null, "vector": [1, 0, 0.13, 0.04, 0, 0.66, 0.2353, 553, 0, 3, 0, 0, 553, 0, 0], "semantic": {"name": "django.views.generic.create_update", "arg_names": [], "import_names": ["create_object", "delete_object", "update_object"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.create_update import create_object, delete_object, \\\n update_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L8_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.16, 0.02, 0, 0.66, 0.2941, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L9_C0", "label": "from mimetypes import guess_type", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.18, 0.02, 0, 0.66, 0.3529, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["guess_type"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mimetypes import guess_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L10_C0", "label": "from myapp.forms import PersonForm", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.02, 0, 0.66, 0.4118, 524, 0, 1, 0, 0, 524, 0, 0], "semantic": {"name": "myapp.forms", "arg_names": [], "import_names": ["PersonForm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from myapp.forms import PersonForm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L11_C0", "label": "from myapp.models import Contract, File, Person", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.22, 0.02, 0, 0.66, 0.4706, 0, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "myapp.models", "arg_names": [], "import_names": ["Contract", "File", "Person"], "rhs_call_name": "", "annotation": ""}, "snippet": "from myapp.models import Contract, File, Person"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L12_C0", "label": "from ragendja.dbutils import get_object_or_404", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.24, 0.02, 0, 0.66, 0.5294, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["get_object_or_404"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import get_object_or_404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:ImportFrom_L13_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.26, 0.02, 0, 0.66, 0.5882, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L15_C0", "label": "list_people", "type": "function", "loc": [15, 16], "level": 0, "parent": null, "vector": [2, 0, 0.31, 0.04, 0, 0.66, 0.6471, 315, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "list_people", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_people(request):\n return object_list(request, Person.all(), paginate_by=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L15_C0", "vector": [13, 1, 0.32, 0.02, 1, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object_list(request, Person.all(), paginate_by=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L18_C0", "label": "show_person", "type": "function", "loc": [18, 19], "level": 0, "parent": null, "vector": [2, 0, 0.37, 0.04, 0, 0.66, 0.7059, 394, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "show_person", "arg_names": ["request", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show_person(request, key):\n return object_detail(request, Person.all(), key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L19_C4", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L18_C0", "vector": [13, 1, 0.38, 0.02, 1, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object_detail(request, Person.all(), key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L21_C0", "label": "add_person", "type": "function", "loc": [21, 24], "level": 0, "parent": null, "vector": [2, 0, 0.45, 0.08, 0, 0.66, 0.7647, 1, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "add_person", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def add_person(request):\n return create_object(request, form_class=PersonForm,\n post_save_redirect=reverse('myapp.views.show_person',\n kwargs=dict(key='%(key)s')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L21_C0", "vector": [13, 1, 0.46, 0.06, 1, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return create_object(request, form_class=PersonForm,\n post_save_redirect=reverse('myapp.views.show_person',\n kwargs=dict(key='%(key)s')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L26_C0", "label": "edit_person", "type": "function", "loc": [26, 27], "level": 0, "parent": null, "vector": [2, 0, 0.53, 0.04, 0, 0.66, 0.8235, 352, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "edit_person", "arg_names": ["request", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def edit_person(request, key):\n return update_object(request, object_id=key, form_class=PersonForm)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L27_C4", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L26_C0", "vector": [13, 1, 0.54, 0.02, 1, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return update_object(request, object_id=key, form_class=PersonForm)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L29_C0", "label": "delete_person", "type": "function", "loc": [29, 31], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.06, 0, 0.66, 0.8824, 190, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "delete_person", "arg_names": ["request", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delete_person(request, key):\n return delete_object(request, Person, object_id=key,\n post_delete_redirect=reverse('myapp.views.list_people'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L29_C0", "vector": [13, 1, 0.61, 0.04, 1, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return delete_object(request, Person, object_id=key,\n post_delete_redirect=reverse('myapp.views.list_people'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "label": "download_file", "type": "function", "loc": [33, 38], "level": 0, "parent": null, "vector": [2, 0, 0.71, 0.12, 0, 0.66, 0.9412, 129, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "download_file", "arg_names": ["request", "key", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download_file(request, key, name):\n file = get_object_or_404(File, key)\n if file.name != name:\n raise Http404('Could not find file with this name!')\n return HttpResponse(file.file,\n content_type=guess_type(file.name)[0] or 'application/octet-stream')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L34_C4", "label": "file = get_object_or_404()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "vector": [14, 1, 0.68, 0.02, 1, 0.05, 0.0, 107, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "get_object_or_404", "annotation": ""}, "snippet": " file = get_object_or_404(File, key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:If_L35_C4", "label": "if", "type": "if", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "vector": [4, 1, 0.71, 0.04, 1, 0.05, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file.name != name:\n raise Http404('Could not find file with this name!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "vector": [13, 1, 0.75, 0.04, 1, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(file.file,\n content_type=guess_type(file.name)[0] or 'application/octet-stream')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "label": "create_admin_user", "type": "function", "loc": [40, 50], "level": 0, "parent": null, "vector": [2, 0, 0.9, 0.22, 0, 0.66, 1.0, 18, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "create_admin_user", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_admin_user(request):\n user = User.get_by_key_name('admin')\n if not user or user.username != 'admin' or not (user.is_active and\n user.is_staff and user.is_superuser and\n user.check_password('admin')):\n user = User(key_name='admin', username='admin',\n email='admin@localhost', first_name='Boss', last_name='Admin',\n is_active=True, is_staff=True, is_superuser=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L41_C4", "label": "user = get_by_key_name()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "vector": [14, 1, 0.82, 0.02, 1, 0.18, 0.0, 503, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " user = User.get_by_key_name('admin')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "label": "if", "type": "if", "loc": [42, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "vector": [4, 1, 0.91, 0.16, 1, 0.18, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not user or user.username != 'admin' or not (user.is_active and\n user.is_staff and user.is_superuser and\n user.check_password('admin')):\n user = User(key_name='admin', username='admin',\n email='admin@localhost', first_name='Boss', last_name='Admin',\n is_active=True, is_staff=True, is_superuser=True)\n user.set_password('admin')\n user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L45_C8", "label": "user = User()", "type": "assigned_variable", "loc": [45, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "vector": [14, 2, 0.92, 0.06, 2, 0.61, 0.0, 503, 3, 8, 0, 0, 61, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "User", "annotation": ""}, "snippet": " user = User(key_name='admin', username='admin',\n email='admin@localhost', first_name='Boss', last_name='Admin',\n is_active=True, is_staff=True, is_superuser=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Expr_L48_C8", "label": "set_password()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "vector": [8, 2, 0.96, 0.02, 2, 0.61, 0.5, 803, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_password", "arg_names": [], "import_names": [], "rhs_call_name": "set_password", "annotation": ""}, "snippet": " user.set_password('admin')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Expr_L49_C8", "label": "put()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "vector": [8, 2, 0.98, 0.02, 2, 0.61, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "vector": [13, 1, 1.0, 0.02, 1, 0.18, 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(request, 'myapp/admin_created.html')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:If_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_176:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_176:Return_L50_C4"}] |
from django.contrib import admin
from myapp.models import Person, File
class FileInline(admin.TabularInline):
model = File
class PersonAdmin(admin.ModelAdmin):
inlines = (FileInline,)
list_display = ('first_name', 'last_name')
admin.site.register(Person, PersonAdmin)
| ajibawa-2023/Python-Code-Large/train/row_177 | 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_177:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_177:ImportFrom_L2_C0", "label": "from myapp.models import Person, File", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.25, 0, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "myapp.models", "arg_names": [], "import_names": ["Person", "File"], "rhs_call_name": "", "annotation": ""}, "snippet": "from myapp.models import Person, File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L4_C0", "label": "FileInline", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.4091, 0.1818, 0, 0.66, 0.5, 747, 0, 0, 0, 0, 24, 0, 0], "semantic": {"name": "FileInline", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileInline(admin.TabularInline):\n model = File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L5_C4", "label": "model =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L4_C0", "vector": [14, 1, 0.4545, 0.0909, 1, 0.6, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "label": "PersonAdmin", "type": "class", "loc": [7, 9], "level": 0, "parent": null, "vector": [3, 0, 0.7273, 0.2727, 0, 0.66, 0.75, 977, 0, 0, 0, 0, 823, 0, 0], "semantic": {"name": "PersonAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PersonAdmin(admin.ModelAdmin):\n inlines = (FileInline,)\n list_display = ('first_name', 'last_name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L8_C4", "label": "inlines =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "vector": [14, 1, 0.7273, 0.0909, 1, 0.48, 0.0, 353, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "inlines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inlines = (FileInline,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L9_C4", "label": "list_display =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "vector": [14, 1, 0.8182, 0.0909, 1, 0.48, 1.0, 489, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_display = ('first_name', 'last_name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_177:Expr_L11_C0", "label": "register()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 276, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "admin.site.register(Person, PersonAdmin)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_177:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_177:Assign_L9_C4"}] |
#!/usr/bin/env python
if __name__ == '__main__':
from common.appenginepatch.aecmd import setup_env
setup_env(manage_py_env=True)
# Recompile translation files
from mediautils.compilemessages import updatemessages
updatemessages()
# Generate compressed media files for manage.py update
import sys
from mediautils.generatemedia import updatemedia
if len(sys.argv) >= 2 and sys.argv[1] == 'update':
updatemedia(True)
import settings
from django.core.management import execute_manager
execute_manager(settings)
| ajibawa-2023/Python-Code-Large/train/row_178 | 12 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "label": "if", "type": "if", "loc": [2, 18], "level": 0, "parent": null, "vector": [4, 0, 0.5556, 0.9444, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n from common.appenginepatch.aecmd import setup_env\n setup_env(manage_py_env=True)\n\n # Recompile translation files\n from mediautils.compilemessages import updatemessages\n updatemessages()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L3_C4", "label": "from common.appenginepatch.aecmd import setup_env", "type": "import", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.1667, 0.0556, 1, 0.75, 0.0, 448, 0, 1, 0, 0, 448, 0, 0], "semantic": {"name": "common.appenginepatch.aecmd", "arg_names": [], "import_names": ["setup_env"], "rhs_call_name": "", "annotation": ""}, "snippet": " from common.appenginepatch.aecmd import setup_env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L4_C4", "label": "setup_env()", "type": "expression", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [8, 1, 0.2222, 0.0556, 1, 0.75, 0.1111, 193, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup_env", "arg_names": [], "import_names": [], "rhs_call_name": "setup_env", "annotation": ""}, "snippet": " setup_env(manage_py_env=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L7_C4", "label": "from mediautils.compilemessages import updatemessages", "type": "import", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.3889, 0.0556, 1, 0.75, 0.2222, 916, 0, 1, 0, 0, 916, 0, 0], "semantic": {"name": "mediautils.compilemessages", "arg_names": [], "import_names": ["updatemessages"], "rhs_call_name": "", "annotation": ""}, "snippet": " from mediautils.compilemessages import updatemessages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L8_C4", "label": "updatemessages()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [8, 1, 0.4444, 0.0556, 1, 0.75, 0.3333, 813, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "updatemessages", "arg_names": [], "import_names": [], "rhs_call_name": "updatemessages", "annotation": ""}, "snippet": " updatemessages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:Import_L11_C4", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.6111, 0.0556, 1, 0.75, 0.4444, 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_178:ImportFrom_L12_C4", "label": "from mediautils.generatemedia import updatemedia", "type": "import", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.6667, 0.0556, 1, 0.75, 0.5556, 547, 0, 1, 0, 0, 547, 0, 0], "semantic": {"name": "mediautils.generatemedia", "arg_names": [], "import_names": ["updatemedia"], "rhs_call_name": "", "annotation": ""}, "snippet": " from mediautils.generatemedia import updatemedia"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:If_L13_C4", "label": "if", "type": "if", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [4, 1, 0.75, 0.1111, 1, 0.75, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2 and sys.argv[1] == 'update':\n updatemedia(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L14_C8", "label": "updatemedia()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L13_C4", "vector": [8, 2, 0.7778, 0.0556, 2, 0.37, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updatemedia", "arg_names": [], "import_names": [], "rhs_call_name": "updatemedia", "annotation": ""}, "snippet": " updatemedia(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:Import_L16_C4", "label": "settings import settings", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.8889, 0.0556, 1, 0.75, 0.7778, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L17_C4", "label": "from django.core.management import execute_manager", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [1, 1, 0.9444, 0.0556, 1, 0.75, 0.8889, 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_178:Expr_L18_C4", "label": "execute_manager()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "vector": [8, 1, 1.0, 0.0556, 1, 0.75, 1.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_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:If_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Import_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_178:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_178:Expr_L18_C4"}] |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, RequestContext, loader
from django.views.generic.list_detail import object_list
from django.views.generic.simple import direct_to_template
from django.forms.formsets import formset_factory
from haco.models import *
from httpauth import *
from haco.jsTime import *
from haco.convert import *
import logging
import time
@login_required
def repo_all( request):
u = User.all()
u = u.filter( 'username', request.user.username)
u = u.filter( 'is_superuser', True)
if u.count() == 0:
return HttpResponse("you don't have the right to access this page")
else:
logging.info("repo_all")
if request.GET.has_key( 'delta'):
day = someday(int(request.GET['delta']))
else:
day = today()
q = HacoUser.all()
mes = "<html><head></head><body>"
for hacoUser in q:
user = hacoUser.user
mes += str(hacoUser.user.username)
mes +="<div>"
t_list = [-1.0] * 144
l_list = [-1.0] * 144
w_list = [-1.0] * 144
q =Haco.all()
q =q.order( 'pnum')
q =q.filter( 'user', user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
for h in q:
t_list[h.pnum] = h.temp
l_list[h.pnum] = h.light
w_list[h.pnum] = h.watt
mes += t_chart(t_list)
mes += l_chart(l_list)
mes += w_chart(w_list)
mes +="</div>"
mes +="</body></html>"
return HttpResponse( mes)
def t_chart( a_list):
chart = "<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=00b379&chxt=y&chxr=0,0,40&chds=0,40&chd=t:"
for data in a_list:
chart += str(data) +","
chart = chart[0:len(chart)-1]
chart += "&chtt=temperature&chg=4.17,25,1,4&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>"
return chart
def l_chart( a_list):
chart = "<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chxt =y&chxr=0,0,700&chds=0,700&chd=t:"
for data in a_list:
chart += str(data) +","
chart = chart[0:len(chart)-1]
chart += "&cht=lc&chtt=light&chg=4.17,14.3,1,2&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>"
return chart
def w_chart( a_list):
chart = "<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=009CD1&chxt=y&chxr=0,0,1000&chds=0,1000&chd=t:"
for data in a_list:
chart += str(data) +","
chart = chart[0:len(chart)-1]
chart += "&cht=lc&chtt=watt&chg=4.17,20.00,1,2&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>"
return chart
| ajibawa-2023/Python-Code-Large/train/row_180 | 57 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0108, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth.decorators", "arg_names": [], "import_names": ["login_required"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.decorators import login_required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L4_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.043, 0.0108, 0, 0.66, 0.0556, 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_180:ImportFrom_L5_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0538, 0.0108, 0, 0.66, 0.1111, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L6_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0108, 0, 0.66, 0.1667, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L7_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0753, 0.0108, 0, 0.66, 0.2222, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L8_C0", "label": "from django.template import Context, RequestContext, loader", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.086, 0.0108, 0, 0.66, 0.2778, 213, 0, 3, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Context", "RequestContext", "loader"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Context, RequestContext, loader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L9_C0", "label": "from django.views.generic.list_detail import object_list", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0108, 0, 0.66, 0.3333, 992, 0, 1, 0, 0, 992, 0, 0], "semantic": {"name": "django.views.generic.list_detail", "arg_names": [], "import_names": ["object_list"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.list_detail import object_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L10_C0", "label": "from django.views.generic.simple import direct_to_template", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1075, 0.0108, 0, 0.66, 0.3889, 956, 0, 1, 0, 0, 956, 0, 0], "semantic": {"name": "django.views.generic.simple", "arg_names": [], "import_names": ["direct_to_template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.simple import direct_to_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L11_C0", "label": "from django.forms.formsets import formset_factory", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1183, 0.0108, 0, 0.66, 0.4444, 42, 0, 1, 0, 0, 42, 0, 0], "semantic": {"name": "django.forms.formsets", "arg_names": [], "import_names": ["formset_factory"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.formsets import formset_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L12_C0", "label": "from haco.models import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.129, 0.0108, 0, 0.66, 0.5, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L13_C0", "label": "from httpauth import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1398, 0.0108, 0, 0.66, 0.5556, 707, 0, 1, 0, 0, 707, 0, 0], "semantic": {"name": "httpauth", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from httpauth import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L14_C0", "label": "from haco.jsTime import *", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1505, 0.0108, 0, 0.66, 0.6111, 615, 0, 1, 0, 0, 615, 0, 0], "semantic": {"name": "haco.jsTime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.jsTime import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:ImportFrom_L15_C0", "label": "from haco.convert import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1613, 0.0108, 0, 0.66, 0.6667, 668, 0, 1, 0, 0, 668, 0, 0], "semantic": {"name": "haco.convert", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.convert import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Import_L16_C0", "label": "logging import logging", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.172, 0.0108, 0, 0.66, 0.7222, 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_180:Import_L17_C0", "label": "time import time", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1828, 0.0108, 0, 0.66, 0.7778, 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_180:FunctionDef_L20_C0", "label": "repo_all", "type": "function", "loc": [20, 64], "level": 0, "parent": null, "vector": [2, 0, 0.4516, 0.4839, 0, 0.66, 0.8333, 559, 0, 1, 1, 0, 0, 0, 21], "semantic": {"name": "repo_all", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def repo_all( request):\n\n u = User.all()\n u = u.filter( 'username', request.user.username)\n u = u.filter( 'is_superuser', True)\n\n if u.count() == 0:\n return HttpResponse(\"you don't have the right to access this page\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L22_C4", "label": "u = all()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "vector": [14, 1, 0.2366, 0.0108, 1, 0.01, 0.0, 609, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " u = User.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L23_C4", "label": "u = filter()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "vector": [14, 1, 0.2473, 0.0108, 1, 0.01, 0.3333, 609, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " u = u.filter( 'username', request.user.username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L24_C4", "label": "u = filter()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "vector": [14, 1, 0.2581, 0.0108, 1, 0.01, 0.6667, 609, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " u = u.filter( 'is_superuser', True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "label": "if", "type": "if", "loc": [26, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "vector": [4, 1, 0.4839, 0.4194, 1, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if u.count() == 0:\n return HttpResponse(\"you don't have the right to access this page\")\n else:\n logging.info(\"repo_all\")\n if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [13, 2, 0.2903, 0.0108, 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 HttpResponse(\"you don't have the right to access this page\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Expr_L29_C8", "label": "info()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [8, 2, 0.3118, 0.0108, 2, 0.09, 0.1667, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info(\"repo_all\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8", "label": "if", "type": "if", "loc": [30, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [4, 2, 0.3387, 0.043, 2, 0.09, 0.3333, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L31_C12", "label": "day = someday()", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8", "vector": [14, 3, 0.3333, 0.0108, 3, 0.13, 0.0, 878, 3, 1, 0, 0, 934, 10, 2], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(int(request.GET['delta']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L33_C12", "label": "day = today()", "type": "assigned_variable", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8", "vector": [14, 3, 0.3548, 0.0108, 3, 0.13, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L35_C8", "label": "q = all()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [14, 2, 0.3763, 0.0108, 2, 0.09, 0.5, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q = HacoUser.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L37_C8", "label": "mes =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [14, 2, 0.3978, 0.0108, 2, 0.09, 0.6667, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mes = \"<html><head></head><body>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "label": "for hacoUser", "type": "for", "loc": [38, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [6, 2, 0.5376, 0.2688, 2, 0.09, 0.8333, 496, 2, 0, 0, 0, 0, 0, 9], "semantic": {"name": "hacoUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for hacoUser in q:\n user = hacoUser.user\n \n mes += str(hacoUser.user.username)\n mes +=\"<div>\"\n t_list = [-1.0] * 144\n l_list = [-1.0] * 144\n w_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L39_C12", "label": "user =", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.4194, 0.0108, 3, 0.63, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = hacoUser.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L43_C12", "label": "t_list =", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.4624, 0.0108, 3, 0.63, 0.1111, 192, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L44_C12", "label": "l_list =", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.4731, 0.0108, 3, 0.63, 0.2222, 536, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L45_C12", "label": "w_list =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.4839, 0.0108, 3, 0.63, 0.3333, 821, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L47_C12", "label": "q = all()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.5054, 0.0108, 3, 0.63, 0.4444, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L48_C12", "label": "q = order()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.5161, 0.0108, 3, 0.63, 0.5556, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L49_C12", "label": "q = filter()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.5269, 0.0108, 3, 0.63, 0.6667, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L50_C12", "label": "q = filter()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.5376, 0.0108, 3, 0.63, 0.7778, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L51_C12", "label": "q = order()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [14, 3, 0.5484, 0.0108, 3, 0.63, 0.8889, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "label": "for h", "type": "for", "loc": [53, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "vector": [6, 3, 0.586, 0.043, 3, 0.63, 1.0, 686, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in q:\n t_list[h.pnum] = h.temp\n l_list[h.pnum] = h.light\n w_list[h.pnum] = h.watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L54_C16", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "vector": [14, 4, 0.5806, 0.0108, 4, 0.46, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_list[h.pnum] = h.temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L55_C16", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "vector": [14, 4, 0.5914, 0.0108, 4, 0.46, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l_list[h.pnum] = h.light"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L56_C16", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "vector": [14, 4, 0.6022, 0.0108, 4, 0.46, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_list[h.pnum] = h.watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "vector": [13, 2, 0.6882, 0.0108, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse( mes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "label": "t_chart", "type": "function", "loc": [66, 73], "level": 0, "parent": null, "vector": [2, 0, 0.7473, 0.086, 0, 0.66, 0.8889, 439, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "t_chart", "arg_names": ["a_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def t_chart( a_list):\n chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=00b379&chxt=y&chxr=0,0,40&chds=0,40&chd=t:\"\n for data in a_list:\n chart += str(data) +\",\"\n chart = chart[0:len(chart)-1]\n chart += \"&chtt=temperature&chg=4.17,25,1,4&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>\"\n\n return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L67_C4", "label": "chart =", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "vector": [14, 1, 0.7204, 0.0108, 1, 0.86, 0.0, 930, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=00b379&chxt=y&chxr=0,0,40&chds=0,40&chd=t:\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:For_L68_C4", "label": "for data", "type": "for", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "vector": [6, 1, 0.7366, 0.0215, 1, 0.86, 0.3333, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in a_list:\n chart += str(data) +\",\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L70_C4", "label": "chart =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "vector": [14, 1, 0.7527, 0.0108, 1, 0.86, 0.6667, 930, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = chart[0:len(chart)-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "vector": [13, 1, 0.7849, 0.0108, 1, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "label": "l_chart", "type": "function", "loc": [75, 81], "level": 0, "parent": null, "vector": [2, 0, 0.8387, 0.0753, 0, 0.66, 0.9444, 682, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "l_chart", "arg_names": ["a_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def l_chart( a_list):\n chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chxt\t\t=y&chxr=0,0,700&chds=0,700&chd=t:\"\n for data in a_list:\n chart += str(data) +\",\"\n chart = chart[0:len(chart)-1]\n chart += \"&cht=lc&chtt=light&chg=4.17,14.3,1,2&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>\"\n return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L76_C4", "label": "chart =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "vector": [14, 1, 0.8172, 0.0108, 1, 0.75, 0.0, 930, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chxt\t\t=y&chxr=0,0,700&chds=0,700&chd=t:\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:For_L77_C4", "label": "for data", "type": "for", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "vector": [6, 1, 0.8333, 0.0215, 1, 0.75, 0.3333, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in a_list:\n chart += str(data) +\",\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L79_C4", "label": "chart =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "vector": [14, 1, 0.8495, 0.0108, 1, 0.75, 0.6667, 930, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = chart[0:len(chart)-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "vector": [13, 1, 0.871, 0.0108, 1, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "label": "w_chart", "type": "function", "loc": [83, 90], "level": 0, "parent": null, "vector": [2, 0, 0.9301, 0.086, 0, 0.66, 1.0, 821, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "w_chart", "arg_names": ["a_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def w_chart( a_list):\n chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=009CD1&chxt=y&chxr=0,0,1000&chds=0,1000&chd=t:\"\n for data in a_list:\n chart += str(data) +\",\"\n chart = chart[0:len(chart)-1]\n chart += \"&cht=lc&chtt=watt&chg=4.17,20.00,1,2&chl=0|||||1|||||2|||||3|||||4|||||5|||||6|||||7|||||8|||||9|||||10|||||11|||||12|||||13|||||14|||||15|||||16|||||17|||||18|||||19|||||20|||||21|||||22|||||23|||||'>\"\n\n return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L84_C4", "label": "chart =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "vector": [14, 1, 0.9032, 0.0108, 1, 0.81, 0.0, 930, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = \"<img src='http://chart.apis.google.com/chart?chs=750x185&cht=lc&chco=009CD1&chxt=y&chxr=0,0,1000&chds=0,1000&chd=t:\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:For_L85_C4", "label": "for data", "type": "for", "loc": [85, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "vector": [6, 1, 0.9194, 0.0215, 1, 0.81, 0.3333, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in a_list:\n chart += str(data) +\",\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L87_C4", "label": "chart =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "vector": [14, 1, 0.9355, 0.0108, 1, 0.81, 0.6667, 930, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = chart[0:len(chart)-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L90_C4", "label": "return", "type": "return", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "vector": [13, 1, 0.9677, 0.0108, 1, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return chart"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:For_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:For_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:For_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:For_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_180:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_180:Return_L90_C4"}] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
from django.contrib.auth.models import User
#from datetime import *
import datetime
class HacoUser( db.Model):
user =db.ReferenceProperty( User)
zip =db.StringProperty()
twitterID =db.StringProperty()
address =db.StringProperty()
geoPt =db.GeoPtProperty()
class Haco( db.Model):
user =db.ReferenceProperty( User)
username =db.StringProperty( str(User))
pnum =db.IntegerProperty()
temp =db.FloatProperty()
light =db.FloatProperty()
watt =db.FloatProperty()
date =db.DateTimeProperty()
timestamp = db.DateTimeProperty()
class Mention( db.Model):
postUser =db.StringProperty()
postText =db.StringProperty()
postDate =db.DateTimeProperty()
| ajibawa-2023/Python-Code-Large/train/row_181 | 23 | 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_181:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0357, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.0357, 0, 0.66, 0.1667, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:ImportFrom_L4_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0357, 0, 0.66, 0.3333, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Import_L6_C0", "label": "datetime import datetime", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2143, 0.0357, 0, 0.66, 0.5, 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_181:ClassDef_L8_C0", "label": "HacoUser", "type": "class", "loc": [8, 13], "level": 0, "parent": null, "vector": [3, 0, 0.375, 0.2143, 0, 0.66, 0.6667, 181, 0, 0, 0, 0, 697, 0, 5], "semantic": {"name": "HacoUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HacoUser( db.Model):\n user =db.ReferenceProperty( User)\n zip =db.StringProperty()\n twitterID =db.StringProperty()\n address =db.StringProperty()\n geoPt =db.GeoPtProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L9_C4", "label": "user = ReferenceProperty()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "vector": [14, 1, 0.3214, 0.0357, 1, 0.87, 0.0, 503, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " user =db.ReferenceProperty( User)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L10_C4", "label": "zip = StringProperty()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "vector": [14, 1, 0.3571, 0.0357, 1, 0.87, 0.25, 814, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "zip", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " zip =db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L11_C4", "label": "twitterID = StringProperty()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "vector": [14, 1, 0.3929, 0.0357, 1, 0.87, 0.5, 954, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "twitterID", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " twitterID =db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L12_C4", "label": "address = StringProperty()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "vector": [14, 1, 0.4286, 0.0357, 1, 0.87, 0.75, 666, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "address", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " address =db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L13_C4", "label": "geoPt = GeoPtProperty()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "vector": [14, 1, 0.4643, 0.0357, 1, 0.87, 1.0, 656, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "geoPt", "arg_names": [], "import_names": [], "rhs_call_name": "GeoPtProperty", "annotation": ""}, "snippet": " geoPt =db.GeoPtProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "label": "Haco", "type": "class", "loc": [15, 23], "level": 0, "parent": null, "vector": [3, 0, 0.6786, 0.3214, 0, 0.66, 0.8333, 425, 0, 0, 0, 0, 697, 0, 9], "semantic": {"name": "Haco", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Haco( db.Model):\n user =db.ReferenceProperty( User)\n username =db.StringProperty( str(User))\n pnum =db.IntegerProperty()\n temp =db.FloatProperty()\n light =db.FloatProperty()\n watt =db.FloatProperty()\n date =db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L16_C4", "label": "user = ReferenceProperty()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.5714, 0.0357, 1, 0.1, 0.0, 503, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " user =db.ReferenceProperty( User)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L17_C4", "label": "username = StringProperty()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.6071, 0.0357, 1, 0.1, 0.1429, 718, 3, 1, 0, 0, 882, 10, 2], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " username =db.StringProperty( str(User))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L18_C4", "label": "pnum = IntegerProperty()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.6429, 0.0357, 1, 0.1, 0.2857, 112, 3, 0, 0, 0, 703, 10, 1], "semantic": {"name": "pnum", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " pnum =db.IntegerProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L19_C4", "label": "temp = FloatProperty()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.6786, 0.0357, 1, 0.1, 0.4286, 915, 3, 0, 0, 0, 515, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "FloatProperty", "annotation": ""}, "snippet": " temp =db.FloatProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L20_C4", "label": "light = FloatProperty()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.7143, 0.0357, 1, 0.1, 0.5714, 16, 3, 0, 0, 0, 515, 10, 1], "semantic": {"name": "light", "arg_names": [], "import_names": [], "rhs_call_name": "FloatProperty", "annotation": ""}, "snippet": " light =db.FloatProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L21_C4", "label": "watt = FloatProperty()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.75, 0.0357, 1, 0.1, 0.7143, 57, 3, 0, 0, 0, 515, 10, 1], "semantic": {"name": "watt", "arg_names": [], "import_names": [], "rhs_call_name": "FloatProperty", "annotation": ""}, "snippet": " watt =db.FloatProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L22_C4", "label": "date = DateTimeProperty()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.7857, 0.0357, 1, 0.1, 0.8571, 56, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " date =db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L23_C4", "label": "timestamp = DateTimeProperty()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "vector": [14, 1, 0.8214, 0.0357, 1, 0.1, 1.0, 834, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " timestamp = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "label": "Mention", "type": "class", "loc": [25, 28], "level": 0, "parent": null, "vector": [3, 0, 0.9464, 0.1429, 0, 0.66, 1.0, 386, 0, 0, 0, 0, 697, 0, 3], "semantic": {"name": "Mention", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Mention( db.Model):\n postUser =db.StringProperty()\n postText =db.StringProperty()\n postDate =db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L26_C4", "label": "postUser = StringProperty()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "vector": [14, 1, 0.9286, 0.0357, 1, 0.6, 0.0, 257, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "postUser", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " postUser =db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L27_C4", "label": "postText = StringProperty()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "vector": [14, 1, 0.9643, 0.0357, 1, 0.6, 0.5, 669, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "postText", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " postText =db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L28_C4", "label": "postDate = DateTimeProperty()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "vector": [14, 1, 1.0, 0.0357, 1, 0.6, 1.0, 337, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "postDate", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " postDate =db.DateTimeProperty()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_181:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_181:Assign_L28_C4"}] |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.models import User
from django.core.files.uploadedfile import UploadedFile
from django.utils.translation import ugettext_lazy as _, ugettext as __
from myapp.models import Person, File, Contract
from ragendja.auth.models import UserTraits
from ragendja.forms import FormWithSets, FormSetField
from registration.forms import RegistrationForm, RegistrationFormUniqueEmail
from registration.models import RegistrationProfile
from hashlib import sha1
from haco.models import HacoUser
class UserRegistrationForm(forms.ModelForm):
username =forms.RegexField(regex=r'^\w+$', max_length=30,
label=_(u'Username'))
email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),
label=_(u'Email address'))
twitterID =forms.RegexField(regex=r'^\w+$', max_length=30,
label=_(u'TwitterID'))
zip =forms.RegexField(regex=r'^[0-9]+$', max_length=30,
label=_(u'Zip'))
password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'Password'))
password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'Password (again)'))
def clean_username(self):
"""
Validate that the username is alphanumeric and is not already
in use.
"""
user = User.get_by_key_name("key_"+self.cleaned_data['username'].lower())
if user and user.is_active:
raise forms.ValidationError(__(u'This username is already taken. Please choose another.'))
return self.cleaned_data['username']
def clean(self):
"""
Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field.
"""
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(__(u'You must type the same password each time'))
return self.cleaned_data
def save(self, domain_override="", user=""):
"""
Create the new ``User`` and ``RegistrationProfile``, and
returns the ``User``.
This is essentially a light wrapper around
``RegistrationProfile.objects.create_inactive_user()``,
feeding it the form data and a profile callback (see the
documentation on ``create_inactive_user()`` for details) if
supplied.
"""
new_user = RegistrationProfile.objects.create_inactive_user(
username=self.cleaned_data['username'],
password=self.cleaned_data['password1'],
email=self.cleaned_data['email'],
domain_override=domain_override,
send_email=False)
self.instance = new_user
if super(UserRegistrationForm, self).save():
haco_users =HacoUser.all().filter( 'user =', self.instance)
if haco_users.count() ==0:
haco_user =HacoUser()
haco_user.user =new_user
haco_user.zip =self.cleaned_data['twitterID']
haco_user.zip =self.cleaned_data['zip']
haco_user.put()
else:
for haco_user in haco_users:
haco_user.zip =self.cleaned_data['twitterID']
haco_user.zip =self.cleaned_data['zip']
haco_user.put()
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
email = self.cleaned_data['email'].lower()
if User.all().filter('email =', email).filter(
'is_active =', True).count(1):
raise forms.ValidationError(__(u'This email address is already in use. Please supply a different email address.'))
return email
class Meta:
model =User
exclude = UserTraits.properties().keys()
class UserConfigForm(forms.Form):
twitterID =forms.RegexField(regex=r'^\w+$', max_length=30,
label=_(u'TwitterID'))
zip = forms.RegexField(required=True, regex=r'^[0-9]+$',
max_length=7,label=_(u'Zip'))
def save(self, key=""):
q =HacoUser.all()
q =q.filter( 'user',key)
for hacoUser in q:
ID = hacoUser.key().id()
hacouser = HacoUser.get_by_id(ID)
hacouser.user = key
hacouser.zip = self.cleaned_data['zip']
hacouser.twitterID = self.cleaned_data['twitterID']
hacouser.put()
class QueryForm(forms.Form):
username = forms.RegexField(regex=r'^\w+$', max_length=30)
delta = forms.RegexField(regex=r'^-[0-9]+$', max_length=3)
pnum = forms.RegexField(regex=r'^[0-9]+$', max_length=3)
##class UserConfigurationForm(forms.Form):
##
## email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),
## label=_(u'Email address'))
##
## first_name = forms.RegexField(regex=r'^\w+$', max_length=30,
## label=_(u'First name'))
##
## last_name = forms.RegexField(regex=r'^\w+$', max_length=30,
## label=_(u'Last name'))
##
## twitterID =forms.RegexField(regex=r'^\w+$', max_length=30,
## label=_(u'TwitterID'))
##
## zip =forms.RegexField(regex=r'^[0-9]+$', max_length=30,
## label=_(u'zip'))
##
## password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),
## label=_(u'Password'))
##
## password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),
## label=_(u'Password (again)'))
##
## def clean(self):
## return self.cleaned_data
##
## def save(self, key=""):
##
## auth_user = User.get( key)
##
##
## q =HacoUser.all()
## q =q.filter( 'user',key)
## for hacoUser in q:
## ID = hacoUser.key().id()
##
## user = User.get(key)
## user.email = self.cleaned_data['zip']
## user.first_name = self.cleaned_data['first_name']
## user.last_name = self.cleaned_data['last_name']
## user.password = sha1(self.cleaned_data['password1']).hexdigest()
## user.put()
##
##
##
## hacouser = HacoUser.get_by_id(ID)
## hacouser.user = key
## hacouser.zip = self.cleaned_data['zip']
## hacouser.twitterID = self.cleaned_data['twitterID']
## hacouser.put()
##
##
class FileForm(forms.ModelForm):
name = forms.CharField(required=False, label='Name (set automatically)')
def clean(self):
file = self.cleaned_data.get('file')
if not self.cleaned_data.get('name'):
if isinstance(file, UploadedFile):
self.cleaned_data['name'] = file.name
else:
del self.cleaned_data['name']
return self.cleaned_data
class Meta:
model = File
#class PersonForm(forms.ModelForm):
# files = FormSetField(File, form=FileForm, exclude='content_type')
# employers = FormSetField(Contract, fk_name='employee')
# employees = FormSetField(Contract, fk_name='employer')
#
# class Meta:
# model = Person
#PersonForm = FormWithSets(PersonForm)
| ajibawa-2023/Python-Code-Large/train/row_182 | 79 | 216 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L2_C0", "label": "from django import forms", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0046, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L3_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0046, 0, 0.66, 0.0714, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L4_C0", "label": "from django.core.files.uploadedfile import UploadedFile", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0046, 0, 0.66, 0.1429, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.core.files.uploadedfile", "arg_names": [], "import_names": ["UploadedFile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.files.uploadedfile import UploadedFile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L5_C0", "label": "from django.utils.translation import _, __", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0231, 0.0046, 0, 0.66, 0.2143, 389, 0, 2, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_", "__"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _, ugettext as __"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L6_C0", "label": "from myapp.models import Person, File, Contract", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0046, 0, 0.66, 0.2857, 0, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "myapp.models", "arg_names": [], "import_names": ["Person", "File", "Contract"], "rhs_call_name": "", "annotation": ""}, "snippet": "from myapp.models import Person, File, Contract"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L7_C0", "label": "from ragendja.auth.models import UserTraits", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0324, 0.0046, 0, 0.66, 0.3571, 7, 0, 1, 0, 0, 7, 0, 0], "semantic": {"name": "ragendja.auth.models", "arg_names": [], "import_names": ["UserTraits"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.models import UserTraits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L8_C0", "label": "from ragendja.forms import FormWithSets, FormSetField", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0046, 0, 0.66, 0.4286, 305, 0, 2, 0, 0, 305, 0, 0], "semantic": {"name": "ragendja.forms", "arg_names": [], "import_names": ["FormWithSets", "FormSetField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.forms import FormWithSets, FormSetField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L9_C0", "label": "from registration.forms import RegistrationForm, RegistrationFormUniqueEmail", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0046, 0, 0.66, 0.5, 823, 0, 2, 0, 0, 823, 0, 0], "semantic": {"name": "registration.forms", "arg_names": [], "import_names": ["RegistrationForm", "RegistrationFormUniqueEmail"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.forms import RegistrationForm, RegistrationFormUniqueEmail"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L10_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0463, 0.0046, 0, 0.66, 0.5714, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L11_C0", "label": "from hashlib import sha1", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0509, 0.0046, 0, 0.66, 0.6429, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["sha1"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hashlib import sha1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ImportFrom_L13_C0", "label": "from haco.models import HacoUser", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0602, 0.0046, 0, 0.66, 0.7143, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["HacoUser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import HacoUser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "label": "UserRegistrationForm", "type": "class", "loc": [15, 107], "level": 0, "parent": null, "vector": [3, 0, 0.2824, 0.4306, 0, 0.66, 0.7857, 677, 0, 4, 0, 0, 445, 0, 40], "semantic": {"name": "UserRegistrationForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UserRegistrationForm(forms.ModelForm):\n username =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'Username'))\n \n email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),\n label=_(u'Email address')) \n \n twitterID =forms.RegexField(regex=r'^\\w+$', max_length=30,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L16_C4", "label": "username = RegexField()", "type": "assigned_variable", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.0764, 0.0093, 1, 0.39, 0.0, 718, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " username =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'Username'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L19_C4", "label": "email = EmailField()", "type": "assigned_variable", "loc": [19, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.0903, 0.0093, 1, 0.39, 0.1, 413, 3, 2, 0, 0, 767, 10, 4], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "EmailField", "annotation": ""}, "snippet": " email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),\n label=_(u'Email address')) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L22_C4", "label": "twitterID = RegexField()", "type": "assigned_variable", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.1042, 0.0093, 1, 0.39, 0.2, 954, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "twitterID", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " twitterID =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'TwitterID'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L25_C4", "label": "zip = RegexField()", "type": "assigned_variable", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.1181, 0.0093, 1, 0.39, 0.3, 814, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "zip", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " zip =forms.RegexField(regex=r'^[0-9]+$', max_length=30,\n label=_(u'Zip'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L28_C4", "label": "password1 = CharField()", "type": "assigned_variable", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.1319, 0.0093, 1, 0.39, 0.4, 374, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password1", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L31_C4", "label": "password2 = CharField()", "type": "assigned_variable", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [14, 1, 0.1458, 0.0093, 1, 0.39, 0.5, 314, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password2", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password2 = forms.CharField(widget=forms.PasswordInput(render_value=False),\n label=_(u'Password (again)'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "label": "clean_username", "type": "function", "loc": [34, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [2, 1, 0.1782, 0.0463, 1, 0.39, 0.6, 629, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "clean_username", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_username(self):\n \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\"\n user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())\n if user and user.is_active:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L35_C8", "label": "expression", "type": "expression", "loc": [35, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "vector": [8, 2, 0.1713, 0.0231, 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 Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L40_C8", "label": "user = get_by_key_name()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "vector": [14, 2, 0.1852, 0.0046, 2, 0.18, 0.3333, 503, 3, 1, 0, 0, 899, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L41_C8", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "vector": [4, 2, 0.1921, 0.0093, 2, 0.18, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user and user.is_active:\n raise forms.ValidationError(__(u'This username is already taken. Please choose another.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "vector": [13, 2, 0.1991, 0.0046, 2, 0.18, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data['username']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "label": "clean", "type": "function", "loc": [45, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [2, 1, 0.2338, 0.0556, 1, 0.39, 0.7, 517, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n \"\"\"\n Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L46_C8", "label": "expression", "type": "expression", "loc": [46, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "vector": [8, 2, 0.2269, 0.0324, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L53_C8", "label": "if", "type": "if", "loc": [53, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "vector": [4, 2, 0.25, 0.0139, 2, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(__(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L54_C12", "label": "if", "type": "if", "loc": [54, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L53_C8", "vector": [4, 3, 0.2523, 0.0093, 3, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(__(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "vector": [13, 2, 0.2593, 0.0046, 2, 0.26, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "label": "save", "type": "function", "loc": [58, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [2, 1, 0.3449, 0.1574, 1, 0.39, 0.8, 928, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "save", "arg_names": ["self", "domain_override", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, domain_override=\"\", user=\"\"):\n \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User``.\n \n This is essentially a light wrapper around\n ``RegistrationProfile.objects.create_inactive_user()``,\n feeding it the form data and a profile callback (see the"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L59_C8", "label": "expression", "type": "expression", "loc": [59, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "vector": [8, 2, 0.2963, 0.0509, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User``.\n \n This is essentially a light wrapper around\n ``RegistrationProfile.objects.create_inactive_user()``,\n feeding it the form data and a profile callback (see the\n documentation on ``create_inactive_user()`` for details) if"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L70_C8", "label": "new_user = create_inactive_user()", "type": "assigned_variable", "loc": [70, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "vector": [14, 2, 0.3356, 0.0278, 2, 0.66, 0.3333, 932, 3, 5, 0, 0, 686, 10, 1], "semantic": {"name": "new_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " new_user = RegistrationProfile.objects.create_inactive_user(\n username=self.cleaned_data['username'],\n password=self.cleaned_data['password1'],\n email=self.cleaned_data['email'],\n domain_override=domain_override,\n send_email=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L76_C8", "label": "self.instance =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "vector": [14, 2, 0.3519, 0.0046, 2, 0.66, 0.6667, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.instance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.instance = new_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8", "label": "if", "type": "if", "loc": [78, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "vector": [4, 2, 0.3912, 0.0648, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if super(UserRegistrationForm, self).save():\n haco_users =HacoUser.all().filter( 'user =', self.instance)\n\n if haco_users.count() ==0:\n haco_user =HacoUser()\n haco_user.user =new_user\n haco_user.zip =self.cleaned_data['twitterID']\n haco_user.zip =self.cleaned_data['zip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L79_C12", "label": "haco_users = filter()", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8", "vector": [14, 3, 0.3657, 0.0046, 3, 0.95, 0.0, 674, 3, 2, 0, 0, 526, 10, 2], "semantic": {"name": "haco_users", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " haco_users =HacoUser.all().filter( 'user =', self.instance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "label": "if", "type": "if", "loc": [81, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8", "vector": [4, 3, 0.3981, 0.0509, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if haco_users.count() ==0:\n haco_user =HacoUser()\n haco_user.user =new_user\n haco_user.zip =self.cleaned_data['twitterID']\n haco_user.zip =self.cleaned_data['zip']\n haco_user.put()\n else:\n for haco_user in haco_users:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L82_C16", "label": "haco_user = HacoUser()", "type": "assigned_variable", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [14, 4, 0.3796, 0.0046, 4, 0.18, 0.0, 763, 3, 0, 0, 0, 181, 10, 1], "semantic": {"name": "haco_user", "arg_names": [], "import_names": [], "rhs_call_name": "HacoUser", "annotation": ""}, "snippet": " haco_user =HacoUser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L83_C16", "label": "haco_user.user =", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [14, 4, 0.3843, 0.0046, 4, 0.18, 0.2, 199, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco_user.user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco_user.user =new_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L84_C16", "label": "haco_user.zip =", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [14, 4, 0.3889, 0.0046, 4, 0.18, 0.4, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco_user.zip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco_user.zip =self.cleaned_data['twitterID']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L85_C16", "label": "haco_user.zip =", "type": "assigned_variable", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [14, 4, 0.3935, 0.0046, 4, 0.18, 0.6, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco_user.zip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco_user.zip =self.cleaned_data['zip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L86_C16", "label": "put()", "type": "expression", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [8, 4, 0.3981, 0.0046, 4, 0.18, 0.8, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " haco_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "label": "for haco_user", "type": "for", "loc": [88, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "vector": [6, 4, 0.4144, 0.0185, 4, 0.18, 1.0, 763, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "haco_user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for haco_user in haco_users:\n haco_user.zip =self.cleaned_data['twitterID']\n haco_user.zip =self.cleaned_data['zip']\n haco_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L89_C20", "label": "haco_user.zip =", "type": "assigned_variable", "loc": [89, 89], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "vector": [14, 5, 0.412, 0.0046, 5, 0.54, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco_user.zip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco_user.zip =self.cleaned_data['twitterID']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L90_C20", "label": "haco_user.zip =", "type": "assigned_variable", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "vector": [14, 5, 0.4167, 0.0046, 5, 0.54, 0.5, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco_user.zip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco_user.zip =self.cleaned_data['zip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L91_C20", "label": "put()", "type": "expression", "loc": [91, 91], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "vector": [8, 5, 0.4213, 0.0046, 5, 0.54, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " haco_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "label": "clean_email", "type": "function", "loc": [93, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [2, 1, 0.4537, 0.0509, 1, 0.39, 0.9, 160, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "clean_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_email(self):\n \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\"\n email = self.cleaned_data['email'].lower()\n if User.all().filter('email =', email).filter("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "vector": [8, 2, 0.4444, 0.0231, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L99_C8", "label": "email = lower()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "vector": [14, 2, 0.4583, 0.0046, 2, 0.45, 0.3333, 413, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " email = self.cleaned_data['email'].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L100_C8", "label": "if", "type": "if", "loc": [100, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "vector": [4, 2, 0.4676, 0.0139, 2, 0.45, 0.6667, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if User.all().filter('email =', email).filter(\n 'is_active =', True).count(1):\n raise forms.ValidationError(__(u'This email address is already in use. Please supply a different email address.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "vector": [13, 2, 0.4769, 0.0046, 2, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4", "label": "Meta", "type": "class", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "vector": [3, 1, 0.4907, 0.0139, 1, 0.39, 1.0, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n model =User\n exclude = UserTraits.properties().keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L106_C8", "label": "model =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4", "vector": [14, 2, 0.4907, 0.0046, 2, 0.0, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model =User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L107_C8", "label": "exclude = keys()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4", "vector": [14, 2, 0.4954, 0.0046, 2, 0.0, 1.0, 739, 3, 0, 0, 0, 204, 10, 2], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " exclude = UserTraits.properties().keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "label": "UserConfigForm", "type": "class", "loc": [109, 128], "level": 0, "parent": null, "vector": [3, 0, 0.5486, 0.0926, 0, 0.66, 0.8571, 799, 0, 1, 0, 0, 953, 0, 10], "semantic": {"name": "UserConfigForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UserConfigForm(forms.Form):\n twitterID =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'TwitterID'))\n zip = forms.RegexField(required=True, regex=r'^[0-9]+$',\n max_length=7,label=_(u'Zip'))\n\n\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L110_C4", "label": "twitterID = RegexField()", "type": "assigned_variable", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "vector": [14, 1, 0.5116, 0.0093, 1, 0.37, 0.0, 954, 3, 3, 0, 0, 671, 10, 2], "semantic": {"name": "twitterID", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " twitterID =forms.RegexField(regex=r'^\\w+$', max_length=30,\n label=_(u'TwitterID'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L112_C4", "label": "zip = RegexField()", "type": "assigned_variable", "loc": [112, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "vector": [14, 1, 0.5208, 0.0093, 1, 0.37, 0.5, 814, 3, 4, 0, 0, 671, 10, 2], "semantic": {"name": "zip", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " zip = forms.RegexField(required=True, regex=r'^[0-9]+$',\n max_length=7,label=_(u'Zip'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "label": "save", "type": "function", "loc": [117, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "vector": [2, 1, 0.5671, 0.0556, 1, 0.37, 1.0, 928, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "save", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, key=\"\"):\n\n q =HacoUser.all()\n q =q.filter( 'user',key)\n for hacoUser in q:\n ID = hacoUser.key().id()\n \n hacouser = HacoUser.get_by_id(ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L119_C12", "label": "q = all()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.5509, 0.0046, 2, 0.54, 0.0, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =HacoUser.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L120_C12", "label": "q = filter()", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.5556, 0.0046, 2, 0.54, 0.1429, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user',key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:For_L121_C12", "label": "for hacoUser", "type": "for", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [6, 2, 0.5625, 0.0093, 2, 0.54, 0.2857, 496, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "hacoUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for hacoUser in q:\n ID = hacoUser.key().id()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L122_C16", "label": "ID = id()", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:For_L121_C12", "vector": [14, 3, 0.5648, 0.0046, 3, 0.59, 0.0, 789, 3, 0, 0, 0, 941, 10, 2], "semantic": {"name": "ID", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " ID = hacoUser.key().id()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L124_C12", "label": "hacouser = get_by_id()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.5741, 0.0046, 2, 0.54, 0.4286, 945, 3, 1, 0, 0, 397, 10, 1], "semantic": {"name": "hacouser", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_id", "annotation": ""}, "snippet": " hacouser = HacoUser.get_by_id(ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L125_C12", "label": "hacouser.user =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.5787, 0.0046, 2, 0.54, 0.5714, 410, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hacouser.user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hacouser.user = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L126_C12", "label": "hacouser.zip =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.5833, 0.0046, 2, 0.54, 0.7143, 69, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hacouser.zip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hacouser.zip = self.cleaned_data['zip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L127_C12", "label": "hacouser.twitterID =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [14, 2, 0.588, 0.0046, 2, 0.54, 0.8571, 401, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hacouser.twitterID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hacouser.twitterID = self.cleaned_data['twitterID']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L128_C12", "label": "put()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "vector": [8, 2, 0.5926, 0.0046, 2, 0.54, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " hacouser.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "label": "QueryForm", "type": "class", "loc": [132, 135], "level": 0, "parent": null, "vector": [3, 0, 0.6181, 0.0185, 0, 0.66, 0.9286, 571, 0, 0, 0, 0, 953, 0, 3], "semantic": {"name": "QueryForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class QueryForm(forms.Form):\n username = forms.RegexField(regex=r'^\\w+$', max_length=30)\n delta = forms.RegexField(regex=r'^-[0-9]+$', max_length=3)\n pnum = forms.RegexField(regex=r'^[0-9]+$', max_length=3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L133_C4", "label": "username = RegexField()", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "vector": [14, 1, 0.6157, 0.0046, 1, 0.94, 0.0, 718, 3, 2, 0, 0, 671, 10, 1], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " username = forms.RegexField(regex=r'^\\w+$', max_length=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L134_C4", "label": "delta = RegexField()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "vector": [14, 1, 0.6204, 0.0046, 1, 0.94, 0.5, 593, 3, 2, 0, 0, 671, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " delta = forms.RegexField(regex=r'^-[0-9]+$', max_length=3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L135_C4", "label": "pnum = RegexField()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "vector": [14, 1, 0.625, 0.0046, 1, 0.94, 1.0, 112, 3, 2, 0, 0, 671, 10, 1], "semantic": {"name": "pnum", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " pnum = forms.RegexField(regex=r'^[0-9]+$', max_length=3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "label": "FileForm", "type": "class", "loc": [194, 207], "level": 0, "parent": null, "vector": [3, 0, 0.9282, 0.0648, 0, 0.66, 1.0, 549, 0, 1, 0, 0, 445, 0, 4], "semantic": {"name": "FileForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileForm(forms.ModelForm):\n name = forms.CharField(required=False, label='Name (set automatically)')\n\n def clean(self):\n file = self.cleaned_data.get('file')\n if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L195_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "vector": [14, 1, 0.9028, 0.0046, 1, 0.79, 0.0, 57, 3, 2, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = forms.CharField(required=False, label='Name (set automatically)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "label": "clean", "type": "function", "loc": [197, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "vector": [2, 1, 0.9282, 0.037, 1, 0.79, 0.5, 517, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n file = self.cleaned_data.get('file')\n if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']\n return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L198_C8", "label": "file = get()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "vector": [14, 2, 0.9167, 0.0046, 2, 0.78, 0.0, 107, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " file = self.cleaned_data.get('file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L199_C8", "label": "if", "type": "if", "loc": [199, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "vector": [4, 2, 0.9306, 0.0231, 2, 0.78, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.cleaned_data.get('name'):\n if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:If_L200_C12", "label": "if", "type": "if", "loc": [200, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L199_C8", "vector": [4, 3, 0.9329, 0.0185, 3, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(file, UploadedFile):\n self.cleaned_data['name'] = file.name\n else:\n del self.cleaned_data['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L201_C16", "label": "assign", "type": "assigned_variable", "loc": [201, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:If_L200_C12", "vector": [14, 4, 0.9306, 0.0046, 4, 0.36, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cleaned_data['name'] = file.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L204_C8", "label": "return", "type": "return", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "vector": [13, 2, 0.9444, 0.0046, 2, 0.78, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L206_C4", "label": "Meta", "type": "class", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "vector": [3, 1, 0.956, 0.0093, 1, 0.79, 1.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n model = File"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L207_C8", "label": "model =", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L206_C4", "vector": [14, 2, 0.9583, 0.0046, 2, 0.45, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = File"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L86_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L89_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L90_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:For_L88_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L91_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:For_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:For_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L122_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Expr_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_182:If_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:If_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Return_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_182:ClassDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_182:Assign_L207_C8"}] |
# -*- coding: utf8 -*-
from twitter import Api
import simplejson
import urllib2
import logging
class Api(Api):
''' twitter.Apiクラスの拡張
self._cacheの影響でファイル入出力が発生するため、
Apiクラスのラッパーとして利用する。
'''
def __init__(self,
username=None,
password=None,
input_encoding=None,
request_headers=None):
'''gaetwitter.Api オブジェクトの初期化
Args:
username: The username of the twitter account. [optional]
password: The password for the twitter account. [optional]
input_encoding: The encoding used to encode input strings. [optional]
request_header: A dictionary of additional HTTP request headers. [optional]
'''
self._cache = None
self._urllib = urllib2
self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT
self._InitializeRequestHeaders(request_headers)
self._InitializeUserAgent()
self._InitializeDefaultParameters()
self._input_encoding = input_encoding
self.SetCredentials(username, password)
def Search(self, q=None):
parameters = {}
if q:
parameters['q'] = q
url = 'http://search.twitter.com/search.json'
json = self._FetchUrl(url, parameters=parameters)
data = simplejson.loads(json)
self._CheckForTwitterError(data)
return [Search.NewFromJsonDict(x) for x in data['results']]
class Search(object):
def __init(self,
text=None):
self.text = text
@staticmethod
def NewFromJsonDict(data):
if 'from_user' in data:
return data['from_user']
| ajibawa-2023/Python-Code-Large/train/row_185 | 31 | 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_185:ImportFrom_L2_C0", "label": "from twitter import Api", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0196, 0, 0.66, 0.0, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "twitter", "arg_names": [], "import_names": ["Api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twitter import Api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Import_L3_C0", "label": "simplejson import simplejson", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0196, 0, 0.66, 0.2, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Import_L4_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0784, 0.0196, 0, 0.66, 0.4, 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_185:Import_L5_C0", "label": "logging import logging", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.098, 0.0196, 0, 0.66, 0.6, 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_185:ClassDef_L7_C0", "label": "Api", "type": "class", "loc": [7, 42], "level": 0, "parent": null, "vector": [3, 0, 0.4804, 0.7059, 0, 0.66, 0.8, 192, 0, 2, 0, 0, 192, 0, 8], "semantic": {"name": "Api", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Api(Api):\n ''' twitter.Api\u30af\u30e9\u30b9\u306e\u62e1\u5f35\n self._cache\u306e\u5f71\u97ff\u3067\u30d5\u30a1\u30a4\u30eb\u5165\u51fa\u529b\u304c\u767a\u751f\u3059\u308b\u305f\u3081\u3001\n Api\u30af\u30e9\u30b9\u306e\u30e9\u30c3\u30d1\u30fc\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u3002\n '''\n def __init__(self,\n username=None,\n password=None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "vector": [8, 1, 0.1863, 0.0784, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ''' twitter.Api\u30af\u30e9\u30b9\u306e\u62e1\u5f35\n self._cache\u306e\u5f71\u97ff\u3067\u30d5\u30a1\u30a4\u30eb\u5165\u51fa\u529b\u304c\u767a\u751f\u3059\u308b\u305f\u3081\u3001\n Api\u30af\u30e9\u30b9\u306e\u30e9\u30c3\u30d1\u30fc\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u3002\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "label": "__init__", "type": "function", "loc": [12, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "vector": [2, 1, 0.4314, 0.4118, 1, 0.52, 0.5, 555, 0, 5, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "username", "password", "input_encoding", "request_headers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n username=None,\n password=None,\n input_encoding=None,\n request_headers=None):\n '''gaetwitter.Api \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u521d\u671f\u5316\n\n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [8, 2, 0.402, 0.1569, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''gaetwitter.Api \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u521d\u671f\u5316\n\n Args:\n username: The username of the twitter account. [optional]\n password: The password for the twitter account. [optional]\n input_encoding: The encoding used to encode input strings. [optional]\n request_header: A dictionary of additional HTTP request headers. [optional]\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L25_C8", "label": "self._cache =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [14, 2, 0.4902, 0.0196, 2, 0.91, 0.125, 723, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._cache = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L26_C8", "label": "self._urllib =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [14, 2, 0.5098, 0.0196, 2, 0.91, 0.25, 741, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._urllib", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._urllib = urllib2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L27_C8", "label": "self._cache_timeout =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [14, 2, 0.5294, 0.0196, 2, 0.91, 0.375, 486, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._cache_timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._cache_timeout = Api.DEFAULT_CACHE_TIMEOUT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L28_C8", "label": "_InitializeRequestHeaders()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [8, 2, 0.549, 0.0196, 2, 0.91, 0.5, 982, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_InitializeRequestHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "_InitializeRequestHeaders", "annotation": ""}, "snippet": " self._InitializeRequestHeaders(request_headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L29_C8", "label": "_InitializeUserAgent()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [8, 2, 0.5686, 0.0196, 2, 0.91, 0.625, 336, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_InitializeUserAgent", "arg_names": [], "import_names": [], "rhs_call_name": "_InitializeUserAgent", "annotation": ""}, "snippet": " self._InitializeUserAgent()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L30_C8", "label": "_InitializeDefaultParameters()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [8, 2, 0.5882, 0.0196, 2, 0.91, 0.75, 890, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_InitializeDefaultParameters", "arg_names": [], "import_names": [], "rhs_call_name": "_InitializeDefaultParameters", "annotation": ""}, "snippet": " self._InitializeDefaultParameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L31_C8", "label": "self._input_encoding =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [14, 2, 0.6078, 0.0196, 2, 0.91, 0.875, 419, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._input_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_encoding = input_encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L32_C8", "label": "SetCredentials()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "vector": [8, 2, 0.6275, 0.0196, 2, 0.91, 1.0, 168, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "SetCredentials", "arg_names": [], "import_names": [], "rhs_call_name": "SetCredentials", "annotation": ""}, "snippet": " self.SetCredentials(username, password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "label": "Search", "type": "function", "loc": [34, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "vector": [2, 1, 0.7451, 0.1765, 1, 0.52, 1.0, 123, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "Search", "arg_names": ["self", "q"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Search(self, q=None):\n parameters = {}\n if q:\n parameters['q'] = q\n url = 'http://search.twitter.com/search.json'\n json = self._FetchUrl(url, parameters=parameters)\n data = simplejson.loads(json)\n self._CheckForTwitterError(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L35_C8", "label": "parameters =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [14, 2, 0.6863, 0.0196, 2, 0.18, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:If_L36_C8", "label": "if", "type": "if", "loc": [36, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [4, 2, 0.7157, 0.0392, 2, 0.18, 0.1667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if q:\n parameters['q'] = q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L37_C12", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:If_L36_C8", "vector": [14, 3, 0.7255, 0.0196, 3, 0.79, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['q'] = q"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L38_C8", "label": "url =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [14, 2, 0.7451, 0.0196, 2, 0.18, 0.3333, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://search.twitter.com/search.json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L39_C8", "label": "json = _FetchUrl()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [14, 2, 0.7647, 0.0196, 2, 0.18, 0.5, 463, 3, 2, 0, 0, 788, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "_FetchUrl", "annotation": ""}, "snippet": " json = self._FetchUrl(url, parameters=parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L40_C8", "label": "data = loads()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [14, 2, 0.7843, 0.0196, 2, 0.18, 0.6667, 929, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " data = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L41_C8", "label": "_CheckForTwitterError()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [8, 2, 0.8039, 0.0196, 2, 0.18, 0.8333, 14, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_CheckForTwitterError", "arg_names": [], "import_names": [], "rhs_call_name": "_CheckForTwitterError", "annotation": ""}, "snippet": " self._CheckForTwitterError(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Return_L42_C8", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "vector": [13, 2, 0.8235, 0.0196, 2, 0.18, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [Search.NewFromJsonDict(x) for x in data['results']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L44_C0", "label": "Search", "type": "class", "loc": [44, 51], "level": 0, "parent": null, "vector": [3, 0, 0.9314, 0.1569, 0, 0.66, 1.0, 123, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Search", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Search(object):\n def __init(self,\n text=None):\n self.text = text\n @staticmethod\n def NewFromJsonDict(data):\n if 'from_user' in data:\n return data['from_user']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L45_C4", "label": "__init", "type": "function", "loc": [45, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L44_C0", "vector": [2, 1, 0.902, 0.0588, 1, 0.54, 0.0, 75, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init(self,\n text=None):\n self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L47_C8", "label": "self.text =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L45_C4", "vector": [14, 2, 0.9216, 0.0196, 2, 0.07, 0.0, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L49_C4", "label": "NewFromJsonDict", "type": "function", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L44_C0", "vector": [2, 1, 0.9804, 0.0588, 1, 0.54, 1.0, 22, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "NewFromJsonDict", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def NewFromJsonDict(data):\n if 'from_user' in data:\n return data['from_user']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:If_L50_C8", "label": "if", "type": "if", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L49_C4", "vector": [4, 2, 0.9902, 0.0392, 2, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'from_user' in data:\n return data['from_user']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_185:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_185:If_L50_C8", "vector": [13, 3, 1.0, 0.0196, 3, 0.96, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data['from_user']"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Return_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_185:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_185:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_185:Return_L51_C12"}] |
from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views
from views import *
from views2 import *
from twit import *
urlpatterns =patterns(
'',
#url( r'^login/$',
# auth_views.login,
# {'template_name': 'haco/login.html',
# 'redirect_field_name': report},
# name='auth_login'),
#(r'^$',
# 'django.views.generic.simple.direct_to_template',
# {'template': 'index.html'}),
#'booklist.views', (r'^list', 'list'),
#'haco.views',
#(r'^$', 'login'),
#url(r'^$', login),
url(r'^report/$', report),
url(r'^record/$', record),
url(r'^matrix/$', matrix),
url(r'^map/$', map),
url(r'^test/$', test),
url(r'^feed/$', feed),
url(r'^csv/$',csv),
url(r'^repo_all/$',repo_all),
url(r'^cron/twitBot/$',twitBot),
)
| ajibawa-2023/Python-Code-Large/train/row_187 | 6 | 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_187:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_187:ImportFrom_L2_C0", "label": "from django.contrib.auth import auth_views", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0606, 0.0303, 0, 0.66, 0.2, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names": [], "import_names": ["auth_views"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth import views as auth_views"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_187:ImportFrom_L3_C0", "label": "from views import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0303, 0, 0.66, 0.4, 547, 0, 1, 0, 0, 547, 0, 0], "semantic": {"name": "views", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from views import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_187:ImportFrom_L4_C0", "label": "from views2 import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1212, 0.0303, 0, 0.66, 0.6, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "views2", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from views2 import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_187:ImportFrom_L5_C0", "label": "from twit import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1515, 0.0303, 0, 0.66, 0.8, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "twit", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twit import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_187:Assign_L7_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [7, 33], "level": 0, "parent": null, "vector": [14, 0, 0.6061, 0.8182, 0, 0.66, 1.0, 990, 3, 10, 0, 0, 75, 10, 10], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns =patterns(\n '',\n \n #url( r'^login/$', \n # auth_views.login, \n # {'template_name': 'haco/login.html',\n # 'redirect_field_name': report}, \n # name='auth_login'),"}] | [] |
# -*- coding: utf-8 -*-
from decimal import *
from math import *
def v2W(volt):
if float(volt) < 0:
return -1
else:
watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100
watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)
return watt
def v2L(volt):
if float(volt) <= 0:
return -1
else:
CON = 0.81
OFFS = 1.22
current = (((float(volt) * (1100.0 / 1024.0) )/ 1000.0) / 11.0) * 1000.0
light = pow(10.0, (CON * log(current,10) + OFFS));
light = Decimal(str(light)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)
return light
def v2T(volt):
if float(volt) < 0:
return -1
else:
temp = (float(volt) / 1024.0 * 1100.0 / 6.25) + (-424.0 / 6.25)
temp = Decimal(str(temp)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)
return temp
| ajibawa-2023/Python-Code-Large/train/row_188 | 23 | 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_188:ImportFrom_L3_C0", "label": "from decimal import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0278, 0, 0.66, 0.0, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decimal import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:ImportFrom_L4_C0", "label": "from math import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0278, 0, 0.66, 0.25, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from math import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L6_C0", "label": "v2W", "type": "function", "loc": [6, 13], "level": 0, "parent": null, "vector": [2, 0, 0.2639, 0.2222, 0, 0.66, 0.5, 148, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "v2W", "arg_names": ["volt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def v2W(volt):\n if float(volt) < 0:\n return -1\n else: \n watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100\n watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)\n\n return watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "label": "if", "type": "if", "loc": [7, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L6_C0", "vector": [4, 1, 0.2778, 0.1944, 1, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if float(volt) < 0:\n return -1\n else: \n watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100\n watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)\n\n return watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "vector": [13, 2, 0.2222, 0.0278, 2, 0.94, 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_188:Assign_L10_C8", "label": "watt =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "vector": [14, 2, 0.2778, 0.0278, 2, 0.94, 0.3333, 57, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "watt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " watt = (float(volt) * 1100.0 / 1024.0) * 3000 / (0.9 * 100) / 1000 * 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L11_C8", "label": "watt = quantize()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "vector": [14, 2, 0.3056, 0.0278, 2, 0.94, 0.6667, 57, 3, 2, 0, 0, 534, 10, 4], "semantic": {"name": "watt", "arg_names": [], "import_names": [], "rhs_call_name": "quantize", "annotation": ""}, "snippet": " watt = Decimal(str(watt)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L13_C8", "label": "return", "type": "return", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "vector": [13, 2, 0.3611, 0.0278, 2, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L15_C0", "label": "v2L", "type": "function", "loc": [15, 25], "level": 0, "parent": null, "vector": [2, 0, 0.5556, 0.3056, 0, 0.66, 0.75, 437, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "v2L", "arg_names": ["volt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def v2L(volt):\n if float(volt) <= 0:\n return -1\n else:\n CON = 0.81\n OFFS = 1.22\n current = (((float(volt) * (1100.0 / 1024.0) )/ 1000.0) / 11.0) * 1000.0\n light = pow(10.0, (CON * log(current,10) + OFFS));"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "label": "if", "type": "if", "loc": [16, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L15_C0", "vector": [4, 1, 0.5694, 0.2778, 1, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if float(volt) <= 0:\n return -1\n else:\n CON = 0.81\n OFFS = 1.22\n current = (((float(volt) * (1100.0 / 1024.0) )/ 1000.0) / 11.0) * 1000.0\n light = pow(10.0, (CON * log(current,10) + OFFS));\n light = Decimal(str(light)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [13, 2, 0.4722, 0.0278, 2, 0.29, 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_188:Assign_L19_C8", "label": "CON =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [14, 2, 0.5278, 0.0278, 2, 0.29, 0.1667, 57, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "CON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CON = 0.81"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L20_C8", "label": "OFFS =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [14, 2, 0.5556, 0.0278, 2, 0.29, 0.3333, 102, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "OFFS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " OFFS = 1.22"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L21_C8", "label": "current =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [14, 2, 0.5833, 0.0278, 2, 0.29, 0.5, 32, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "current", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current = (((float(volt) * (1100.0 / 1024.0) )/ 1000.0) / 11.0) * 1000.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L22_C8", "label": "light = pow()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [14, 2, 0.6111, 0.0278, 2, 0.29, 0.6667, 16, 3, 2, 0, 0, 714, 10, 2], "semantic": {"name": "light", "arg_names": [], "import_names": [], "rhs_call_name": "pow", "annotation": ""}, "snippet": " light = pow(10.0, (CON * log(current,10) + OFFS));"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L23_C8", "label": "light = quantize()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [14, 2, 0.6389, 0.0278, 2, 0.29, 0.8333, 16, 3, 2, 0, 0, 534, 10, 4], "semantic": {"name": "light", "arg_names": [], "import_names": [], "rhs_call_name": "quantize", "annotation": ""}, "snippet": " light = Decimal(str(light)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "vector": [13, 2, 0.6944, 0.0278, 2, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return light"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L28_C0", "label": "v2T", "type": "function", "loc": [28, 35], "level": 0, "parent": null, "vector": [2, 0, 0.875, 0.2222, 0, 0.66, 1.0, 706, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "v2T", "arg_names": ["volt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def v2T(volt):\n if float(volt) < 0:\n return -1\n else:\n temp = (float(volt) / 1024.0 * 1100.0 / 6.25) + (-424.0 / 6.25)\n temp = Decimal(str(temp)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)\n\n return temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "label": "if", "type": "if", "loc": [29, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L28_C0", "vector": [4, 1, 0.8611, 0.1389, 1, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if float(volt) < 0:\n return -1\n else:\n temp = (float(volt) / 1024.0 * 1100.0 / 6.25) + (-424.0 / 6.25)\n temp = Decimal(str(temp)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "vector": [13, 2, 0.8333, 0.0278, 2, 0.37, 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_188:Assign_L32_C8", "label": "temp =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "vector": [14, 2, 0.8889, 0.0278, 2, 0.37, 0.5, 915, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp = (float(volt) / 1024.0 * 1100.0 / 6.25) + (-424.0 / 6.25)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L33_C8", "label": "temp = quantize()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "vector": [14, 2, 0.9167, 0.0278, 2, 0.37, 1.0, 915, 3, 2, 0, 0, 534, 10, 4], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "quantize", "annotation": ""}, "snippet": " temp = Decimal(str(temp)).quantize(Decimal('.0'), rounding=ROUND_HALF_UP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L28_C0", "vector": [13, 1, 0.9722, 0.0278, 1, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return temp"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_188:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_188:Return_L35_C4"}] |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from haco.models import *
from haco.jsTime import *
import logging
import twython
from datetime import *
def twitBot( request):
mes ="<html><head></head><body>"
api = apimake()
t = api.getUserMentions(count="20")
for e in t:
q = Mention.all()
q =q.filter('postUser',e['user']['screen_name'])
q =q.filter('postText',e['text'])
q =q.filter('postDate >=',datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9))
if len(q):
break
else:
# post(makeReply(e))
directMessage(e['user']['screen_name'],makeReply(e))
save(e)
return HttpResponse( "OK")
def post(msg):
api = apimake()
api.updateStatus(msg)
def directMessage(user, msg):
api = apimake()
api.sendDirectMessage(user, msg)
def save( e):
mention =Mention()
mention.postUser =e['user']['screen_name']
mention.postText =e['text']
mention.postDate =datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9)
mention.put()
def makeReply( e):
#parse text and generate reply text
return "OK I'v got your message"
def apimake():
return twython.setup(authtype="Basic",username="user",password="pass")
| ajibawa-2023/Python-Code-Large/train/row_189 | 37 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L3_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0185, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L4_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.0185, 0, 0.66, 0.0769, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L5_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0926, 0.0185, 0, 0.66, 0.1538, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L6_C0", "label": "from haco.models import *", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0185, 0, 0.66, 0.2308, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L7_C0", "label": "from haco.jsTime import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1296, 0.0185, 0, 0.66, 0.3077, 615, 0, 1, 0, 0, 615, 0, 0], "semantic": {"name": "haco.jsTime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.jsTime import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Import_L8_C0", "label": "logging import logging", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.0185, 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_189:Import_L9_C0", "label": "twython import twython", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0185, 0, 0.66, 0.4615, 816, 0, 1, 0, 0, 816, 0, 0], "semantic": {"name": "twython", "arg_names": [], "import_names": ["twython"], "rhs_call_name": "", "annotation": ""}, "snippet": "import twython"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:ImportFrom_L10_C0", "label": "from datetime import *", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.0185, 0, 0.66, 0.5385, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "label": "twitBot", "type": "function", "loc": [13, 31], "level": 0, "parent": null, "vector": [2, 0, 0.4074, 0.3519, 0, 0.66, 0.6154, 129, 0, 1, 1, 0, 0, 0, 13], "semantic": {"name": "twitBot", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitBot( request):\n mes =\"<html><head></head><body>\"\n api = apimake() \n t = api.getUserMentions(count=\"20\")\n\n for e in t:\n q = Mention.all()\n q =q.filter('postUser',e['user']['screen_name'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L14_C4", "label": "mes =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "vector": [14, 1, 0.2593, 0.0185, 1, 0.0, 0.0, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mes =\"<html><head></head><body>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L15_C4", "label": "api = apimake()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "vector": [14, 1, 0.2778, 0.0185, 1, 0.0, 0.25, 976, 3, 0, 0, 0, 762, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "apimake", "annotation": ""}, "snippet": " api = apimake() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L16_C4", "label": "t = getUserMentions()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "vector": [14, 1, 0.2963, 0.0185, 1, 0.0, 0.5, 15, 3, 1, 0, 0, 47, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "getUserMentions", "annotation": ""}, "snippet": " t = api.getUserMentions(count=\"20\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "label": "for e", "type": "for", "loc": [18, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "vector": [6, 1, 0.4352, 0.2222, 1, 0.0, 0.75, 175, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in t:\n q = Mention.all()\n q =q.filter('postUser',e['user']['screen_name'])\n q =q.filter('postText',e['text'])\n q =q.filter('postDate >=',datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9))\n\n if len(q):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L19_C8", "label": "q = all()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "vector": [14, 2, 0.3519, 0.0185, 2, 0.77, 0.0, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q = Mention.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L20_C8", "label": "q = filter()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "vector": [14, 2, 0.3704, 0.0185, 2, 0.77, 0.25, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter('postUser',e['user']['screen_name'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L21_C8", "label": "q = filter()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "vector": [14, 2, 0.3889, 0.0185, 2, 0.77, 0.5, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter('postText',e['text'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L22_C8", "label": "q = filter()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "vector": [14, 2, 0.4074, 0.0185, 2, 0.77, 0.75, 516, 3, 2, 0, 0, 526, 10, 3], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter('postDate >=',datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8", "label": "if", "type": "if", "loc": [24, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "vector": [4, 2, 0.4907, 0.1111, 2, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(q):\n break\n else:\n# post(makeReply(e))\n directMessage(e['user']['screen_name'],makeReply(e))\n save(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L28_C12", "label": "directMessage()", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8", "vector": [8, 3, 0.5185, 0.0185, 3, 0.34, 0.0, 46, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "directMessage", "arg_names": [], "import_names": [], "rhs_call_name": "directMessage", "annotation": ""}, "snippet": " directMessage(e['user']['screen_name'],makeReply(e))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L29_C12", "label": "save()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8", "vector": [8, 3, 0.537, 0.0185, 3, 0.34, 1.0, 928, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " save(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L31_C4", "label": "return", "type": "return", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "vector": [13, 1, 0.5741, 0.0185, 1, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse( \"OK\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L33_C0", "label": "post", "type": "function", "loc": [33, 35], "level": 0, "parent": null, "vector": [2, 0, 0.6296, 0.0556, 0, 0.66, 0.6923, 304, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "post", "arg_names": ["msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def post(msg):\n api = apimake()\n api.updateStatus(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L34_C4", "label": "api = apimake()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L33_C0", "vector": [14, 1, 0.6296, 0.0185, 1, 0.63, 0.0, 976, 3, 0, 0, 0, 762, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "apimake", "annotation": ""}, "snippet": " api = apimake()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L35_C4", "label": "updateStatus()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L33_C0", "vector": [8, 1, 0.6481, 0.0185, 1, 0.63, 1.0, 5, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updateStatus", "arg_names": [], "import_names": [], "rhs_call_name": "updateStatus", "annotation": ""}, "snippet": " api.updateStatus(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L37_C0", "label": "directMessage", "type": "function", "loc": [37, 39], "level": 0, "parent": null, "vector": [2, 0, 0.7037, 0.0556, 0, 0.66, 0.7692, 46, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "directMessage", "arg_names": ["user", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def directMessage(user, msg):\n api = apimake()\n api.sendDirectMessage(user, msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L38_C4", "label": "api = apimake()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L37_C0", "vector": [14, 1, 0.7037, 0.0185, 1, 0.81, 0.0, 976, 3, 0, 0, 0, 762, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "apimake", "annotation": ""}, "snippet": " api = apimake()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L39_C4", "label": "sendDirectMessage()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L37_C0", "vector": [8, 1, 0.7222, 0.0185, 1, 0.81, 1.0, 816, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sendDirectMessage", "arg_names": [], "import_names": [], "rhs_call_name": "sendDirectMessage", "annotation": ""}, "snippet": " api.sendDirectMessage(user, msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "label": "save", "type": "function", "loc": [41, 46], "level": 0, "parent": null, "vector": [2, 0, 0.8056, 0.1111, 0, 0.66, 0.8462, 928, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "save", "arg_names": ["e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def save( e):\n mention =Mention()\n mention.postUser =e['user']['screen_name']\n mention.postText =e['text']\n mention.postDate =datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9)\n mention.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L42_C4", "label": "mention = Mention()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "vector": [14, 1, 0.7778, 0.0185, 1, 0.63, 0.0, 795, 3, 0, 0, 0, 386, 10, 1], "semantic": {"name": "mention", "arg_names": [], "import_names": [], "rhs_call_name": "Mention", "annotation": ""}, "snippet": " mention =Mention()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L43_C4", "label": "mention.postUser =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "vector": [14, 1, 0.7963, 0.0185, 1, 0.63, 0.25, 766, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mention.postUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mention.postUser =e['user']['screen_name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L44_C4", "label": "mention.postText =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "vector": [14, 1, 0.8148, 0.0185, 1, 0.63, 0.5, 132, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mention.postText", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mention.postText =e['text']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L45_C4", "label": "mention.postDate =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "vector": [14, 1, 0.8333, 0.0185, 1, 0.63, 0.75, 796, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "mention.postDate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mention.postDate =datetime.strptime(e['created_at'], '%a %b %d %H:%M:%S +0000 %Y')+timedelta(hours=9)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L46_C4", "label": "put()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "vector": [8, 1, 0.8519, 0.0185, 1, 0.63, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " mention.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L48_C0", "label": "makeReply", "type": "function", "loc": [48, 50], "level": 0, "parent": null, "vector": [2, 0, 0.9074, 0.0556, 0, 0.66, 0.9231, 745, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "makeReply", "arg_names": ["e"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def makeReply( e):\n #parse text and generate reply text\n return \"OK I'v got your message\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L48_C0", "vector": [13, 1, 0.9259, 0.0185, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"OK I'v got your message\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L53_C0", "label": "apimake", "type": "function", "loc": [53, 54], "level": 0, "parent": null, "vector": [2, 0, 0.9907, 0.037, 0, 0.66, 1.0, 762, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "apimake", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apimake():\n return twython.setup(authtype=\"Basic\",username=\"user\",password=\"pass\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L54_C4", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L53_C0", "vector": [13, 1, 1.0, 0.0185, 1, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return twython.setup(authtype=\"Basic\",username=\"user\",password=\"pass\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_189:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_189:Return_L54_C4"}] |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, RequestContext, loader
from django.views.generic.list_detail import object_list
from django.views.generic.simple import direct_to_template
from django.forms.formsets import formset_factory
from haco.models import *
from httpauth import *
from haco.jsTime import *
from haco.convert import *
import logging
import time
import csv
@http_login_required()
def record( request):
logging.info(request.user.username + ":" + request.GET['pnum'])
mes ="<html><body>"
haco =Haco(key_name= now().strftime("%Y-%m-%d")
+ ":" + str(request.GET['pnum'])
+ ":" + request.user.username)
haco.user =request.user
haco.username =request.user.username
haco.date = today()
if request.GET['pnum'] == "0":
if now().strftime("%H") == "23":
haco.date = tomorrow()
haco.timestamp = now()
mes +=request.user.username+"<br/>"
if request.GET.has_key( 'pnum'):
haco.pnum =int( request.GET['pnum'])
mes +="pnum:"+str(haco.pnum)+"<br/>"
if request.GET.has_key( 'temp'):
haco.temp =float( v2T(request.GET['temp']))
mes +="temp:"+str(haco.temp)+"<br/>"
if request.GET.has_key( 'light'):
haco.light =float( v2L(request.GET['light']))
mes +="light:"+str(haco.light)+"<br/>"
if request.GET.has_key( 'watt'):
haco.watt =float( v2W(request.GET['watt']))
mes +="watt:"+str(haco.watt)+"<br/>"
mes +="</body></html>"
haco.put()
return HttpResponse( mes)
@login_required()
def report( request):
delta = 0
if request.GET.has_key( 'delta'):
delta = int(request.GET['delta'])
day = someday(delta)
else:
day = today()
t_list = [-1.0] * 144
l_list = [-1.0] * 144
w_list = [-1.0] * 144
q =Haco.all()
q =q.filter( 'user', request.user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
for h in q:
t_list[h.pnum] = h.temp
l_list[h.pnum] = h.light
w_list[h.pnum] = h.watt
if max(w_list) < 200:
w_scale = 200
w_line = 25
else:
w_scale = 1000
w_line = 20
return direct_to_template(request, 'report.html',
{
'day' : day.strftime("%m/%d"),
'delta' : delta,
'prev_url' : "./?delta="+str(delta -1 ),
'next_url' : "./?delta="+str(delta +1 ),
't_list': chartmake(t_list),
'l_list': chartmake(l_list),
'w_list': chartmake(w_list),
'w_scale': w_scale,
'w_line': w_line,
})
def chartmake( a_list):
chart =""
for data in a_list:
chart += str(data) +","
chart = chart[0:len(chart)-1]
return chart
@login_required()
def matrix( request):
if request.GET.has_key( 'delta'):
day = someday(int(request.GET['delta']))
else:
day = today()
q =Haco.all()
q =q.filter( 'user', request.user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
return object_list( request, q)
@login_required
def map( request):
return direct_to_template(request, 'map.html',
{
'ido': str(36.054148),
'kdo': str(140.140033),
})
@login_required
def feed( request):
delta = 0
if request.GET.has_key( 'delta'):
delta = int(request.GET['delta'])
day = someday(delta)
else:
day = today()
q =Haco.all()
q =q.filter( 'user', request.user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
return object_list( request, queryset=q ,template_name="feed.xml"
,extra_context = {'date':day.strftime("%Y-%m-%d"),
'username':request.user.username}
,mimetype="application/xml")
@login_required
def csv( request):
delta = 0
if request.GET.has_key( 'delta'):
delta = int(request.GET['delta'])
day = someday(delta)
else:
day = today()
mes =""
q =Haco.all()
q =q.filter( 'user', request.user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
mes = ""
for h in q:
mes += str(h.username)+","
mes += str(h.date)+","
mes += str(h.pnum)+","
mes += str(h.light)+","
mes += str(h.temp)+","
mes += str(h.watt)+","
mes += str(h.timestamp)
mes +="\n"
return HttpResponse(mes,mimetype = "text/plain" )
@login_required
def test( request):
if request.GET.has_key( 'delta'):
day = someday(int(request.GET['delta']))
else:
day = today()
q =Haco.all()
q =q.filter( 'user', request.user)
q =q.filter( 'date', day)
q =q.order( 'pnum')
return object_list( request, q, template_name = "test.html",
extra_context ={
'count': len(q),
}
)
| ajibawa-2023/Python-Code-Large/train/row_191 | 110 | 212 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0142, 0.0047, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth.decorators", "arg_names": [], "import_names": ["login_required"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.decorators import login_required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L4_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0047, 0, 0.66, 0.0435, 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_191:ImportFrom_L5_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0236, 0.0047, 0, 0.66, 0.087, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L6_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0283, 0.0047, 0, 0.66, 0.1304, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L7_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.033, 0.0047, 0, 0.66, 0.1739, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L8_C0", "label": "from django.template import Context, RequestContext, loader", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0377, 0.0047, 0, 0.66, 0.2174, 213, 0, 3, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Context", "RequestContext", "loader"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Context, RequestContext, loader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L9_C0", "label": "from django.views.generic.list_detail import object_list", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0425, 0.0047, 0, 0.66, 0.2609, 992, 0, 1, 0, 0, 992, 0, 0], "semantic": {"name": "django.views.generic.list_detail", "arg_names": [], "import_names": ["object_list"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.list_detail import object_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L10_C0", "label": "from django.views.generic.simple import direct_to_template", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0472, 0.0047, 0, 0.66, 0.3043, 956, 0, 1, 0, 0, 956, 0, 0], "semantic": {"name": "django.views.generic.simple", "arg_names": [], "import_names": ["direct_to_template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.simple import direct_to_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L11_C0", "label": "from django.forms.formsets import formset_factory", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0519, 0.0047, 0, 0.66, 0.3478, 42, 0, 1, 0, 0, 42, 0, 0], "semantic": {"name": "django.forms.formsets", "arg_names": [], "import_names": ["formset_factory"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.formsets import formset_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L12_C0", "label": "from haco.models import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0566, 0.0047, 0, 0.66, 0.3913, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L13_C0", "label": "from httpauth import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0613, 0.0047, 0, 0.66, 0.4348, 707, 0, 1, 0, 0, 707, 0, 0], "semantic": {"name": "httpauth", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from httpauth import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L14_C0", "label": "from haco.jsTime import *", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.066, 0.0047, 0, 0.66, 0.4783, 615, 0, 1, 0, 0, 615, 0, 0], "semantic": {"name": "haco.jsTime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.jsTime import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:ImportFrom_L15_C0", "label": "from haco.convert import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0708, 0.0047, 0, 0.66, 0.5217, 668, 0, 1, 0, 0, 668, 0, 0], "semantic": {"name": "haco.convert", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.convert import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Import_L16_C0", "label": "logging import logging", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0755, 0.0047, 0, 0.66, 0.5652, 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_191:Import_L17_C0", "label": "time import time", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0802, 0.0047, 0, 0.66, 0.6087, 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_191:Import_L18_C0", "label": "csv import csv", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0849, 0.0047, 0, 0.66, 0.6522, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "label": "record", "type": "function", "loc": [23, 64], "level": 0, "parent": null, "vector": [2, 0, 0.2052, 0.1981, 0, 0.66, 0.6957, 667, 0, 1, 1, 0, 0, 0, 28], "semantic": {"name": "record", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def record( request):\n\n logging.info(request.user.username + \":\" + request.GET['pnum'])\n \n mes =\"<html><body>\"\n \n haco =Haco(key_name= now().strftime(\"%Y-%m-%d\")\n + \":\" + str(request.GET['pnum'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Expr_L25_C4", "label": "info()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [8, 1, 0.1179, 0.0047, 1, 0.42, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info(request.user.username + \":\" + request.GET['pnum'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L27_C4", "label": "mes =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1274, 0.0047, 1, 0.42, 0.0769, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mes =\"<html><body>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L29_C4", "label": "haco = Haco()", "type": "assigned_variable", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1415, 0.0142, 1, 0.42, 0.1538, 636, 3, 1, 0, 0, 425, 10, 4], "semantic": {"name": "haco", "arg_names": [], "import_names": [], "rhs_call_name": "Haco", "annotation": ""}, "snippet": " haco =Haco(key_name= now().strftime(\"%Y-%m-%d\")\n + \":\" + str(request.GET['pnum'])\n + \":\" + request.user.username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L32_C4", "label": "haco.user =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1509, 0.0047, 1, 0.42, 0.2308, 543, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco.user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco.user =request.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L33_C4", "label": "haco.username =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1557, 0.0047, 1, 0.42, 0.3077, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "haco.username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " haco.username =request.user.username"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L34_C4", "label": "haco.date = today()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1604, 0.0047, 1, 0.42, 0.3846, 515, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "haco.date", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " haco.date = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L36_C4", "label": "if", "type": "if", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [4, 1, 0.1745, 0.0142, 1, 0.42, 0.4615, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET['pnum'] == \"0\":\n if now().strftime(\"%H\") == \"23\":\n haco.date = tomorrow()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L37_C8", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L36_C4", "vector": [4, 2, 0.1769, 0.0094, 2, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if now().strftime(\"%H\") == \"23\":\n haco.date = tomorrow()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L38_C12", "label": "haco.date = tomorrow()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L37_C8", "vector": [14, 3, 0.1792, 0.0047, 3, 0.69, 0.0, 515, 3, 0, 0, 0, 440, 10, 1], "semantic": {"name": "haco.date", "arg_names": [], "import_names": [], "rhs_call_name": "tomorrow", "annotation": ""}, "snippet": " haco.date = tomorrow()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L40_C4", "label": "haco.timestamp = now()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [14, 1, 0.1887, 0.0047, 1, 0.42, 0.5385, 76, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "haco.timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " haco.timestamp = now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L43_C4", "label": "if", "type": "if", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [4, 1, 0.2075, 0.0142, 1, 0.42, 0.6154, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'pnum'):\n haco.pnum =int( request.GET['pnum'])\n mes +=\"pnum:\"+str(haco.pnum)+\"<br/>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L44_C8", "label": "haco.pnum = int()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L43_C4", "vector": [14, 2, 0.2075, 0.0047, 2, 0.54, 0.0, 343, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "haco.pnum", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " haco.pnum =int( request.GET['pnum'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L47_C4", "label": "if", "type": "if", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [4, 1, 0.2264, 0.0142, 1, 0.42, 0.6923, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'temp'):\n haco.temp =float( v2T(request.GET['temp']))\n mes +=\"temp:\"+str(haco.temp)+\"<br/>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L48_C8", "label": "haco.temp = float()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L47_C4", "vector": [14, 2, 0.2264, 0.0047, 2, 0.52, 0.0, 531, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "haco.temp", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " haco.temp =float( v2T(request.GET['temp']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L51_C4", "label": "if", "type": "if", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [4, 1, 0.2453, 0.0142, 1, 0.42, 0.7692, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'light'):\n haco.light =float( v2L(request.GET['light']))\n mes +=\"light:\"+str(haco.light)+\"<br/>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L52_C8", "label": "haco.light = float()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L51_C4", "vector": [14, 2, 0.2453, 0.0047, 2, 0.96, 0.0, 699, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "haco.light", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " haco.light =float( v2L(request.GET['light']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L55_C4", "label": "if", "type": "if", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [4, 1, 0.2642, 0.0142, 1, 0.42, 0.8462, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'watt'):\n haco.watt =float( v2W(request.GET['watt']))\n mes +=\"watt:\"+str(haco.watt)+\"<br/>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L56_C8", "label": "haco.watt = float()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L55_C4", "vector": [14, 2, 0.2642, 0.0047, 2, 0.16, 0.0, 678, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "haco.watt", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " haco.watt =float( v2W(request.GET['watt']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Expr_L60_C4", "label": "put()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [8, 1, 0.283, 0.0047, 1, 0.42, 0.9231, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " haco.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L64_C4", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "vector": [13, 1, 0.3019, 0.0047, 1, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse( mes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "label": "report", "type": "function", "loc": [67, 108], "level": 0, "parent": null, "vector": [2, 0, 0.4127, 0.1981, 0, 0.66, 0.7391, 57, 0, 1, 1, 0, 0, 0, 17], "semantic": {"name": "report", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def report( request):\n\n delta = 0\n if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L69_C4", "label": "delta =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3255, 0.0047, 1, 0.26, 0.0, 593, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "label": "if", "type": "if", "loc": [70, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [4, 1, 0.3396, 0.0236, 1, 0.26, 0.0909, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L71_C8", "label": "delta = int()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "vector": [14, 2, 0.3349, 0.0047, 2, 0.21, 0.0, 593, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " delta = int(request.GET['delta'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L72_C8", "label": "day = someday()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "vector": [14, 2, 0.3396, 0.0047, 2, 0.21, 0.5, 878, 3, 1, 0, 0, 934, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(delta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L74_C8", "label": "day = today()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "vector": [14, 2, 0.3491, 0.0047, 2, 0.21, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L76_C4", "label": "t_list =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3585, 0.0047, 1, 0.26, 0.1818, 192, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L77_C4", "label": "l_list =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3632, 0.0047, 1, 0.26, 0.2727, 536, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L78_C4", "label": "w_list =", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3679, 0.0047, 1, 0.26, 0.3636, 821, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_list = [-1.0] * 144"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L80_C4", "label": "q = all()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3774, 0.0047, 1, 0.26, 0.4545, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L81_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3821, 0.0047, 1, 0.26, 0.5455, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L82_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3868, 0.0047, 1, 0.26, 0.6364, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L83_C4", "label": "q = order()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [14, 1, 0.3915, 0.0047, 1, 0.26, 0.7273, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "label": "for h", "type": "for", "loc": [85, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [6, 1, 0.408, 0.0189, 1, 0.26, 0.8182, 686, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in q:\n t_list[h.pnum] = h.temp\n l_list[h.pnum] = h.light\n w_list[h.pnum] = h.watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L86_C8", "label": "assign", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "vector": [14, 2, 0.4057, 0.0047, 2, 0.37, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_list[h.pnum] = h.temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L87_C8", "label": "assign", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "vector": [14, 2, 0.4104, 0.0047, 2, 0.37, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l_list[h.pnum] = h.light"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L88_C8", "label": "assign", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "vector": [14, 2, 0.4151, 0.0047, 2, 0.37, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_list[h.pnum] = h.watt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "label": "if", "type": "if", "loc": [90, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [4, 1, 0.4363, 0.0283, 1, 0.26, 0.9091, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max(w_list) < 200:\n w_scale = 200\n w_line = 25\n else:\n w_scale = 1000\n w_line = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L91_C8", "label": "w_scale =", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "vector": [14, 2, 0.4292, 0.0047, 2, 0.92, 0.0, 296, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "w_scale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_scale = 200"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L92_C8", "label": "w_line =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "vector": [14, 2, 0.434, 0.0047, 2, 0.92, 0.3333, 937, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "w_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_line = 25"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L94_C8", "label": "w_scale =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "vector": [14, 2, 0.4434, 0.0047, 2, 0.92, 0.6667, 296, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "w_scale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_scale = 1000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L95_C8", "label": "w_line =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "vector": [14, 2, 0.4481, 0.0047, 2, 0.92, 1.0, 937, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "w_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w_line = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L97_C4", "label": "return", "type": "return", "loc": [97, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "vector": [13, 1, 0.4835, 0.0566, 1, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return direct_to_template(request, 'report.html',\n {\n 'day' : day.strftime(\"%m/%d\"),\n 'delta' : delta,\n 'prev_url' : \"./?delta=\"+str(delta -1 ),\n 'next_url' : \"./?delta=\"+str(delta +1 ),\n 't_list': chartmake(t_list),\n 'l_list': chartmake(l_list),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "label": "chartmake", "type": "function", "loc": [111, 116], "level": 0, "parent": null, "vector": [2, 0, 0.5354, 0.0283, 0, 0.66, 0.7826, 537, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "chartmake", "arg_names": ["a_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def chartmake( a_list):\n chart =\"\"\n for data in a_list:\n chart += str(data) +\",\"\n chart = chart[0:len(chart)-1]\n return chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L112_C4", "label": "chart =", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "vector": [14, 1, 0.5283, 0.0047, 1, 0.71, 0.0, 930, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart =\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:For_L113_C4", "label": "for data", "type": "for", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "vector": [6, 1, 0.5354, 0.0094, 1, 0.71, 0.3333, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in a_list:\n chart += str(data) +\",\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L115_C4", "label": "chart =", "type": "assigned_variable", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "vector": [14, 1, 0.5425, 0.0047, 1, 0.71, 0.6667, 930, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chart = chart[0:len(chart)-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L116_C4", "label": "return", "type": "return", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "vector": [13, 1, 0.5472, 0.0047, 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 chart"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "label": "matrix", "type": "function", "loc": [119, 131], "level": 0, "parent": null, "vector": [2, 0, 0.5896, 0.0613, 0, 0.66, 0.8261, 162, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "matrix", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def matrix( request):\n\n if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()\n \n q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4", "label": "if", "type": "if", "loc": [121, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [4, 1, 0.5778, 0.0189, 1, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L122_C8", "label": "day = someday()", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4", "vector": [14, 2, 0.5755, 0.0047, 2, 0.23, 0.0, 878, 3, 1, 0, 0, 934, 10, 2], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(int(request.GET['delta']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L124_C8", "label": "day = today()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4", "vector": [14, 2, 0.5849, 0.0047, 2, 0.23, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L126_C4", "label": "q = all()", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [14, 1, 0.5943, 0.0047, 1, 0.96, 0.2, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L127_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [14, 1, 0.5991, 0.0047, 1, 0.96, 0.4, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L128_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [14, 1, 0.6038, 0.0047, 1, 0.96, 0.6, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L129_C4", "label": "q = order()", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [14, 1, 0.6085, 0.0047, 1, 0.96, 0.8, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L131_C4", "label": "return", "type": "return", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "vector": [13, 1, 0.6179, 0.0047, 1, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object_list( request, q)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L135_C0", "label": "map", "type": "function", "loc": [135, 141], "level": 0, "parent": null, "vector": [2, 0, 0.6509, 0.033, 0, 0.66, 0.8696, 53, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "map", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def map( request):\n \n return direct_to_template(request, 'map.html',\n {\n 'ido': str(36.054148),\n 'kdo': str(140.140033),\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L137_C4", "label": "return", "type": "return", "loc": [137, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L135_C0", "vector": [13, 1, 0.6557, 0.0236, 1, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return direct_to_template(request, 'map.html',\n {\n 'ido': str(36.054148),\n 'kdo': str(140.140033),\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "label": "feed", "type": "function", "loc": [145, 163], "level": 0, "parent": null, "vector": [2, 0, 0.7264, 0.0896, 0, 0.66, 0.913, 87, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "feed", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def feed( request):\n\n delta = 0\n if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L147_C4", "label": "delta =", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [14, 1, 0.6934, 0.0047, 1, 0.93, 0.0, 593, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "label": "if", "type": "if", "loc": [148, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [4, 1, 0.7075, 0.0236, 1, 0.93, 0.1667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L149_C8", "label": "delta = int()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "vector": [14, 2, 0.7028, 0.0047, 2, 0.29, 0.0, 593, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " delta = int(request.GET['delta'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L150_C8", "label": "day = someday()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "vector": [14, 2, 0.7075, 0.0047, 2, 0.29, 0.5, 878, 3, 1, 0, 0, 934, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(delta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L152_C8", "label": "day = today()", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "vector": [14, 2, 0.717, 0.0047, 2, 0.29, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L154_C4", "label": "q = all()", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [14, 1, 0.7264, 0.0047, 1, 0.93, 0.3333, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L155_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [14, 1, 0.7311, 0.0047, 1, 0.93, 0.5, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L156_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [14, 1, 0.7358, 0.0047, 1, 0.93, 0.6667, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L157_C4", "label": "q = order()", "type": "assigned_variable", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [14, 1, 0.7406, 0.0047, 1, 0.93, 0.8333, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L160_C4", "label": "return", "type": "return", "loc": [160, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "vector": [13, 1, 0.7618, 0.0189, 1, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object_list( request, queryset=q ,template_name=\"feed.xml\"\n ,extra_context = {'date':day.strftime(\"%Y-%m-%d\"),\n 'username':request.user.username}\n ,mimetype=\"application/xml\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "label": "csv", "type": "function", "loc": [166, 191], "level": 0, "parent": null, "vector": [2, 0, 0.842, 0.1226, 0, 0.66, 0.9565, 312, 0, 1, 1, 0, 0, 0, 16], "semantic": {"name": "csv", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def csv( request):\n\n delta = 0\n if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L168_C4", "label": "delta =", "type": "assigned_variable", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.7925, 0.0047, 1, 0.29, 0.0, 593, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "label": "if", "type": "if", "loc": [169, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [4, 1, 0.8066, 0.0236, 1, 0.29, 0.1111, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n delta = int(request.GET['delta'])\n day = someday(delta)\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L170_C8", "label": "delta = int()", "type": "assigned_variable", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "vector": [14, 2, 0.8019, 0.0047, 2, 0.54, 0.0, 593, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " delta = int(request.GET['delta'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L171_C8", "label": "day = someday()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "vector": [14, 2, 0.8066, 0.0047, 2, 0.54, 0.5, 878, 3, 1, 0, 0, 934, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(delta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L173_C8", "label": "day = today()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "vector": [14, 2, 0.816, 0.0047, 2, 0.54, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L175_C4", "label": "mes =", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8255, 0.0047, 1, 0.29, 0.2222, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mes =\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L176_C4", "label": "q = all()", "type": "assigned_variable", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8302, 0.0047, 1, 0.29, 0.3333, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L177_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8349, 0.0047, 1, 0.29, 0.4444, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L178_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8396, 0.0047, 1, 0.29, 0.5556, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L179_C4", "label": "q = order()", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8443, 0.0047, 1, 0.29, 0.6667, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L180_C4", "label": "mes =", "type": "assigned_variable", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [14, 1, 0.8491, 0.0047, 1, 0.29, 0.7778, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mes = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:For_L181_C4", "label": "for h", "type": "for", "loc": [181, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [6, 1, 0.8726, 0.0425, 1, 0.29, 0.8889, 686, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in q:\n mes += str(h.username)+\",\"\n mes += str(h.date)+\",\"\n mes += str(h.pnum)+\",\"\n mes += str(h.light)+\",\"\n mes += str(h.temp)+\",\"\n mes += str(h.watt)+\",\"\n mes += str(h.timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L191_C4", "label": "return", "type": "return", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "vector": [13, 1, 0.9009, 0.0047, 1, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(mes,mimetype = \"text/plain\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "label": "test", "type": "function", "loc": [197, 212], "level": 0, "parent": null, "vector": [2, 0, 0.9646, 0.0755, 0, 0.66, 1.0, 224, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "test", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test( request):\n if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()\n \n q =Haco.all()\n q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4", "label": "if", "type": "if", "loc": [198, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [4, 1, 0.941, 0.0189, 1, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.GET.has_key( 'delta'):\n day = someday(int(request.GET['delta']))\n else:\n day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L199_C8", "label": "day = someday()", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4", "vector": [14, 2, 0.9387, 0.0047, 2, 0.47, 0.0, 878, 3, 1, 0, 0, 934, 10, 2], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "someday", "annotation": ""}, "snippet": " day = someday(int(request.GET['delta']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L201_C8", "label": "day = today()", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4", "vector": [14, 2, 0.9481, 0.0047, 2, 0.47, 1.0, 878, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "day", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " day = today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L203_C4", "label": "q = all()", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [14, 1, 0.9575, 0.0047, 1, 0.15, 0.2, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q =Haco.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L204_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [14, 1, 0.9623, 0.0047, 1, 0.15, 0.4, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'user', request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L205_C4", "label": "q = filter()", "type": "assigned_variable", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [14, 1, 0.967, 0.0047, 1, 0.15, 0.6, 516, 3, 2, 0, 0, 526, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q =q.filter( 'date', day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L206_C4", "label": "q = order()", "type": "assigned_variable", "loc": [206, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [14, 1, 0.9717, 0.0047, 1, 0.15, 0.8, 516, 3, 1, 0, 0, 234, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "order", "annotation": ""}, "snippet": " q =q.order( 'pnum')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L208_C4", "label": "return", "type": "return", "loc": [208, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "vector": [13, 1, 0.9906, 0.0236, 1, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object_list( request, q, template_name = \"test.html\",\n extra_context ={\n 'count': len(q),\n }\n )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:For_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:For_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L135_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L145_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:For_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_191:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_191:Return_L208_C4"}] |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
from django.template import Context, loader
from django.views.generic.list_detail import object_list
from haco.models import *
from httpauth import *
from haco.jsTime import *
| ajibawa-2023/Python-Code-Large/train/row_192 | 10 | 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_192:ImportFrom_L3_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth.decorators", "arg_names": [], "import_names": ["login_required"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.decorators import login_required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L5_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.3846, 0.0769, 0, 0.66, 0.1111, 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_192:ImportFrom_L6_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.4615, 0.0769, 0, 0.66, 0.2222, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L7_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.5385, 0.0769, 0, 0.66, 0.3333, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L8_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.6154, 0.0769, 0, 0.66, 0.4444, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L9_C0", "label": "from django.template import Context, loader", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.6923, 0.0769, 0, 0.66, 0.5556, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Context", "loader"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Context, loader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L10_C0", "label": "from django.views.generic.list_detail import object_list", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.7692, 0.0769, 0, 0.66, 0.6667, 992, 0, 1, 0, 0, 992, 0, 0], "semantic": {"name": "django.views.generic.list_detail", "arg_names": [], "import_names": ["object_list"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.list_detail import object_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L11_C0", "label": "from haco.models import *", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.8462, 0.0769, 0, 0.66, 0.7778, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L12_C0", "label": "from httpauth import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.9231, 0.0769, 0, 0.66, 0.8889, 707, 0, 1, 0, 0, 707, 0, 0], "semantic": {"name": "httpauth", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from httpauth import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_192:ImportFrom_L13_C0", "label": "from haco.jsTime import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.0769, 0, 0.66, 1.0, 615, 0, 1, 0, 0, 615, 0, 0], "semantic": {"name": "haco.jsTime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.jsTime import *"}] | [] |
from django.contrib import admin
from haco.models import HacoUser, Haco
class HacoUserAdmin( admin.ModelAdmin):
list_display =( 'user', 'prefecture', 'city')
class HacoAdmin( admin.ModelAdmin):
list_display =( 'temp', 'light', 'watt', 'date')
admin.site.register( HacoUser)
admin.site.register( Haco)
| ajibawa-2023/Python-Code-Large/train/row_193 | 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_193:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_193:ImportFrom_L2_C0", "label": "from haco.models import HacoUser, Haco", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.2, 209, 0, 2, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["HacoUser", "Haco"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import HacoUser, Haco"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L4_C0", "label": "HacoUserAdmin", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.4091, 0.1818, 0, 0.66, 0.4, 437, 0, 0, 0, 0, 823, 0, 0], "semantic": {"name": "HacoUserAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HacoUserAdmin( admin.ModelAdmin):\n list_display =( 'user', 'prefecture', 'city')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L5_C4", "label": "list_display =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L4_C0", "vector": [14, 1, 0.4545, 0.0909, 1, 0.07, 0.0, 489, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_display =( 'user', 'prefecture', 'city')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L7_C0", "label": "HacoAdmin", "type": "class", "loc": [7, 8], "level": 0, "parent": null, "vector": [3, 0, 0.6818, 0.1818, 0, 0.66, 0.6, 960, 0, 0, 0, 0, 823, 0, 0], "semantic": {"name": "HacoAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HacoAdmin( admin.ModelAdmin):\n list_display =( 'temp', 'light', 'watt', 'date')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L8_C4", "label": "list_display =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L7_C0", "vector": [14, 1, 0.7273, 0.0909, 1, 0.01, 0.0, 489, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_display =( 'temp', 'light', 'watt', 'date')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:Expr_L10_C0", "label": "register()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "admin.site.register( HacoUser)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_193:Expr_L11_C0", "label": "register()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 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( Haco)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_193:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_193:Assign_L8_C4"}] |
# -*- coding: utf-8 -*-
from datetime import *
def now():
return datetime.now() + timedelta(hours=9)
def today():
return now().replace(hour=0,minute=0,second=0,microsecond=0)
def tomorrow():
return (now() + timedelta(days=1)).replace(hour=0,minute=0,second=0,microsecond=0)
def someday(delta):
return (now() + timedelta(days=delta)).replace(hour=0,minute=0,second=0,microsecond=0)
| ajibawa-2023/Python-Code-Large/train/row_194 | 9 | 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_194:ImportFrom_L3_C0", "label": "from datetime import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L6_C0", "label": "now", "type": "function", "loc": [6, 7], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.1538, 0, 0.66, 0.25, 894, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def now():\n return datetime.now() + timedelta(hours=9)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L7_C4", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L6_C0", "vector": [13, 1, 0.5385, 0.0769, 1, 0.75, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return datetime.now() + timedelta(hours=9)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L8_C0", "label": "today", "type": "function", "loc": [8, 9], "level": 0, "parent": null, "vector": [2, 0, 0.6538, 0.1538, 0, 0.66, 0.5, 788, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def today():\n return now().replace(hour=0,minute=0,second=0,microsecond=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L9_C4", "label": "return", "type": "return", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L8_C0", "vector": [13, 1, 0.6923, 0.0769, 1, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return now().replace(hour=0,minute=0,second=0,microsecond=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L10_C0", "label": "tomorrow", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.8077, 0.1538, 0, 0.66, 0.75, 440, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "tomorrow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tomorrow():\n return (now() + timedelta(days=1)).replace(hour=0,minute=0,second=0,microsecond=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L10_C0", "vector": [13, 1, 0.8462, 0.0769, 1, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (now() + timedelta(days=1)).replace(hour=0,minute=0,second=0,microsecond=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L12_C0", "label": "someday", "type": "function", "loc": [12, 13], "level": 0, "parent": null, "vector": [2, 0, 0.9615, 0.1538, 0, 0.66, 1.0, 934, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "someday", "arg_names": ["delta"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def someday(delta):\n return (now() + timedelta(days=delta)).replace(hour=0,minute=0,second=0,microsecond=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L12_C0", "vector": [13, 1, 1.0, 0.0769, 1, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (now() + timedelta(days=delta)).replace(hour=0,minute=0,second=0,microsecond=0)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_194:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_194:Return_L13_C4"}] |
from ragendja.settings_post import settings
settings.add_app_media('combined-%(LANGUAGE_DIR)s.css',
'blueprintcss/reset.css',
'blueprintcss/typography.css',
'blueprintcss/forms.css',
'blueprintcss/grid.css',
'blueprintcss/lang-%(LANGUAGE_DIR)s.css',
)
settings.add_app_media('combined-print-%(LANGUAGE_DIR)s.css',
'blueprintcss/print.css',
)
settings.add_app_media('ie.css',
'blueprintcss/ie.css',
)
| ajibawa-2023/Python-Code-Large/train/row_195 | 4 | 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_195:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_post import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_195:Expr_L2_C0", "label": "add_app_media()", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.3571, 0.5, 0, 0.66, 0.3333, 197, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_app_media", "arg_names": [], "import_names": [], "rhs_call_name": "add_app_media", "annotation": ""}, "snippet": "settings.add_app_media('combined-%(LANGUAGE_DIR)s.css',\n 'blueprintcss/reset.css',\n 'blueprintcss/typography.css',\n 'blueprintcss/forms.css',\n 'blueprintcss/grid.css',\n 'blueprintcss/lang-%(LANGUAGE_DIR)s.css',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_195:Expr_L9_C0", "label": "add_app_media()", "type": "expression", "loc": [9, 11], "level": 0, "parent": null, "vector": [8, 0, 0.7143, 0.2143, 0, 0.66, 0.6667, 197, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_app_media", "arg_names": [], "import_names": [], "rhs_call_name": "add_app_media", "annotation": ""}, "snippet": "settings.add_app_media('combined-print-%(LANGUAGE_DIR)s.css',\n 'blueprintcss/print.css',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_195:Expr_L12_C0", "label": "add_app_media()", "type": "expression", "loc": [12, 14], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.2143, 0, 0.66, 1.0, 197, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_app_media", "arg_names": [], "import_names": [], "rhs_call_name": "add_app_media", "annotation": ""}, "snippet": "settings.add_app_media('ie.css',\n 'blueprintcss/ie.css',\n)"}] | [] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from ragendja.urlsauto import urlpatterns
from ragendja.auth.urls import urlpatterns as auth_patterns
#from myapp.forms import UserRegistrationForm
from django.contrib import admin
from django.contrib.auth import views as auth_views
from haco import views as haco_views
from haco.forms import UserRegistrationForm
admin.autodiscover()
handler500 = 'ragendja.views.server_error'
urlpatterns = auth_patterns + patterns(
'',
('^admin/(.*)', admin.site.root),
#(r'^$', 'django.views.generic.simple.direct_to_template',
# {'template': 'main.html'}),
# Override the default registration form
url(r'^account/register/$', 'registration.views.register',
kwargs={'form_class': UserRegistrationForm},
name='registration_register'),
#url(r'^$', 'haco.views.login'),
url( r'^$',
auth_views.login,
{'template_name': 'registration/login.html'},
name='auth_login'),
(r'^accounts/change-password/$', 'django.contrib.auth.views.password_change',
{'post_change_redirect': '/'}),
(r'^haco/', include( 'haco.urls')),
) + urlpatterns
| ajibawa-2023/Python-Code-Large/train/row_196 | 10 | 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_196:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0263, 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_196:ImportFrom_L3_C0", "label": "from ragendja.urlsauto import urlpatterns", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0789, 0.0263, 0, 0.66, 0.1111, 517, 0, 1, 0, 0, 517, 0, 0], "semantic": {"name": "ragendja.urlsauto", "arg_names": [], "import_names": ["urlpatterns"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.urlsauto import urlpatterns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:ImportFrom_L4_C0", "label": "from ragendja.auth.urls import auth_patterns", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0263, 0, 0.66, 0.2222, 905, 0, 1, 0, 0, 905, 0, 0], "semantic": {"name": "ragendja.auth.urls", "arg_names": [], "import_names": ["auth_patterns"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.urls import urlpatterns as auth_patterns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:ImportFrom_L6_C0", "label": "from django.contrib import admin", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0263, 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_196:ImportFrom_L8_C0", "label": "from django.contrib.auth import auth_views", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0263, 0, 0.66, 0.4444, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names": [], "import_names": ["auth_views"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth import views as auth_views"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:ImportFrom_L9_C0", "label": "from haco import haco_views", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2368, 0.0263, 0, 0.66, 0.5556, 636, 0, 1, 0, 0, 636, 0, 0], "semantic": {"name": "haco", "arg_names": [], "import_names": ["haco_views"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco import views as haco_views"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:ImportFrom_L10_C0", "label": "from haco.forms import UserRegistrationForm", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2632, 0.0263, 0, 0.66, 0.6667, 225, 0, 1, 0, 0, 225, 0, 0], "semantic": {"name": "haco.forms", "arg_names": [], "import_names": ["UserRegistrationForm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.forms import UserRegistrationForm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:Expr_L12_C0", "label": "autodiscover()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.3158, 0.0263, 0, 0.66, 0.7778, 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_196:Assign_L14_C0", "label": "handler500 =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.3684, 0.0263, 0, 0.66, 0.8889, 91, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "handler500", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "handler500 = 'ragendja.views.server_error'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_196:Assign_L16_C0", "label": "urlpatterns =", "type": "assigned_variable", "loc": [16, 38], "level": 0, "parent": null, "vector": [14, 0, 0.7105, 0.6053, 0, 0.66, 1.0, 990, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "urlpatterns = auth_patterns + patterns(\n '',\n ('^admin/(.*)', admin.site.root),\n #(r'^$', 'django.views.generic.simple.direct_to_template',\n # {'template': 'main.html'}),\n # Override the default registration form\n url(r'^account/register/$', 'registration.views.register',\n kwargs={'form_class': UserRegistrationForm},"}] | [] |
from ragendja.settings_post import settings
if not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'):
settings.ACCOUNT_ACTIVATION_DAYS = 30
| ajibawa-2023/Python-Code-Large/train/row_197 | 3 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_197:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_post import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_197:If_L3_C0", "label": "if", "type": "if", "loc": [3, 4], "level": 0, "parent": null, "vector": [4, 0, 0.875, 0.5, 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 not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'):\n settings.ACCOUNT_ACTIVATION_DAYS = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_197:Assign_L4_C4", "label": "settings.ACCOUNT_ACTIVATION_DAYS =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_197:If_L3_C0", "vector": [14, 1, 1.0, 0.25, 1, 0.61, 0.0, 827, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "settings.ACCOUNT_ACTIVATION_DAYS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.ACCOUNT_ACTIVATION_DAYS = 30"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_197:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_197:Assign_L4_C4"}] |
from django.conf.urls.defaults import *
rootpatterns = patterns('',
(r'^account/', include('registration.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_198 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_198:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 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_198:Assign_L3_C0", "label": "rootpatterns = patterns()", "type": "assigned_variable", "loc": [3, 5], "level": 0, "parent": null, "vector": [14, 0, 0.8, 0.6, 0, 0.66, 1.0, 319, 3, 2, 0, 0, 75, 10, 2], "semantic": {"name": "rootpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "rootpatterns = patterns('',\n (r'^account/', include('registration.urls')),\n)"}] | [] |
import datetime
import random
import re
import sha
from google.appengine.ext import db
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
SHA1_RE = re.compile('^[a-f0-9]{40}$')
class RegistrationManager(models.Manager):
"""
Custom manager for the ``RegistrationProfile`` model.
The methods defined here provide shortcuts for account creation
and activation (including generation and emailing of activation
keys), and for cleaning out expired inactive accounts.
"""
def activate_user(self, activation_key):
"""
Validate an activation key and activate the corresponding
``User`` if valid.
If the key is valid and has not expired, return the ``User``
after activating.
If the key is not valid or has expired, return ``False``.
If the key is valid but the ``User`` is already active,
return ``False``.
To prevent reactivation of an account which has been
deactivated by site administrators, the activation key is
reset to the string constant ``RegistrationProfile.ACTIVATED``
after successful activation.
To execute customized logic when a ``User`` is activated,
connect a function to the signal
``registration.signals.user_activated``; this signal will be
sent (with the ``User`` as the value of the keyword argument
``user``) after a successful activation.
"""
from registration.signals import user_activated
# Make sure the key we're trying conforms to the pattern of a
# SHA1 hash; if it doesn't, no point trying to look it up in
# the database.
if SHA1_RE.search(activation_key):
profile = RegistrationProfile.get_by_key_name("key_"+activation_key)
if not profile:
return False
if not profile.activation_key_expired():
user = profile.user
user.is_active = True
user.put()
profile.activation_key = RegistrationProfile.ACTIVATED
profile.put()
user_activated.send(sender=self.model, user=user)
return user
return False
def create_inactive_user(self, username, password, email, domain_override="",
send_email=True):
"""
Create a new, inactive ``User``, generate a
``RegistrationProfile`` and email its activation key to the
``User``, returning the new ``User``.
To disable the email, call with ``send_email=False``.
The activation email will make use of two templates:
``registration/activation_email_subject.txt``
This template will be used for the subject line of the
email. It receives one context variable, ``site``, which
is the currently-active
``django.contrib.sites.models.Site`` instance. Because it
is used as the subject line of an email, this template's
output **must** be only a single line of text; output
longer than one line will be forcibly joined into only a
single line.
``registration/activation_email.txt``
This template will be used for the body of the email. It
will receive three context variables: ``activation_key``
will be the user's activation key (for use in constructing
a URL to activate the account), ``expiration_days`` will
be the number of days for which the key will be valid and
``site`` will be the currently-active
``django.contrib.sites.models.Site`` instance.
To execute customized logic once the new ``User`` has been
created, connect a function to the signal
``registration.signals.user_registered``; this signal will be
sent (with the new ``User`` as the value of the keyword
argument ``user``) after the ``User`` and
``RegistrationProfile`` have been created, and the email (if
any) has been sent..
"""
from registration.signals import user_registered
# prepend "key_" to the key_name, because key_names can't start with numbers
new_user = User(username=username, key_name="key_"+username.lower(),
email=email, is_active=False)
new_user.set_password(password)
new_user.put()
registration_profile = self.create_profile(new_user)
if send_email:
# from django.core.mail import send_mail
# from google.appengine.api.mail import send_mail
current_site = domain_override
# current_site = Site.objects.get_current()
subject = render_to_string('registration/activation_email_subject.txt',
{ 'site': current_site })
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
message = render_to_string('registration/activation_email.txt',
{ 'activation_key': registration_profile.activation_key,
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
'site': current_site })
#send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])
# send_mail( sender =settings.DEFAULT_FROM_EMAIL,
# to =[new_user.email],
# subject =subject,
# body =message)
user_registered.send(sender=self.model, user=new_user)
return new_user
def create_profile(self, user):
"""
Create a ``RegistrationProfile`` for a given
``User``, and return the ``RegistrationProfile``.
The activation key for the ``RegistrationProfile`` will be a
SHA1 hash, generated from a combination of the ``User``'s
username and a random salt.
"""
salt = sha.new(str(random.random())).hexdigest()[:5]
activation_key = sha.new(salt+user.username).hexdigest()
# prepend "key_" to the key_name, because key_names can't start with numbers
registrationprofile = RegistrationProfile(user=user, activation_key=activation_key, key_name="key_"+activation_key)
registrationprofile.put()
return registrationprofile
def delete_expired_users(self):
"""
Remove expired instances of ``RegistrationProfile`` and their
associated ``User``s.
Accounts to be deleted are identified by searching for
instances of ``RegistrationProfile`` with expired activation
keys, and then checking to see if their associated ``User``
instances have the field ``is_active`` set to ``False``; any
``User`` who is both inactive and has an expired activation
key will be deleted.
It is recommended that this method be executed regularly as
part of your routine site maintenance; this application
provides a custom management command which will call this
method, accessible as ``manage.py cleanupregistration``.
Regularly clearing out accounts which have never been
activated serves two useful purposes:
1. It alleviates the ocasional need to reset a
``RegistrationProfile`` and/or re-send an activation email
when a user does not receive or does not act upon the
initial activation email; since the account will be
deleted, the user will be able to simply re-register and
receive a new activation key.
2. It prevents the possibility of a malicious user registering
one or more accounts and never activating them (thus
denying the use of those usernames to anyone else); since
those accounts will be deleted, the usernames will become
available for use again.
If you have a troublesome ``User`` and wish to disable their
account while keeping it in the database, simply delete the
associated ``RegistrationProfile``; an inactive ``User`` which
does not have an associated ``RegistrationProfile`` will not
be deleted.
"""
for profile in RegistrationProfile.all():
if profile.activation_key_expired():
user = profile.user
if not user.is_active:
user.delete()
profile.delete()
class RegistrationProfile(db.Model):
"""
A simple profile which stores an activation key for use during
user account registration.
Generally, you will not want to interact directly with instances
of this model; the provided manager includes methods
for creating and activating new accounts, as well as for cleaning
out accounts which have never been activated.
While it is possible to use this model as the value of the
``AUTH_PROFILE_MODULE`` setting, it's not recommended that you do
so. This model's sole purpose is to store data temporarily during
account registration and activation.
"""
ACTIVATED = u"ALREADY_ACTIVATED"
user = db.ReferenceProperty(User, verbose_name=_('user'))
activation_key = db.StringProperty(_('activation key'))
objects = RegistrationManager()
class Meta:
verbose_name = _('registration profile')
verbose_name_plural = _('registration profiles')
def __unicode__(self):
return u"Registration information for %s" % self.user
def activation_key_expired(self):
"""
Determine whether this ``RegistrationProfile``'s activation
key has expired, returning a boolean -- ``True`` if the key
has expired.
Key expiration is determined by a two-step process:
1. If the user has already activated, the key will have been
reset to the string constant ``ACTIVATED``. Re-activating
is not permitted, and so this method returns ``True`` in
this case.
2. Otherwise, the date the user signed up is incremented by
the number of days specified in the setting
``ACCOUNT_ACTIVATION_DAYS`` (which should be the number of
days after signup during which a user is allowed to
activate their account); if the result is less than or
equal to the current date, the key has expired and this
method returns ``True``.
"""
expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
return self.activation_key == RegistrationProfile.ACTIVATED or \
(self.user.date_joined + expiration_date <= datetime.datetime.now())
activation_key_expired.boolean = True
| ajibawa-2023/Python-Code-Large/train/row_199 | 75 | 264 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_199:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0038, 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_199:Import_L2_C0", "label": "random import random", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0076, 0.0038, 0, 0.66, 0.0769, 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_199:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0114, 0.0038, 0, 0.66, 0.1538, 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_199:Import_L4_C0", "label": "sha import sha", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0038, 0, 0.66, 0.2308, 263, 0, 1, 0, 0, 263, 0, 0], "semantic": {"name": "sha", "arg_names": [], "import_names": ["sha"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sha"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L6_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0038, 0, 0.66, 0.3077, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L8_C0", "label": "from django.conf import settings", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0038, 0, 0.66, 0.3846, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L9_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0341, 0.0038, 0, 0.66, 0.4615, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L10_C0", "label": "from django.contrib.sites.models import Site", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0379, 0.0038, 0, 0.66, 0.5385, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "django.contrib.sites.models", "arg_names": [], "import_names": ["Site"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sites.models import Site"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L11_C0", "label": "from django.db import models", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0038, 0, 0.66, 0.6154, 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_199:ImportFrom_L12_C0", "label": "from django.template.loader import render_to_string", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0038, 0, 0.66, 0.6923, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "django.template.loader", "arg_names": [], "import_names": ["render_to_string"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template.loader import render_to_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L13_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0038, 0, 0.66, 0.7692, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L15_C0", "label": "SHA1_RE = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0568, 0.0038, 0, 0.66, 0.8462, 631, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "SHA1_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "SHA1_RE = re.compile('^[a-f0-9]{40}$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "label": "RegistrationManager", "type": "class", "loc": [18, 207], "level": 0, "parent": null, "vector": [3, 0, 0.4261, 0.7197, 0, 0.66, 0.9231, 857, 0, 4, 0, 0, 948, 0, 28], "semantic": {"name": "RegistrationManager", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationManager(models.Manager):\n \"\"\"\n Custom manager for the ``RegistrationProfile`` model.\n \n The methods defined here provide shortcuts for account creation\n and activation (including generation and emailing of activation\n keys), and for cleaning out expired inactive accounts.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "vector": [8, 1, 0.0852, 0.0303, 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 Custom manager for the ``RegistrationProfile`` model.\n \n The methods defined here provide shortcuts for account creation\n and activation (including generation and emailing of activation\n keys), and for cleaning out expired inactive accounts.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "label": "activate_user", "type": "function", "loc": [27, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "vector": [2, 1, 0.1818, 0.1629, 1, 0.08, 0.25, 439, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "activate_user", "arg_names": ["self", "activation_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activate_user(self, activation_key):\n \"\"\"\n Validate an activation key and activate the corresponding\n ``User`` if valid.\n \n If the key is valid and has not expired, return the ``User``\n after activating.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L28_C8", "label": "expression", "type": "expression", "loc": [28, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "vector": [8, 2, 0.1496, 0.0909, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate an activation key and activate the corresponding\n ``User`` if valid.\n \n If the key is valid and has not expired, return the ``User``\n after activating.\n \n If the key is not valid or has expired, return ``False``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L52_C8", "label": "from registration.signals import user_activated", "type": "import", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "vector": [1, 2, 0.197, 0.0038, 2, 0.6, 0.3333, 497, 0, 1, 0, 0, 497, 0, 0], "semantic": {"name": "registration.signals", "arg_names": [], "import_names": ["user_activated"], "rhs_call_name": "", "annotation": ""}, "snippet": " from registration.signals import user_activated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "label": "if", "type": "if", "loc": [57, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "vector": [4, 2, 0.2367, 0.0455, 2, 0.6, 0.6667, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if SHA1_RE.search(activation_key):\n profile = RegistrationProfile.get_by_key_name(\"key_\"+activation_key)\n if not profile:\n return False\n if not profile.activation_key_expired():\n user = profile.user\n user.is_active = True\n user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L58_C12", "label": "profile = get_by_key_name()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "vector": [14, 3, 0.2197, 0.0038, 3, 0.73, 0.0, 924, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "profile", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " profile = RegistrationProfile.get_by_key_name(\"key_\"+activation_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L59_C12", "label": "if", "type": "if", "loc": [59, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "vector": [4, 3, 0.2254, 0.0076, 3, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not profile:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L60_C16", "label": "return", "type": "return", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L59_C12", "vector": [13, 4, 0.2273, 0.0038, 4, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "label": "if", "type": "if", "loc": [61, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "vector": [4, 3, 0.2443, 0.0303, 3, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not profile.activation_key_expired():\n user = profile.user\n user.is_active = True\n user.put()\n profile.activation_key = RegistrationProfile.ACTIVATED\n profile.put()\n user_activated.send(sender=self.model, user=user)\n return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L62_C16", "label": "user =", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [14, 4, 0.2348, 0.0038, 4, 0.81, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = profile.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L63_C16", "label": "user.is_active =", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [14, 4, 0.2386, 0.0038, 4, 0.81, 0.1667, 242, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "user.is_active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user.is_active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L64_C16", "label": "put()", "type": "expression", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [8, 4, 0.2424, 0.0038, 4, 0.81, 0.3333, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L65_C16", "label": "profile.activation_key =", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [14, 4, 0.2462, 0.0038, 4, 0.81, 0.5, 666, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "profile.activation_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " profile.activation_key = RegistrationProfile.ACTIVATED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L66_C16", "label": "put()", "type": "expression", "loc": [66, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [8, 4, 0.25, 0.0038, 4, 0.81, 0.6667, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " profile.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L67_C16", "label": "send()", "type": "expression", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [8, 4, 0.2538, 0.0038, 4, 0.81, 0.8333, 826, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " user_activated.send(sender=self.model, user=user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L68_C16", "label": "return", "type": "return", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "vector": [13, 4, 0.2576, 0.0038, 4, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "vector": [13, 2, 0.2614, 0.0038, 2, 0.6, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "label": "create_inactive_user", "type": "function", "loc": [71, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "vector": [2, 1, 0.4053, 0.2765, 1, 0.08, 0.5, 686, 0, 6, 1, 0, 0, 0, 10], "semantic": {"name": "create_inactive_user", "arg_names": ["self", "username", "password", "email", "domain_override", "send_email"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_inactive_user(self, username, password, email, domain_override=\"\", \n send_email=True):\n \"\"\"\n Create a new, inactive ``User``, generate a\n ``RegistrationProfile`` and email its activation key to the\n ``User``, returning the new ``User``.\n \n To disable the email, call with ``send_email=False``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L73_C8", "label": "expression", "type": "expression", "loc": [73, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [8, 2, 0.3447, 0.1402, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create a new, inactive ``User``, generate a\n ``RegistrationProfile`` and email its activation key to the\n ``User``, returning the new ``User``.\n \n To disable the email, call with ``send_email=False``.\n\n The activation email will make use of two templates:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L110_C8", "label": "from registration.signals import user_registered", "type": "import", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [1, 2, 0.4167, 0.0038, 2, 0.41, 0.125, 497, 0, 1, 0, 0, 497, 0, 0], "semantic": {"name": "registration.signals", "arg_names": [], "import_names": ["user_registered"], "rhs_call_name": "", "annotation": ""}, "snippet": " from registration.signals import user_registered"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L112_C8", "label": "new_user = User()", "type": "assigned_variable", "loc": [112, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [14, 2, 0.4261, 0.0076, 2, 0.41, 0.25, 932, 3, 4, 0, 0, 61, 10, 2], "semantic": {"name": "new_user", "arg_names": [], "import_names": [], "rhs_call_name": "User", "annotation": ""}, "snippet": " new_user = User(username=username, key_name=\"key_\"+username.lower(),\n email=email, is_active=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L114_C8", "label": "set_password()", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [8, 2, 0.4318, 0.0038, 2, 0.41, 0.375, 803, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_password", "arg_names": [], "import_names": [], "rhs_call_name": "set_password", "annotation": ""}, "snippet": " new_user.set_password(password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L115_C8", "label": "put()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [8, 2, 0.4356, 0.0038, 2, 0.41, 0.5, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " new_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L117_C8", "label": "registration_profile = create_profile()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [14, 2, 0.4432, 0.0038, 2, 0.41, 0.625, 844, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "registration_profile", "arg_names": [], "import_names": [], "rhs_call_name": "create_profile", "annotation": ""}, "snippet": " registration_profile = self.create_profile(new_user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "label": "if", "type": "if", "loc": [119, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [4, 2, 0.4792, 0.0606, 2, 0.41, 0.75, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if send_email:\n# from django.core.mail import send_mail\n# from google.appengine.api.mail import send_mail\n\n current_site = domain_override\n# current_site = Site.objects.get_current()\n \n subject = render_to_string('registration/activation_email_subject.txt',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L123_C12", "label": "current_site =", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "vector": [14, 3, 0.4659, 0.0038, 3, 0.4, 0.0, 725, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current_site", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current_site = domain_override"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L126_C12", "label": "subject = render_to_string()", "type": "assigned_variable", "loc": [126, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "vector": [14, 3, 0.4792, 0.0076, 3, 0.4, 0.3333, 241, 3, 2, 0, 0, 851, 10, 1], "semantic": {"name": "subject", "arg_names": [], "import_names": [], "rhs_call_name": "render_to_string", "annotation": ""}, "snippet": " subject = render_to_string('registration/activation_email_subject.txt',\n { 'site': current_site })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L129_C12", "label": "subject = join()", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "vector": [14, 3, 0.4886, 0.0038, 3, 0.4, 0.6667, 241, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "subject", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " subject = ''.join(subject.splitlines())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L131_C12", "label": "message = render_to_string()", "type": "assigned_variable", "loc": [131, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "vector": [14, 3, 0.5019, 0.0152, 3, 0.4, 1.0, 635, 3, 2, 0, 0, 851, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "render_to_string", "annotation": ""}, "snippet": " message = render_to_string('registration/activation_email.txt',\n { 'activation_key': registration_profile.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'site': current_site })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L142_C8", "label": "send()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [8, 2, 0.5379, 0.0038, 2, 0.41, 0.875, 826, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " user_registered.send(sender=self.model, user=new_user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "vector": [13, 2, 0.5417, 0.0038, 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 new_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "label": "create_profile", "type": "function", "loc": [145, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "vector": [2, 1, 0.5777, 0.0606, 1, 0.08, 0.75, 88, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "create_profile", "arg_names": ["self", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_profile(self, user):\n \"\"\"\n Create a ``RegistrationProfile`` for a given\n ``User``, and return the ``RegistrationProfile``.\n \n The activation key for the ``RegistrationProfile`` will be a\n SHA1 hash, generated from a combination of the ``User``'s\n username and a random salt."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L146_C8", "label": "expression", "type": "expression", "loc": [146, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [8, 2, 0.5682, 0.0341, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create a ``RegistrationProfile`` for a given\n ``User``, and return the ``RegistrationProfile``.\n \n The activation key for the ``RegistrationProfile`` will be a\n SHA1 hash, generated from a combination of the ``User``'s\n username and a random salt.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L155_C8", "label": "salt =", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [14, 2, 0.5871, 0.0038, 2, 0.15, 0.2, 153, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "salt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " salt = sha.new(str(random.random())).hexdigest()[:5]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L156_C8", "label": "activation_key = hexdigest()", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [14, 2, 0.5909, 0.0038, 2, 0.15, 0.4, 285, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "activation_key", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " activation_key = sha.new(salt+user.username).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L158_C8", "label": "registrationprofile = RegistrationProfile()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [14, 2, 0.5985, 0.0038, 2, 0.15, 0.6, 707, 3, 3, 0, 0, 399, 10, 1], "semantic": {"name": "registrationprofile", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationProfile", "annotation": ""}, "snippet": " registrationprofile = RegistrationProfile(user=user, activation_key=activation_key, key_name=\"key_\"+activation_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L159_C8", "label": "put()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [8, 2, 0.6023, 0.0038, 2, 0.15, 0.8, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " registrationprofile.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "vector": [13, 2, 0.6061, 0.0038, 2, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return registrationprofile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4", "label": "delete_expired_users", "type": "function", "loc": [162, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "vector": [2, 1, 0.6989, 0.1742, 1, 0.08, 1.0, 266, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "delete_expired_users", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete_expired_users(self):\n \"\"\"\n Remove expired instances of ``RegistrationProfile`` and their\n associated ``User``s.\n \n Accounts to be deleted are identified by searching for\n instances of ``RegistrationProfile`` with expired activation\n keys, and then checking to see if their associated ``User``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L163_C8", "label": "expression", "type": "expression", "loc": [163, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4", "vector": [8, 2, 0.6894, 0.1477, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Remove expired instances of ``RegistrationProfile`` and their\n associated ``User``s.\n \n Accounts to be deleted are identified by searching for\n instances of ``RegistrationProfile`` with expired activation\n keys, and then checking to see if their associated ``User``\n instances have the field ``is_active`` set to ``False``; any"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:For_L202_C8", "label": "for profile", "type": "for", "loc": [202, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4", "vector": [6, 2, 0.7746, 0.0227, 2, 0.97, 1.0, 924, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for profile in RegistrationProfile.all():\n if profile.activation_key_expired():\n user = profile.user\n if not user.is_active:\n user.delete()\n profile.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12", "label": "if", "type": "if", "loc": [203, 207], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:For_L202_C8", "vector": [4, 3, 0.7765, 0.0189, 3, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if profile.activation_key_expired():\n user = profile.user\n if not user.is_active:\n user.delete()\n profile.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L204_C16", "label": "user =", "type": "assigned_variable", "loc": [204, 204], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12", "vector": [14, 4, 0.7727, 0.0038, 4, 0.83, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = profile.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16", "label": "if", "type": "if", "loc": [205, 207], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12", "vector": [4, 4, 0.7803, 0.0114, 4, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not user.is_active:\n user.delete()\n profile.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L206_C20", "label": "delete()", "type": "expression", "loc": [206, 206], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16", "vector": [8, 5, 0.7803, 0.0038, 5, 0.06, 0.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " user.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L207_C20", "label": "delete()", "type": "expression", "loc": [207, 207], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16", "vector": [8, 5, 0.7841, 0.0038, 5, 0.06, 1.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " profile.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "label": "RegistrationProfile", "type": "class", "loc": [210, 264], "level": 0, "parent": null, "vector": [3, 0, 0.8977, 0.2083, 0, 0.66, 1.0, 399, 0, 2, 0, 0, 697, 0, 9], "semantic": {"name": "RegistrationProfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationProfile(db.Model):\n \"\"\"\n A simple profile which stores an activation key for use during\n user account registration.\n \n Generally, you will not want to interact directly with instances\n of this model; the provided manager includes methods\n for creating and activating new accounts, as well as for cleaning"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L211_C4", "label": "expression", "type": "expression", "loc": [211, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [8, 1, 0.8258, 0.0568, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A simple profile which stores an activation key for use during\n user account registration.\n \n Generally, you will not want to interact directly with instances\n of this model; the provided manager includes methods\n for creating and activating new accounts, as well as for cleaning\n out accounts which have never been activated."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L226_C4", "label": "ACTIVATED =", "type": "assigned_variable", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [14, 1, 0.8561, 0.0038, 1, 0.71, 0.125, 271, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ACTIVATED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ACTIVATED = u\"ALREADY_ACTIVATED\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L228_C4", "label": "user = ReferenceProperty()", "type": "assigned_variable", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [14, 1, 0.8636, 0.0038, 1, 0.71, 0.25, 503, 3, 2, 0, 0, 167, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " user = db.ReferenceProperty(User, verbose_name=_('user'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L229_C4", "label": "activation_key = StringProperty()", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [14, 1, 0.8674, 0.0038, 1, 0.71, 0.375, 285, 3, 1, 0, 0, 882, 10, 2], "semantic": {"name": "activation_key", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " activation_key = db.StringProperty(_('activation key'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L230_C4", "label": "objects = RegistrationManager()", "type": "assigned_variable", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [14, 1, 0.8712, 0.0038, 1, 0.71, 0.5, 550, 3, 0, 0, 0, 857, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationManager", "annotation": ""}, "snippet": " objects = RegistrationManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4", "label": "Meta", "type": "class", "loc": [232, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [3, 1, 0.8826, 0.0114, 1, 0.71, 0.625, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n verbose_name = _('registration profile')\n verbose_name_plural = _('registration profiles')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L233_C8", "label": "verbose_name = _()", "type": "assigned_variable", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4", "vector": [14, 2, 0.8826, 0.0038, 2, 0.4, 0.0, 616, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name = _('registration profile')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L234_C8", "label": "verbose_name_plural = _()", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4", "vector": [14, 2, 0.8864, 0.0038, 2, 0.4, 1.0, 329, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name_plural", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name_plural = _('registration profiles')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L236_C4", "label": "__unicode__", "type": "function", "loc": [236, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [2, 1, 0.8958, 0.0076, 1, 0.71, 0.75, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return u\"Registration information for %s\" % self.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L237_C8", "label": "return", "type": "return", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L236_C4", "vector": [13, 2, 0.8977, 0.0038, 2, 0.88, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return u\"Registration information for %s\" % self.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "label": "activation_key_expired", "type": "function", "loc": [239, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [2, 1, 0.9508, 0.0947, 1, 0.71, 0.875, 570, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "activation_key_expired", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activation_key_expired(self):\n \"\"\"\n Determine whether this ``RegistrationProfile``'s activation\n key has expired, returning a boolean -- ``True`` if the key\n has expired.\n \n Key expiration is determined by a two-step process:\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L240_C8", "label": "expression", "type": "expression", "loc": [240, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "vector": [8, 2, 0.947, 0.0795, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Determine whether this ``RegistrationProfile``'s activation\n key has expired, returning a boolean -- ``True`` if the key\n has expired.\n \n Key expiration is determined by a two-step process:\n \n 1. If the user has already activated, the key will have been"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L261_C8", "label": "expiration_date = timedelta()", "type": "assigned_variable", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "vector": [14, 2, 0.9886, 0.0038, 2, 0.6, 0.5, 950, 3, 1, 0, 0, 790, 10, 1], "semantic": {"name": "expiration_date", "arg_names": [], "import_names": [], "rhs_call_name": "timedelta", "annotation": ""}, "snippet": " expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L262_C8", "label": "return", "type": "return", "loc": [262, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "vector": [13, 2, 0.9943, 0.0076, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L264_C4", "label": "activation_key_expired.boolean =", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "vector": [14, 1, 1.0, 0.0038, 1, 0.71, 1.0, 86, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "activation_key_expired.boolean", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " activation_key_expired.boolean = True"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L59_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L63_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L66_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:ImportFrom_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:For_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:For_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L204_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L203_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L206_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:If_L205_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L207_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L232_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Return_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_199:ClassDef_L210_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_199:Assign_L264_C4"}] |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
# I put this on all required fields, because it's easier to pick up
# on them with CSS or JavaScript if they have a class of "required"
# in the HTML. Your mileage may vary. If/when Django ticket #3515
# lands in trunk, this will no longer be necessary.
attrs_dict = { 'class': 'required' }
class RegistrationForm(forms.Form):
"""
Form for registering a new user account.
Validates that the requested username is not already in use, and
requires the password to be entered twice to catch typos.
Subclasses should feel free to add any additional validation they
need, but should either preserve the base ``save()`` or implement
a ``save()`` method which returns a ``User``.
"""
username = forms.RegexField(regex=r'^\w+$',
max_length=30,
widget=forms.TextInput(attrs=attrs_dict),
label=_(u'username'))
email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,
maxlength=75)),
label=_(u'email address'))
password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),
label=_(u'password'))
password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),
label=_(u'password (again)'))
def clean_username(self):
"""
Validate that the username is alphanumeric and is not already
in use.
"""
user = User.get_by_key_name("key_"+self.cleaned_data['username'].lower())
if user:
raise forms.ValidationError(_(u'This username is already taken. Please choose another.'))
return self.cleaned_data['username']
def clean(self):
"""
Verifiy that the values entered into the two password fields
match. Note that an error here will end up in
``non_field_errors()`` because it doesn't apply to a single
field.
"""
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(_(u'You must type the same password each time'))
return self.cleaned_data
def save(self, domain_override=""):
"""
Create the new ``User`` and ``RegistrationProfile``, and
returns the ``User`` (by calling
``RegistrationProfile.objects.create_inactive_user()``).
"""
new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],
password=self.cleaned_data['password1'],
email=self.cleaned_data['email'],
domain_override=domain_override,
)
return new_user
class RegistrationFormTermsOfService(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which adds a required checkbox
for agreeing to a site's Terms of Service.
"""
tos = forms.BooleanField(widget=forms.CheckboxInput(attrs=attrs_dict),
label=_(u'I have read and agree to the Terms of Service'),
error_messages={ 'required': u"You must agree to the terms to register" })
class RegistrationFormUniqueEmail(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which enforces uniqueness of
email addresses.
"""
def clean_email(self):
"""
Validate that the supplied email address is unique for the
site.
"""
email = self.cleaned_data['email'].lower()
if User.all().filter('email =', email).count(1):
raise forms.ValidationError(_(u'This email address is already in use. Please supply a different email address.'))
return email
class RegistrationFormNoFreeEmail(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which disallows registration with
email addresses from popular free webmail services; moderately
useful for preventing automated spam registrations.
To change the list of banned domains, subclass this form and
override the attribute ``bad_domains``.
"""
bad_domains = ['aim.com', 'aol.com', 'email.com', 'gmail.com',
'googlemail.com', 'hotmail.com', 'hushmail.com',
'msn.com', 'mail.ru', 'mailinator.com', 'live.com']
def clean_email(self):
"""
Check the supplied email address against a list of known free
webmail domains.
"""
email_domain = self.cleaned_data['email'].split('@')[1]
if email_domain in self.bad_domains:
raise forms.ValidationError(_(u'Registration using free email addresses is prohibited. Please supply a different email address.'))
return self.cleaned_data['email']
| ajibawa-2023/Python-Code-Large/train/row_200 | 44 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0294, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nForms and validation code for user registration.\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ImportFrom_L6_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0441, 0.0074, 0, 0.66, 0.1111, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ImportFrom_L7_C0", "label": "from django import forms", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0515, 0.0074, 0, 0.66, 0.2222, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ImportFrom_L8_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0074, 0, 0.66, 0.3333, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ImportFrom_L10_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0735, 0.0074, 0, 0.66, 0.4444, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L17_C0", "label": "attrs_dict =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0074, 0, 0.66, 0.5556, 606, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "attrs_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "attrs_dict = { 'class': 'required' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "label": "RegistrationForm", "type": "class", "loc": [20, 81], "level": 0, "parent": null, "vector": [3, 0, 0.3713, 0.4559, 0, 0.66, 0.6667, 703, 0, 3, 0, 0, 953, 0, 20], "semantic": {"name": "RegistrationForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationForm(forms.Form):\n \"\"\"\n Form for registering a new user account.\n \n Validates that the requested username is not already in use, and\n requires the password to be entered twice to catch typos.\n \n Subclasses should feel free to add any additional validation they"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [8, 1, 0.1912, 0.0809, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Form for registering a new user account.\n \n Validates that the requested username is not already in use, and\n requires the password to be entered twice to catch typos.\n \n Subclasses should feel free to add any additional validation they\n need, but should either preserve the base ``save()`` or implement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L32_C4", "label": "username = RegexField()", "type": "assigned_variable", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [14, 1, 0.2463, 0.0294, 1, 0.41, 0.1429, 718, 3, 4, 0, 0, 671, 10, 3], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "RegexField", "annotation": ""}, "snippet": " username = forms.RegexField(regex=r'^\\w+$',\n max_length=30,\n widget=forms.TextInput(attrs=attrs_dict),\n label=_(u'username'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L36_C4", "label": "email = EmailField()", "type": "assigned_variable", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [14, 1, 0.2721, 0.0221, 1, 0.41, 0.2857, 413, 3, 2, 0, 0, 767, 10, 4], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "EmailField", "annotation": ""}, "snippet": " email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,\n maxlength=75)),\n label=_(u'email address'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L39_C4", "label": "password1 = CharField()", "type": "assigned_variable", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [14, 1, 0.2904, 0.0147, 1, 0.41, 0.4286, 374, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password1", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),\n label=_(u'password'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L41_C4", "label": "password2 = CharField()", "type": "assigned_variable", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [14, 1, 0.3051, 0.0147, 1, 0.41, 0.5714, 314, 3, 2, 0, 0, 952, 10, 3], "semantic": {"name": "password2", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),\n label=_(u'password (again)'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "label": "clean_username", "type": "function", "loc": [44, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [2, 1, 0.3566, 0.0735, 1, 0.41, 0.7143, 629, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "clean_username", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_username(self):\n \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\"\n user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())\n if user:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L45_C8", "label": "expression", "type": "expression", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "vector": [8, 2, 0.3456, 0.0368, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate that the username is alphanumeric and is not already\n in use.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L50_C8", "label": "user = get_by_key_name()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "vector": [14, 2, 0.3676, 0.0074, 2, 0.69, 0.3333, 503, 3, 1, 0, 0, 899, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " user = User.get_by_key_name(\"key_\"+self.cleaned_data['username'].lower())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:If_L51_C8", "label": "if", "type": "if", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "vector": [4, 2, 0.3787, 0.0147, 2, 0.69, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user:\n raise forms.ValidationError(_(u'This username is already taken. Please choose another.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "vector": [13, 2, 0.3897, 0.0074, 2, 0.69, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data['username']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "label": "clean", "type": "function", "loc": [56, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [2, 1, 0.4522, 0.0882, 1, 0.41, 0.8571, 517, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n \"\"\"\n Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L57_C8", "label": "expression", "type": "expression", "loc": [57, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "vector": [8, 2, 0.4412, 0.0515, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Verifiy that the values entered into the two password fields\n match. Note that an error here will end up in\n ``non_field_errors()`` because it doesn't apply to a single\n field.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:If_L64_C8", "label": "if", "type": "if", "loc": [64, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "vector": [4, 2, 0.4779, 0.0221, 2, 0.82, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:\n if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(_(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:If_L65_C12", "label": "if", "type": "if", "loc": [65, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:If_L64_C8", "vector": [4, 3, 0.4816, 0.0147, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.cleaned_data['password1'] != self.cleaned_data['password2']:\n raise forms.ValidationError(_(u'You must type the same password each time'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "vector": [13, 2, 0.4926, 0.0074, 2, 0.82, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "label": "save", "type": "function", "loc": [69, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "vector": [2, 1, 0.5515, 0.0956, 1, 0.41, 1.0, 928, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": ["self", "domain_override"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, domain_override=\"\"):\n \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User`` (by calling\n ``RegistrationProfile.objects.create_inactive_user()``).\n \n \"\"\"\n new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "vector": [8, 2, 0.5331, 0.0441, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the new ``User`` and ``RegistrationProfile``, and\n returns the ``User`` (by calling\n ``RegistrationProfile.objects.create_inactive_user()``).\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L76_C8", "label": "new_user = create_inactive_user()", "type": "assigned_variable", "loc": [76, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "vector": [14, 2, 0.5735, 0.0368, 2, 0.38, 0.5, 932, 3, 4, 0, 0, 686, 10, 1], "semantic": {"name": "new_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],\n password=self.cleaned_data['password1'],\n email=self.cleaned_data['email'],\n domain_override=domain_override,\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "vector": [13, 2, 0.5956, 0.0074, 2, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L84_C0", "label": "RegistrationFormTermsOfService", "type": "class", "loc": [84, 92], "level": 0, "parent": null, "vector": [3, 0, 0.6471, 0.0662, 0, 0.66, 0.7778, 986, 0, 0, 0, 0, 703, 0, 3], "semantic": {"name": "RegistrationFormTermsOfService", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationFormTermsOfService(RegistrationForm):\n \"\"\"\n Subclass of ``RegistrationForm`` which adds a required checkbox\n for agreeing to a site's Terms of Service.\n \n \"\"\"\n tos = forms.BooleanField(widget=forms.CheckboxInput(attrs=attrs_dict),\n label=_(u'I have read and agree to the Terms of Service'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L85_C4", "label": "expression", "type": "expression", "loc": [85, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L84_C0", "vector": [8, 1, 0.6397, 0.0368, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Subclass of ``RegistrationForm`` which adds a required checkbox\n for agreeing to a site's Terms of Service.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L90_C4", "label": "tos = BooleanField()", "type": "assigned_variable", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L84_C0", "vector": [14, 1, 0.6691, 0.0221, 1, 0.38, 1.0, 592, 3, 3, 0, 0, 498, 10, 3], "semantic": {"name": "tos", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanField", "annotation": ""}, "snippet": " tos = forms.BooleanField(widget=forms.CheckboxInput(attrs=attrs_dict),\n label=_(u'I have read and agree to the Terms of Service'),\n error_messages={ 'required': u\"You must agree to the terms to register\" })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L95_C0", "label": "RegistrationFormUniqueEmail", "type": "class", "loc": [95, 110], "level": 0, "parent": null, "vector": [3, 0, 0.7537, 0.1176, 0, 0.66, 0.8889, 334, 0, 1, 0, 0, 703, 0, 6], "semantic": {"name": "RegistrationFormUniqueEmail", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationFormUniqueEmail(RegistrationForm):\n \"\"\"\n Subclass of ``RegistrationForm`` which enforces uniqueness of\n email addresses.\n \n \"\"\"\n def clean_email(self):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L96_C4", "label": "expression", "type": "expression", "loc": [96, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L95_C0", "vector": [8, 1, 0.7206, 0.0368, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Subclass of ``RegistrationForm`` which enforces uniqueness of\n email addresses.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "label": "clean_email", "type": "function", "loc": [101, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L95_C0", "vector": [2, 1, 0.7757, 0.0735, 1, 0.91, 1.0, 160, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "clean_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_email(self):\n \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\"\n email = self.cleaned_data['email'].lower()\n if User.all().filter('email =', email).count(1):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L102_C8", "label": "expression", "type": "expression", "loc": [102, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "vector": [8, 2, 0.7647, 0.0368, 2, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validate that the supplied email address is unique for the\n site.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L107_C8", "label": "email = lower()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "vector": [14, 2, 0.7868, 0.0074, 2, 0.9, 0.3333, 413, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " email = self.cleaned_data['email'].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:If_L108_C8", "label": "if", "type": "if", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "vector": [4, 2, 0.7978, 0.0147, 2, 0.9, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if User.all().filter('email =', email).count(1):\n raise forms.ValidationError(_(u'This email address is already in use. Please supply a different email address.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "vector": [13, 2, 0.8088, 0.0074, 2, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "label": "RegistrationFormNoFreeEmail", "type": "class", "loc": [113, 136], "level": 0, "parent": null, "vector": [3, 0, 0.9154, 0.1765, 0, 0.66, 1.0, 650, 0, 1, 0, 0, 703, 0, 3], "semantic": {"name": "RegistrationFormNoFreeEmail", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationFormNoFreeEmail(RegistrationForm):\n \"\"\"\n Subclass of ``RegistrationForm`` which disallows registration with\n email addresses from popular free webmail services; moderately\n useful for preventing automated spam registrations.\n \n To change the list of banned domains, subclass this form and\n override the attribute ``bad_domains``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L114_C4", "label": "expression", "type": "expression", "loc": [114, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "vector": [8, 1, 0.8676, 0.0662, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Subclass of ``RegistrationForm`` which disallows registration with\n email addresses from popular free webmail services; moderately\n useful for preventing automated spam registrations.\n \n To change the list of banned domains, subclass this form and\n override the attribute ``bad_domains``.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L123_C4", "label": "bad_domains =", "type": "assigned_variable", "loc": [123, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "vector": [14, 1, 0.9118, 0.0221, 1, 0.23, 0.5, 282, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "bad_domains", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bad_domains = ['aim.com', 'aol.com', 'email.com', 'gmail.com',\n 'googlemail.com', 'hotmail.com', 'hushmail.com',\n 'msn.com', 'mail.ru', 'mailinator.com', 'live.com']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "label": "clean_email", "type": "function", "loc": [127, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "vector": [2, 1, 0.9669, 0.0735, 1, 0.23, 1.0, 160, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "clean_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean_email(self):\n \"\"\"\n Check the supplied email address against a list of known free\n webmail domains.\n \n \"\"\"\n email_domain = self.cleaned_data['email'].split('@')[1]\n if email_domain in self.bad_domains:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L128_C8", "label": "expression", "type": "expression", "loc": [128, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "vector": [8, 2, 0.9559, 0.0368, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check the supplied email address against a list of known free\n webmail domains.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L133_C8", "label": "email_domain =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "vector": [14, 2, 0.9779, 0.0074, 2, 0.46, 0.3333, 79, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "email_domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " email_domain = self.cleaned_data['email'].split('@')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:If_L134_C8", "label": "if", "type": "if", "loc": [134, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "vector": [4, 2, 0.989, 0.0147, 2, 0.46, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if email_domain in self.bad_domains:\n raise forms.ValidationError(_(u'Registration using free email addresses is prohibited. Please supply a different email address.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "vector": [13, 2, 1.0, 0.0074, 2, 0.46, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cleaned_data['email']"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:If_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_200:If_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:If_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:ClassDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:If_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_200:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_200:Return_L136_C8"}] |
"""
Unit tests for django-registration.
These tests assume that you've completed all the prerequisites for
getting django-registration running in the default setup, to wit:
1. You have ``registration`` in your ``INSTALLED_APPS`` setting.
2. You have created all of the templates mentioned in this
application's documentation.
3. You have added the setting ``ACCOUNT_ACTIVATION_DAYS`` to your
settings file.
4. You have URL patterns pointing to the registration and activation
views, with the names ``registration_register`` and
``registration_activate``, respectively, and a URL pattern named
'registration_complete'.
"""
import datetime
import sha
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core import management
from django.core.urlresolvers import reverse
from django.test import TestCase
from google.appengine.ext import db
from registration import forms
from registration.models import RegistrationProfile
from registration import signals
class RegistrationTestCase(TestCase):
"""
Base class for the test cases; this sets up two users -- one
expired, one not -- which are used to exercise various parts of
the application.
"""
def setUp(self):
self.sample_user = RegistrationProfile.objects.create_inactive_user(username='alice',
password='secret',
email='alice@example.com')
self.expired_user = RegistrationProfile.objects.create_inactive_user(username='bob',
password='swordfish',
email='bob@example.com')
self.expired_user.date_joined -= datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS + 1)
self.expired_user.save()
class RegistrationModelTests(RegistrationTestCase):
"""
Tests for the model-oriented functionality of django-registration,
including ``RegistrationProfile`` and its custom manager.
"""
def test_new_user_is_inactive(self):
"""
Test that a newly-created user is inactive.
"""
self.failIf(self.sample_user.is_active)
def test_registration_profile_created(self):
"""
Test that a ``RegistrationProfile`` is created for a new user.
"""
self.assertEqual(RegistrationProfile.all().count(), 2)
def test_activation_email(self):
"""
Test that user signup sends an activation email.
"""
self.assertEqual(len(mail.outbox), 2)
def test_activation_email_disable(self):
"""
Test that activation email can be disabled.
"""
RegistrationProfile.objects.create_inactive_user(username='noemail',
password='foo',
email='nobody@example.com',
send_email=False)
self.assertEqual(len(mail.outbox), 2)
def test_activation(self):
"""
Test that user activation actually activates the user and
properly resets the activation key, and fails for an
already-active or expired user, or an invalid key.
"""
# Activating a valid user returns the user.
self.failUnlessEqual(RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key).key(),
self.sample_user.key())
# The activated user must now be active.
self.failUnless(User.get(self.sample_user.key()).is_active)
# The activation key must now be reset to the "already activated" constant.
self.failUnlessEqual(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key,
RegistrationProfile.ACTIVATED)
# Activating an expired user returns False.
self.failIf(RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key))
# Activating from a key that isn't a SHA1 hash returns False.
self.failIf(RegistrationProfile.objects.activate_user('foo'))
# Activating from a key that doesn't exist returns False.
self.failIf(RegistrationProfile.objects.activate_user(sha.new('foo').hexdigest()))
def test_account_expiration_condition(self):
"""
Test that ``RegistrationProfile.activation_key_expired()``
returns ``True`` for expired users and for active users, and
``False`` otherwise.
"""
# Unexpired user returns False.
self.failIf(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key_expired())
# Expired user returns True.
self.failUnless(RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key_expired())
# Activated user returns True.
RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key)
self.failUnless(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key_expired())
def test_expired_user_deletion(self):
"""
Test that
``RegistrationProfile.objects.delete_expired_users()`` deletes
only inactive users whose activation window has expired.
"""
RegistrationProfile.objects.delete_expired_users()
self.assertEqual(RegistrationProfile.all().count(), 1)
def test_management_command(self):
"""
Test that ``manage.py cleanupregistration`` functions
correctly.
"""
management.call_command('cleanupregistration')
self.assertEqual(RegistrationProfile.all().count(), 1)
def test_signals(self):
"""
Test that the ``user_registered`` and ``user_activated``
signals are sent, and that they send the ``User`` as an
argument.
"""
def receiver(sender, **kwargs):
self.assert_('user' in kwargs)
self.assertEqual(kwargs['user'].username, u'signal_test')
received_signals.append(kwargs.get('signal'))
received_signals = []
expected_signals = [signals.user_registered, signals.user_activated]
for signal in expected_signals:
signal.connect(receiver)
RegistrationProfile.objects.create_inactive_user(username='signal_test',
password='foo',
email='nobody@example.com',
send_email=False)
RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', db.Key.from_path(User.kind(), 'key_signal_test')).get().activation_key)
self.assertEqual(received_signals, expected_signals)
class RegistrationFormTests(RegistrationTestCase):
"""
Tests for the forms and custom validation logic included in
django-registration.
"""
def test_registration_form(self):
"""
Test that ``RegistrationForm`` enforces username constraints
and matching passwords.
"""
invalid_data_dicts = [
# Non-alphanumeric username.
{
'data':
{ 'username': 'foo/bar',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' },
'error':
('username', [u"Enter a valid value."])
},
# Already-existing username.
{
'data':
{ 'username': 'alice',
'email': 'alice@example.com',
'password1': 'secret',
'password2': 'secret' },
'error':
('username', [u"This username is already taken. Please choose another."])
},
# Mismatched passwords.
{
'data':
{ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'bar' },
'error':
('__all__', [u"You must type the same password each time"])
},
]
for invalid_dict in invalid_data_dicts:
form = forms.RegistrationForm(data=invalid_dict['data'])
self.failIf(form.is_valid())
self.assertEqual(form.errors[invalid_dict['error'][0]], invalid_dict['error'][1])
form = forms.RegistrationForm(data={ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' })
self.failUnless(form.is_valid())
def test_registration_form_tos(self):
"""
Test that ``RegistrationFormTermsOfService`` requires
agreement to the terms of service.
"""
form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' })
self.failIf(form.is_valid())
self.assertEqual(form.errors['tos'], [u"You must agree to the terms to register"])
form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo',
'tos': 'on' })
self.failUnless(form.is_valid())
def test_registration_form_unique_email(self):
"""
Test that ``RegistrationFormUniqueEmail`` validates uniqueness
of email addresses.
"""
form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo',
'email': 'alice@example.com',
'password1': 'foo',
'password2': 'foo' })
self.failIf(form.is_valid())
self.assertEqual(form.errors['email'], [u"This email address is already in use. Please supply a different email address."])
form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' })
self.failUnless(form.is_valid())
def test_registration_form_no_free_email(self):
"""
Test that ``RegistrationFormNoFreeEmail`` disallows
registration with free email addresses.
"""
base_data = { 'username': 'foo',
'password1': 'foo',
'password2': 'foo' }
for domain in ('aim.com', 'aol.com', 'email.com', 'gmail.com',
'googlemail.com', 'hotmail.com', 'hushmail.com',
'msn.com', 'mail.ru', 'mailinator.com', 'live.com'):
invalid_data = base_data.copy()
invalid_data['email'] = u"foo@%s" % domain
form = forms.RegistrationFormNoFreeEmail(data=invalid_data)
self.failIf(form.is_valid())
self.assertEqual(form.errors['email'], [u"Registration using free email addresses is prohibited. Please supply a different email address."])
base_data['email'] = 'foo@example.com'
form = forms.RegistrationFormNoFreeEmail(data=base_data)
self.failUnless(form.is_valid())
class RegistrationViewTests(RegistrationTestCase):
"""
Tests for the views included in django-registration.
"""
def test_registration_view(self):
"""
Test that the registration view rejects invalid submissions,
and creates a new user and redirects after a valid submission.
"""
# Invalid data fails.
alice = User.all().filter('username =', 'alice').get()
alice.is_active = True
alice.put()
response = self.client.post(reverse('registration_register'),
data={ 'username': 'alice', # Will fail on username uniqueness.
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' })
self.assertEqual(response.status_code, 200)
self.failUnless(response.context[0]['form'])
self.failUnless(response.context[0]['form'].errors)
response = self.client.post(reverse('registration_register'),
data={ 'username': 'foo',
'email': 'foo@example.com',
'password1': 'foo',
'password2': 'foo' })
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], 'http://testserver%s' % reverse('registration_complete'))
self.assertEqual(RegistrationProfile.all().count(), 3)
def test_activation_view(self):
"""
Test that the activation view activates the user from a valid
key and fails if the key is invalid or has expired.
"""
# Valid user puts the user account into the context.
response = self.client.get(reverse('registration_activate',
kwargs={ 'activation_key': RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key }))
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context[0]['account'].key(), self.sample_user.key())
# Expired user sets the account to False.
response = self.client.get(reverse('registration_activate',
kwargs={ 'activation_key': RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key }))
self.failIf(response.context[0]['account'])
# Invalid key gets to the view, but sets account to False.
response = self.client.get(reverse('registration_activate',
kwargs={ 'activation_key': 'foo' }))
self.failIf(response.context[0]['account'])
# Nonexistent key sets the account to False.
response = self.client.get(reverse('registration_activate',
kwargs={ 'activation_key': sha.new('foo').hexdigest() }))
self.failIf(response.context[0]['account'])
| ajibawa-2023/Python-Code-Large/train/row_201 | 132 | 359 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.0292, 0.0557, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nUnit tests for django-registration.\n\nThese tests assume that you've completed all the prerequisites for\ngetting django-registration running in the default setup, to wit:\n\n1. You have ``registration`` in your ``INSTALLED_APPS`` setting.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Import_L22_C0", "label": "datetime import datetime", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0613, 0.0028, 0, 0.66, 0.0625, 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_201:Import_L23_C0", "label": "sha import sha", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0641, 0.0028, 0, 0.66, 0.125, 263, 0, 1, 0, 0, 263, 0, 0], "semantic": {"name": "sha", "arg_names": [], "import_names": ["sha"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sha"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L25_C0", "label": "from django.conf import settings", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0696, 0.0028, 0, 0.66, 0.1875, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L26_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0724, 0.0028, 0, 0.66, 0.25, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L27_C0", "label": "from django.core import mail", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0752, 0.0028, 0, 0.66, 0.3125, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["mail"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import mail"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L28_C0", "label": "from django.core import management", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0028, 0, 0.66, 0.375, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["management"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import management"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L29_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0808, 0.0028, 0, 0.66, 0.4375, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L30_C0", "label": "from django.test import TestCase", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.0836, 0.0028, 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_201:ImportFrom_L31_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.0864, 0.0028, 0, 0.66, 0.5625, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L33_C0", "label": "from registration import forms", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.0919, 0.0028, 0, 0.66, 0.625, 514, 0, 1, 0, 0, 514, 0, 0], "semantic": {"name": "registration", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L34_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.0947, 0.0028, 0, 0.66, 0.6875, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ImportFrom_L35_C0", "label": "from registration import signals", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.0975, 0.0028, 0, 0.66, 0.75, 514, 0, 1, 0, 0, 514, 0, 0], "semantic": {"name": "registration", "arg_names": [], "import_names": ["signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration import signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "label": "RegistrationTestCase", "type": "class", "loc": [38, 53], "level": 0, "parent": null, "vector": [3, 0, 0.1267, 0.0446, 0, 0.66, 0.8125, 131, 0, 1, 0, 0, 3, 0, 4], "semantic": {"name": "RegistrationTestCase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationTestCase(TestCase):\n \"\"\"\n Base class for the test cases; this sets up two users -- one\n expired, one not -- which are used to exercise various parts of\n the application.\n \n \"\"\"\n def setUp(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "vector": [8, 1, 0.1156, 0.0167, 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 Base class for the test cases; this sets up two users -- one\n expired, one not -- which are used to exercise various parts of\n the application.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "label": "setUp", "type": "function", "loc": [45, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "vector": [2, 1, 0.1365, 0.0251, 1, 0.44, 1.0, 952, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.sample_user = RegistrationProfile.objects.create_inactive_user(username='alice',\n password='secret',\n email='alice@example.com')\n self.expired_user = RegistrationProfile.objects.create_inactive_user(username='bob',\n password='swordfish',\n email='bob@example.com')\n self.expired_user.date_joined -= datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L46_C8", "label": "self.sample_user = create_inactive_user()", "type": "assigned_variable", "loc": [46, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "vector": [14, 2, 0.1309, 0.0084, 2, 0.67, 0.0, 557, 3, 3, 0, 0, 686, 10, 1], "semantic": {"name": "self.sample_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " self.sample_user = RegistrationProfile.objects.create_inactive_user(username='alice',\n password='secret',\n email='alice@example.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L49_C8", "label": "self.expired_user = create_inactive_user()", "type": "assigned_variable", "loc": [49, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "vector": [14, 2, 0.1393, 0.0084, 2, 0.67, 0.5, 704, 3, 3, 0, 0, 686, 10, 1], "semantic": {"name": "self.expired_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " self.expired_user = RegistrationProfile.objects.create_inactive_user(username='bob',\n password='swordfish',\n email='bob@example.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L53_C8", "label": "save()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "vector": [8, 2, 0.1476, 0.0028, 2, 0.67, 1.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.expired_user.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "label": "RegistrationModelTests", "type": "class", "loc": [56, 180], "level": 0, "parent": null, "vector": [3, 0, 0.3287, 0.3482, 0, 0.66, 0.875, 979, 0, 10, 0, 0, 131, 0, 74], "semantic": {"name": "RegistrationModelTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationModelTests(RegistrationTestCase):\n \"\"\"\n Tests for the model-oriented functionality of django-registration,\n including ``RegistrationProfile`` and its custom manager.\n \n \"\"\"\n def test_new_user_is_inactive(self):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [8, 1, 0.1643, 0.0139, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Tests for the model-oriented functionality of django-registration,\n including ``RegistrationProfile`` and its custom manager.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4", "label": "test_new_user_is_inactive", "type": "function", "loc": [62, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.1797, 0.0167, 1, 0.04, 0.1111, 769, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_new_user_is_inactive", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_new_user_is_inactive(self):\n \"\"\"\n Test that a newly-created user is inactive.\n \n \"\"\"\n self.failIf(self.sample_user.is_active)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4", "vector": [8, 2, 0.1797, 0.0111, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that a newly-created user is inactive.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L67_C8", "label": "failIf()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4", "vector": [8, 2, 0.1866, 0.0028, 2, 0.19, 1.0, 360, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(self.sample_user.is_active)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4", "label": "test_registration_profile_created", "type": "function", "loc": [69, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.1992, 0.0167, 1, 0.04, 0.2222, 417, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_registration_profile_created", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_profile_created(self):\n \"\"\"\n Test that a ``RegistrationProfile`` is created for a new user.\n \n \"\"\"\n self.assertEqual(RegistrationProfile.all().count(), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4", "vector": [8, 2, 0.1992, 0.0111, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that a ``RegistrationProfile`` is created for a new user.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L74_C8", "label": "assertEqual()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4", "vector": [8, 2, 0.2061, 0.0028, 2, 0.96, 1.0, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(RegistrationProfile.all().count(), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4", "label": "test_activation_email", "type": "function", "loc": [76, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.2187, 0.0167, 1, 0.04, 0.3333, 405, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "test_activation_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_activation_email(self):\n \"\"\"\n Test that user signup sends an activation email.\n \n \"\"\"\n self.assertEqual(len(mail.outbox), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L77_C8", "label": "expression", "type": "expression", "loc": [77, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4", "vector": [8, 2, 0.2187, 0.0111, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that user signup sends an activation email.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L81_C8", "label": "assertEqual()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4", "vector": [8, 2, 0.2256, 0.0028, 2, 0.21, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(len(mail.outbox), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "label": "test_activation_email_disable", "type": "function", "loc": [83, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.2437, 0.0279, 1, 0.04, 0.4444, 865, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_activation_email_disable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_activation_email_disable(self):\n \"\"\"\n Test that activation email can be disabled.\n \n \"\"\"\n RegistrationProfile.objects.create_inactive_user(username='noemail',\n password='foo',\n email='nobody@example.com',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L84_C8", "label": "expression", "type": "expression", "loc": [84, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "vector": [8, 2, 0.2382, 0.0111, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that activation email can be disabled.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L88_C8", "label": "create_inactive_user()", "type": "expression", "loc": [88, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "vector": [8, 2, 0.2493, 0.0111, 2, 0.59, 0.5, 686, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_inactive_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " RegistrationProfile.objects.create_inactive_user(username='noemail',\n password='foo',\n email='nobody@example.com',\n send_email=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L92_C8", "label": "assertEqual()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "vector": [8, 2, 0.2563, 0.0028, 2, 0.59, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(len(mail.outbox), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "label": "test_activation", "type": "function", "loc": [94, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.2967, 0.0724, 1, 0.04, 0.5556, 348, 0, 1, 0, 0, 0, 0, 25], "semantic": {"name": "test_activation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_activation(self):\n \"\"\"\n Test that user activation actually activates the user and\n properly resets the activation key, and fails for an\n already-active or expired user, or an invalid key.\n \n \"\"\"\n # Activating a valid user returns the user."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L95_C8", "label": "expression", "type": "expression", "loc": [95, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.2716, 0.0167, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that user activation actually activates the user and\n properly resets the activation key, and fails for an\n already-active or expired user, or an invalid key.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L102_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [102, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.2855, 0.0056, 2, 0.04, 0.1667, 21, 3, 2, 0, 0, 0, 0, 7], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key).key(),\n self.sample_user.key())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L106_C8", "label": "failUnless()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.2953, 0.0028, 2, 0.04, 0.3333, 252, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(User.get(self.sample_user.key()).is_active)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L109_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [109, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.305, 0.0056, 2, 0.04, 0.5, 21, 3, 2, 0, 0, 0, 0, 4], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key,\n RegistrationProfile.ACTIVATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L113_C8", "label": "failIf()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.3148, 0.0028, 2, 0.04, 0.6667, 360, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L116_C8", "label": "failIf()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.3231, 0.0028, 2, 0.04, 0.8333, 360, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(RegistrationProfile.objects.activate_user('foo'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L119_C8", "label": "failIf()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "vector": [8, 2, 0.3315, 0.0028, 2, 0.04, 1.0, 360, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(RegistrationProfile.objects.activate_user(sha.new('foo').hexdigest()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "label": "test_account_expiration_condition", "type": "function", "loc": [121, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.3579, 0.0446, 1, 0.04, 0.6667, 708, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "test_account_expiration_condition", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_account_expiration_condition(self):\n \"\"\"\n Test that ``RegistrationProfile.activation_key_expired()``\n returns ``True`` for expired users and for active users, and\n ``False`` otherwise.\n \n \"\"\"\n # Unexpired user returns False."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L122_C8", "label": "expression", "type": "expression", "loc": [122, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "vector": [8, 2, 0.3468, 0.0167, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``RegistrationProfile.activation_key_expired()``\n returns ``True`` for expired users and for active users, and\n ``False`` otherwise.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L129_C8", "label": "failIf()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "vector": [8, 2, 0.3593, 0.0028, 2, 0.7, 0.25, 360, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key_expired())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L132_C8", "label": "failUnless()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "vector": [8, 2, 0.3677, 0.0028, 2, 0.7, 0.5, 252, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key_expired())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L135_C8", "label": "activate_user()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "vector": [8, 2, 0.376, 0.0028, 2, 0.7, 0.75, 439, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "activate_user", "arg_names": [], "import_names": [], "rhs_call_name": "activate_user", "annotation": ""}, "snippet": " RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L136_C8", "label": "failUnless()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "vector": [8, 2, 0.3788, 0.0028, 2, 0.7, 1.0, 252, 3, 1, 0, 0, 0, 0, 5], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key_expired())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "label": "test_expired_user_deletion", "type": "function", "loc": [138, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.3955, 0.0251, 1, 0.04, 0.7778, 120, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test_expired_user_deletion", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_expired_user_deletion(self):\n \"\"\"\n Test that\n ``RegistrationProfile.objects.delete_expired_users()`` deletes\n only inactive users whose activation window has expired.\n \n \"\"\"\n RegistrationProfile.objects.delete_expired_users()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L139_C8", "label": "expression", "type": "expression", "loc": [139, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "vector": [8, 2, 0.3942, 0.0167, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that\n ``RegistrationProfile.objects.delete_expired_users()`` deletes\n only inactive users whose activation window has expired.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L145_C8", "label": "delete_expired_users()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "vector": [8, 2, 0.4039, 0.0028, 2, 0.19, 0.5, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_expired_users", "arg_names": [], "import_names": [], "rhs_call_name": "delete_expired_users", "annotation": ""}, "snippet": " RegistrationProfile.objects.delete_expired_users()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L146_C8", "label": "assertEqual()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "vector": [8, 2, 0.4067, 0.0028, 2, 0.19, 1.0, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(RegistrationProfile.all().count(), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "label": "test_management_command", "type": "function", "loc": [148, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.422, 0.0223, 1, 0.04, 0.8889, 200, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test_management_command", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_management_command(self):\n \"\"\"\n Test that ``manage.py cleanupregistration`` functions\n correctly.\n \n \"\"\"\n management.call_command('cleanupregistration')\n self.assertEqual(RegistrationProfile.all().count(), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L149_C8", "label": "expression", "type": "expression", "loc": [149, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "vector": [8, 2, 0.4206, 0.0139, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``manage.py cleanupregistration`` functions\n correctly.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L154_C8", "label": "call_command()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "vector": [8, 2, 0.429, 0.0028, 2, 0.74, 0.5, 587, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "call_command", "arg_names": [], "import_names": [], "rhs_call_name": "call_command", "annotation": ""}, "snippet": " management.call_command('cleanupregistration')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L155_C8", "label": "assertEqual()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "vector": [8, 2, 0.4318, 0.0028, 2, 0.74, 1.0, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(RegistrationProfile.all().count(), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "label": "test_signals", "type": "function", "loc": [157, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "vector": [2, 1, 0.4694, 0.0669, 1, 0.04, 1.0, 362, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "test_signals", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_signals(self):\n \"\"\"\n Test that the ``user_registered`` and ``user_activated``\n signals are sent, and that they send the ``User`` as an\n argument.\n \n \"\"\"\n def receiver(sender, **kwargs):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L158_C8", "label": "expression", "type": "expression", "loc": [158, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [8, 2, 0.4471, 0.0167, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that the ``user_registered`` and ``user_activated``\n signals are sent, and that they send the ``User`` as an\n argument.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "label": "receiver", "type": "function", "loc": [164, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [2, 2, 0.461, 0.0111, 2, 0.98, 0.1429, 513, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "receiver", "arg_names": ["sender", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def receiver(sender, **kwargs):\n self.assert_('user' in kwargs)\n self.assertEqual(kwargs['user'].username, u'signal_test')\n received_signals.append(kwargs.get('signal'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L165_C12", "label": "assert_()", "type": "expression", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "vector": [8, 3, 0.4596, 0.0028, 3, 0.9, 0.0, 17, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assert_", "arg_names": [], "import_names": [], "rhs_call_name": "assert_", "annotation": ""}, "snippet": " self.assert_('user' in kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L166_C12", "label": "assertEqual()", "type": "expression", "loc": [166, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "vector": [8, 3, 0.4624, 0.0028, 3, 0.9, 0.5, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(kwargs['user'].username, u'signal_test')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L167_C12", "label": "append()", "type": "expression", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "vector": [8, 3, 0.4652, 0.0028, 3, 0.9, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " received_signals.append(kwargs.get('signal'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L169_C8", "label": "received_signals =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [14, 2, 0.4708, 0.0028, 2, 0.98, 0.2857, 583, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "received_signals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_signals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L170_C8", "label": "expected_signals =", "type": "assigned_variable", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [14, 2, 0.4735, 0.0028, 2, 0.98, 0.4286, 828, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "expected_signals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected_signals = [signals.user_registered, signals.user_activated]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:For_L171_C8", "label": "for signal", "type": "for", "loc": [171, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [6, 2, 0.4777, 0.0056, 2, 0.98, 0.5714, 621, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "signal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for signal in expected_signals:\n signal.connect(receiver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L172_C12", "label": "connect()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L171_C8", "vector": [8, 3, 0.4791, 0.0028, 3, 0.58, 0.0, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signal.connect(receiver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L174_C8", "label": "create_inactive_user()", "type": "expression", "loc": [174, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [8, 2, 0.4889, 0.0111, 2, 0.98, 0.7143, 686, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_inactive_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_inactive_user", "annotation": ""}, "snippet": " RegistrationProfile.objects.create_inactive_user(username='signal_test',\n password='foo',\n email='nobody@example.com',\n send_email=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L178_C8", "label": "activate_user()", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [8, 2, 0.4958, 0.0028, 2, 0.98, 0.8571, 439, 3, 1, 0, 0, 0, 0, 6], "semantic": {"name": "activate_user", "arg_names": [], "import_names": [], "rhs_call_name": "activate_user", "annotation": ""}, "snippet": " RegistrationProfile.objects.activate_user(RegistrationProfile.all().filter('user =', db.Key.from_path(User.kind(), 'key_signal_test')).get().activation_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L180_C8", "label": "assertEqual()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "vector": [8, 2, 0.5014, 0.0028, 2, 0.98, 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(received_signals, expected_signals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "label": "RegistrationFormTests", "type": "class", "loc": [183, 298], "level": 0, "parent": null, "vector": [3, 0, 0.6699, 0.3231, 0, 0.66, 0.9375, 642, 0, 4, 0, 0, 131, 0, 29], "semantic": {"name": "RegistrationFormTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationFormTests(RegistrationTestCase):\n \"\"\"\n Tests for the forms and custom validation logic included in\n django-registration.\n \n \"\"\"\n def test_registration_form(self):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L184_C4", "label": "expression", "type": "expression", "loc": [184, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "vector": [8, 1, 0.5181, 0.0139, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Tests for the forms and custom validation logic included in\n django-registration.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "label": "test_registration_form", "type": "function", "loc": [189, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "vector": [2, 1, 0.5933, 0.1365, 1, 0.17, 0.25, 941, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_registration_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_form(self):\n \"\"\"\n Test that ``RegistrationForm`` enforces username constraints\n and matching passwords.\n \n \"\"\"\n invalid_data_dicts = [\n # Non-alphanumeric username."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L190_C8", "label": "expression", "type": "expression", "loc": [190, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "vector": [8, 2, 0.5348, 0.0139, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``RegistrationForm`` enforces username constraints\n and matching passwords.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L195_C8", "label": "invalid_data_dicts =", "type": "assigned_variable", "loc": [195, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "vector": [14, 2, 0.5864, 0.0891, 2, 0.92, 0.25, 403, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "invalid_data_dicts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " invalid_data_dicts = [\n # Non-alphanumeric username.\n {\n 'data':\n { 'username': 'foo/bar',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' },"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "label": "for invalid_dict", "type": "for", "loc": [228, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "vector": [6, 2, 0.6393, 0.0111, 2, 0.92, 0.5, 353, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "invalid_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for invalid_dict in invalid_data_dicts:\n form = forms.RegistrationForm(data=invalid_dict['data'])\n self.failIf(form.is_valid())\n self.assertEqual(form.errors[invalid_dict['error'][0]], invalid_dict['error'][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L229_C12", "label": "form = RegistrationForm()", "type": "assigned_variable", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "vector": [14, 3, 0.6379, 0.0028, 3, 0.98, 0.0, 761, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationForm", "annotation": ""}, "snippet": " form = forms.RegistrationForm(data=invalid_dict['data'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L230_C12", "label": "failIf()", "type": "expression", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "vector": [8, 3, 0.6407, 0.0028, 3, 0.98, 0.5, 360, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L231_C12", "label": "assertEqual()", "type": "expression", "loc": [231, 231], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "vector": [8, 3, 0.6435, 0.0028, 3, 0.98, 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(form.errors[invalid_dict['error'][0]], invalid_dict['error'][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L233_C8", "label": "form = RegistrationForm()", "type": "assigned_variable", "loc": [233, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "vector": [14, 2, 0.6532, 0.0111, 2, 0.92, 0.75, 761, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationForm", "annotation": ""}, "snippet": " form = forms.RegistrationForm(data={ 'username': 'foo',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L237_C8", "label": "failUnless()", "type": "expression", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "vector": [8, 2, 0.6602, 0.0028, 2, 0.92, 1.0, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "label": "test_registration_form_tos", "type": "function", "loc": [239, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "vector": [2, 1, 0.6908, 0.0529, 1, 0.17, 0.5, 28, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_registration_form_tos", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_form_tos(self):\n \"\"\"\n Test that ``RegistrationFormTermsOfService`` requires\n agreement to the terms of service.\n \n \"\"\"\n form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo',\n 'email': 'foo@example.com',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L240_C8", "label": "expression", "type": "expression", "loc": [240, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [8, 2, 0.6741, 0.0139, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``RegistrationFormTermsOfService`` requires\n agreement to the terms of service.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L245_C8", "label": "form = RegistrationFormTermsOfService()", "type": "assigned_variable", "loc": [245, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [14, 2, 0.6866, 0.0111, 2, 0.62, 0.2, 761, 3, 1, 0, 0, 986, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormTermsOfService", "annotation": ""}, "snippet": " form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L249_C8", "label": "failIf()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [8, 2, 0.6936, 0.0028, 2, 0.62, 0.4, 360, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L250_C8", "label": "assertEqual()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [8, 2, 0.6964, 0.0028, 2, 0.62, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(form.errors['tos'], [u\"You must agree to the terms to register\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L252_C8", "label": "form = RegistrationFormTermsOfService()", "type": "assigned_variable", "loc": [252, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [14, 2, 0.7075, 0.0139, 2, 0.62, 0.8, 761, 3, 1, 0, 0, 986, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormTermsOfService", "annotation": ""}, "snippet": " form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo',\n 'tos': 'on' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L257_C8", "label": "failUnless()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "vector": [8, 2, 0.7159, 0.0028, 2, 0.62, 1.0, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "label": "test_registration_form_unique_email", "type": "function", "loc": [259, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "vector": [2, 1, 0.7451, 0.0501, 1, 0.17, 0.75, 580, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_registration_form_unique_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_form_unique_email(self):\n \"\"\"\n Test that ``RegistrationFormUniqueEmail`` validates uniqueness\n of email addresses.\n \n \"\"\"\n form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo',\n 'email': 'alice@example.com',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L260_C8", "label": "expression", "type": "expression", "loc": [260, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [8, 2, 0.7298, 0.0139, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``RegistrationFormUniqueEmail`` validates uniqueness\n of email addresses.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L265_C8", "label": "form = RegistrationFormUniqueEmail()", "type": "assigned_variable", "loc": [265, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [14, 2, 0.7423, 0.0111, 2, 0.25, 0.2, 761, 3, 1, 0, 0, 334, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormUniqueEmail", "annotation": ""}, "snippet": " form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo',\n 'email': 'alice@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L269_C8", "label": "failIf()", "type": "expression", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [8, 2, 0.7493, 0.0028, 2, 0.25, 0.4, 360, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L270_C8", "label": "assertEqual()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [8, 2, 0.7521, 0.0028, 2, 0.25, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(form.errors['email'], [u\"This email address is already in use. Please supply a different email address.\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L272_C8", "label": "form = RegistrationFormUniqueEmail()", "type": "assigned_variable", "loc": [272, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [14, 2, 0.7618, 0.0111, 2, 0.25, 0.8, 761, 3, 1, 0, 0, 334, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormUniqueEmail", "annotation": ""}, "snippet": " form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L276_C8", "label": "failUnless()", "type": "expression", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "vector": [8, 2, 0.7688, 0.0028, 2, 0.25, 1.0, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "label": "test_registration_form_no_free_email", "type": "function", "loc": [278, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "vector": [2, 1, 0.8022, 0.0585, 1, 0.17, 1.0, 419, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test_registration_form_no_free_email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_form_no_free_email(self):\n \"\"\"\n Test that ``RegistrationFormNoFreeEmail`` disallows\n registration with free email addresses.\n \n \"\"\"\n base_data = { 'username': 'foo',\n 'password1': 'foo',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L279_C8", "label": "expression", "type": "expression", "loc": [279, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [8, 2, 0.7827, 0.0139, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that ``RegistrationFormNoFreeEmail`` disallows\n registration with free email addresses.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L284_C8", "label": "base_data =", "type": "assigned_variable", "loc": [284, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [14, 2, 0.7939, 0.0084, 2, 0.49, 0.2, 462, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "base_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " base_data = { 'username': 'foo',\n 'password1': 'foo',\n 'password2': 'foo' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "label": "for domain", "type": "for", "loc": [287, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [6, 2, 0.8092, 0.0223, 2, 0.49, 0.4, 438, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for domain in ('aim.com', 'aol.com', 'email.com', 'gmail.com',\n 'googlemail.com', 'hotmail.com', 'hushmail.com',\n 'msn.com', 'mail.ru', 'mailinator.com', 'live.com'):\n invalid_data = base_data.copy()\n invalid_data['email'] = u\"foo@%s\" % domain\n form = forms.RegistrationFormNoFreeEmail(data=invalid_data)\n self.failIf(form.is_valid())\n self.assertEqual(form.errors['email'], [u\"Registration using free email addresses is prohibited. Please supply a different email address.\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L290_C12", "label": "invalid_data = copy()", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "vector": [14, 3, 0.8078, 0.0028, 3, 0.92, 0.0, 16, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "invalid_data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " invalid_data = base_data.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L291_C12", "label": "assign", "type": "assigned_variable", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "vector": [14, 3, 0.8106, 0.0028, 3, 0.92, 0.25, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " invalid_data['email'] = u\"foo@%s\" % domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L292_C12", "label": "form = RegistrationFormNoFreeEmail()", "type": "assigned_variable", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "vector": [14, 3, 0.8134, 0.0028, 3, 0.92, 0.5, 761, 3, 1, 0, 0, 650, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormNoFreeEmail", "annotation": ""}, "snippet": " form = forms.RegistrationFormNoFreeEmail(data=invalid_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L293_C12", "label": "failIf()", "type": "expression", "loc": [293, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "vector": [8, 3, 0.8162, 0.0028, 3, 0.92, 0.75, 360, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L294_C12", "label": "assertEqual()", "type": "expression", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "vector": [8, 3, 0.8189, 0.0028, 3, 0.92, 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(form.errors['email'], [u\"Registration using free email addresses is prohibited. Please supply a different email address.\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L296_C8", "label": "assign", "type": "assigned_variable", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [14, 2, 0.8245, 0.0028, 2, 0.49, 0.6, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " base_data['email'] = 'foo@example.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L297_C8", "label": "form = RegistrationFormNoFreeEmail()", "type": "assigned_variable", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [14, 2, 0.8273, 0.0028, 2, 0.49, 0.8, 761, 3, 1, 0, 0, 650, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "RegistrationFormNoFreeEmail", "annotation": ""}, "snippet": " form = forms.RegistrationFormNoFreeEmail(data=base_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L298_C8", "label": "failUnless()", "type": "expression", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "vector": [8, 2, 0.8301, 0.0028, 2, 0.49, 1.0, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(form.is_valid())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "label": "RegistrationViewTests", "type": "class", "loc": [301, 359], "level": 0, "parent": null, "vector": [3, 0, 0.9192, 0.1643, 0, 0.66, 1.0, 592, 0, 2, 0, 0, 131, 0, 40], "semantic": {"name": "RegistrationViewTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationViewTests(RegistrationTestCase):\n \"\"\"\n Tests for the views included in django-registration.\n \n \"\"\"\n def test_registration_view(self):\n \"\"\"\n Test that the registration view rejects invalid submissions,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L302_C4", "label": "expression", "type": "expression", "loc": [302, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "vector": [8, 1, 0.8454, 0.0111, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Tests for the views included in django-registration.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "label": "test_registration_view", "type": "function", "loc": [306, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "vector": [2, 1, 0.8886, 0.0752, 1, 0.65, 0.5, 557, 0, 1, 0, 0, 0, 0, 17], "semantic": {"name": "test_registration_view", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_registration_view(self):\n \"\"\"\n Test that the registration view rejects invalid submissions,\n and creates a new user and redirects after a valid submission.\n \n \"\"\"\n # Invalid data fails.\n alice = User.all().filter('username =', 'alice').get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L307_C8", "label": "expression", "type": "expression", "loc": [307, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.8607, 0.0139, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that the registration view rejects invalid submissions,\n and creates a new user and redirects after a valid submission.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L313_C8", "label": "alice = get()", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [14, 2, 0.8719, 0.0028, 2, 0.27, 0.0909, 724, 3, 0, 0, 0, 607, 10, 3], "semantic": {"name": "alice", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " alice = User.all().filter('username =', 'alice').get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L314_C8", "label": "alice.is_active =", "type": "assigned_variable", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [14, 2, 0.8747, 0.0028, 2, 0.27, 0.1818, 641, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "alice.is_active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alice.is_active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L315_C8", "label": "put()", "type": "expression", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.8774, 0.0028, 2, 0.27, 0.2727, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " alice.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L316_C8", "label": "response = post()", "type": "assigned_variable", "loc": [316, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [14, 2, 0.8858, 0.0139, 2, 0.27, 0.3636, 511, 3, 2, 0, 0, 304, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(reverse('registration_register'),\n data={ 'username': 'alice', # Will fail on username uniqueness.\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L321_C8", "label": "assertEqual()", "type": "expression", "loc": [321, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.8942, 0.0028, 2, 0.27, 0.4545, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L322_C8", "label": "failUnless()", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.8969, 0.0028, 2, 0.27, 0.5455, 252, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(response.context[0]['form'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L323_C8", "label": "failUnless()", "type": "expression", "loc": [323, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.8997, 0.0028, 2, 0.27, 0.6364, 252, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(response.context[0]['form'].errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L325_C8", "label": "response = post()", "type": "assigned_variable", "loc": [325, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [14, 2, 0.9109, 0.0139, 2, 0.27, 0.7273, 511, 3, 2, 0, 0, 304, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(reverse('registration_register'),\n data={ 'username': 'foo',\n 'email': 'foo@example.com',\n 'password1': 'foo',\n 'password2': 'foo' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L330_C8", "label": "assertEqual()", "type": "expression", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.9192, 0.0028, 2, 0.27, 0.8182, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(response.status_code, 302)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L331_C8", "label": "assertEqual()", "type": "expression", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.922, 0.0028, 2, 0.27, 0.9091, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(response['Location'], 'http://testserver%s' % reverse('registration_complete'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L332_C8", "label": "assertEqual()", "type": "expression", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "vector": [8, 2, 0.9248, 0.0028, 2, 0.27, 1.0, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(RegistrationProfile.all().count(), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "label": "test_activation_view", "type": "function", "loc": [334, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "vector": [2, 1, 0.9652, 0.0724, 1, 0.65, 1.0, 553, 0, 1, 0, 0, 0, 0, 23], "semantic": {"name": "test_activation_view", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_activation_view(self):\n \"\"\"\n Test that the activation view activates the user from a valid\n key and fails if the key is invalid or has expired.\n \n \"\"\"\n # Valid user puts the user account into the context.\n response = self.client.get(reverse('registration_activate',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 0.9387, 0.0139, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Test that the activation view activates the user from a valid\n key and fails if the key is invalid or has expired.\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L341_C8", "label": "response = get()", "type": "assigned_variable", "loc": [341, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [14, 2, 0.9513, 0.0056, 2, 0.83, 0.1111, 511, 3, 1, 0, 0, 607, 10, 5], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(reverse('registration_activate',\n kwargs={ 'activation_key': RegistrationProfile.all().filter('user =', self.sample_user).get().activation_key }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L343_C8", "label": "assertEqual()", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 0.9554, 0.0028, 2, 0.83, 0.2222, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L344_C8", "label": "assertEqual()", "type": "expression", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 0.9582, 0.0028, 2, 0.83, 0.3333, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(response.context[0]['account'].key(), self.sample_user.key())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L347_C8", "label": "response = get()", "type": "assigned_variable", "loc": [347, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [14, 2, 0.968, 0.0056, 2, 0.83, 0.4444, 511, 3, 1, 0, 0, 607, 10, 5], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(reverse('registration_activate',\n kwargs={ 'activation_key': RegistrationProfile.all().filter('user =', self.expired_user).get().activation_key }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L349_C8", "label": "failIf()", "type": "expression", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 0.9721, 0.0028, 2, 0.83, 0.5556, 360, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(response.context[0]['account'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L352_C8", "label": "response = get()", "type": "assigned_variable", "loc": [352, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [14, 2, 0.9819, 0.0056, 2, 0.83, 0.6667, 511, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(reverse('registration_activate',\n kwargs={ 'activation_key': 'foo' }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L354_C8", "label": "failIf()", "type": "expression", "loc": [354, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 0.9861, 0.0028, 2, 0.83, 0.7778, 360, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(response.context[0]['account'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L357_C8", "label": "response = get()", "type": "assigned_variable", "loc": [357, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [14, 2, 0.9958, 0.0056, 2, 0.83, 0.8889, 511, 3, 1, 0, 0, 607, 10, 4], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(reverse('registration_activate',\n kwargs={ 'activation_key': sha.new('foo').hexdigest() }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L359_C8", "label": "failIf()", "type": "expression", "loc": [359, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "vector": [8, 2, 1.0, 0.0028, 2, 0.83, 1.0, 360, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failIf", "arg_names": [], "import_names": [], "rhs_call_name": "failIf", "annotation": ""}, "snippet": " self.failIf(response.context[0]['account'])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:For_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L231_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L278_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L321_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:ClassDef_L301_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Assign_L357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_201:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_201:Expr_L359_C8"}] |
"""
URLConf for Django user registration and authentication.
If the default behavior of the registration views is acceptable to
you, simply use a line like this in your root URLConf to set up the
default URLs for registration::
(r'^accounts/', include('registration.urls')),
This will also automatically set up the views in
``django.contrib.auth`` at sensible default locations.
But if you'd like to customize the behavior (e.g., by passing extra
arguments to the various views) or split up the URLs, feel free to set
up your own URL patterns for these views instead. If you do, it's a
good idea to use the names ``registration_activate``,
``registration_complete`` and ``registration_register`` for the
various steps of the user-signup process.
"""
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib.auth import views as auth_views
from registration.views import *
urlpatterns = patterns('',
# Activation keys get matched by \w+ instead of the more specific
# [a-fA-F0-9]{40} because a bad activation key should still get to the view;
# that way it can return a sensible "invalid key" message instead of a
# confusing 404.
url(r'^activate/(?P<activation_key>\w+)/$',
activate,
name='registration_activate'),
url(r'^login/$',
auth_views.login,
{'template_name': 'registration/login.html'},
name='auth_login'),
url(r'^logout/$',
auth_views.logout,
name='auth_logout'),
url(r'^password/change/$',
auth_views.password_change,
name='auth_password_change'),
url(r'^password/change/done/$',
auth_views.password_change_done,
name='auth_password_change_done'),
url(r'^password/reset/$',
auth_views.password_reset,
name='auth_password_reset'),
url(r'^password/reset/confirm/(?P<uidb36>.+)/(?P<token>.+)/$',
auth_views.password_reset_confirm,
name='auth_password_reset_confirm'),
url(r'^password/reset/complete/$',
auth_views.password_reset_complete,
name='auth_password_reset_complete'),
url(r'^password/reset/done/$',
auth_views.password_reset_done,
name='auth_password_reset_done'),
url(r'^register/$',
register,
name='registration_register'),
url(r'^register/complete/$',
direct_to_template,
{'template': 'registration/registration_complete.html'},
name='registration_complete'),
url(r'^config/$',
config,
name='config'),
url(r'^config/complete/$',
direct_to_template,
{'template': 'registration/config_complete.html'},
name='config_complete'),
)
| ajibawa-2023/Python-Code-Large/train/row_202 | 6 | 79 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_202:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.1329, 0.2532, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nURLConf for Django user registration and authentication.\n\nIf the default behavior of the registration views is acceptable to\nyou, simply use a line like this in your root URLConf to set up the\ndefault URLs for registration::\n\n (r'^accounts/', include('registration.urls')),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_202:ImportFrom_L23_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2911, 0.0127, 0, 0.66, 0.2, 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_202:ImportFrom_L24_C0", "label": "from django.views.generic.simple import direct_to_template", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.3038, 0.0127, 0, 0.66, 0.4, 956, 0, 1, 0, 0, 956, 0, 0], "semantic": {"name": "django.views.generic.simple", "arg_names": [], "import_names": ["direct_to_template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.simple import direct_to_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_202:ImportFrom_L25_C0", "label": "from django.contrib.auth import auth_views", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3165, 0.0127, 0, 0.66, 0.6, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names": [], "import_names": ["auth_views"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth import views as auth_views"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_202:ImportFrom_L27_C0", "label": "from registration.views import *", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3418, 0.0127, 0, 0.66, 0.8, 588, 0, 1, 0, 0, 588, 0, 0], "semantic": {"name": "registration.views", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.views import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_202:Assign_L29_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [29, 76], "level": 0, "parent": null, "vector": [14, 0, 0.6646, 0.6076, 0, 0.66, 1.0, 990, 3, 14, 0, 0, 75, 10, 14], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n # Activation keys get matched by \\w+ instead of the more specific\n # [a-fA-F0-9]{40} because a bad activation key should still get to the view;\n # that way it can return a sensible \"invalid key\" message instead of a\n # confusing 404.\n url(r'^activate/(?P<activation_key>\\w+)/$',\n activate,\n name='registration_activate'),"}] | [] |
"""
A management command which deletes expired accounts (e.g.,
accounts which signed up but never activated) from the database.
Calls ``RegistrationProfile.objects.delete_expired_users()``, which
contains the actual logic for determining which accounts are deleted.
"""
from django.core.management.base import NoArgsCommand
from registration.models import RegistrationProfile
class Command(NoArgsCommand):
help = "Delete expired user registrations from the database"
def handle_noargs(self, **options):
RegistrationProfile.objects.delete_expired_users()
| ajibawa-2023/Python-Code-Large/train/row_203 | 7 | 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_203:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2368, 0.4211, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nA management command which deletes expired accounts (e.g.,\naccounts which signed up but never activated) from the database.\n\nCalls ``RegistrationProfile.objects.delete_expired_users()``, which\ncontains the actual logic for determining which accounts are deleted.\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:ImportFrom_L10_C0", "label": "from django.core.management.base import NoArgsCommand", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.5263, 0.0526, 0, 0.66, 0.3333, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.base", "arg_names": [], "import_names": ["NoArgsCommand"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management.base import NoArgsCommand"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:ImportFrom_L12_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.6316, 0.0526, 0, 0.66, 0.6667, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "label": "Command", "type": "class", "loc": [15, 19], "level": 0, "parent": null, "vector": [3, 0, 0.8947, 0.2632, 0, 0.66, 1.0, 73, 0, 1, 0, 0, 795, 0, 1], "semantic": {"name": "Command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Command(NoArgsCommand):\n help = \"Delete expired user registrations from the database\"\n\n def handle_noargs(self, **options):\n RegistrationProfile.objects.delete_expired_users()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:Assign_L16_C4", "label": "help =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "vector": [14, 1, 0.8421, 0.0526, 1, 0.33, 0.0, 868, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "help", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " help = \"Delete expired user registrations from the database\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:FunctionDef_L18_C4", "label": "handle_noargs", "type": "function", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "vector": [2, 1, 0.9737, 0.1053, 1, 0.33, 1.0, 28, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_noargs", "arg_names": ["self", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_noargs(self, **options):\n RegistrationProfile.objects.delete_expired_users()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_203:Expr_L19_C8", "label": "delete_expired_users()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_203:FunctionDef_L18_C4", "vector": [8, 2, 1.0, 0.0526, 2, 0.5, 0.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_expired_users", "arg_names": [], "import_names": [], "rhs_call_name": "delete_expired_users", "annotation": ""}, "snippet": " RegistrationProfile.objects.delete_expired_users()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_203:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_203:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_203:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_203:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_203:Expr_L19_C8"}] |
"""
Views which allow users to create and activate accounts.
"""
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic.simple import direct_to_template
from registration.forms import RegistrationForm
from haco.models import *
from haco.forms import *
from registration.models import RegistrationProfile
from django.http import *
def activate(request, activation_key,
template_name='registration/activate.html',
extra_context=None):
"""
Activate a ``User``'s account from an activation key, if their key
is valid and hasn't expired.
By default, use the template ``registration/activate.html``; to
change this, pass the name of a template as the keyword argument
``template_name``.
**Required arguments**
``activation_key``
The activation key to validate and use for activating the
``User``.
**Optional arguments**
``extra_context``
A dictionary of variables to add to the template context. Any
callable object in this dictionary will be called to produce
the end result which appears in the context.
``template_name``
A custom template to use.
**Context:**
``account``
The ``User`` object corresponding to the account, if the
activation was successful. ``False`` if the activation was not
successful.
``expiration_days``
The number of days for which activation keys stay valid after
registration.
Any extra variables supplied in the ``extra_context`` argument
(see above).
**Template:**
registration/activate.html or ``template_name`` keyword argument.
"""
activation_key = activation_key.lower() # Normalize before trying anything with it.
account = RegistrationProfile.objects.activate_user(activation_key)
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'account': account,
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS },
context_instance=context)
def register(request, success_url=None,
form_class=RegistrationForm,
template_name='registration/registration_form.html',
extra_context=None):
"""
Allow a new user to register an account.
Following successful registration, issue a redirect; by default,
this will be whatever URL corresponds to the named URL pattern
``registration_complete``, which will be
``/accounts/register/complete/`` if using the included URLConf. To
change this, point that named pattern at another URL, or pass your
preferred URL as the keyword argument ``success_url``.
By default, ``registration.forms.RegistrationForm`` will be used
as the registration form; to change this, pass a different form
class as the ``form_class`` keyword argument. The form class you
specify must have a method ``save`` which will create and return
the new ``User``.
By default, use the template
``registration/registration_form.html``; to change this, pass the
name of a template as the keyword argument ``template_name``.
**Required arguments**
None.
**Optional arguments**
``form_class``
The form class to use for registration.
``extra_context``
A dictionary of variables to add to the template context. Any
callable object in this dictionary will be called to produce
the end result which appears in the context.
``success_url``
The URL to redirect to on successful registration.
``template_name``
A custom template to use.
**Context:**
``form``
The registration form.
Any extra variables supplied in the ``extra_context`` argument
(see above).
**Template:**
registration/registration_form.html or ``template_name`` keyword
argument.
"""
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES)
domain_override = request.get_host()
if form.is_valid():
new_user = form.save(domain_override)
# success_url needs to be dynamically generated here; setting a
# a default value using reverse() will cause circular-import
# problems with the default URLConf for this application, which
# imports this file.
return HttpResponseRedirect(success_url or reverse('registration_complete'))
else:
form = form_class()
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'form': form },
context_instance=context)
@login_required
def config( request, success_url=None,
form_class=UserConfigForm,
template_name='config.html',
extra_context=None):
u_name = request.user.username
u_query =db.GqlQuery("SELECT * FROM auth_user Where username = :1",u_name )
for data in u_query:
key =data.key()
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES)
if form.is_valid():
form.save(key)
return HttpResponseRedirect(success_url or reverse('config_complete'))
else:
form = form_class()
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'form': form },
context_instance=context)
| ajibawa-2023/Python-Code-Large/train/row_204 | 55 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0132, 0.0212, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nViews which allow users to create and activate accounts.\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L6_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0317, 0.0053, 0, 0.66, 0.0667, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth.decorators", "arg_names": [], "import_names": ["login_required"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.decorators import login_required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L7_C0", "label": "from django.conf import settings", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0053, 0, 0.66, 0.1333, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L8_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0423, 0.0053, 0, 0.66, 0.2, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L9_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0053, 0, 0.66, 0.2667, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L10_C0", "label": "from django.shortcuts import render_to_response", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0529, 0.0053, 0, 0.66, 0.3333, 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_204:ImportFrom_L11_C0", "label": "from django.template import RequestContext", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0582, 0.0053, 0, 0.66, 0.4, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["RequestContext"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import RequestContext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L12_C0", "label": "from django.views.generic.simple import direct_to_template", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0635, 0.0053, 0, 0.66, 0.4667, 956, 0, 1, 0, 0, 956, 0, 0], "semantic": {"name": "django.views.generic.simple", "arg_names": [], "import_names": ["direct_to_template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.simple import direct_to_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L14_C0", "label": "from registration.forms import RegistrationForm", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.0053, 0, 0.66, 0.5333, 823, 0, 1, 0, 0, 823, 0, 0], "semantic": {"name": "registration.forms", "arg_names": [], "import_names": ["RegistrationForm"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.forms import RegistrationForm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L15_C0", "label": "from haco.models import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0794, 0.0053, 0, 0.66, 0.6, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "haco.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L16_C0", "label": "from haco.forms import *", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0847, 0.0053, 0, 0.66, 0.6667, 225, 0, 1, 0, 0, 225, 0, 0], "semantic": {"name": "haco.forms", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from haco.forms import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L17_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0899, 0.0053, 0, 0.66, 0.7333, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:ImportFrom_L18_C0", "label": "from django.http import *", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0053, 0, 0.66, 0.8, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "label": "activate", "type": "function", "loc": [21, 77], "level": 0, "parent": null, "vector": [2, 0, 0.2593, 0.3016, 0, 0.66, 0.8667, 177, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "activate", "arg_names": ["request", "activation_key", "template_name", "extra_context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def activate(request, activation_key,\n template_name='registration/activate.html',\n extra_context=None):\n \"\"\"\n Activate a ``User``'s account from an activation key, if their key\n is valid and hasn't expired.\n \n By default, use the template ``registration/activate.html``; to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [8, 1, 0.2381, 0.2275, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Activate a ``User``'s account from an activation key, if their key\n is valid and hasn't expired.\n \n By default, use the template ``registration/activate.html``; to\n change this, pass the name of a template as the keyword argument\n ``template_name``.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L67_C4", "label": "activation_key = lower()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [14, 1, 0.3545, 0.0053, 1, 0.09, 0.1667, 285, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "activation_key", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " activation_key = activation_key.lower() # Normalize before trying anything with it."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L68_C4", "label": "account = activate_user()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [14, 1, 0.3598, 0.0053, 1, 0.09, 0.3333, 492, 3, 1, 0, 0, 439, 10, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "activate_user", "annotation": ""}, "snippet": " account = RegistrationProfile.objects.activate_user(activation_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L69_C4", "label": "if", "type": "if", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [4, 1, 0.3677, 0.0106, 1, 0.09, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extra_context is None:\n extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L70_C8", "label": "extra_context =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L69_C4", "vector": [14, 2, 0.3704, 0.0053, 2, 0.69, 0.0, 751, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "extra_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L71_C4", "label": "context = RequestContext()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [14, 1, 0.3757, 0.0053, 1, 0.09, 0.6667, 954, 3, 1, 0, 0, 47, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " context = RequestContext(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:For_L72_C4", "label": "for key, value", "type": "for", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [6, 1, 0.3836, 0.0106, 1, 0.09, 0.8333, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in extra_context.items():\n context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L73_C8", "label": "assign", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:For_L72_C4", "vector": [14, 2, 0.3862, 0.0053, 2, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "vector": [13, 1, 0.3995, 0.0212, 1, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(template_name,\n { 'account': account,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS },\n context_instance=context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "label": "register", "type": "function", "loc": [80, 159], "level": 0, "parent": null, "vector": [2, 0, 0.6323, 0.4233, 0, 0.66, 0.9333, 276, 0, 5, 1, 0, 0, 0, 12], "semantic": {"name": "register", "arg_names": ["request", "success_url", "form_class", "template_name", "extra_context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def register(request, success_url=None,\n form_class=RegistrationForm,\n template_name='registration/registration_form.html',\n extra_context=None):\n \"\"\"\n Allow a new user to register an account.\n \n Following successful registration, issue a redirect; by default,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L84_C4", "label": "expression", "type": "expression", "loc": [84, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [8, 1, 0.5847, 0.2857, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Allow a new user to register an account.\n \n Following successful registration, issue a redirect; by default,\n this will be whatever URL corresponds to the named URL pattern\n ``registration_complete``, which will be\n ``/accounts/register/complete/`` if using the included URLConf. To\n change this, point that named pattern at another URL, or pass your"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "label": "if", "type": "if", "loc": [138, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [4, 1, 0.7619, 0.0688, 1, 0.94, 0.2, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.method == 'POST':\n\n form = form_class(data=request.POST, files=request.FILES)\n domain_override = request.get_host()\n if form.is_valid():\n new_user = form.save(domain_override)\n # success_url needs to be dynamically generated here; setting a\n # a default value using reverse() will cause circular-import"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L140_C8", "label": "form = form_class()", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "vector": [14, 2, 0.7407, 0.0053, 2, 0.6, 0.0, 761, 3, 2, 0, 0, 393, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "form_class", "annotation": ""}, "snippet": " form = form_class(data=request.POST, files=request.FILES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L141_C8", "label": "domain_override = get_host()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "vector": [14, 2, 0.746, 0.0053, 2, 0.6, 0.3333, 841, 3, 0, 0, 0, 946, 10, 1], "semantic": {"name": "domain_override", "arg_names": [], "import_names": [], "rhs_call_name": "get_host", "annotation": ""}, "snippet": " domain_override = request.get_host()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8", "label": "if", "type": "if", "loc": [142, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "vector": [4, 2, 0.7672, 0.037, 2, 0.6, 0.6667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.is_valid():\n new_user = form.save(domain_override)\n # success_url needs to be dynamically generated here; setting a\n # a default value using reverse() will cause circular-import\n # problems with the default URLConf for this application, which\n # imports this file.\n return HttpResponseRedirect(success_url or reverse('registration_complete'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L143_C12", "label": "new_user = save()", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8", "vector": [14, 3, 0.7566, 0.0053, 3, 0.81, 0.0, 932, 3, 1, 0, 0, 928, 10, 1], "semantic": {"name": "new_user", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " new_user = form.save(domain_override)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L148_C12", "label": "return", "type": "return", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8", "vector": [13, 3, 0.7831, 0.0053, 3, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(success_url or reverse('registration_complete'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L150_C8", "label": "form = form_class()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "vector": [14, 2, 0.7937, 0.0053, 2, 0.6, 1.0, 761, 3, 0, 0, 0, 393, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "form_class", "annotation": ""}, "snippet": " form = form_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L152_C4", "label": "if", "type": "if", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [4, 1, 0.8069, 0.0106, 1, 0.94, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extra_context is None:\n extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L153_C8", "label": "extra_context =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L152_C4", "vector": [14, 2, 0.8095, 0.0053, 2, 0.76, 0.0, 751, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "extra_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L154_C4", "label": "context = RequestContext()", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [14, 1, 0.8148, 0.0053, 1, 0.94, 0.6, 954, 3, 1, 0, 0, 47, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " context = RequestContext(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:For_L155_C4", "label": "for key, value", "type": "for", "loc": [155, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [6, 1, 0.8228, 0.0106, 1, 0.94, 0.8, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in extra_context.items():\n context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L156_C8", "label": "assign", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:For_L155_C4", "vector": [14, 2, 0.8254, 0.0053, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L157_C4", "label": "return", "type": "return", "loc": [157, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "vector": [13, 1, 0.836, 0.0159, 1, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(template_name,\n { 'form': form },\n context_instance=context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "label": "config", "type": "function", "loc": [162, 189], "level": 0, "parent": null, "vector": [2, 0, 0.9286, 0.1481, 0, 0.66, 1.0, 308, 0, 5, 1, 0, 0, 0, 13], "semantic": {"name": "config", "arg_names": ["request", "success_url", "form_class", "template_name", "extra_context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def config( request, success_url=None,\n form_class=UserConfigForm,\n template_name='config.html',\n extra_context=None):\n\n u_name = request.user.username\n u_query =db.GqlQuery(\"SELECT * FROM auth_user Where username = :1\",u_name )\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L167_C4", "label": "u_name =", "type": "assigned_variable", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [14, 1, 0.8836, 0.0053, 1, 0.51, 0.0, 121, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "u_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " u_name = request.user.username"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L168_C4", "label": "u_query = GqlQuery()", "type": "assigned_variable", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [14, 1, 0.8889, 0.0053, 1, 0.51, 0.1429, 76, 3, 2, 0, 0, 420, 10, 1], "semantic": {"name": "u_query", "arg_names": [], "import_names": [], "rhs_call_name": "GqlQuery", "annotation": ""}, "snippet": " u_query =db.GqlQuery(\"SELECT * FROM auth_user Where username = :1\",u_name )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:For_L170_C4", "label": "for data", "type": "for", "loc": [170, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [6, 1, 0.9021, 0.0106, 1, 0.51, 0.2857, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in u_query:\n key =data.key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L171_C8", "label": "key = key()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:For_L170_C4", "vector": [14, 2, 0.9048, 0.0053, 2, 0.35, 0.0, 230, 3, 0, 0, 0, 230, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "key", "annotation": ""}, "snippet": " key =data.key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "label": "if", "type": "if", "loc": [173, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [4, 1, 0.9339, 0.0423, 1, 0.51, 0.4286, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.method == 'POST': \n form = form_class(data=request.POST, files=request.FILES)\n if form.is_valid():\n form.save(key)\n return HttpResponseRedirect(success_url or reverse('config_complete'))\n\n else:\n form = form_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L174_C8", "label": "form = form_class()", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "vector": [14, 2, 0.9206, 0.0053, 2, 0.11, 0.0, 761, 3, 2, 0, 0, 393, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "form_class", "annotation": ""}, "snippet": " form = form_class(data=request.POST, files=request.FILES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8", "label": "if", "type": "if", "loc": [175, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "vector": [4, 2, 0.9312, 0.0159, 2, 0.11, 0.5, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.is_valid():\n form.save(key)\n return HttpResponseRedirect(success_url or reverse('config_complete'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L176_C12", "label": "save()", "type": "expression", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8", "vector": [8, 3, 0.9312, 0.0053, 3, 0.94, 0.0, 928, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " form.save(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L177_C12", "label": "return", "type": "return", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8", "vector": [13, 3, 0.9365, 0.0053, 3, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(success_url or reverse('config_complete'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L180_C8", "label": "form = form_class()", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "vector": [14, 2, 0.9524, 0.0053, 2, 0.11, 1.0, 761, 3, 0, 0, 0, 393, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "form_class", "annotation": ""}, "snippet": " form = form_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:If_L182_C4", "label": "if", "type": "if", "loc": [182, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [4, 1, 0.9656, 0.0106, 1, 0.51, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extra_context is None:\n extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L183_C8", "label": "extra_context =", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:If_L182_C4", "vector": [14, 2, 0.9683, 0.0053, 2, 0.86, 0.0, 751, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "extra_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L184_C4", "label": "context = RequestContext()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [14, 1, 0.9735, 0.0053, 1, 0.51, 0.7143, 954, 3, 1, 0, 0, 47, 10, 1], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " context = RequestContext(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:For_L185_C4", "label": "for key, value", "type": "for", "loc": [185, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [6, 1, 0.9815, 0.0106, 1, 0.51, 0.8571, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in extra_context.items():\n context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L186_C8", "label": "assign", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:For_L185_C4", "vector": [14, 2, 0.9841, 0.0053, 2, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context[key] = callable(value) and value() or value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L187_C4", "label": "return", "type": "return", "loc": [187, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "vector": [13, 1, 0.9947, 0.0159, 1, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(template_name,\n { 'form': form },\n context_instance=context)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:For_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:For_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:For_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:For_L155_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:For_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:For_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Expr_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L175_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:If_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:If_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:For_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:For_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_204:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_204:Return_L187_C4"}] |
from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| ajibawa-2023/Python-Code-Large/train/row_205 | 6 | 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_205:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_205:ImportFrom_L3_C0", "label": "from registration.models import RegistrationProfile", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2727, 0.0909, 0, 0.66, 0.3333, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "registration.models", "arg_names": [], "import_names": ["RegistrationProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "from registration.models import RegistrationProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "label": "RegistrationAdmin", "type": "class", "loc": [6, 8], "level": 0, "parent": null, "vector": [3, 0, 0.6364, 0.2727, 0, 0.66, 0.6667, 116, 0, 0, 0, 0, 823, 0, 0], "semantic": {"name": "RegistrationAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RegistrationAdmin(admin.ModelAdmin):\n list_display = ('__unicode__', 'activation_key_expired')\n search_fields = ('user__username', 'user__first_name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L7_C4", "label": "list_display =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "vector": [14, 1, 0.6364, 0.0909, 1, 0.71, 0.0, 489, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_display = ('__unicode__', 'activation_key_expired')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L8_C4", "label": "search_fields =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "vector": [14, 1, 0.7273, 0.0909, 1, 0.71, 1.0, 834, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "search_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_fields = ('user__username', 'user__first_name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_205:Expr_L11_C0", "label": "register()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 276, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "admin.site.register(RegistrationProfile, RegistrationAdmin)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_205:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_205:Assign_L8_C4"}] |
from django.dispatch import Signal
# A new user has registered.
user_registered = Signal(providing_args=["user"])
# A user has activated his or her account.
user_activated = Signal(providing_args=["user"])
| ajibawa-2023/Python-Code-Large/train/row_206 | 3 | 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_206:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "import_names": ["Signal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.dispatch import Signal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_206:Assign_L5_C0", "label": "user_registered = Signal()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.625, 0.125, 0, 0.66, 0.5, 929, 3, 1, 0, 0, 592, 10, 1], "semantic": {"name": "user_registered", "arg_names": [], "import_names": [], "rhs_call_name": "Signal", "annotation": ""}, "snippet": "user_registered = Signal(providing_args=[\"user\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_206:Assign_L8_C0", "label": "user_activated = Signal()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.125, 0, 0.66, 1.0, 902, 3, 1, 0, 0, 592, 10, 1], "semantic": {"name": "user_activated", "arg_names": [], "import_names": [], "rhs_call_name": "Signal", "annotation": ""}, "snippet": "user_activated = Signal(providing_args=[\"user\"])"}] | [] |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scanner(context):
parse_object = context.parse_object
parse_array = context.parse_array
parse_string = context.parse_string
match_number = NUMBER_RE.match
encoding = context.encoding
strict = context.strict
parse_float = context.parse_float
parse_int = context.parse_int
parse_constant = context.parse_constant
object_hook = context.object_hook
def _scan_once(string, idx):
try:
nextchar = string[idx]
except IndexError:
raise StopIteration
if nextchar == '"':
return parse_string(string, idx + 1, encoding, strict)
elif nextchar == '{':
return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)
elif nextchar == '[':
return parse_array((string, idx + 1), _scan_once)
elif nextchar == 'n' and string[idx:idx + 4] == 'null':
return None, idx + 4
elif nextchar == 't' and string[idx:idx + 4] == 'true':
return True, idx + 4
elif nextchar == 'f' and string[idx:idx + 5] == 'false':
return False, idx + 5
m = match_number(string, idx)
if m is not None:
integer, frac, exp = m.groups()
if frac or exp:
res = parse_float(integer + (frac or '') + (exp or ''))
else:
res = parse_int(integer)
return res, m.end()
elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
return parse_constant('NaN'), idx + 3
elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
return parse_constant('Infinity'), idx + 8
elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
return parse_constant('-Infinity'), idx + 9
else:
raise StopIteration
return _scan_once
make_scanner = c_make_scanner or py_make_scanner
| ajibawa-2023/Python-Code-Large/train/row_208 | 48 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_208:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"JSON token scanner\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.0846, 0.0615, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:ImportFrom_L5_C4", "label": "from simplejson._speedups import c_make_scanner", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "vector": [1, 1, 0.0769, 0.0154, 1, 0.23, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_scanner"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_scanner as c_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L7_C4", "label": "c_make_scanner =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "vector": [14, 1, 0.1077, 0.0154, 1, 0.23, 0.0, 400, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L9_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1385, 0.0154, 0, 0.66, 0.5, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['make_scanner']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L11_C0", "label": "NUMBER_RE = compile()", "type": "assigned_variable", "loc": [11, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1846, 0.0462, 0, 0.66, 0.6667, 566, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "NUMBER_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "NUMBER_RE = re.compile(\n r'(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?',\n (re.VERBOSE | re.MULTILINE | re.DOTALL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "label": "py_make_scanner", "type": "function", "loc": [15, 63], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.7538, 0, 0.66, 0.8333, 796, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "py_make_scanner", "arg_names": ["context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_make_scanner(context):\n parse_object = context.parse_object\n parse_array = context.parse_array\n parse_string = context.parse_string\n match_number = NUMBER_RE.match\n encoding = context.encoding\n strict = context.strict\n parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L16_C4", "label": "parse_object =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.64, 0.0, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_object = context.parse_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L17_C4", "label": "parse_array =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.64, 0.0909, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_array = context.parse_array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L18_C4", "label": "parse_string =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.64, 0.1818, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_string = context.parse_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L19_C4", "label": "match_number =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.2923, 0.0154, 1, 0.64, 0.2727, 264, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_number = NUMBER_RE.match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L20_C4", "label": "encoding =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3077, 0.0154, 1, 0.64, 0.3636, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = context.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L21_C4", "label": "strict =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3231, 0.0154, 1, 0.64, 0.4545, 697, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = context.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L22_C4", "label": "parse_float =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3385, 0.0154, 1, 0.64, 0.5455, 475, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_float", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L23_C4", "label": "parse_int =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3538, 0.0154, 1, 0.64, 0.6364, 31, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_int", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_int = context.parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L24_C4", "label": "parse_constant =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3692, 0.0154, 1, 0.64, 0.7273, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_constant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_constant = context.parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L25_C4", "label": "object_hook =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [14, 1, 0.3846, 0.0154, 1, 0.64, 0.8182, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_hook = context.object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "label": "_scan_once", "type": "function", "loc": [27, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [2, 1, 0.6769, 0.5385, 1, 0.64, 0.9091, 221, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_scan_once", "arg_names": ["string", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _scan_once(string, idx):\n try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration\n\n if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "vector": [7, 2, 0.4538, 0.0615, 2, 0.04, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L29_C12", "label": "nextchar =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L28_C8", "vector": [14, 3, 0.4462, 0.0154, 3, 0.44, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nextchar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nextchar = string[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8", "label": "if", "type": "if", "loc": [33, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "vector": [4, 2, 0.5923, 0.1846, 2, 0.04, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)\n elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L34_C12", "label": "return", "type": "return", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8", "vector": [13, 3, 0.5231, 0.0154, 3, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8", "label": "if", "type": "if", "loc": [35, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8", "vector": [4, 3, 0.6077, 0.1538, 3, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L36_C12", "label": "return", "type": "return", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8", "vector": [13, 4, 0.5538, 0.0154, 4, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8", "label": "if", "type": "if", "loc": [37, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8", "vector": [4, 4, 0.6231, 0.1231, 4, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L38_C12", "label": "return", "type": "return", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8", "vector": [13, 5, 0.5846, 0.0154, 5, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_array((string, idx + 1), _scan_once)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8", "vector": [4, 5, 0.6385, 0.0923, 5, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8", "vector": [13, 6, 0.6154, 0.0154, 6, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8", "label": "if", "type": "if", "loc": [41, 44], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8", "vector": [4, 6, 0.6538, 0.0615, 6, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L42_C12", "label": "return", "type": "return", "loc": [42, 42], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8", "vector": [13, 7, 0.6462, 0.0154, 7, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L43_C8", "label": "if", "type": "if", "loc": [43, 44], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8", "vector": [4, 7, 0.6692, 0.0308, 7, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L44_C12", "label": "return", "type": "return", "loc": [44, 44], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L43_C8", "vector": [13, 8, 0.6769, 0.0154, 8, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L46_C8", "label": "m = match_number()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "vector": [14, 2, 0.7077, 0.0154, 2, 0.04, 0.6667, 711, 3, 2, 0, 0, 264, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match_number", "annotation": ""}, "snippet": " m = match_number(string, idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "label": "if", "type": "if", "loc": [47, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "vector": [4, 2, 0.8308, 0.2308, 2, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m is not None:\n integer, frac, exp = m.groups()\n if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)\n return res, m.end()\n elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L48_C12", "label": "integer, frac, exp = groups()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "vector": [14, 3, 0.7385, 0.0154, 3, 0.24, 0.0, 563, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "integer, frac, exp", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " integer, frac, exp = m.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12", "label": "if", "type": "if", "loc": [49, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "vector": [4, 3, 0.7769, 0.0615, 3, 0.24, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L50_C16", "label": "res = parse_float()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12", "vector": [14, 4, 0.7692, 0.0154, 4, 0.45, 0.0, 413, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_float", "annotation": ""}, "snippet": " res = parse_float(integer + (frac or '') + (exp or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L52_C16", "label": "res = parse_int()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12", "vector": [14, 4, 0.8, 0.0154, 4, 0.45, 1.0, 413, 3, 1, 0, 0, 31, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_int", "annotation": ""}, "snippet": " res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "vector": [13, 3, 0.8154, 0.0154, 3, 0.24, 0.6667, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res, m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "vector": [4, 3, 0.8846, 0.1231, 3, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\n return parse_constant('NaN'), idx + 3\n elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8", "vector": [13, 4, 0.8462, 0.0154, 4, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('NaN'), idx + 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8", "label": "if", "type": "if", "loc": [56, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8", "vector": [4, 4, 0.9, 0.0923, 4, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8", "vector": [13, 5, 0.8769, 0.0154, 5, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('Infinity'), idx + 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8", "vector": [4, 5, 0.9154, 0.0615, 5, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:If_L58_C8", "vector": [13, 6, 0.9077, 0.0154, 6, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('-Infinity'), idx + 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "vector": [13, 1, 0.9692, 0.0154, 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 _scan_once"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L65_C0", "label": "make_scanner =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0154, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "make_scanner = c_make_scanner or py_make_scanner"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_208:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_208:Return_L63_C4"}] |
"""Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
}
for i in range(0x20):
ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
# Assume this produces an infinity on all machines (probably not guaranteed)
INFINITY = float('1e66666')
FLOAT_REPR = repr
def encode_basestring(s):
"""Return a JSON representation of a Python string
"""
def replace(match):
return ESCAPE_DCT[match.group(0)]
return '"' + ESCAPE.sub(replace, s) + '"'
def py_encode_basestring_ascii(s):
"""Return an ASCII-only JSON representation of a Python string
"""
if isinstance(s, str) and HAS_UTF8.search(s) is not None:
s = s.decode('utf-8')
def replace(match):
s = match.group(0)
try:
return ESCAPE_DCT[s]
except KeyError:
n = ord(s)
if n < 0x10000:
return '\\u%04x' % (n,)
else:
# surrogate pair
n -= 0x10000
s1 = 0xd800 | ((n >> 10) & 0x3ff)
s2 = 0xdc00 | (n & 0x3ff)
return '\\u%04x\\u%04x' % (s1, s2)
return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii
class JSONEncoder(object):
"""Extensible JSON <http://json.org> encoder for Python data structures.
Supports the following objects and types by default:
+-------------------+---------------+
| Python | JSON |
+===================+===============+
| dict | object |
+-------------------+---------------+
| list, tuple | array |
+-------------------+---------------+
| str, unicode | string |
+-------------------+---------------+
| int, long, float | number |
+-------------------+---------------+
| True | true |
+-------------------+---------------+
| False | false |
+-------------------+---------------+
| None | null |
+-------------------+---------------+
To extend this to recognize other objects, subclass and implement a
``.default()`` method with another method that returns a serializable
object for ``o`` if possible, otherwise it should call the superclass
implementation (to raise ``TypeError``).
"""
item_separator = ', '
key_separator = ': '
def __init__(self, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, encoding='utf-8', default=None):
"""Constructor for JSONEncoder, with sensible defaults.
If skipkeys is False, then it is a TypeError to attempt
encoding of keys that are not str, int, long, float or None. If
skipkeys is True, such items are simply skipped.
If ensure_ascii is True, the output is guaranteed to be str
objects with all incoming unicode characters escaped. If
ensure_ascii is false, the output will be unicode object.
If check_circular is True, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to
prevent an infinite recursion (which would cause an OverflowError).
Otherwise, no such check takes place.
If allow_nan is True, then NaN, Infinity, and -Infinity will be
encoded as such. This behavior is not JSON specification compliant,
but is consistent with most JavaScript based encoders and decoders.
Otherwise, it will be a ValueError to encode such floats.
If sort_keys is True, then the output of dictionaries will be
sorted by key; this is useful for regression tests to ensure
that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array
elements and object members will be pretty-printed with that
indent level. An indent level of 0 will only insert newlines.
None is the most compact representation.
If specified, separators should be a (item_separator, key_separator)
tuple. The default is (', ', ': '). To get the most compact JSON
representation you should specify (',', ':') to eliminate whitespace.
If specified, default is a function that gets called for objects
that can't otherwise be serialized. It should return a JSON encodable
version of the object or raise a ``TypeError``.
If encoding is not None, then all input strings will be
transformed into unicode using that encoding prior to JSON-encoding.
The default is UTF-8.
"""
self.skipkeys = skipkeys
self.ensure_ascii = ensure_ascii
self.check_circular = check_circular
self.allow_nan = allow_nan
self.sort_keys = sort_keys
self.indent = indent
if separators is not None:
self.item_separator, self.key_separator = separators
if default is not None:
self.default = default
self.encoding = encoding
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
return JSONEncoder.default(self, o)
"""
raise TypeError("%r is not JSON serializable" % (o,))
def encode(self, o):
"""Return a JSON string representation of a Python data structure.
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
"""
# This is for extremely simple cases and benchmarks.
if isinstance(o, basestring):
if isinstance(o, str):
_encoding = self.encoding
if (_encoding is not None
and not (_encoding == 'utf-8')):
o = o.decode(_encoding)
if self.ensure_ascii:
return encode_basestring_ascii(o)
else:
return encode_basestring(o)
# This doesn't pass the iterator directly to ''.join() because the
# exceptions aren't as detailed. The list call should be roughly
# equivalent to the PySequence_Fast that ''.join() would do.
chunks = self.iterencode(o, _one_shot=True)
if not isinstance(chunks, (list, tuple)):
chunks = list(chunks)
return ''.join(chunks)
def iterencode(self, o, _one_shot=False):
"""Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)
"""
if self.check_circular:
markers = {}
else:
markers = None
if self.ensure_ascii:
_encoder = encode_basestring_ascii
else:
_encoder = encode_basestring
if self.encoding != 'utf-8':
def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
if isinstance(o, str):
o = o.decode(_encoding)
return _orig_encoder(o)
def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):
# Check for specials. Note that this type of test is processor- and/or
# platform-specific, so do tests which don't depend on the internals.
if o != o:
text = 'NaN'
elif o == _inf:
text = 'Infinity'
elif o == _neginf:
text = '-Infinity'
else:
return _repr(o)
if not allow_nan:
raise ValueError("Out of range float values are not JSON compliant: %r"
% (o,))
return text
if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:
_iterencode = c_make_encoder(
markers, self.default, _encoder, self.indent,
self.key_separator, self.item_separator, self.sort_keys,
self.skipkeys, self.allow_nan)
else:
_iterencode = _make_iterencode(
markers, self.default, _encoder, self.indent, floatstr,
self.key_separator, self.item_separator, self.sort_keys,
self.skipkeys, _one_shot)
return _iterencode(o, 0)
def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
## HACK: hand-optimized bytecode; turn globals into locals
False=False,
True=True,
ValueError=ValueError,
basestring=basestring,
dict=dict,
float=float,
id=id,
int=int,
isinstance=isinstance,
list=list,
long=long,
str=str,
tuple=tuple,
):
def _iterencode_list(lst, _current_indent_level):
if not lst:
yield '[]'
return
if markers is not None:
markerid = id(lst)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = lst
buf = '['
if _indent is not None:
_current_indent_level += 1
newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
separator = _item_separator + newline_indent
buf += newline_indent
else:
newline_indent = None
separator = _item_separator
first = True
for value in lst:
if first:
first = False
else:
buf = separator
if isinstance(value, basestring):
yield buf + _encoder(value)
elif value is None:
yield buf + 'null'
elif value is True:
yield buf + 'true'
elif value is False:
yield buf + 'false'
elif isinstance(value, (int, long)):
yield buf + str(value)
elif isinstance(value, float):
yield buf + _floatstr(value)
else:
yield buf
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
for chunk in chunks:
yield chunk
if newline_indent is not None:
_current_indent_level -= 1
yield '\n' + (' ' * (_indent * _current_indent_level))
yield ']'
if markers is not None:
del markers[markerid]
def _iterencode_dict(dct, _current_indent_level):
if not dct:
yield '{}'
return
if markers is not None:
markerid = id(dct)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = dct
yield '{'
if _indent is not None:
_current_indent_level += 1
newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
item_separator = _item_separator + newline_indent
yield newline_indent
else:
newline_indent = None
item_separator = _item_separator
first = True
if _sort_keys:
items = dct.items()
items.sort(key=lambda kv: kv[0])
else:
items = dct.iteritems()
for key, value in items:
if isinstance(key, basestring):
pass
# JavaScript is weakly typed for these, so it makes sense to
# also allow them. Many encoders seem to do something like this.
elif isinstance(key, float):
key = _floatstr(key)
elif isinstance(key, (int, long)):
key = str(key)
elif key is True:
key = 'true'
elif key is False:
key = 'false'
elif key is None:
key = 'null'
elif _skipkeys:
continue
else:
raise TypeError("key %r is not a string" % (key,))
if first:
first = False
else:
yield item_separator
yield _encoder(key)
yield _key_separator
if isinstance(value, basestring):
yield _encoder(value)
elif value is None:
yield 'null'
elif value is True:
yield 'true'
elif value is False:
yield 'false'
elif isinstance(value, (int, long)):
yield str(value)
elif isinstance(value, float):
yield _floatstr(value)
else:
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
for chunk in chunks:
yield chunk
if newline_indent is not None:
_current_indent_level -= 1
yield '\n' + (' ' * (_indent * _current_indent_level))
yield '}'
if markers is not None:
del markers[markerid]
def _iterencode(o, _current_indent_level):
if isinstance(o, basestring):
yield _encoder(o)
elif o is None:
yield 'null'
elif o is True:
yield 'true'
elif o is False:
yield 'false'
elif isinstance(o, (int, long)):
yield str(o)
elif isinstance(o, float):
yield _floatstr(o)
elif isinstance(o, (list, tuple)):
for chunk in _iterencode_list(o, _current_indent_level):
yield chunk
elif isinstance(o, dict):
for chunk in _iterencode_dict(o, _current_indent_level):
yield chunk
else:
if markers is not None:
markerid = id(o)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = o
o = _default(o)
for chunk in _iterencode(o, _current_indent_level):
yield chunk
if markers is not None:
del markers[markerid]
return _iterencode
| ajibawa-2023/Python-Code-Large/train/row_209 | 230 | 434 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0046, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Implementation of JSONEncoder\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0023, 0, 0.66, 0.0667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "label": "try", "type": "try", "loc": [5, 8], "level": 0, "parent": null, "vector": [7, 0, 0.015, 0.0092, 0, 0.66, 0.1333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:ImportFrom_L6_C4", "label": "from simplejson._speedups import c_encode_basestring_ascii", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "vector": [1, 1, 0.0138, 0.0023, 1, 0.87, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_encode_basestring_ascii"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L8_C4", "label": "c_encode_basestring_ascii =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "vector": [14, 1, 0.0184, 0.0023, 1, 0.87, 0.0, 485, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L9_C0", "label": "try", "type": "try", "loc": [9, 12], "level": 0, "parent": null, "vector": [7, 0, 0.0242, 0.0092, 0, 0.66, 0.2, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:ImportFrom_L10_C4", "label": "from simplejson._speedups import c_make_encoder", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L9_C0", "vector": [1, 1, 0.023, 0.0023, 1, 0.68, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L12_C4", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L9_C0", "vector": [14, 1, 0.0276, 0.0023, 1, 0.68, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L14_C0", "label": "ESCAPE = compile()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0323, 0.0023, 0, 0.66, 0.2667, 562, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L15_C0", "label": "ESCAPE_ASCII = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0346, 0.0023, 0, 0.66, 0.3333, 214, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE_ASCII", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L16_C0", "label": "HAS_UTF8 = compile()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0369, 0.0023, 0, 0.66, 0.4, 954, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "HAS_UTF8", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "HAS_UTF8 = re.compile(r'[\\x80-\\xff]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L17_C0", "label": "ESCAPE_DCT =", "type": "assigned_variable", "loc": [17, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0484, 0.0207, 0, 0.66, 0.4667, 404, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ESCAPE_DCT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_DCT = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L26_C0", "label": "for i", "type": "for", "loc": [26, 27], "level": 0, "parent": null, "vector": [6, 0, 0.0611, 0.0046, 0, 0.66, 0.5333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L27_C4", "label": "setdefault()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L26_C0", "vector": [8, 1, 0.0622, 0.0023, 1, 0.51, 0.0, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L30_C0", "label": "INFINITY = float()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.0691, 0.0023, 0, 0.66, 0.6, 681, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "INFINITY", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "INFINITY = float('1e66666')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L31_C0", "label": "FLOAT_REPR =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0023, 0, 0.66, 0.6667, 39, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLOAT_REPR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLOAT_REPR = repr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "label": "encode_basestring", "type": "function", "loc": [33, 39], "level": 0, "parent": null, "vector": [2, 0, 0.0829, 0.0161, 0, 0.66, 0.7333, 207, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "encode_basestring", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_basestring(s):\n \"\"\"Return a JSON representation of a Python string\n\n \"\"\"\n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "vector": [8, 1, 0.0806, 0.0069, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L37_C4", "label": "replace", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "vector": [2, 1, 0.0864, 0.0046, 1, 0.26, 0.5, 293, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L37_C4", "vector": [13, 2, 0.0876, 0.0023, 2, 0.09, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "vector": [13, 1, 0.0899, 0.0023, 1, 0.26, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "label": "py_encode_basestring_ascii", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.1198, 0.0484, 0, 0.66, 0.8, 438, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "py_encode_basestring_ascii", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_encode_basestring_ascii(s):\n \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "vector": [8, 1, 0.1014, 0.0069, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L46_C4", "label": "if", "type": "if", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "vector": [4, 1, 0.1071, 0.0046, 1, 0.32, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L47_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L46_C4", "vector": [14, 2, 0.1083, 0.0023, 2, 0.54, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4", "label": "replace", "type": "function", "loc": [48, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "vector": [2, 1, 0.1256, 0.0323, 1, 0.32, 0.6667, 293, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L49_C8", "label": "s = group()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4", "vector": [14, 2, 0.1129, 0.0023, 2, 0.98, 0.0, 553, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "label": "try", "type": "try", "loc": [50, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4", "vector": [7, 2, 0.1279, 0.0276, 2, 0.98, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "vector": [13, 3, 0.1175, 0.0023, 3, 0.95, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[s]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L53_C12", "label": "n = ord()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "vector": [14, 3, 0.1221, 0.0023, 3, 0.95, 0.0, 773, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " n = ord(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "vector": [4, 3, 0.1325, 0.0184, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair\n n -= 0x10000\n s1 = 0xd800 | ((n >> 10) & 0x3ff)\n s2 = 0xdc00 | (n & 0x3ff)\n return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L55_C16", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "vector": [13, 4, 0.1267, 0.0023, 4, 0.46, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L59_C16", "label": "s1 =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "vector": [14, 4, 0.1359, 0.0023, 4, 0.46, 0.3333, 745, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s1 = 0xd800 | ((n >> 10) & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L60_C16", "label": "s2 =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "vector": [14, 4, 0.1382, 0.0023, 4, 0.46, 0.6667, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L61_C16", "label": "return", "type": "return", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "vector": [13, 4, 0.1406, 0.0023, 4, 0.46, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "vector": [13, 1, 0.1429, 0.0023, 1, 0.32, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + str(ESCAPE_ASCII.sub(replace, s)) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L65_C0", "label": "encode_basestring_ascii =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.1498, 0.0023, 0, 0.66, 0.8667, 105, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "label": "JSONEncoder", "type": "class", "loc": [67, 256], "level": 0, "parent": null, "vector": [3, 0, 0.3721, 0.4378, 0, 0.66, 0.9333, 228, 0, 6, 0, 0, 186, 0, 18], "semantic": {"name": "JSONEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONEncoder(object):\n \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [8, 1, 0.1878, 0.0645, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+\n | dict | object |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L96_C4", "label": "item_separator =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [14, 1, 0.2212, 0.0023, 1, 0.07, 0.1667, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = ', '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L97_C4", "label": "key_separator =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [14, 1, 0.2235, 0.0023, 1, 0.07, 0.3333, 294, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_separator = ': '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [2, 1, 0.2903, 0.1313, 1, 0.07, 0.5, 555, 0, 10, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "sort_keys", "indent", "separators", "encoding", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, skipkeys=False, ensure_ascii=True,\n check_circular=True, allow_nan=True, sort_keys=False,\n indent=None, separators=None, encoding='utf-8', default=None):\n \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [8, 2, 0.28, 0.0968, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped.\n\n If ensure_ascii is True, the output is guaranteed to be str\n objects with all incoming unicode characters escaped. If"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L144_C8", "label": "self.skipkeys =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3318, 0.0023, 2, 0.31, 0.1111, 853, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.skipkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.skipkeys = skipkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L145_C8", "label": "self.ensure_ascii =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3341, 0.0023, 2, 0.31, 0.2222, 255, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ensure_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ensure_ascii = ensure_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L146_C8", "label": "self.check_circular =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3364, 0.0023, 2, 0.31, 0.3333, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.check_circular", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_circular = check_circular"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L147_C8", "label": "self.allow_nan =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3387, 0.0023, 2, 0.31, 0.4444, 507, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_nan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_nan = allow_nan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L148_C8", "label": "self.sort_keys =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.341, 0.0023, 2, 0.31, 0.5556, 911, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sort_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sort_keys = sort_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L149_C8", "label": "self.indent =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3433, 0.0023, 2, 0.31, 0.6667, 771, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.indent = indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L150_C8", "label": "if", "type": "if", "loc": [150, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [4, 2, 0.3468, 0.0046, 2, 0.31, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if separators is not None:\n self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L151_C12", "label": "assign", "type": "assigned_variable", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L150_C8", "vector": [14, 3, 0.3479, 0.0023, 3, 0.19, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [4, 2, 0.3514, 0.0046, 2, 0.31, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default is not None:\n self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L153_C12", "label": "self.default =", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L152_C8", "vector": [14, 3, 0.3525, 0.0023, 3, 0.53, 0.0, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L154_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "vector": [14, 2, 0.3548, 0.0023, 2, 0.31, 1.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L156_C4", "label": "default", "type": "function", "loc": [156, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [2, 1, 0.3802, 0.0438, 1, 0.07, 0.6667, 977, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "default", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, o):\n \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L156_C4", "vector": [8, 2, 0.3802, 0.0392, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n\n def default(self, o):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "label": "encode", "type": "function", "loc": [176, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [2, 1, 0.4332, 0.0576, 1, 0.07, 0.8333, 623, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "encode", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, o):\n \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\"\n # This is for extremely simple cases and benchmarks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L177_C8", "label": "expression", "type": "expression", "loc": [177, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "vector": [8, 2, 0.4136, 0.0138, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8", "label": "if", "type": "if", "loc": [184, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "vector": [4, 2, 0.4343, 0.023, 2, 0.85, 0.25, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)\n if self.ensure_ascii:\n return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12", "label": "if", "type": "if", "loc": [185, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8", "vector": [4, 3, 0.4309, 0.0115, 3, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L186_C16", "label": "_encoding =", "type": "assigned_variable", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12", "vector": [14, 4, 0.4286, 0.0023, 4, 0.71, 0.0, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoding = self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L187_C16", "label": "if", "type": "if", "loc": [187, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12", "vector": [4, 4, 0.4332, 0.0069, 4, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L189_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L187_C16", "vector": [14, 5, 0.4355, 0.0023, 5, 0.89, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12", "label": "if", "type": "if", "loc": [190, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8", "vector": [4, 3, 0.4412, 0.0092, 3, 0.83, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else:\n return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L191_C16", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12", "vector": [13, 4, 0.4401, 0.0023, 4, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L193_C16", "label": "return", "type": "return", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12", "vector": [13, 4, 0.4447, 0.0023, 4, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L197_C8", "label": "chunks = iterencode()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "vector": [14, 2, 0.4539, 0.0023, 2, 0.85, 0.5, 284, 3, 2, 0, 0, 315, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " chunks = self.iterencode(o, _one_shot=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L198_C8", "label": "if", "type": "if", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "vector": [4, 2, 0.4574, 0.0046, 2, 0.85, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(chunks, (list, tuple)):\n chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L199_C12", "label": "chunks = list()", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L198_C8", "vector": [14, 3, 0.4585, 0.0023, 3, 0.35, 0.0, 284, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "vector": [13, 2, 0.4608, 0.0023, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "label": "iterencode", "type": "function", "loc": [202, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "vector": [2, 1, 0.5276, 0.1267, 1, 0.07, 1.0, 315, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "iterencode", "arg_names": ["self", "o", "_one_shot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterencode(self, o, _one_shot=False):\n \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L203_C8", "label": "expression", "type": "expression", "loc": [203, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [8, 2, 0.477, 0.0207, 2, 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 object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8", "label": "if", "type": "if", "loc": [212, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [4, 2, 0.4919, 0.0092, 2, 0.13, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_circular:\n markers = {}\n else:\n markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L213_C12", "label": "markers =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8", "vector": [14, 3, 0.4908, 0.0023, 3, 0.48, 0.0, 586, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L215_C12", "label": "markers =", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8", "vector": [14, 3, 0.4954, 0.0023, 3, 0.48, 1.0, 586, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8", "label": "if", "type": "if", "loc": [216, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [4, 2, 0.5012, 0.0092, 2, 0.13, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n _encoder = encode_basestring_ascii\n else:\n _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L217_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8", "vector": [14, 3, 0.5, 0.0023, 3, 0.75, 0.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L219_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8", "vector": [14, 3, 0.5046, 0.0023, 3, 0.75, 1.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L220_C8", "label": "if", "type": "if", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [4, 2, 0.5115, 0.0115, 2, 0.13, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.encoding != 'utf-8':\n def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12", "label": "_encoder", "type": "function", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L220_C8", "vector": [2, 3, 0.5127, 0.0092, 3, 0.42, 0.0, 153, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_encoder", "arg_names": ["o", "_orig_encoder", "_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L222_C16", "label": "if", "type": "if", "loc": [222, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12", "vector": [4, 4, 0.5127, 0.0046, 4, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L223_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [223, 223], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L222_C16", "vector": [14, 5, 0.5138, 0.0023, 5, 0.61, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L224_C16", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12", "vector": [13, 4, 0.5161, 0.0023, 4, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "label": "floatstr", "type": "function", "loc": [226, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [2, 2, 0.5403, 0.0415, 2, 0.13, 0.6667, 122, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "floatstr", "arg_names": ["o", "allow_nan", "_repr", "_inf", "_neginf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):\n # Check for specials. Note that this type of test is processor- and/or\n # platform-specific, so do tests which don't depend on the internals.\n\n if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12", "label": "if", "type": "if", "loc": [230, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "vector": [4, 3, 0.538, 0.0184, 3, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L231_C16", "label": "text =", "type": "assigned_variable", "loc": [231, 231], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12", "vector": [14, 4, 0.5323, 0.0023, 4, 0.54, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12", "label": "if", "type": "if", "loc": [232, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12", "vector": [4, 4, 0.5403, 0.0138, 4, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L233_C16", "label": "text =", "type": "assigned_variable", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12", "vector": [14, 5, 0.5369, 0.0023, 5, 0.29, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12", "vector": [4, 5, 0.5426, 0.0092, 5, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L235_C16", "label": "text =", "type": "assigned_variable", "loc": [235, 235], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12", "vector": [14, 6, 0.5415, 0.0023, 6, 0.52, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = '-Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L237_C16", "label": "return", "type": "return", "loc": [237, 237], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12", "vector": [13, 6, 0.5461, 0.0023, 6, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L239_C12", "label": "if", "type": "if", "loc": [239, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "vector": [4, 3, 0.553, 0.0069, 3, 0.72, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_nan:\n raise ValueError(\"Out of range float values are not JSON compliant: %r\"\n % (o,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L243_C12", "label": "return", "type": "return", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "vector": [13, 3, 0.5599, 0.0023, 3, 0.72, 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_209:If_L246_C8", "label": "if", "type": "if", "loc": [246, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [4, 2, 0.5772, 0.023, 2, 0.13, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:\n _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)\n else:\n _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L247_C12", "label": "_iterencode = c_make_encoder()", "type": "assigned_variable", "loc": [247, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L246_C8", "vector": [14, 3, 0.5726, 0.0092, 3, 0.62, 0.0, 136, 3, 9, 0, 0, 30, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "c_make_encoder", "annotation": ""}, "snippet": " _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L252_C12", "label": "_iterencode = _make_iterencode()", "type": "assigned_variable", "loc": [252, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L246_C8", "vector": [14, 3, 0.5841, 0.0092, 3, 0.62, 1.0, 136, 3, 10, 0, 0, 845, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "_make_iterencode", "annotation": ""}, "snippet": " _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, _one_shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "vector": [13, 2, 0.5899, 0.0023, 2, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode(o, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "label": "_make_iterencode", "type": "function", "loc": [258, 434], "level": 0, "parent": null, "vector": [2, 0, 0.7972, 0.4078, 0, 0.66, 1.0, 845, 0, 21, 1, 0, 0, 0, 50], "semantic": {"name": "_make_iterencode", "arg_names": ["markers", "_default", "_encoder", "_indent", "_floatstr", "_key_separator", "_item_separator", "_sort_keys", "_skipkeys", "_one_shot", "ValueError", "basestring", "dict", "float", "id", "int", "isinstance", "list", "long", "str", "tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\n ## HACK: hand-optimized bytecode; turn globals into locals\n ValueError=ValueError,\n basestring=basestring,\n dict=dict,\n float=float,\n id=id,\n int=int,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "label": "_iterencode_list", "type": "function", "loc": [273, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "vector": [2, 1, 0.6878, 0.1198, 1, 0.78, 0.0, 1, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "_iterencode_list", "arg_names": ["lst", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_list(lst, _current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8", "label": "if", "type": "if", "loc": [274, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [4, 2, 0.6336, 0.0069, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lst:\n yield '[]'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L275_C12", "label": "expression", "type": "expression", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8", "vector": [8, 3, 0.6336, 0.0023, 3, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '[]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L276_C12", "label": "return", "type": "return", "loc": [276, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8", "vector": [13, 3, 0.6359, 0.0023, 3, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "label": "if", "type": "if", "loc": [277, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [4, 2, 0.6429, 0.0115, 2, 0.56, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L278_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "vector": [14, 3, 0.6406, 0.0023, 3, 0.31, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(lst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L279_C12", "label": "if", "type": "if", "loc": [279, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "vector": [4, 3, 0.644, 0.0046, 3, 0.31, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L281_C12", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "vector": [14, 3, 0.6475, 0.0023, 3, 0.31, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L282_C8", "label": "buf =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [14, 2, 0.6498, 0.0023, 2, 0.56, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = '['"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "label": "if", "type": "if", "loc": [283, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [4, 2, 0.6601, 0.0184, 2, 0.56, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n separator = _item_separator + newline_indent\n buf += newline_indent\n else:\n newline_indent = None\n separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L285_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "vector": [14, 3, 0.6567, 0.0023, 3, 0.72, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L286_C12", "label": "separator =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "vector": [14, 3, 0.659, 0.0023, 3, 0.72, 0.3333, 539, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L289_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "vector": [14, 3, 0.6659, 0.0023, 3, 0.72, 0.6667, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L290_C12", "label": "separator =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "vector": [14, 3, 0.6682, 0.0023, 3, 0.72, 1.0, 539, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L291_C8", "label": "first =", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [14, 2, 0.6705, 0.0023, 2, 0.56, 0.5, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8", "label": "for value", "type": "for", "loc": [292, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [6, 2, 0.7028, 0.0622, 2, 0.56, 0.625, 441, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value in lst:\n if first:\n first = False\n else:\n buf = separator\n if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12", "label": "if", "type": "if", "loc": [293, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8", "vector": [4, 3, 0.6786, 0.0092, 3, 0.99, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L294_C16", "label": "first =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12", "vector": [14, 4, 0.6774, 0.0023, 4, 0.88, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L296_C16", "label": "buf =", "type": "assigned_variable", "loc": [296, 296], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12", "vector": [14, 4, 0.682, 0.0023, 4, 0.88, 1.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12", "label": "if", "type": "if", "loc": [297, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8", "vector": [4, 3, 0.7085, 0.0507, 3, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L298_C16", "label": "expression", "type": "expression", "loc": [298, 298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12", "vector": [8, 4, 0.6866, 0.0023, 4, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12", "label": "if", "type": "if", "loc": [299, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12", "vector": [4, 4, 0.7108, 0.0461, 4, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L300_C16", "label": "expression", "type": "expression", "loc": [300, 300], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12", "vector": [8, 5, 0.6912, 0.0023, 5, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12", "label": "if", "type": "if", "loc": [301, 318], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12", "vector": [4, 5, 0.7131, 0.0415, 5, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L302_C16", "label": "expression", "type": "expression", "loc": [302, 302], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12", "vector": [8, 6, 0.6959, 0.0023, 6, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12", "label": "if", "type": "if", "loc": [303, 318], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12", "vector": [4, 6, 0.7154, 0.0369, 6, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L304_C16", "label": "expression", "type": "expression", "loc": [304, 304], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12", "vector": [8, 7, 0.7005, 0.0023, 7, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12", "label": "if", "type": "if", "loc": [305, 318], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12", "vector": [4, 7, 0.7177, 0.0323, 7, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L306_C16", "label": "expression", "type": "expression", "loc": [306, 306], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12", "vector": [8, 8, 0.7051, 0.0023, 8, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "label": "if", "type": "if", "loc": [307, 318], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12", "vector": [4, 8, 0.72, 0.0276, 8, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L308_C16", "label": "expression", "type": "expression", "loc": [308, 308], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "vector": [8, 9, 0.7097, 0.0023, 9, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L310_C16", "label": "expression", "type": "expression", "loc": [310, 310], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "vector": [8, 9, 0.7143, 0.0023, 9, 0.56, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16", "label": "if", "type": "if", "loc": [311, 316], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "vector": [4, 9, 0.7224, 0.0138, 9, 0.56, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L312_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [312, 312], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16", "vector": [14, 10, 0.7189, 0.0023, 10, 0.03, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16", "label": "if", "type": "if", "loc": [313, 316], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16", "vector": [4, 10, 0.7247, 0.0092, 10, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L314_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [314, 314], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16", "vector": [14, 11, 0.7235, 0.0023, 11, 0.58, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L316_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [316, 316], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16", "vector": [14, 11, 0.7281, 0.0023, 11, 0.58, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L317_C16", "label": "for chunk", "type": "for", "loc": [317, 318], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "vector": [6, 9, 0.7316, 0.0046, 9, 0.56, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L318_C20", "label": "expression", "type": "expression", "loc": [318, 318], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L317_C16", "vector": [8, 10, 0.7327, 0.0023, 10, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L319_C8", "label": "if", "type": "if", "loc": [319, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [4, 2, 0.7373, 0.0069, 2, 0.56, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L321_C12", "label": "expression", "type": "expression", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L319_C8", "vector": [8, 3, 0.7396, 0.0023, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [8, 2, 0.7419, 0.0023, 2, 0.56, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L323_C8", "label": "if", "type": "if", "loc": [323, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "vector": [4, 2, 0.7454, 0.0046, 2, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "label": "_iterencode_dict", "type": "function", "loc": [326, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "vector": [2, 1, 0.8376, 0.1751, 1, 0.78, 0.3333, 301, 0, 2, 0, 0, 0, 0, 23], "semantic": {"name": "_iterencode_dict", "arg_names": ["dct", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_dict(dct, _current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8", "label": "if", "type": "if", "loc": [327, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.7558, 0.0069, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dct:\n yield '{}'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L328_C12", "label": "expression", "type": "expression", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8", "vector": [8, 3, 0.7558, 0.0023, 3, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L329_C12", "label": "return", "type": "return", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8", "vector": [13, 3, 0.7581, 0.0023, 3, 0.65, 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_209:If_L330_C8", "label": "if", "type": "if", "loc": [330, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.765, 0.0115, 2, 0.86, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L331_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "vector": [14, 3, 0.7627, 0.0023, 3, 0.14, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(dct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L332_C12", "label": "if", "type": "if", "loc": [332, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "vector": [4, 3, 0.7661, 0.0046, 3, 0.14, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L334_C12", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "vector": [14, 3, 0.7696, 0.0023, 3, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [8, 2, 0.7719, 0.0023, 2, 0.86, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "label": "if", "type": "if", "loc": [336, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.7823, 0.0184, 2, 0.86, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n item_separator = _item_separator + newline_indent\n yield newline_indent\n else:\n newline_indent = None\n item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L338_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "vector": [14, 3, 0.7788, 0.0023, 3, 0.43, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L339_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "vector": [14, 3, 0.7811, 0.0023, 3, 0.43, 0.25, 330, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L340_C12", "label": "expression", "type": "expression", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "vector": [8, 3, 0.7834, 0.0023, 3, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L342_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "vector": [14, 3, 0.788, 0.0023, 3, 0.43, 0.75, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L343_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [343, 343], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "vector": [14, 3, 0.7903, 0.0023, 3, 0.43, 1.0, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L344_C8", "label": "first =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [14, 2, 0.7926, 0.0023, 2, 0.86, 0.4444, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "label": "if", "type": "if", "loc": [345, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.7995, 0.0115, 2, 0.86, 0.5556, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _sort_keys:\n items = dct.items()\n items.sort(key=lambda kv: kv[0])\n else:\n items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L346_C12", "label": "items = items()", "type": "assigned_variable", "loc": [346, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "vector": [14, 3, 0.7972, 0.0023, 3, 0.25, 0.0, 339, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " items = dct.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L347_C12", "label": "sort()", "type": "expression", "loc": [347, 347], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "vector": [8, 3, 0.7995, 0.0023, 3, 0.25, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " items.sort(key=lambda kv: kv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L349_C12", "label": "items = iteritems()", "type": "assigned_variable", "loc": [349, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "vector": [14, 3, 0.8041, 0.0023, 3, 0.25, 1.0, 339, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "label": "for key, value", "type": "for", "loc": [350, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [6, 2, 0.8583, 0.106, 2, 0.86, 0.6667, 839, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in items:\n if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L351_C12", "label": "if", "type": "if", "loc": [351, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "vector": [4, 3, 0.8283, 0.0415, 3, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12", "label": "if", "type": "if", "loc": [355, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L351_C12", "vector": [4, 4, 0.8329, 0.0323, 4, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L356_C16", "label": "key = _floatstr()", "type": "assigned_variable", "loc": [356, 356], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12", "vector": [14, 5, 0.8203, 0.0023, 5, 0.34, 0.0, 230, 3, 1, 0, 0, 185, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "_floatstr", "annotation": ""}, "snippet": " key = _floatstr(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12", "label": "if", "type": "if", "loc": [357, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12", "vector": [4, 5, 0.8353, 0.0276, 5, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L358_C16", "label": "key = str()", "type": "assigned_variable", "loc": [358, 358], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12", "vector": [14, 6, 0.8249, 0.0023, 6, 0.91, 0.0, 230, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12", "label": "if", "type": "if", "loc": [359, 368], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12", "vector": [4, 6, 0.8376, 0.023, 6, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L360_C16", "label": "key =", "type": "assigned_variable", "loc": [360, 360], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12", "vector": [14, 7, 0.8295, 0.0023, 7, 0.42, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12", "label": "if", "type": "if", "loc": [361, 368], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12", "vector": [4, 7, 0.8399, 0.0184, 7, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L362_C16", "label": "key =", "type": "assigned_variable", "loc": [362, 362], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12", "vector": [14, 8, 0.8341, 0.0023, 8, 0.28, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12", "label": "if", "type": "if", "loc": [363, 368], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12", "vector": [4, 8, 0.8422, 0.0138, 8, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L364_C16", "label": "key =", "type": "assigned_variable", "loc": [364, 364], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12", "vector": [14, 9, 0.8387, 0.0023, 9, 0.83, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L365_C12", "label": "if", "type": "if", "loc": [365, 368], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12", "vector": [4, 9, 0.8445, 0.0092, 9, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12", "label": "if", "type": "if", "loc": [369, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "vector": [4, 3, 0.8537, 0.0092, 3, 0.43, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L370_C16", "label": "first =", "type": "assigned_variable", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12", "vector": [14, 4, 0.8525, 0.0023, 4, 0.14, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L372_C16", "label": "expression", "type": "expression", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12", "vector": [8, 4, 0.8571, 0.0023, 4, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L373_C12", "label": "expression", "type": "expression", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "vector": [8, 3, 0.8594, 0.0023, 3, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L374_C12", "label": "expression", "type": "expression", "loc": [374, 374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "vector": [8, 3, 0.8618, 0.0023, 3, 0.43, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _key_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12", "label": "if", "type": "if", "loc": [375, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "vector": [4, 3, 0.8871, 0.0484, 3, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield _encoder(value)\n elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L376_C16", "label": "expression", "type": "expression", "loc": [376, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12", "vector": [8, 4, 0.8664, 0.0023, 4, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12", "label": "if", "type": "if", "loc": [377, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12", "vector": [4, 4, 0.8894, 0.0438, 4, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L378_C16", "label": "expression", "type": "expression", "loc": [378, 378], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12", "vector": [8, 5, 0.871, 0.0023, 5, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12", "label": "if", "type": "if", "loc": [379, 395], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12", "vector": [4, 5, 0.8917, 0.0392, 5, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L380_C16", "label": "expression", "type": "expression", "loc": [380, 380], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12", "vector": [8, 6, 0.8756, 0.0023, 6, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12", "label": "if", "type": "if", "loc": [381, 395], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12", "vector": [4, 6, 0.894, 0.0346, 6, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L382_C16", "label": "expression", "type": "expression", "loc": [382, 382], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12", "vector": [8, 7, 0.8802, 0.0023, 7, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12", "label": "if", "type": "if", "loc": [383, 395], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12", "vector": [4, 7, 0.8963, 0.03, 7, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L384_C16", "label": "expression", "type": "expression", "loc": [384, 384], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12", "vector": [8, 8, 0.8848, 0.0023, 8, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "label": "if", "type": "if", "loc": [385, 395], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12", "vector": [4, 8, 0.8986, 0.0253, 8, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L386_C16", "label": "expression", "type": "expression", "loc": [386, 386], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "vector": [8, 9, 0.8894, 0.0023, 9, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16", "label": "if", "type": "if", "loc": [388, 393], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "vector": [4, 9, 0.8998, 0.0138, 9, 0.88, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L389_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [389, 389], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16", "vector": [14, 10, 0.8963, 0.0023, 10, 0.87, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16", "label": "if", "type": "if", "loc": [390, 393], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16", "vector": [4, 10, 0.9021, 0.0092, 10, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L391_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [391, 391], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16", "vector": [14, 11, 0.9009, 0.0023, 11, 0.4, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L393_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [393, 393], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16", "vector": [14, 11, 0.9055, 0.0023, 11, 0.4, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L394_C16", "label": "for chunk", "type": "for", "loc": [394, 395], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "vector": [6, 9, 0.909, 0.0046, 9, 0.88, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L395_C20", "label": "expression", "type": "expression", "loc": [395, 395], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L394_C16", "vector": [8, 10, 0.9101, 0.0023, 10, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L396_C8", "label": "if", "type": "if", "loc": [396, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.9147, 0.0069, 2, 0.86, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L398_C12", "label": "expression", "type": "expression", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L396_C8", "vector": [8, 3, 0.9171, 0.0023, 3, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L399_C8", "label": "expression", "type": "expression", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [8, 2, 0.9194, 0.0023, 2, 0.86, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L400_C8", "label": "if", "type": "if", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "vector": [4, 2, 0.9228, 0.0046, 2, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L403_C4", "label": "_iterencode", "type": "function", "loc": [403, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "vector": [2, 1, 0.962, 0.0691, 1, 0.78, 0.6667, 136, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "_iterencode", "arg_names": ["o", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode(o, _current_indent_level):\n if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8", "label": "if", "type": "if", "loc": [404, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L403_C4", "vector": [4, 2, 0.9631, 0.0668, 2, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L405_C12", "label": "expression", "type": "expression", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8", "vector": [8, 3, 0.9332, 0.0023, 3, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8", "label": "if", "type": "if", "loc": [406, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8", "vector": [4, 3, 0.9654, 0.0622, 3, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L407_C12", "label": "expression", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8", "vector": [8, 4, 0.9378, 0.0023, 4, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8", "label": "if", "type": "if", "loc": [408, 432], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8", "vector": [4, 4, 0.9677, 0.0576, 4, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L409_C12", "label": "expression", "type": "expression", "loc": [409, 409], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8", "vector": [8, 5, 0.9424, 0.0023, 5, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8", "label": "if", "type": "if", "loc": [410, 432], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8", "vector": [4, 5, 0.97, 0.053, 5, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L411_C12", "label": "expression", "type": "expression", "loc": [411, 411], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8", "vector": [8, 6, 0.947, 0.0023, 6, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8", "label": "if", "type": "if", "loc": [412, 432], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8", "vector": [4, 6, 0.9724, 0.0484, 6, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L413_C12", "label": "expression", "type": "expression", "loc": [413, 413], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8", "vector": [8, 7, 0.9516, 0.0023, 7, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8", "label": "if", "type": "if", "loc": [414, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8", "vector": [4, 7, 0.9747, 0.0438, 7, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L415_C12", "label": "expression", "type": "expression", "loc": [415, 415], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8", "vector": [8, 8, 0.9562, 0.0023, 8, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8", "label": "if", "type": "if", "loc": [416, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8", "vector": [4, 8, 0.977, 0.0392, 8, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L417_C12", "label": "for chunk", "type": "for", "loc": [417, 418], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8", "vector": [6, 9, 0.962, 0.0046, 9, 0.09, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L418_C16", "label": "expression", "type": "expression", "loc": [418, 418], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L417_C12", "vector": [8, 10, 0.9631, 0.0023, 10, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "label": "if", "type": "if", "loc": [419, 432], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8", "vector": [4, 9, 0.9804, 0.0323, 9, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L420_C12", "label": "for chunk", "type": "for", "loc": [420, 421], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "vector": [6, 10, 0.9689, 0.0046, 10, 0.83, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L421_C16", "label": "expression", "type": "expression", "loc": [421, 421], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L420_C12", "vector": [8, 11, 0.97, 0.0023, 11, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "label": "if", "type": "if", "loc": [423, 427], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "vector": [4, 10, 0.9793, 0.0115, 10, 0.83, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L424_C16", "label": "markerid = id()", "type": "assigned_variable", "loc": [424, 424], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "vector": [14, 11, 0.977, 0.0023, 11, 0.74, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L425_C16", "label": "if", "type": "if", "loc": [425, 426], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "vector": [4, 11, 0.9804, 0.0046, 11, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L427_C16", "label": "assign", "type": "assigned_variable", "loc": [427, 427], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "vector": [14, 11, 0.9839, 0.0023, 11, 0.74, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L428_C12", "label": "o = _default()", "type": "assigned_variable", "loc": [428, 428], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "vector": [14, 10, 0.9862, 0.0023, 10, 0.83, 0.5, 926, 3, 1, 0, 0, 99, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "_default", "annotation": ""}, "snippet": " o = _default(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:For_L429_C12", "label": "for chunk", "type": "for", "loc": [429, 430], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "vector": [6, 10, 0.9896, 0.0046, 10, 0.83, 0.75, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L430_C16", "label": "expression", "type": "expression", "loc": [430, 430], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:For_L429_C12", "vector": [8, 11, 0.9908, 0.0023, 11, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:If_L431_C12", "label": "if", "type": "if", "loc": [431, 432], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "vector": [4, 10, 0.9942, 0.0046, 10, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L434_C4", "label": "return", "type": "return", "loc": [434, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "vector": [13, 1, 1.0, 0.0023, 1, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L186_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L187_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L189_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L222_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L223_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L296_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L300_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L302_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L304_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L306_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L308_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L310_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L312_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L314_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L316_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L317_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L317_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L318_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L334_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L343_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L351_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L356_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L358_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L360_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L362_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L364_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L380_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L382_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L384_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L386_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L389_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L391_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L393_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L394_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L394_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L395_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L396_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L400_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L403_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L409_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L417_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L418_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L420_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L420_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L421_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L424_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L425_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L427_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Assign_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:For_L429_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:For_L429_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Expr_L430_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_209:If_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_209:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_209:Return_L434_C4"}] |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of the :mod:`json` library contained in Python 2.6, but maintains
compatibility with Python 2.4 and Python 2.5 and (currently) has
significant performance advantages, even without using the optional C
extension for speedups.
Encoding basic Python object hierarchies::
>>> import simplejson as json
>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
'["foo", {"bar": ["baz", null, 1.0, 2]}]'
>>> print json.dumps("\"foo\bar")
"\"foo\bar"
>>> print json.dumps(u'\u1234')
"\u1234"
>>> print json.dumps('\\')
"\\"
>>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
{"a": 0, "b": 0, "c": 0}
>>> from StringIO import StringIO
>>> io = StringIO()
>>> json.dump(['streaming API'], io)
>>> io.getvalue()
'["streaming API"]'
Compact encoding::
>>> import simplejson as json
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
'[1,2,3,{"4":5,"6":7}]'
Pretty printing::
>>> import simplejson as json
>>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
>>> print '\n'.join([l.rstrip() for l in s.splitlines()])
{
"4": 5,
"6": 7
}
Decoding JSON::
>>> import simplejson as json
>>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
>>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
True
>>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
True
>>> from StringIO import StringIO
>>> io = StringIO('["streaming API"]')
>>> json.load(io)[0] == 'streaming API'
True
Specializing JSON object decoding::
>>> import simplejson as json
>>> def as_complex(dct):
... if '__complex__' in dct:
... return complex(dct['real'], dct['imag'])
... return dct
...
>>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
... object_hook=as_complex)
(1+2j)
>>> import decimal
>>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1')
True
Specializing JSON object encoding::
>>> import simplejson as json
>>> def encode_complex(obj):
... if isinstance(obj, complex):
... return [obj.real, obj.imag]
... raise TypeError("%r is not JSON serializable" % (o,))
...
>>> json.dumps(2 + 1j, default=encode_complex)
'[2.0, 1.0]'
>>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
'[2.0, 1.0]'
>>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
'[2.0, 1.0]'
Using simplejson.tool from the shell to validate and pretty-print::
$ echo '{"json":"obj"}' | python -msimplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -msimplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
__version__ = '2.0.7'
__all__ = [
'dump', 'dumps', 'load', 'loads',
'JSONDecoder', 'JSONEncoder',
]
from decoder import JSONDecoder
from encoder import JSONEncoder
_default_encoder = JSONEncoder(
skipkeys=False,
ensure_ascii=True,
check_circular=True,
allow_nan=True,
indent=None,
separators=None,
encoding='utf-8',
default=None,
)
def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
"""Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
``.write()``-supporting file-like object).
If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types
(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
will be skipped instead of raising a ``TypeError``.
If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``
may be ``unicode`` instances, subject to normal Python ``str`` to
``unicode`` coercion rules. Unless ``fp.write()`` explicitly
understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
to cause an error.
If ``check_circular`` is ``False``, then the circular reference check
for container types will be skipped and a circular reference will
result in an ``OverflowError`` (or worse).
If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to
serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
in strict compliance of the JSON specification, instead of using the
JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
If ``indent`` is a non-negative integer, then JSON array elements and object
members will be pretty-printed with that indent level. An indent level
of 0 will only insert newlines. ``None`` is the most compact representation.
If ``separators`` is an ``(item_separator, dict_separator)`` tuple
then it will be used instead of the default ``(', ', ': ')`` separators.
``(',', ':')`` is the most compact JSON representation.
``encoding`` is the character encoding for str instances, default is UTF-8.
``default(obj)`` is a function that should return a serializable version
of obj or raise TypeError. The default simply raises TypeError.
To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
``.default()`` method to serialize additional types), specify it with
the ``cls`` kwarg.
"""
# cached encoder
if (skipkeys is False and ensure_ascii is True and
check_circular is True and allow_nan is True and
cls is None and indent is None and separators is None and
encoding == 'utf-8' and default is None and not kw):
iterable = _default_encoder.iterencode(obj)
else:
if cls is None:
cls = JSONEncoder
iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
check_circular=check_circular, allow_nan=allow_nan, indent=indent,
separators=separators, encoding=encoding,
default=default, **kw).iterencode(obj)
# could accelerate with writelines in some versions of Python, at
# a debuggability cost
for chunk in iterable:
fp.write(chunk)
def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
"""Serialize ``obj`` to a JSON formatted ``str``.
If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types
(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
will be skipped instead of raising a ``TypeError``.
If ``ensure_ascii`` is ``False``, then the return value will be a
``unicode`` instance subject to normal Python ``str`` to ``unicode``
coercion rules instead of being escaped to an ASCII ``str``.
If ``check_circular`` is ``False``, then the circular reference check
for container types will be skipped and a circular reference will
result in an ``OverflowError`` (or worse).
If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to
serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
strict compliance of the JSON specification, instead of using the
JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
If ``indent`` is a non-negative integer, then JSON array elements and
object members will be pretty-printed with that indent level. An indent
level of 0 will only insert newlines. ``None`` is the most compact
representation.
If ``separators`` is an ``(item_separator, dict_separator)`` tuple
then it will be used instead of the default ``(', ', ': ')`` separators.
``(',', ':')`` is the most compact JSON representation.
``encoding`` is the character encoding for str instances, default is UTF-8.
``default(obj)`` is a function that should return a serializable version
of obj or raise TypeError. The default simply raises TypeError.
To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
``.default()`` method to serialize additional types), specify it with
the ``cls`` kwarg.
"""
# cached encoder
if (skipkeys is False and ensure_ascii is True and
check_circular is True and allow_nan is True and
cls is None and indent is None and separators is None and
encoding == 'utf-8' and default is None and not kw):
return _default_encoder.encode(obj)
if cls is None:
cls = JSONEncoder
return cls(
skipkeys=skipkeys, ensure_ascii=ensure_ascii,
check_circular=check_circular, allow_nan=allow_nan, indent=indent,
separators=separators, encoding=encoding, default=default,
**kw).encode(obj)
_default_decoder = JSONDecoder(encoding=None, object_hook=None)
def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, **kw):
"""Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
a JSON document) to a Python object.
If the contents of ``fp`` is encoded with an ASCII based encoding other
than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must
be specified. Encodings that are not ASCII based (such as UCS-2) are
not allowed, and should be wrapped with
``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``
object and passed to ``loads()``
``object_hook`` is an optional function that will be called with the
result of any object literal decode (a ``dict``). The return value of
``object_hook`` will be used instead of the ``dict``. This feature
can be used to implement custom decoders (e.g. JSON-RPC class hinting).
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg.
"""
return loads(fp.read(),
encoding=encoding, cls=cls, object_hook=object_hook,
parse_float=parse_float, parse_int=parse_int,
parse_constant=parse_constant, **kw)
def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, **kw):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding
other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name
must be specified. Encodings that are not ASCII based (such as UCS-2)
are not allowed and should be decoded to ``unicode`` first.
``object_hook`` is an optional function that will be called with the
result of any object literal decode (a ``dict``). The return value of
``object_hook`` will be used instead of the ``dict``. This feature
can be used to implement custom decoders (e.g. JSON-RPC class hinting).
``parse_float``, if specified, will be called with the string
of every JSON float to be decoded. By default this is equivalent to
float(num_str). This can be used to use another datatype or parser
for JSON floats (e.g. decimal.Decimal).
``parse_int``, if specified, will be called with the string
of every JSON int to be decoded. By default this is equivalent to
int(num_str). This can be used to use another datatype or parser
for JSON integers (e.g. float).
``parse_constant``, if specified, will be called with one of the
following strings: -Infinity, Infinity, NaN, null, true, false.
This can be used to raise an exception if invalid JSON numbers
are encountered.
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg.
"""
if (cls is None and encoding is None and object_hook is None and
parse_int is None and parse_float is None and
parse_constant is None and not kw):
return _default_decoder.decode(s)
if cls is None:
cls = JSONDecoder
if object_hook is not None:
kw['object_hook'] = object_hook
if parse_float is not None:
kw['parse_float'] = parse_float
if parse_int is not None:
kw['parse_int'] = parse_int
if parse_constant is not None:
kw['parse_constant'] = parse_constant
return cls(encoding=encoding, **kw).decode(s)
| ajibawa-2023/Python-Code-Large/train/row_210 | 41 | 316 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1582, 0.3133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility with Python 2.4 and Python 2.5 and (currently) has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L100_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.3165, 0.0032, 0, 0.66, 0.1, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '2.0.7'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L101_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [101, 104], "level": 0, "parent": null, "vector": [14, 0, 0.3244, 0.0127, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'dump', 'dumps', 'load', 'loads',\n 'JSONDecoder', 'JSONEncoder',\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:ImportFrom_L106_C0", "label": "from decoder import JSONDecoder", "type": "import", "loc": [106, 106], "level": 0, "parent": null, "vector": [1, 0, 0.3354, 0.0032, 0, 0.66, 0.3, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["JSONDecoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:ImportFrom_L107_C0", "label": "from encoder import JSONEncoder", "type": "import", "loc": [107, 107], "level": 0, "parent": null, "vector": [1, 0, 0.3386, 0.0032, 0, 0.66, 0.4, 672, 0, 1, 0, 0, 672, 0, 0], "semantic": {"name": "encoder", "arg_names": [], "import_names": ["JSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from encoder import JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L109_C0", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [109, 118], "level": 0, "parent": null, "vector": [14, 0, 0.3592, 0.0316, 0, 0.66, 0.5, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": "_default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "label": "dump", "type": "function", "loc": [120, 179], "level": 0, "parent": null, "vector": [2, 0, 0.4731, 0.1899, 0, 0.66, 0.6, 952, 0, 12, 0, 0, 0, 0, 4], "semantic": {"name": "dump", "arg_names": ["obj", "fp", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L123_C4", "label": "expression", "type": "expression", "loc": [123, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "vector": [8, 1, 0.4509, 0.1266, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "label": "if", "type": "if", "loc": [164, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "vector": [4, 1, 0.5364, 0.038, 1, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n iterable = _default_encoder.iterencode(obj)\n else:\n if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L168_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "vector": [14, 2, 0.5316, 0.0032, 2, 0.88, 0.0, 444, 3, 1, 0, 0, 315, 10, 1], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = _default_encoder.iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L170_C8", "label": "if", "type": "if", "loc": [170, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "vector": [4, 2, 0.5396, 0.0063, 2, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L171_C12", "label": "cls =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L170_C8", "vector": [14, 3, 0.5411, 0.0032, 3, 0.86, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L172_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "vector": [14, 2, 0.5491, 0.0127, 2, 0.88, 1.0, 444, 3, 1, 0, 0, 315, 10, 2], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding,\n default=default, **kw).iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:For_L178_C4", "label": "for chunk", "type": "for", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "vector": [6, 1, 0.5649, 0.0063, 1, 0.46, 1.0, 637, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in iterable:\n fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L179_C8", "label": "write()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:For_L178_C4", "vector": [8, 2, 0.5665, 0.0032, 2, 0.14, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "label": "dumps", "type": "function", "loc": [182, 235], "level": 0, "parent": null, "vector": [2, 0, 0.6598, 0.1709, 0, 0.66, 0.7, 160, 0, 11, 1, 0, 0, 0, 3], "semantic": {"name": "dumps", "arg_names": ["obj", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L185_C4", "label": "expression", "type": "expression", "loc": [185, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "vector": [8, 1, 0.644, 0.1203, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the return value will be a\n ``unicode`` instance subject to normal Python ``str`` to ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "vector": [4, 1, 0.7152, 0.0158, 1, 0.08, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L224_C4", "vector": [13, 2, 0.7215, 0.0032, 2, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L229_C4", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "vector": [4, 1, 0.7263, 0.0063, 1, 0.08, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L230_C8", "label": "cls =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L229_C4", "vector": [14, 2, 0.7278, 0.0032, 2, 0.77, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "vector": [13, 1, 0.7373, 0.0158, 1, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(\n skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding, default=default,\n **kw).encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L238_C0", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [238, 238], "level": 0, "parent": null, "vector": [14, 0, 0.7532, 0.0032, 0, 0.66, 0.8, 340, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": "_default_decoder = JSONDecoder(encoding=None, object_hook=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L241_C0", "label": "load", "type": "function", "loc": [241, 265], "level": 0, "parent": null, "vector": [2, 0, 0.8006, 0.0791, 0, 0.66, 0.9, 37, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "load", "arg_names": ["fp", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L241_C0", "vector": [8, 1, 0.7975, 0.0601, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are\n not allowed, and should be wrapped with\n ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L241_C0", "vector": [13, 1, 0.8339, 0.0127, 1, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_constant=parse_constant, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "label": "loads", "type": "function", "loc": [268, 316], "level": 0, "parent": null, "vector": [2, 0, 0.9241, 0.1551, 0, 0.66, 1.0, 88, 0, 8, 1, 0, 0, 0, 3], "semantic": {"name": "loads", "arg_names": ["s", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L270_C4", "label": "expression", "type": "expression", "loc": [270, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [8, 1, 0.9035, 0.1013, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)\n are not allowed and should be decoded to ``unicode`` first.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L302_C4", "label": "if", "type": "if", "loc": [302, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9604, 0.0127, 1, 0.14, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None and not kw):\n return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L302_C4", "vector": [13, 2, 0.9652, 0.0032, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9699, 0.0063, 1, 0.14, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L307_C8", "label": "cls =", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L306_C4", "vector": [14, 2, 0.9715, 0.0032, 2, 0.2, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9763, 0.0063, 1, 0.14, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_hook is not None:\n kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L309_C8", "label": "assign", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L308_C4", "vector": [14, 2, 0.9778, 0.0032, 2, 0.17, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L310_C4", "label": "if", "type": "if", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9826, 0.0063, 1, 0.14, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_float is not None:\n kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L311_C8", "label": "assign", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L310_C4", "vector": [14, 2, 0.9842, 0.0032, 2, 0.8, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L312_C4", "label": "if", "type": "if", "loc": [312, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9889, 0.0063, 1, 0.14, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_int is not None:\n kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L313_C8", "label": "assign", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L312_C4", "vector": [14, 2, 0.9905, 0.0032, 2, 0.24, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:If_L314_C4", "label": "if", "type": "if", "loc": [314, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [4, 1, 0.9953, 0.0063, 1, 0.14, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_constant is not None:\n kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L315_C8", "label": "assign", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:If_L314_C4", "vector": [14, 2, 0.9968, 0.0032, 2, 0.89, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "vector": [13, 1, 1.0, 0.0032, 1, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(encoding=encoding, **kw).decode(s)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:For_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:For_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:If_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:If_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_210:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_210:Return_L316_C4"}] |
#!/usr/bin/env python
if __name__ == '__main__':
from common.appenginepatch.aecmd import setup_env
setup_env(manage_py_env=True)
# Recompile translation files
from mediautils.compilemessages import updatemessages
updatemessages()
# Generate compressed media files for manage.py update
import sys
from mediautils.generatemedia import updatemedia
if len(sys.argv) >= 2 and sys.argv[1] == 'update':
updatemedia(True)
import settings
from django.core.management import execute_manager
execute_manager(settings)
| ajibawa-2023/Python-Code-Large/train/row_213 | 12 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "label": "if", "type": "if", "loc": [2, 18], "level": 0, "parent": null, "vector": [4, 0, 0.5556, 0.9444, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n from common.appenginepatch.aecmd import setup_env\n setup_env(manage_py_env=True)\n\n # Recompile translation files\n from mediautils.compilemessages import updatemessages\n updatemessages()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L3_C4", "label": "from common.appenginepatch.aecmd import setup_env", "type": "import", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.1667, 0.0556, 1, 0.27, 0.0, 448, 0, 1, 0, 0, 448, 0, 0], "semantic": {"name": "common.appenginepatch.aecmd", "arg_names": [], "import_names": ["setup_env"], "rhs_call_name": "", "annotation": ""}, "snippet": " from common.appenginepatch.aecmd import setup_env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L4_C4", "label": "setup_env()", "type": "expression", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [8, 1, 0.2222, 0.0556, 1, 0.27, 0.1111, 193, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup_env", "arg_names": [], "import_names": [], "rhs_call_name": "setup_env", "annotation": ""}, "snippet": " setup_env(manage_py_env=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L7_C4", "label": "from mediautils.compilemessages import updatemessages", "type": "import", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.3889, 0.0556, 1, 0.27, 0.2222, 916, 0, 1, 0, 0, 916, 0, 0], "semantic": {"name": "mediautils.compilemessages", "arg_names": [], "import_names": ["updatemessages"], "rhs_call_name": "", "annotation": ""}, "snippet": " from mediautils.compilemessages import updatemessages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L8_C4", "label": "updatemessages()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [8, 1, 0.4444, 0.0556, 1, 0.27, 0.3333, 813, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "updatemessages", "arg_names": [], "import_names": [], "rhs_call_name": "updatemessages", "annotation": ""}, "snippet": " updatemessages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:Import_L11_C4", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.6111, 0.0556, 1, 0.27, 0.4444, 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_213:ImportFrom_L12_C4", "label": "from mediautils.generatemedia import updatemedia", "type": "import", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.6667, 0.0556, 1, 0.27, 0.5556, 547, 0, 1, 0, 0, 547, 0, 0], "semantic": {"name": "mediautils.generatemedia", "arg_names": [], "import_names": ["updatemedia"], "rhs_call_name": "", "annotation": ""}, "snippet": " from mediautils.generatemedia import updatemedia"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:If_L13_C4", "label": "if", "type": "if", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [4, 1, 0.75, 0.1111, 1, 0.27, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) >= 2 and sys.argv[1] == 'update':\n updatemedia(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L14_C8", "label": "updatemedia()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L13_C4", "vector": [8, 2, 0.7778, 0.0556, 2, 0.18, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updatemedia", "arg_names": [], "import_names": [], "rhs_call_name": "updatemedia", "annotation": ""}, "snippet": " updatemedia(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:Import_L16_C4", "label": "settings import settings", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.8889, 0.0556, 1, 0.27, 0.7778, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L17_C4", "label": "from django.core.management import execute_manager", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [1, 1, 0.9444, 0.0556, 1, 0.27, 0.8889, 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_213:Expr_L18_C4", "label": "execute_manager()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "vector": [8, 1, 1.0, 0.0556, 1, 0.27, 1.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_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:If_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Import_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_213:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_213:Expr_L18_C4"}] |
# -*- coding: utf-8 -*-
import os, sys
# Add current folder to sys.path, so we can import aecmd.
# App Engine causes main.py to be reloaded if an exception gets raised
# on the first request of a main.py instance, so don't add current_dir multiple
# times.
current_dir = os.path.abspath(os.path.dirname(__file__))
if current_dir not in sys.path:
sys.path = [current_dir] + sys.path
import aecmd
aecmd.setup_project()
from appenginepatcher.patch import patch_all, setup_logging
patch_all()
import django.core.handlers.wsgi
from google.appengine.ext.webapp import util
from django.conf import settings
def real_main():
# Reset path and environment variables
global path_backup
try:
sys.path = path_backup[:]
except:
path_backup = sys.path[:]
os.environ.update(aecmd.env_ext)
setup_logging()
# Create a Django application for WSGI.
application = django.core.handlers.wsgi.WSGIHandler()
# Run the WSGI CGI handler with that application.
util.run_wsgi_app(application)
def profile_main():
import logging, cProfile, pstats, random, StringIO
only_forced_profile = getattr(settings, 'ONLY_FORCED_PROFILE', False)
profile_percentage = getattr(settings, 'PROFILE_PERCENTAGE', None)
if (only_forced_profile and
'profile=forced' not in os.environ.get('QUERY_STRING')) or \
(not only_forced_profile and profile_percentage and
float(profile_percentage) / 100.0 <= random.random()):
return real_main()
prof = cProfile.Profile()
prof = prof.runctx('real_main()', globals(), locals())
stream = StringIO.StringIO()
stats = pstats.Stats(prof, stream=stream)
sort_by = getattr(settings, 'SORT_PROFILE_RESULTS_BY', 'time')
if not isinstance(sort_by, (list, tuple)):
sort_by = (sort_by,)
stats.sort_stats(*sort_by)
restrictions = []
profile_pattern = getattr(settings, 'PROFILE_PATTERN', None)
if profile_pattern:
restrictions.append(profile_pattern)
max_results = getattr(settings, 'MAX_PROFILE_RESULTS', 80)
if max_results and max_results != 'all':
restrictions.append(max_results)
stats.print_stats(*restrictions)
extra_output = getattr(settings, 'EXTRA_PROFILE_OUTPUT', None) or ()
if not isinstance(sort_by, (list, tuple)):
extra_output = (extra_output,)
if 'callees' in extra_output:
stats.print_callees()
if 'callers' in extra_output:
stats.print_callers()
logging.info('Profile data:\n%s', stream.getvalue())
main = getattr(settings, 'ENABLE_PROFILER', False) and profile_main or real_main
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_214 | 52 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_214:Import_L2_C0", "label": "os import os, sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.026, 0.013, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L8_C0", "label": "current_dir = abspath()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1039, 0.013, 0, 0.66, 0.0769, 467, 3, 1, 0, 0, 142, 10, 2], "semantic": {"name": "current_dir", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": "current_dir = os.path.abspath(os.path.dirname(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L9_C0", "label": "if", "type": "if", "loc": [9, 10], "level": 0, "parent": null, "vector": [4, 0, 0.1234, 0.026, 0, 0.66, 0.1538, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if current_dir not in sys.path:\n sys.path = [current_dir] + sys.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L10_C4", "label": "sys.path =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L9_C0", "vector": [14, 1, 0.1299, 0.013, 1, 0.92, 0.0, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.path = [current_dir] + sys.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Import_L12_C0", "label": "aecmd import aecmd", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1558, 0.013, 0, 0.66, 0.2308, 420, 0, 1, 0, 0, 420, 0, 0], "semantic": {"name": "aecmd", "arg_names": [], "import_names": ["aecmd"], "rhs_call_name": "", "annotation": ""}, "snippet": "import aecmd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L13_C0", "label": "setup_project()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1688, 0.013, 0, 0.66, 0.3077, 915, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setup_project", "arg_names": [], "import_names": [], "rhs_call_name": "setup_project", "annotation": ""}, "snippet": "aecmd.setup_project()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:ImportFrom_L15_C0", "label": "from appenginepatcher.patch import patch_all, setup_logging", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1948, 0.013, 0, 0.66, 0.3846, 964, 0, 2, 0, 0, 964, 0, 0], "semantic": {"name": "appenginepatcher.patch", "arg_names": [], "import_names": ["patch_all", "setup_logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "from appenginepatcher.patch import patch_all, setup_logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L16_C0", "label": "patch_all()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.2078, 0.013, 0, 0.66, 0.4615, 472, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "patch_all", "arg_names": [], "import_names": [], "rhs_call_name": "patch_all", "annotation": ""}, "snippet": "patch_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Import_L18_C0", "label": "django.core.handlers.wsgi import django.core.handlers.wsgi", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2338, 0.013, 0, 0.66, 0.5385, 643, 0, 1, 0, 0, 643, 0, 0], "semantic": {"name": "django.core.handlers.wsgi", "arg_names": [], "import_names": ["django.core.handlers.wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.core.handlers.wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:ImportFrom_L19_C0", "label": "from google.appengine.ext.webapp import util", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2468, 0.013, 0, 0.66, 0.6154, 8, 0, 1, 0, 0, 8, 0, 0], "semantic": {"name": "google.appengine.ext.webapp", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:ImportFrom_L20_C0", "label": "from django.conf import settings", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2597, 0.013, 0, 0.66, 0.6923, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "label": "real_main", "type": "function", "loc": [22, 36], "level": 0, "parent": null, "vector": [2, 0, 0.3766, 0.1948, 0, 0.66, 0.7692, 815, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "real_main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def real_main():\n # Reset path and environment variables\n global path_backup\n try:\n sys.path = path_backup[:]\n except:\n path_backup = sys.path[:]\n os.environ.update(aecmd.env_ext)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4", "label": "try", "type": "try", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "vector": [7, 1, 0.3442, 0.0519, 1, 0.47, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sys.path = path_backup[:]\n except:\n path_backup = sys.path[:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L26_C8", "label": "sys.path =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4", "vector": [14, 2, 0.3377, 0.013, 2, 0.9, 0.0, 909, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.path = path_backup[:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L28_C8", "label": "path_backup =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4", "vector": [14, 2, 0.3636, 0.013, 2, 0.9, 0.0, 720, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path_backup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path_backup = sys.path[:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L29_C4", "label": "update()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "vector": [8, 1, 0.3766, 0.013, 1, 0.47, 0.25, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " os.environ.update(aecmd.env_ext)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L30_C4", "label": "setup_logging()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "vector": [8, 1, 0.3896, 0.013, 1, 0.47, 0.5, 183, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setup_logging", "arg_names": [], "import_names": [], "rhs_call_name": "setup_logging", "annotation": ""}, "snippet": " setup_logging()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L33_C4", "label": "application = WSGIHandler()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "vector": [14, 1, 0.4286, 0.013, 1, 0.47, 0.75, 244, 3, 0, 0, 0, 465, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIHandler", "annotation": ""}, "snippet": " application = django.core.handlers.wsgi.WSGIHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L36_C4", "label": "run_wsgi_app()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "vector": [8, 1, 0.4675, 0.013, 1, 0.47, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " util.run_wsgi_app(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "label": "profile_main", "type": "function", "loc": [38, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7143, 0.4545, 0, 0.66, 0.8462, 182, 0, 0, 1, 0, 0, 0, 26], "semantic": {"name": "profile_main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def profile_main():\n import logging, cProfile, pstats, random, StringIO\n only_forced_profile = getattr(settings, 'ONLY_FORCED_PROFILE', False)\n profile_percentage = getattr(settings, 'PROFILE_PERCENTAGE', None)\n if (only_forced_profile and\n 'profile=forced' not in os.environ.get('QUERY_STRING')) or \\\n (not only_forced_profile and profile_percentage and\n float(profile_percentage) / 100.0 <= random.random()):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Import_L39_C4", "label": "logging import logging, cProfile, pstats\u2026", "type": "import", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [1, 1, 0.5065, 0.013, 1, 0.34, 0.0, 715, 0, 5, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging", "cProfile", "pstats", "random", "StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import logging, cProfile, pstats, random, StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L40_C4", "label": "only_forced_profile = getattr()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.5195, 0.013, 1, 0.34, 0.0476, 107, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "only_forced_profile", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " only_forced_profile = getattr(settings, 'ONLY_FORCED_PROFILE', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L41_C4", "label": "profile_percentage = getattr()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.5325, 0.013, 1, 0.34, 0.0952, 453, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "profile_percentage", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " profile_percentage = getattr(settings, 'PROFILE_PERCENTAGE', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L42_C4", "label": "if", "type": "if", "loc": [42, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.5714, 0.0649, 1, 0.34, 0.1429, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (only_forced_profile and\n 'profile=forced' not in os.environ.get('QUERY_STRING')) or \\\n (not only_forced_profile and profile_percentage and\n float(profile_percentage) / 100.0 <= random.random()):\n return real_main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L42_C4", "vector": [13, 2, 0.5974, 0.013, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return real_main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L48_C4", "label": "prof = Profile()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.6234, 0.013, 1, 0.34, 0.1905, 301, 3, 0, 0, 0, 555, 10, 1], "semantic": {"name": "prof", "arg_names": [], "import_names": [], "rhs_call_name": "Profile", "annotation": ""}, "snippet": " prof = cProfile.Profile()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L49_C4", "label": "prof = runctx()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.6364, 0.013, 1, 0.34, 0.2381, 301, 3, 3, 0, 0, 364, 10, 3], "semantic": {"name": "prof", "arg_names": [], "import_names": [], "rhs_call_name": "runctx", "annotation": ""}, "snippet": " prof = prof.runctx('real_main()', globals(), locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L50_C4", "label": "stream = StringIO()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.6494, 0.013, 1, 0.34, 0.2857, 517, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L51_C4", "label": "stats = Stats()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.6623, 0.013, 1, 0.34, 0.3333, 318, 3, 2, 0, 0, 458, 10, 1], "semantic": {"name": "stats", "arg_names": [], "import_names": [], "rhs_call_name": "Stats", "annotation": ""}, "snippet": " stats = pstats.Stats(prof, stream=stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L52_C4", "label": "sort_by = getattr()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.6753, 0.013, 1, 0.34, 0.381, 254, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "sort_by", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " sort_by = getattr(settings, 'SORT_PROFILE_RESULTS_BY', 'time')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L53_C4", "label": "if", "type": "if", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.6948, 0.026, 1, 0.34, 0.4286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(sort_by, (list, tuple)):\n sort_by = (sort_by,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L54_C8", "label": "sort_by =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L53_C4", "vector": [14, 2, 0.7013, 0.013, 2, 0.29, 0.0, 254, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "sort_by", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sort_by = (sort_by,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L55_C4", "label": "sort_stats()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [8, 1, 0.7143, 0.013, 1, 0.34, 0.4762, 392, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort_stats", "arg_names": [], "import_names": [], "rhs_call_name": "sort_stats", "annotation": ""}, "snippet": " stats.sort_stats(*sort_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L57_C4", "label": "restrictions =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.7403, 0.013, 1, 0.34, 0.5238, 500, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "restrictions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " restrictions = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L58_C4", "label": "profile_pattern = getattr()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.7532, 0.013, 1, 0.34, 0.5714, 856, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "profile_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " profile_pattern = getattr(settings, 'PROFILE_PATTERN', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.7727, 0.026, 1, 0.34, 0.619, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if profile_pattern:\n restrictions.append(profile_pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L60_C8", "label": "append()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L59_C4", "vector": [8, 2, 0.7792, 0.013, 2, 0.06, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " restrictions.append(profile_pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L61_C4", "label": "max_results = getattr()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.7922, 0.013, 1, 0.34, 0.6667, 332, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "max_results", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " max_results = getattr(settings, 'MAX_PROFILE_RESULTS', 80)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.8117, 0.026, 1, 0.34, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_results and max_results != 'all':\n restrictions.append(max_results)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L63_C8", "label": "append()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L62_C4", "vector": [8, 2, 0.8182, 0.013, 2, 0.57, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " restrictions.append(max_results)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L64_C4", "label": "print_stats()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [8, 1, 0.8312, 0.013, 1, 0.34, 0.7619, 764, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_stats", "arg_names": [], "import_names": [], "rhs_call_name": "print_stats", "annotation": ""}, "snippet": " stats.print_stats(*restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L65_C4", "label": "extra_output =", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [14, 1, 0.8442, 0.013, 1, 0.34, 0.8095, 423, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "extra_output", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_output = getattr(settings, 'EXTRA_PROFILE_OUTPUT', None) or ()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L66_C4", "label": "if", "type": "if", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.8636, 0.026, 1, 0.34, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(sort_by, (list, tuple)):\n extra_output = (extra_output,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L67_C8", "label": "extra_output =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L66_C4", "vector": [14, 2, 0.8701, 0.013, 2, 0.0, 0.0, 423, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "extra_output", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_output = (extra_output,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L68_C4", "label": "if", "type": "if", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.8896, 0.026, 1, 0.34, 0.9048, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'callees' in extra_output:\n stats.print_callees()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L69_C8", "label": "print_callees()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L68_C4", "vector": [8, 2, 0.8961, 0.013, 2, 0.05, 0.0, 853, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_callees", "arg_names": [], "import_names": [], "rhs_call_name": "print_callees", "annotation": ""}, "snippet": " stats.print_callees()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L70_C4", "label": "if", "type": "if", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [4, 1, 0.9156, 0.026, 1, 0.34, 0.9524, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'callers' in extra_output:\n stats.print_callers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L71_C8", "label": "print_callers()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L70_C4", "vector": [8, 2, 0.9221, 0.013, 2, 0.9, 0.0, 52, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_callers", "arg_names": [], "import_names": [], "rhs_call_name": "print_callers", "annotation": ""}, "snippet": " stats.print_callers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L72_C4", "label": "info()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "vector": [8, 1, 0.9351, 0.013, 1, 0.34, 1.0, 730, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('Profile data:\\n%s', stream.getvalue())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L74_C0", "label": "main =", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.961, 0.013, 0, 0.66, 0.9231, 624, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "main = getattr(settings, 'ENABLE_PROFILER', False) and profile_main or real_main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_214:If_L76_C0", "label": "if", "type": "if", "loc": [76, 77], "level": 0, "parent": null, "vector": [4, 0, 0.9935, 0.026, 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_214:Expr_L77_C4", "label": "main()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_214:If_L76_C0", "vector": [8, 1, 1.0, 0.013, 1, 0.09, 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_214:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:Try_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Import_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_214:If_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_214:Expr_L77_C4"}] |
# Empty file neeed to make this a Django app.
| ajibawa-2023/Python-Code-Large/train/row_215 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This file acts as a very minimal replacement for the 'imp' module.
It contains only what Django expects to use and does not actually implement the
same functionality as the real 'imp' module.
"""
def find_module(name, path=None):
"""Django needs imp.find_module, but it works fine if nothing is found."""
raise ImportError
| ajibawa-2023/Python-Code-Large/train/row_216 | 3 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_216:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.7308, 0.1923, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"This file acts as a very minimal replacement for the 'imp' module.\n\nIt contains only what Django expects to use and does not actually implement the\nsame functionality as the real 'imp' module.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_216:FunctionDef_L24_C0", "label": "find_module", "type": "function", "loc": [24, 26], "level": 0, "parent": null, "vector": [2, 0, 0.9615, 0.1154, 0, 0.66, 1.0, 222, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "find_module", "arg_names": ["name", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_module(name, path=None):\n \"\"\"Django needs imp.find_module, but it works fine if nothing is found.\"\"\"\n raise ImportError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_216:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_216:FunctionDef_L24_C0", "vector": [8, 1, 0.9615, 0.0385, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Django needs imp.find_module, but it works fine if nothing is found.\"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_216:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_216:Expr_L25_C2"}] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
| ajibawa-2023/Python-Code-Large/train/row_217 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_217:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_217:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.6, 0.2, 0, 0.66, 1.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}] | [] |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from ragendja.template import render_to_response
| ajibawa-2023/Python-Code-Large/train/row_218 | 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_218:ImportFrom_L2_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.1667, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_218:ImportFrom_L3_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.1667, 0, 0.66, 0.5, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_218:ImportFrom_L4_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.1667, 0, 0.66, 1.0, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}] | [] |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This file acts as a very minimal replacement for the 'imp' module.
It contains only what Django expects to use and does not actually implement the
same functionality as the real 'imp' module.
"""
def find_module(name, path=None):
"""Django needs imp.find_module, but it works fine if nothing is found."""
raise ImportError
| ajibawa-2023/Python-Code-Large/train/row_219 | 3 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_219:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.7308, 0.1923, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"This file acts as a very minimal replacement for the 'imp' module.\n\nIt contains only what Django expects to use and does not actually implement the\nsame functionality as the real 'imp' module.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_219:FunctionDef_L24_C0", "label": "find_module", "type": "function", "loc": [24, 26], "level": 0, "parent": null, "vector": [2, 0, 0.9615, 0.1154, 0, 0.66, 1.0, 222, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "find_module", "arg_names": ["name", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_module(name, path=None):\n \"\"\"Django needs imp.find_module, but it works fine if nothing is found.\"\"\"\n raise ImportError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_219:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_219:FunctionDef_L24_C0", "vector": [8, 1, 0.9615, 0.0385, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Django needs imp.find_module, but it works fine if nothing is found.\"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_219:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_219:Expr_L25_C2"}] |
# -*- coding: utf-8 -*-
from django.db.models import signals
from django.test import TestCase
from ragendja.dbutils import cleanup_relations
from ragendja.testutils import ModelTestCase
from google.appengine.ext import db
from google.appengine.ext.db.polymodel import PolyModel
from datetime import datetime
# Test class Meta
class TestA(db.Model):
class Meta:
abstract = True
verbose_name = 'aaa'
class TestB(TestA):
class Meta:
verbose_name = 'bbb'
class TestC(TestA):
pass
class TestModelRel(db.Model):
modelrel = db.ReferenceProperty(db.Model)
class PolyA(PolyModel):
class Meta:
verbose_name = 'polyb'
class PolyB(PolyA):
pass
class ModelMetaTest(TestCase):
def test_class_meta(self):
self.assertEqual(TestA._meta.verbose_name_plural, 'aaas')
self.assertTrue(TestA._meta.abstract)
self.assertEqual(TestB._meta.verbose_name_plural, 'bbbs')
self.assertFalse(TestB._meta.abstract)
self.assertEqual(TestC._meta.verbose_name_plural, 'test cs')
self.assertFalse(TestC._meta.abstract)
self.assertFalse(PolyA._meta.abstract)
self.assertFalse(PolyB._meta.abstract)
# Test signals
class SignalTest(TestCase):
def test_signals(self):
global received_pre_delete
global received_post_save
received_pre_delete = False
received_post_save = False
def handle_pre_delete(**kwargs):
global received_pre_delete
received_pre_delete = True
signals.pre_delete.connect(handle_pre_delete, sender=TestC)
def handle_post_save(**kwargs):
global received_post_save
received_post_save = True
signals.post_save.connect(handle_post_save, sender=TestC)
a = TestC()
a.put()
a.delete()
self.assertTrue(received_pre_delete)
self.assertTrue(received_post_save)
def test_batch_signals(self):
global received_pre_delete
global received_post_save
received_pre_delete = False
received_post_save = False
def handle_pre_delete(**kwargs):
global received_pre_delete
received_pre_delete = True
signals.pre_delete.connect(handle_pre_delete, sender=TestC)
def handle_post_save(**kwargs):
global received_post_save
received_post_save = True
signals.post_save.connect(handle_post_save, sender=TestC)
a = TestC()
db.put([a])
db.delete([a])
self.assertTrue(received_pre_delete)
self.assertTrue(received_post_save)
# Test serialization
class SerializeModel(db.Model):
name = db.StringProperty()
count = db.IntegerProperty()
created = db.DateTimeProperty()
class SerializerTest(ModelTestCase):
model = SerializeModel
def test_serializer(self, format='json'):
from django.core import serializers
created = datetime.now()
x = SerializeModel(key_name='blue_key', name='blue', count=4)
x.put()
SerializeModel(name='green', count=1, created=created).put()
data = serializers.serialize(format, SerializeModel.all())
db.delete(SerializeModel.all().fetch(100))
for obj in serializers.deserialize(format, data):
obj.save()
self.validate_state(
('key.name', 'name', 'count', 'created'),
(None, 'green', 1, created),
('blue_key', 'blue', 4, None),
)
def test_xml_serializer(self):
self.test_serializer(format='xml')
def test_python_serializer(self):
self.test_serializer(format='python')
def test_yaml_serializer(self):
self.test_serializer(format='yaml')
# Test ragendja cleanup handler
class SigChild(db.Model):
CLEANUP_REFERENCES = 'rel'
owner = db.ReferenceProperty(TestC)
rel = db.ReferenceProperty(TestC, collection_name='sigchildrel_set')
class RelationsCleanupTest(TestCase):
def test_cleanup(self):
signals.pre_delete.connect(cleanup_relations, sender=TestC)
c1 = TestC()
c2 = TestC()
db.put((c1, c2))
TestModelRel(modelrel=c1).put()
child = SigChild(owner=c1, rel=c2)
child.put()
self.assertEqual(TestC.all().count(), 2)
self.assertEqual(SigChild.all().count(), 1)
self.assertEqual(TestModelRel.all().count(), 1)
c1.delete()
signals.pre_delete.disconnect(cleanup_relations, sender=TestC)
self.assertEqual(SigChild.all().count(), 0)
self.assertEqual(TestC.all().count(), 0)
self.assertEqual(TestModelRel.all().count(), 0)
from ragendja.dbutils import FakeModel, FakeModelProperty, \
FakeModelListProperty
class FM(db.Model):
data = FakeModelProperty(FakeModel, indexed=False)
class FML(db.Model):
data = FakeModelListProperty(FakeModel, indexed=False)
# Test FakeModel, FakeModelProperty, FakeModelListProperty
class RelationsCleanupTest(TestCase):
def test_fake_model_property(self):
value = {'bla': [1, 2, {'blub': 'bla'*1000}]}
FM(data=FakeModel(value=value)).put()
self.assertEqual(FM.all()[0].data.value, value)
def test_fake_model_list_property(self):
value = {'bla': [1, 2, {'blub': 'bla'*1000}]}
FML(data=[FakeModel(value=value)]).put()
self.assertEqual(FML.all()[0].data[0].value, value)
| ajibawa-2023/Python-Code-Large/train/row_220 | 118 | 168 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L2_C0", "label": "from django.db.models import signals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.006, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L3_C0", "label": "from django.test import TestCase", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.006, 0, 0.66, 0.0455, 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_220:ImportFrom_L4_C0", "label": "from ragendja.dbutils import cleanup_relations", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.006, 0, 0.66, 0.0909, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["cleanup_relations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import cleanup_relations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L5_C0", "label": "from ragendja.testutils import ModelTestCase", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0298, 0.006, 0, 0.66, 0.1364, 734, 0, 1, 0, 0, 734, 0, 0], "semantic": {"name": "ragendja.testutils", "arg_names": [], "import_names": ["ModelTestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.testutils import ModelTestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L6_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.006, 0, 0.66, 0.1818, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L7_C0", "label": "from google.appengine.ext.db.polymodel import PolyModel", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.006, 0, 0.66, 0.2273, 414, 0, 1, 0, 0, 414, 0, 0], "semantic": {"name": "google.appengine.ext.db.polymodel", "arg_names": [], "import_names": ["PolyModel"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.db.polymodel import PolyModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L8_C0", "label": "from datetime import datetime", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.006, 0, 0.66, 0.2727, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L12_C0", "label": "TestA", "type": "class", "loc": [12, 15], "level": 0, "parent": null, "vector": [3, 0, 0.0804, 0.0238, 0, 0.66, 0.3182, 296, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "TestA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestA(db.Model):\n class Meta:\n abstract = True\n verbose_name = 'aaa'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "label": "Meta", "type": "class", "loc": [13, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L12_C0", "vector": [3, 1, 0.0833, 0.0179, 1, 0.24, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n abstract = True\n verbose_name = 'aaa'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L14_C8", "label": "abstract =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "vector": [14, 2, 0.0833, 0.006, 2, 0.92, 0.0, 301, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "abstract", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " abstract = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L15_C8", "label": "verbose_name =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "vector": [14, 2, 0.0893, 0.006, 2, 0.92, 1.0, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verbose_name = 'aaa'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L17_C0", "label": "TestB", "type": "class", "loc": [17, 19], "level": 0, "parent": null, "vector": [3, 0, 0.1071, 0.0179, 0, 0.66, 0.3636, 343, 0, 0, 0, 0, 296, 0, 0], "semantic": {"name": "TestB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestB(TestA):\n class Meta:\n verbose_name = 'bbb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L18_C4", "label": "Meta", "type": "class", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L17_C0", "vector": [3, 1, 0.1101, 0.0119, 1, 0.39, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n verbose_name = 'bbb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L19_C8", "label": "verbose_name =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L18_C4", "vector": [14, 2, 0.1131, 0.006, 2, 0.93, 0.0, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verbose_name = 'bbb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L21_C0", "label": "TestC", "type": "class", "loc": [21, 22], "level": 0, "parent": null, "vector": [3, 0, 0.128, 0.0119, 0, 0.66, 0.4091, 799, 0, 0, 0, 0, 296, 0, 0], "semantic": {"name": "TestC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestC(TestA):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L24_C0", "label": "TestModelRel", "type": "class", "loc": [24, 25], "level": 0, "parent": null, "vector": [3, 0, 0.1458, 0.0119, 0, 0.66, 0.4545, 246, 0, 0, 0, 0, 697, 0, 1], "semantic": {"name": "TestModelRel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestModelRel(db.Model):\n modelrel = db.ReferenceProperty(db.Model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L25_C4", "label": "modelrel = ReferenceProperty()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L24_C0", "vector": [14, 1, 0.1488, 0.006, 1, 0.07, 0.0, 249, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "modelrel", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " modelrel = db.ReferenceProperty(db.Model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L27_C0", "label": "PolyA", "type": "class", "loc": [27, 29], "level": 0, "parent": null, "vector": [3, 0, 0.1667, 0.0179, 0, 0.66, 0.5, 205, 0, 0, 0, 0, 348, 0, 0], "semantic": {"name": "PolyA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolyA(PolyModel):\n class Meta:\n verbose_name = 'polyb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L28_C4", "label": "Meta", "type": "class", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L27_C0", "vector": [3, 1, 0.1696, 0.0119, 1, 0.87, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n verbose_name = 'polyb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L29_C8", "label": "verbose_name =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L28_C4", "vector": [14, 2, 0.1726, 0.006, 2, 0.67, 0.0, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verbose_name = 'polyb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L31_C0", "label": "PolyB", "type": "class", "loc": [31, 32], "level": 0, "parent": null, "vector": [3, 0, 0.1875, 0.0119, 0, 0.66, 0.5455, 994, 0, 0, 0, 0, 205, 0, 0], "semantic": {"name": "PolyB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolyB(PolyA):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L34_C0", "label": "ModelMetaTest", "type": "class", "loc": [34, 46], "level": 0, "parent": null, "vector": [3, 0, 0.2381, 0.0774, 0, 0.66, 0.5909, 406, 0, 1, 0, 0, 3, 0, 8], "semantic": {"name": "ModelMetaTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModelMetaTest(TestCase):\n def test_class_meta(self):\n self.assertEqual(TestA._meta.verbose_name_plural, 'aaas')\n self.assertTrue(TestA._meta.abstract)\n\n self.assertEqual(TestB._meta.verbose_name_plural, 'bbbs')\n self.assertFalse(TestB._meta.abstract)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "label": "test_class_meta", "type": "function", "loc": [35, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L34_C0", "vector": [2, 1, 0.2411, 0.0714, 1, 0.67, 0.0, 13, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test_class_meta", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_class_meta(self):\n self.assertEqual(TestA._meta.verbose_name_plural, 'aaas')\n self.assertTrue(TestA._meta.abstract)\n\n self.assertEqual(TestB._meta.verbose_name_plural, 'bbbs')\n self.assertFalse(TestB._meta.abstract)\n\n self.assertEqual(TestC._meta.verbose_name_plural, 'test cs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L36_C8", "label": "assertEqual()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2143, 0.006, 2, 0.15, 0.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestA._meta.verbose_name_plural, 'aaas')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L37_C8", "label": "assertTrue()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2202, 0.006, 2, 0.15, 0.1429, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(TestA._meta.abstract)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L39_C8", "label": "assertEqual()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2321, 0.006, 2, 0.15, 0.2857, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestB._meta.verbose_name_plural, 'bbbs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L40_C8", "label": "assertFalse()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2381, 0.006, 2, 0.15, 0.4286, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(TestB._meta.abstract)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L42_C8", "label": "assertEqual()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.25, 0.006, 2, 0.15, 0.5714, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestC._meta.verbose_name_plural, 'test cs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L43_C8", "label": "assertFalse()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.256, 0.006, 2, 0.15, 0.7143, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(TestC._meta.abstract)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L45_C8", "label": "assertFalse()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2679, 0.006, 2, 0.15, 0.8571, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(PolyA._meta.abstract)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L46_C8", "label": "assertFalse()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "vector": [8, 2, 0.2738, 0.006, 2, 0.15, 1.0, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(PolyB._meta.abstract)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L50_C0", "label": "SignalTest", "type": "class", "loc": [50, 87], "level": 0, "parent": null, "vector": [3, 0, 0.4077, 0.2262, 0, 0.66, 0.6364, 483, 0, 6, 0, 0, 3, 0, 14], "semantic": {"name": "SignalTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SignalTest(TestCase):\n def test_signals(self):\n global received_pre_delete\n global received_post_save\n received_pre_delete = False\n received_post_save = False\n def handle_pre_delete(**kwargs):\n global received_pre_delete"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "label": "test_signals", "type": "function", "loc": [51, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L50_C0", "vector": [2, 1, 0.3542, 0.1071, 1, 0.39, 0.0, 362, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_signals", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_signals(self):\n global received_pre_delete\n global received_post_save\n received_pre_delete = False\n received_post_save = False\n def handle_pre_delete(**kwargs):\n global received_pre_delete\n received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L54_C8", "label": "received_pre_delete =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [14, 2, 0.3214, 0.006, 2, 0.6, 0.0, 733, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_pre_delete", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_pre_delete = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L55_C8", "label": "received_post_save =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [14, 2, 0.3274, 0.006, 2, 0.6, 0.1, 338, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_post_save", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_post_save = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L56_C8", "label": "handle_pre_delete", "type": "function", "loc": [56, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [2, 2, 0.3393, 0.0179, 2, 0.6, 0.2, 373, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "handle_pre_delete", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_pre_delete(**kwargs):\n global received_pre_delete\n received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L58_C12", "label": "received_pre_delete =", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L56_C8", "vector": [14, 3, 0.3452, 0.006, 3, 0.09, 0.0, 733, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_pre_delete", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L59_C8", "label": "connect()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.3512, 0.006, 2, 0.6, 0.3, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signals.pre_delete.connect(handle_pre_delete, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L60_C8", "label": "handle_post_save", "type": "function", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [2, 2, 0.3631, 0.0179, 2, 0.6, 0.4, 104, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "handle_post_save", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_post_save(**kwargs):\n global received_post_save\n received_post_save = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L62_C12", "label": "received_post_save =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L60_C8", "vector": [14, 3, 0.369, 0.006, 3, 0.92, 0.0, 338, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_post_save", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_post_save = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L63_C8", "label": "connect()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.375, 0.006, 2, 0.6, 0.5, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signals.post_save.connect(handle_post_save, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L64_C8", "label": "a = TestC()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [14, 2, 0.381, 0.006, 2, 0.6, 0.6, 475, 3, 0, 0, 0, 799, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "TestC", "annotation": ""}, "snippet": " a = TestC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L65_C8", "label": "put()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.3869, 0.006, 2, 0.6, 0.7, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " a.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L66_C8", "label": "delete()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.3929, 0.006, 2, 0.6, 0.8, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " a.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L67_C8", "label": "assertTrue()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.3988, 0.006, 2, 0.6, 0.9, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(received_pre_delete)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L68_C8", "label": "assertTrue()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "vector": [8, 2, 0.4048, 0.006, 2, 0.6, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(received_post_save)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "label": "test_batch_signals", "type": "function", "loc": [70, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L50_C0", "vector": [2, 1, 0.4673, 0.1071, 1, 0.39, 1.0, 37, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_batch_signals", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_batch_signals(self):\n global received_pre_delete\n global received_post_save\n received_pre_delete = False\n received_post_save = False\n def handle_pre_delete(**kwargs):\n global received_pre_delete\n received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L73_C8", "label": "received_pre_delete =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [14, 2, 0.4345, 0.006, 2, 0.87, 0.0, 733, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_pre_delete", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_pre_delete = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L74_C8", "label": "received_post_save =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [14, 2, 0.4405, 0.006, 2, 0.87, 0.1, 338, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_post_save", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_post_save = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L75_C8", "label": "handle_pre_delete", "type": "function", "loc": [75, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [2, 2, 0.4524, 0.0179, 2, 0.87, 0.2, 373, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "handle_pre_delete", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_pre_delete(**kwargs):\n global received_pre_delete\n received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L77_C12", "label": "received_pre_delete =", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L75_C8", "vector": [14, 3, 0.4583, 0.006, 3, 0.29, 0.0, 733, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_pre_delete", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_pre_delete = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L78_C8", "label": "connect()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.4643, 0.006, 2, 0.87, 0.3, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signals.pre_delete.connect(handle_pre_delete, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L79_C8", "label": "handle_post_save", "type": "function", "loc": [79, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [2, 2, 0.4762, 0.0179, 2, 0.87, 0.4, 104, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "handle_post_save", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_post_save(**kwargs):\n global received_post_save\n received_post_save = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L81_C12", "label": "received_post_save =", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L79_C8", "vector": [14, 3, 0.4821, 0.006, 3, 0.4, 0.0, 338, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "received_post_save", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " received_post_save = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L82_C8", "label": "connect()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.4881, 0.006, 2, 0.87, 0.5, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signals.post_save.connect(handle_post_save, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L83_C8", "label": "a = TestC()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [14, 2, 0.494, 0.006, 2, 0.87, 0.6, 475, 3, 0, 0, 0, 799, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "TestC", "annotation": ""}, "snippet": " a = TestC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L84_C8", "label": "put()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.5, 0.006, 2, 0.87, 0.7, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " db.put([a])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L85_C8", "label": "delete()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.506, 0.006, 2, 0.87, 0.8, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db.delete([a])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L86_C8", "label": "assertTrue()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.5119, 0.006, 2, 0.87, 0.9, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(received_pre_delete)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L87_C8", "label": "assertTrue()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "vector": [8, 2, 0.5179, 0.006, 2, 0.87, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(received_post_save)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "label": "SerializeModel", "type": "class", "loc": [91, 94], "level": 0, "parent": null, "vector": [3, 0, 0.5506, 0.0238, 0, 0.66, 0.6818, 572, 0, 0, 0, 0, 697, 0, 3], "semantic": {"name": "SerializeModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SerializeModel(db.Model):\n name = db.StringProperty()\n count = db.IntegerProperty()\n created = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L92_C4", "label": "name = StringProperty()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "vector": [14, 1, 0.5476, 0.006, 1, 0.74, 0.0, 57, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " name = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L93_C4", "label": "count = IntegerProperty()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "vector": [14, 1, 0.5536, 0.006, 1, 0.74, 0.5, 778, 3, 0, 0, 0, 703, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " count = db.IntegerProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L94_C4", "label": "created = DateTimeProperty()", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "vector": [14, 1, 0.5595, 0.006, 1, 0.74, 1.0, 913, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "created", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " created = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "label": "SerializerTest", "type": "class", "loc": [96, 122], "level": 0, "parent": null, "vector": [3, 0, 0.6488, 0.1607, 0, 0.66, 0.7273, 688, 0, 4, 0, 0, 870, 0, 16], "semantic": {"name": "SerializerTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SerializerTest(ModelTestCase):\n model = SerializeModel\n\n def test_serializer(self, format='json'):\n from django.core import serializers\n created = datetime.now()\n x = SerializeModel(key_name='blue_key', name='blue', count=4)\n x.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L97_C4", "label": "model =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "vector": [14, 1, 0.5774, 0.006, 1, 0.88, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = SerializeModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "label": "test_serializer", "type": "function", "loc": [99, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "vector": [2, 1, 0.631, 0.0893, 1, 0.88, 0.25, 487, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "test_serializer", "arg_names": ["self", "format"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_serializer(self, format='json'):\n from django.core import serializers\n created = datetime.now()\n x = SerializeModel(key_name='blue_key', name='blue', count=4)\n x.put()\n SerializeModel(name='green', count=1, created=created).put()\n data = serializers.serialize(format, SerializeModel.all())\n db.delete(SerializeModel.all().fetch(100))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L100_C8", "label": "from django.core import serializers", "type": "import", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [1, 2, 0.5952, 0.006, 2, 0.28, 0.0, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["serializers"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.core import serializers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L101_C8", "label": "created = now()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [14, 2, 0.6012, 0.006, 2, 0.28, 0.125, 913, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "created", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " created = datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L102_C8", "label": "x = SerializeModel()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [14, 2, 0.6071, 0.006, 2, 0.28, 0.25, 190, 3, 3, 0, 0, 572, 10, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "SerializeModel", "annotation": ""}, "snippet": " x = SerializeModel(key_name='blue_key', name='blue', count=4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L103_C8", "label": "put()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [8, 2, 0.6131, 0.006, 2, 0.28, 0.375, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " x.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L104_C8", "label": "put()", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [8, 2, 0.619, 0.006, 2, 0.28, 0.5, 636, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " SerializeModel(name='green', count=1, created=created).put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L105_C8", "label": "data = serialize()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [14, 2, 0.625, 0.006, 2, 0.28, 0.625, 929, 3, 2, 0, 0, 50, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " data = serializers.serialize(format, SerializeModel.all())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L106_C8", "label": "delete()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [8, 2, 0.631, 0.006, 2, 0.28, 0.75, 266, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db.delete(SerializeModel.all().fetch(100))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:For_L107_C8", "label": "for obj", "type": "for", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [6, 2, 0.6399, 0.0119, 2, 0.28, 0.875, 505, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in serializers.deserialize(format, data):\n obj.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L108_C12", "label": "save()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:For_L107_C8", "vector": [8, 3, 0.6429, 0.006, 3, 0.23, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " obj.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L109_C8", "label": "validate_state()", "type": "expression", "loc": [109, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "vector": [8, 2, 0.6607, 0.0298, 2, 0.28, 1.0, 93, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "validate_state", "arg_names": [], "import_names": [], "rhs_call_name": "validate_state", "annotation": ""}, "snippet": " self.validate_state(\n ('key.name', 'name', 'count', 'created'),\n (None, 'green', 1, created),\n ('blue_key', 'blue', 4, None),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L115_C4", "label": "test_xml_serializer", "type": "function", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "vector": [2, 1, 0.6875, 0.0119, 1, 0.88, 0.5, 989, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_xml_serializer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_xml_serializer(self):\n self.test_serializer(format='xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L116_C8", "label": "test_serializer()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L115_C4", "vector": [8, 2, 0.6905, 0.006, 2, 0.8, 0.0, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_serializer", "arg_names": [], "import_names": [], "rhs_call_name": "test_serializer", "annotation": ""}, "snippet": " self.test_serializer(format='xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L118_C4", "label": "test_python_serializer", "type": "function", "loc": [118, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "vector": [2, 1, 0.7054, 0.0119, 1, 0.88, 0.75, 493, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_python_serializer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_python_serializer(self):\n self.test_serializer(format='python')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L119_C8", "label": "test_serializer()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L118_C4", "vector": [8, 2, 0.7083, 0.006, 2, 0.09, 0.0, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_serializer", "arg_names": [], "import_names": [], "rhs_call_name": "test_serializer", "annotation": ""}, "snippet": " self.test_serializer(format='python')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L121_C4", "label": "test_yaml_serializer", "type": "function", "loc": [121, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "vector": [2, 1, 0.7232, 0.0119, 1, 0.88, 1.0, 363, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_yaml_serializer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_yaml_serializer(self):\n self.test_serializer(format='yaml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L122_C8", "label": "test_serializer()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L121_C4", "vector": [8, 2, 0.7262, 0.006, 2, 0.09, 0.0, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_serializer", "arg_names": [], "import_names": [], "rhs_call_name": "test_serializer", "annotation": ""}, "snippet": " self.test_serializer(format='yaml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "label": "SigChild", "type": "class", "loc": [125, 129], "level": 0, "parent": null, "vector": [3, 0, 0.756, 0.0298, 0, 0.66, 0.7727, 820, 0, 0, 0, 0, 697, 0, 2], "semantic": {"name": "SigChild", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SigChild(db.Model):\n CLEANUP_REFERENCES = 'rel'\n\n owner = db.ReferenceProperty(TestC)\n rel = db.ReferenceProperty(TestC, collection_name='sigchildrel_set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L126_C4", "label": "CLEANUP_REFERENCES =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "vector": [14, 1, 0.75, 0.006, 1, 0.0, 0.0, 29, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CLEANUP_REFERENCES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CLEANUP_REFERENCES = 'rel'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L128_C4", "label": "owner = ReferenceProperty()", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "vector": [14, 1, 0.7619, 0.006, 1, 0.0, 0.5, 365, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "owner", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " owner = db.ReferenceProperty(TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L129_C4", "label": "rel = ReferenceProperty()", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "vector": [14, 1, 0.7679, 0.006, 1, 0.0, 1.0, 773, 3, 2, 0, 0, 167, 10, 1], "semantic": {"name": "rel", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " rel = db.ReferenceProperty(TestC, collection_name='sigchildrel_set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L131_C0", "label": "RelationsCleanupTest", "type": "class", "loc": [131, 147], "level": 0, "parent": null, "vector": [3, 0, 0.8274, 0.1012, 0, 0.66, 0.8182, 390, 0, 1, 0, 0, 3, 0, 28], "semantic": {"name": "RelationsCleanupTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RelationsCleanupTest(TestCase):\n def test_cleanup(self):\n signals.pre_delete.connect(cleanup_relations, sender=TestC)\n c1 = TestC()\n c2 = TestC()\n db.put((c1, c2))\n TestModelRel(modelrel=c1).put()\n child = SigChild(owner=c1, rel=c2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "label": "test_cleanup", "type": "function", "loc": [132, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L131_C0", "vector": [2, 1, 0.8304, 0.0952, 1, 0.88, 0.0, 174, 0, 1, 0, 0, 0, 0, 28], "semantic": {"name": "test_cleanup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_cleanup(self):\n signals.pre_delete.connect(cleanup_relations, sender=TestC)\n c1 = TestC()\n c2 = TestC()\n db.put((c1, c2))\n TestModelRel(modelrel=c1).put()\n child = SigChild(owner=c1, rel=c2)\n child.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L133_C8", "label": "connect()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.7917, 0.006, 2, 0.15, 0.0, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " signals.pre_delete.connect(cleanup_relations, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L134_C8", "label": "c1 = TestC()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [14, 2, 0.7976, 0.006, 2, 0.15, 0.0714, 452, 3, 0, 0, 0, 799, 10, 1], "semantic": {"name": "c1", "arg_names": [], "import_names": [], "rhs_call_name": "TestC", "annotation": ""}, "snippet": " c1 = TestC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L135_C8", "label": "c2 = TestC()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [14, 2, 0.8036, 0.006, 2, 0.15, 0.1429, 600, 3, 0, 0, 0, 799, 10, 1], "semantic": {"name": "c2", "arg_names": [], "import_names": [], "rhs_call_name": "TestC", "annotation": ""}, "snippet": " c2 = TestC()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L136_C8", "label": "put()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8095, 0.006, 2, 0.15, 0.2143, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " db.put((c1, c2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L137_C8", "label": "put()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8155, 0.006, 2, 0.15, 0.2857, 636, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " TestModelRel(modelrel=c1).put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L138_C8", "label": "child = SigChild()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [14, 2, 0.8214, 0.006, 2, 0.15, 0.3571, 967, 3, 2, 0, 0, 820, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "SigChild", "annotation": ""}, "snippet": " child = SigChild(owner=c1, rel=c2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L139_C8", "label": "put()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8274, 0.006, 2, 0.15, 0.4286, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " child.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L140_C8", "label": "assertEqual()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8333, 0.006, 2, 0.15, 0.5, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestC.all().count(), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L141_C8", "label": "assertEqual()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8393, 0.006, 2, 0.15, 0.5714, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(SigChild.all().count(), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L142_C8", "label": "assertEqual()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8452, 0.006, 2, 0.15, 0.6429, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestModelRel.all().count(), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L143_C8", "label": "delete()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8512, 0.006, 2, 0.15, 0.7143, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " c1.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L144_C8", "label": "disconnect()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8571, 0.006, 2, 0.15, 0.7857, 978, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": " signals.pre_delete.disconnect(cleanup_relations, sender=TestC)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L145_C8", "label": "assertEqual()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.8631, 0.006, 2, 0.15, 0.8571, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(SigChild.all().count(), 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L146_C8", "label": "assertEqual()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.869, 0.006, 2, 0.15, 0.9286, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestC.all().count(), 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L147_C8", "label": "assertEqual()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "vector": [8, 2, 0.875, 0.006, 2, 0.15, 1.0, 299, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(TestModelRel.all().count(), 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L149_C0", "label": "from ragendja.dbutils import FakeModel, FakeModelProperty, FakeModelListProperty", "type": "import", "loc": [149, 150], "level": 0, "parent": null, "vector": [1, 0, 0.8899, 0.0119, 0, 0.66, 0.8636, 512, 0, 3, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["FakeModel", "FakeModelProperty", "FakeModelListProperty"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import FakeModel, FakeModelProperty, \\\n FakeModelListProperty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L152_C0", "label": "FM", "type": "class", "loc": [152, 153], "level": 0, "parent": null, "vector": [3, 0, 0.9077, 0.0119, 0, 0.66, 0.9091, 827, 0, 0, 0, 0, 697, 0, 1], "semantic": {"name": "FM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FM(db.Model):\n data = FakeModelProperty(FakeModel, indexed=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L153_C4", "label": "data = FakeModelProperty()", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L152_C0", "vector": [14, 1, 0.9107, 0.006, 1, 0.06, 0.0, 929, 3, 2, 0, 0, 795, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "FakeModelProperty", "annotation": ""}, "snippet": " data = FakeModelProperty(FakeModel, indexed=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L155_C0", "label": "FML", "type": "class", "loc": [155, 156], "level": 0, "parent": null, "vector": [3, 0, 0.9256, 0.0119, 0, 0.66, 0.9545, 210, 0, 0, 0, 0, 697, 0, 1], "semantic": {"name": "FML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FML(db.Model):\n data = FakeModelListProperty(FakeModel, indexed=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L156_C4", "label": "data = FakeModelListProperty()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L155_C0", "vector": [14, 1, 0.9286, 0.006, 1, 0.53, 0.0, 929, 3, 2, 0, 0, 366, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "FakeModelListProperty", "annotation": ""}, "snippet": " data = FakeModelListProperty(FakeModel, indexed=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L159_C0", "label": "RelationsCleanupTest", "type": "class", "loc": [159, 168], "level": 0, "parent": null, "vector": [3, 0, 0.9732, 0.0595, 0, 0.66, 1.0, 390, 0, 2, 0, 0, 3, 0, 10], "semantic": {"name": "RelationsCleanupTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RelationsCleanupTest(TestCase):\n def test_fake_model_property(self):\n value = {'bla': [1, 2, {'blub': 'bla'*1000}]}\n FM(data=FakeModel(value=value)).put()\n self.assertEqual(FM.all()[0].data.value, value)\n\n def test_fake_model_list_property(self):\n value = {'bla': [1, 2, {'blub': 'bla'*1000}]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "label": "test_fake_model_property", "type": "function", "loc": [160, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L159_C0", "vector": [2, 1, 0.9613, 0.0238, 1, 0.21, 0.0, 394, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_fake_model_property", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_fake_model_property(self):\n value = {'bla': [1, 2, {'blub': 'bla'*1000}]}\n FM(data=FakeModel(value=value)).put()\n self.assertEqual(FM.all()[0].data.value, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L161_C8", "label": "value =", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "vector": [14, 2, 0.9583, 0.006, 2, 0.55, 0.0, 441, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = {'bla': [1, 2, {'blub': 'bla'*1000}]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L162_C8", "label": "put()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "vector": [8, 2, 0.9643, 0.006, 2, 0.55, 0.5, 636, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " FM(data=FakeModel(value=value)).put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L163_C8", "label": "assertEqual()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "vector": [8, 2, 0.9702, 0.006, 2, 0.55, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(FM.all()[0].data.value, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "label": "test_fake_model_list_property", "type": "function", "loc": [165, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L159_C0", "vector": [2, 1, 0.9911, 0.0238, 1, 0.21, 1.0, 985, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_fake_model_list_property", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_fake_model_list_property(self):\n value = {'bla': [1, 2, {'blub': 'bla'*1000}]}\n FML(data=[FakeModel(value=value)]).put()\n self.assertEqual(FML.all()[0].data[0].value, value) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L166_C8", "label": "value =", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "vector": [14, 2, 0.9881, 0.006, 2, 0.4, 0.0, 441, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = {'bla': [1, 2, {'blub': 'bla'*1000}]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L167_C8", "label": "put()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "vector": [8, 2, 0.994, 0.006, 2, 0.4, 0.5, 636, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " FML(data=[FakeModel(value=value)]).put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L168_C8", "label": "assertEqual()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "vector": [8, 2, 1.0, 0.006, 2, 0.4, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(FML.all()[0].data[0].value, value) "}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L79_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:ImportFrom_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:For_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:For_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L159_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:ClassDef_L159_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_220:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_220:Expr_L168_C8"}] |
from google.appengine.api import apiproxy_stub_map
from google.appengine.ext import db
from django.dispatch import Signal
from django.db.models import signals
from django.utils._threading_local import local
from functools import wraps
# Add signals which can be run after a transaction has been committed
signals.post_save_committed = Signal()
signals.post_delete_committed = Signal()
local = local()
# Patch transaction handlers, so we can support post_xxx_committed signals
run_in_transaction = db.run_in_transaction
if not hasattr(run_in_transaction, 'patched'):
@wraps(run_in_transaction)
def handle_signals(*args, **kwargs):
try:
if not getattr(local, 'in_transaction', False):
local.in_transaction = True
local.notify = []
result = run_in_transaction(*args, **kwargs)
except:
local.in_transaction = False
local.notify = []
raise
else:
commit()
return result
handle_signals.patched = True
db.run_in_transaction = handle_signals
run_in_transaction_custom_retries = db.run_in_transaction_custom_retries
if not hasattr(run_in_transaction_custom_retries, 'patched'):
@wraps(run_in_transaction_custom_retries)
def handle_signals(*args, **kwargs):
try:
result = run_in_transaction_custom_retries(*args, **kwargs)
except:
local.in_transaction = False
local.notify = []
raise
else:
commit()
return result
handle_signals.patched = True
db.run_in_transaction_custom_retries = handle_signals
def hook(service, call, request, response):
if call == 'Rollback':
# This stores a list of tuples (action, sender, kwargs)
# Possible actions: 'delete', 'save'
local.in_transaction = True
local.notify = []
apiproxy_stub_map.apiproxy.GetPostCallHooks().Append('tx_signals', hook)
def commit():
local.in_transaction = False
for action, sender, kwds in local.notify:
signal = getattr(signals, 'post_%s_committed' % action)
signal.send(sender=sender, **kwds)
def entity_saved(sender, **kwargs):
if 'signal' in kwargs:
del kwargs['signal']
if getattr(local, 'in_transaction', False):
local.notify.append(('save', sender, kwargs))
else:
signals.post_save_committed.send(sender=sender, **kwargs)
signals.post_save.connect(entity_saved)
def entity_deleted(sender, **kwargs):
if 'signal' in kwargs:
del kwargs['signal']
if getattr(local, 'in_transaction', False):
local.notify.append(('delete', sender, kwargs))
else:
signals.post_delete_committed.send(sender=sender, **kwargs)
signals.post_delete.connect(entity_deleted)
| ajibawa-2023/Python-Code-Large/train/row_222 | 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_222:ImportFrom_L1_C0", "label": "from google.appengine.api import apiproxy_stub_map", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["apiproxy_stub_map"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import apiproxy_stub_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:ImportFrom_L2_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.0125, 0, 0.66, 0.0526, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:ImportFrom_L3_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0375, 0.0125, 0, 0.66, 0.1053, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "import_names": ["Signal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.dispatch import Signal "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:ImportFrom_L4_C0", "label": "from django.db.models import signals", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.0125, 0, 0.66, 0.1579, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:ImportFrom_L5_C0", "label": "from django.utils._threading_local import local", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0125, 0, 0.66, 0.2105, 561, 0, 1, 0, 0, 561, 0, 0], "semantic": {"name": "django.utils._threading_local", "arg_names": [], "import_names": ["local"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils._threading_local import local"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:ImportFrom_L6_C0", "label": "from functools import wraps", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.075, 0.0125, 0, 0.66, 0.2632, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["wraps"], "rhs_call_name": "", "annotation": ""}, "snippet": "from functools import wraps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L9_C0", "label": "signals.post_save_committed = Signal()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1125, 0.0125, 0, 0.66, 0.3158, 50, 3, 0, 0, 0, 592, 10, 1], "semantic": {"name": "signals.post_save_committed", "arg_names": [], "import_names": [], "rhs_call_name": "Signal", "annotation": ""}, "snippet": "signals.post_save_committed = Signal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L10_C0", "label": "signals.post_delete_committed = Signal()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0125, 0, 0.66, 0.3684, 403, 3, 0, 0, 0, 592, 10, 1], "semantic": {"name": "signals.post_delete_committed", "arg_names": [], "import_names": [], "rhs_call_name": "Signal", "annotation": ""}, "snippet": "signals.post_delete_committed = Signal()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L12_C0", "label": "local = local()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.15, 0.0125, 0, 0.66, 0.4211, 605, 3, 0, 0, 0, 605, 10, 1], "semantic": {"name": "local", "arg_names": [], "import_names": [], "rhs_call_name": "local", "annotation": ""}, "snippet": "local = local()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L15_C0", "label": "run_in_transaction =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1875, 0.0125, 0, 0.66, 0.4737, 653, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "run_in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "run_in_transaction = db.run_in_transaction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "label": "if", "type": "if", "loc": [16, 32], "level": 0, "parent": null, "vector": [4, 0, 0.3, 0.2125, 0, 0.66, 0.5263, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not hasattr(run_in_transaction, 'patched'):\n @wraps(run_in_transaction)\n def handle_signals(*args, **kwargs):\n try:\n if not getattr(local, 'in_transaction', False):\n local.in_transaction = True\n local.notify = []\n result = run_in_transaction(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4", "label": "handle_signals", "type": "function", "loc": [18, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "vector": [2, 1, 0.3, 0.1625, 1, 0.84, 0.0, 486, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "handle_signals", "arg_names": ["args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_signals(*args, **kwargs):\n try:\n if not getattr(local, 'in_transaction', False):\n local.in_transaction = True\n local.notify = []\n result = run_in_transaction(*args, **kwargs)\n except:\n local.in_transaction = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "label": "try", "type": "try", "loc": [19, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4", "vector": [7, 2, 0.3063, 0.15, 2, 0.59, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if not getattr(local, 'in_transaction', False):\n local.in_transaction = True\n local.notify = []\n result = run_in_transaction(*args, **kwargs)\n except:\n local.in_transaction = False\n local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12", "label": "if", "type": "if", "loc": [20, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [4, 3, 0.2625, 0.0375, 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 getattr(local, 'in_transaction', False):\n local.in_transaction = True\n local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L21_C16", "label": "local.in_transaction =", "type": "assigned_variable", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12", "vector": [14, 4, 0.2625, 0.0125, 4, 0.63, 0.0, 365, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "local.in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.in_transaction = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L22_C16", "label": "local.notify =", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12", "vector": [14, 4, 0.275, 0.0125, 4, 0.63, 1.0, 106, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "local.notify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L23_C12", "label": "result = run_in_transaction()", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [14, 3, 0.2875, 0.0125, 3, 0.56, 0.3333, 51, 3, 2, 0, 0, 653, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "run_in_transaction", "annotation": ""}, "snippet": " result = run_in_transaction(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L25_C12", "label": "local.in_transaction =", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [14, 3, 0.3125, 0.0125, 3, 0.56, 0.0, 365, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "local.in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.in_transaction = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L26_C12", "label": "local.notify =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [14, 3, 0.325, 0.0125, 3, 0.56, 1.0, 106, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "local.notify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L29_C12", "label": "commit()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [8, 3, 0.3625, 0.0125, 3, 0.56, 0.6667, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Return_L30_C12", "label": "return", "type": "return", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "vector": [13, 3, 0.375, 0.0125, 3, 0.56, 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_222:Assign_L31_C4", "label": "handle_signals.patched =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "vector": [14, 1, 0.3875, 0.0125, 1, 0.84, 0.5, 843, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "handle_signals.patched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handle_signals.patched = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L32_C4", "label": "db.run_in_transaction =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "vector": [14, 1, 0.4, 0.0125, 1, 0.84, 1.0, 322, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db.run_in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db.run_in_transaction = handle_signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L34_C0", "label": "run_in_transaction_custom_retries =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.425, 0.0125, 0, 0.66, 0.5789, 276, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "run_in_transaction_custom_retries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "run_in_transaction_custom_retries = db.run_in_transaction_custom_retries"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "label": "if", "type": "if", "loc": [35, 48], "level": 0, "parent": null, "vector": [4, 0, 0.5188, 0.175, 0, 0.66, 0.6316, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not hasattr(run_in_transaction_custom_retries, 'patched'):\n @wraps(run_in_transaction_custom_retries)\n def handle_signals(*args, **kwargs):\n try:\n result = run_in_transaction_custom_retries(*args, **kwargs)\n except:\n local.in_transaction = False\n local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L37_C4", "label": "handle_signals", "type": "function", "loc": [37, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "vector": [2, 1, 0.5188, 0.125, 1, 0.38, 0.0, 486, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "handle_signals", "arg_names": ["args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_signals(*args, **kwargs):\n try:\n result = run_in_transaction_custom_retries(*args, **kwargs)\n except:\n local.in_transaction = False\n local.notify = []\n raise\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "label": "try", "type": "try", "loc": [38, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L37_C4", "vector": [7, 2, 0.525, 0.1125, 2, 0.36, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result = run_in_transaction_custom_retries(*args, **kwargs)\n except:\n local.in_transaction = False\n local.notify = []\n raise\n else:\n commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L39_C12", "label": "result = run_in_transaction_custom_retries()", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "vector": [14, 3, 0.4875, 0.0125, 3, 0.97, 0.0, 51, 3, 2, 0, 0, 276, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "run_in_transaction_custom_retries", "annotation": ""}, "snippet": " result = run_in_transaction_custom_retries(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L41_C12", "label": "local.in_transaction =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "vector": [14, 3, 0.5125, 0.0125, 3, 0.97, 0.0, 365, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "local.in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.in_transaction = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L42_C12", "label": "local.notify =", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "vector": [14, 3, 0.525, 0.0125, 3, 0.97, 1.0, 106, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "local.notify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L45_C12", "label": "commit()", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "vector": [8, 3, 0.5625, 0.0125, 3, 0.97, 0.5, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Return_L46_C12", "label": "return", "type": "return", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "vector": [13, 3, 0.575, 0.0125, 3, 0.97, 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_222:Assign_L47_C4", "label": "handle_signals.patched =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "vector": [14, 1, 0.5875, 0.0125, 1, 0.38, 0.5, 843, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "handle_signals.patched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handle_signals.patched = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L48_C4", "label": "db.run_in_transaction_custom_retries =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "vector": [14, 1, 0.6, 0.0125, 1, 0.38, 1.0, 307, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db.run_in_transaction_custom_retries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db.run_in_transaction_custom_retries = handle_signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L50_C0", "label": "hook", "type": "function", "loc": [50, 55], "level": 0, "parent": null, "vector": [2, 0, 0.6562, 0.075, 0, 0.66, 0.6842, 70, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "hook", "arg_names": ["service", "call", "request", "response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hook(service, call, request, response):\n if call == 'Rollback':\n # This stores a list of tuples (action, sender, kwargs)\n # Possible actions: 'delete', 'save'\n local.in_transaction = True\n local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4", "label": "if", "type": "if", "loc": [51, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L50_C0", "vector": [4, 1, 0.6625, 0.0625, 1, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if call == 'Rollback':\n # This stores a list of tuples (action, sender, kwargs)\n # Possible actions: 'delete', 'save'\n local.in_transaction = True\n local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L54_C8", "label": "local.in_transaction =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4", "vector": [14, 2, 0.675, 0.0125, 2, 0.13, 0.0, 365, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "local.in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.in_transaction = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L55_C8", "label": "local.notify =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4", "vector": [14, 2, 0.6875, 0.0125, 2, 0.13, 1.0, 106, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "local.notify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.notify = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L56_C0", "label": "Append()", "type": "expression", "loc": [56, 56], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.0125, 0, 0.66, 0.7368, 454, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "Append", "arg_names": [], "import_names": [], "rhs_call_name": "Append", "annotation": ""}, "snippet": "apiproxy_stub_map.apiproxy.GetPostCallHooks().Append('tx_signals', hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L58_C0", "label": "commit", "type": "function", "loc": [58, 62], "level": 0, "parent": null, "vector": [2, 0, 0.75, 0.0625, 0, 0.66, 0.7895, 281, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def commit():\n local.in_transaction = False\n for action, sender, kwds in local.notify:\n signal = getattr(signals, 'post_%s_committed' % action)\n signal.send(sender=sender, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L59_C4", "label": "local.in_transaction =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L58_C0", "vector": [14, 1, 0.7375, 0.0125, 1, 0.39, 0.0, 365, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "local.in_transaction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " local.in_transaction = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4", "label": "for action, sender, kwds", "type": "for", "loc": [60, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L58_C0", "vector": [6, 1, 0.7625, 0.0375, 1, 0.39, 1.0, 879, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "action, sender, kwds", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for action, sender, kwds in local.notify:\n signal = getattr(signals, 'post_%s_committed' % action)\n signal.send(sender=sender, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L61_C8", "label": "signal = getattr()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4", "vector": [14, 2, 0.7625, 0.0125, 2, 0.78, 0.0, 621, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "signal", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " signal = getattr(signals, 'post_%s_committed' % action)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L62_C8", "label": "send()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4", "vector": [8, 2, 0.775, 0.0125, 2, 0.78, 1.0, 826, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " signal.send(sender=sender, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L64_C0", "label": "entity_saved", "type": "function", "loc": [64, 70], "level": 0, "parent": null, "vector": [2, 0, 0.8375, 0.0875, 0, 0.66, 0.8421, 613, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "entity_saved", "arg_names": ["sender", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def entity_saved(sender, **kwargs):\n if 'signal' in kwargs:\n del kwargs['signal']\n if getattr(local, 'in_transaction', False):\n local.notify.append(('save', sender, kwargs))\n else:\n signals.post_save_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L65_C4", "label": "if", "type": "if", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L64_C0", "vector": [4, 1, 0.8187, 0.025, 1, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'signal' in kwargs:\n del kwargs['signal']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4", "label": "if", "type": "if", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L64_C0", "vector": [4, 1, 0.8562, 0.05, 1, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(local, 'in_transaction', False):\n local.notify.append(('save', sender, kwargs))\n else:\n signals.post_save_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L68_C8", "label": "append()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4", "vector": [8, 2, 0.85, 0.0125, 2, 0.47, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " local.notify.append(('save', sender, kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L70_C8", "label": "send()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4", "vector": [8, 2, 0.875, 0.0125, 2, 0.47, 1.0, 826, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " signals.post_save_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L71_C0", "label": "connect()", "type": "expression", "loc": [71, 71], "level": 0, "parent": null, "vector": [8, 0, 0.8875, 0.0125, 0, 0.66, 0.8947, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "signals.post_save.connect(entity_saved)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L73_C0", "label": "entity_deleted", "type": "function", "loc": [73, 79], "level": 0, "parent": null, "vector": [2, 0, 0.95, 0.0875, 0, 0.66, 0.9474, 458, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "entity_deleted", "arg_names": ["sender", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def entity_deleted(sender, **kwargs):\n if 'signal' in kwargs:\n del kwargs['signal']\n if getattr(local, 'in_transaction', False):\n local.notify.append(('delete', sender, kwargs))\n else:\n signals.post_delete_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L74_C4", "label": "if", "type": "if", "loc": [74, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L73_C0", "vector": [4, 1, 0.9313, 0.025, 1, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'signal' in kwargs:\n del kwargs['signal']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4", "label": "if", "type": "if", "loc": [76, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L73_C0", "vector": [4, 1, 0.9688, 0.05, 1, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(local, 'in_transaction', False):\n local.notify.append(('delete', sender, kwargs))\n else:\n signals.post_delete_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L77_C8", "label": "append()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4", "vector": [8, 2, 0.9625, 0.0125, 2, 0.54, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " local.notify.append(('delete', sender, kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L79_C8", "label": "send()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4", "vector": [8, 2, 0.9875, 0.0125, 2, 0.54, 1.0, 826, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " signals.post_delete_committed.send(sender=sender, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L80_C0", "label": "connect()", "type": "expression", "loc": [80, 80], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0125, 0, 0.66, 1.0, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "signals.post_delete.connect(entity_deleted)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L21_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L22_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Return_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:Try_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Return_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_222:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_222:Expr_L79_C8"}] |
from google.appengine.api import apiproxy_stub_map
import os, sys
have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))
if have_appserver:
appid = os.environ.get('APPLICATION_ID')
else:
try:
from google.appengine.tools import dev_appserver
from aecmd import PROJECT_DIR
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
appid = appconfig.application
except ImportError:
appid = None
on_production_server = have_appserver and \
not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')
| ajibawa-2023/Python-Code-Large/train/row_223 | 12 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_223:ImportFrom_L1_C0", "label": "from google.appengine.api import apiproxy_stub_map", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["apiproxy_stub_map"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import apiproxy_stub_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Import_L2_C0", "label": "os import os, sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0556, 0, 0.66, 0.25, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L4_C0", "label": "have_appserver = bool()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2222, 0.0556, 0, 0.66, 0.5, 646, 3, 1, 0, 0, 337, 10, 2], "semantic": {"name": "have_appserver", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": "have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "label": "if", "type": "if", "loc": [6, 15], "level": 0, "parent": null, "vector": [4, 0, 0.5833, 0.5556, 0, 0.66, 0.75, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if have_appserver:\n appid = os.environ.get('APPLICATION_ID')\nelse:\n try:\n from google.appengine.tools import dev_appserver\n from aecmd import PROJECT_DIR\n appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})\n appid = appconfig.application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L7_C4", "label": "appid = get()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "vector": [14, 1, 0.3889, 0.0556, 1, 0.07, 0.0, 944, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "appid", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " appid = os.environ.get('APPLICATION_ID')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "label": "try", "type": "try", "loc": [9, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "vector": [7, 1, 0.6667, 0.3889, 1, 0.07, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from google.appengine.tools import dev_appserver\n from aecmd import PROJECT_DIR\n appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})\n appid = appconfig.application\n except ImportError:\n appid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:ImportFrom_L10_C8", "label": "from google.appengine.tools import dev_appserver", "type": "import", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "vector": [1, 2, 0.5556, 0.0556, 2, 0.12, 0.0, 225, 0, 1, 0, 0, 225, 0, 0], "semantic": {"name": "google.appengine.tools", "arg_names": [], "import_names": ["dev_appserver"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.tools import dev_appserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:ImportFrom_L11_C8", "label": "from aecmd import PROJECT_DIR", "type": "import", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "vector": [1, 2, 0.6111, 0.0556, 2, 0.12, 0.3333, 420, 0, 1, 0, 0, 420, 0, 0], "semantic": {"name": "aecmd", "arg_names": [], "import_names": ["PROJECT_DIR"], "rhs_call_name": "", "annotation": ""}, "snippet": " from aecmd import PROJECT_DIR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L12_C8", "label": "appconfig, unused = LoadAppConfig()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "vector": [14, 2, 0.6667, 0.0556, 2, 0.12, 0.6667, 260, 3, 2, 0, 0, 580, 10, 1], "semantic": {"name": "appconfig, unused", "arg_names": [], "import_names": [], "rhs_call_name": "LoadAppConfig", "annotation": ""}, "snippet": " appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L13_C8", "label": "appid =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "vector": [14, 2, 0.7222, 0.0556, 2, 0.12, 1.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "appid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " appid = appconfig.application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L15_C8", "label": "appid =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "vector": [14, 2, 0.8333, 0.0556, 2, 0.12, 0.0, 944, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "appid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " appid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L17_C0", "label": "on_production_server =", "type": "assigned_variable", "loc": [17, 18], "level": 0, "parent": null, "vector": [14, 0, 0.9722, 0.1111, 0, 0.66, 1.0, 551, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "on_production_server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "on_production_server = have_appserver and \\\n not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_223:ImportFrom_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_223:ImportFrom_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_223:Try_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_223:Assign_L15_C8"}] |
from google.appengine.api.memcache import *
| ajibawa-2023/Python-Code-Large/train/row_224 | 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_224:ImportFrom_L1_C0", "label": "from google.appengine.api.memcache import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "google.appengine.api.memcache", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api.memcache import *"}] | [] |
from ragendja.settings_post import settings
from appenginepatcher import have_appserver, on_production_server
if have_appserver and not on_production_server and \
settings.MEDIA_URL.startswith('/'):
if settings.ADMIN_MEDIA_PREFIX.startswith(settings.MEDIA_URL):
settings.ADMIN_MEDIA_PREFIX = '/generated_media' + \
settings.ADMIN_MEDIA_PREFIX
settings.MEDIA_URL = '/generated_media' + settings.MEDIA_URL
settings.MIDDLEWARE_CLASSES = (
'mediautils.middleware.MediaMiddleware',
) + settings.MIDDLEWARE_CLASSES
| ajibawa-2023/Python-Code-Large/train/row_225 | 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_225:ImportFrom_L1_C0", "label": "from ragendja.settings_post import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.settings_post import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:ImportFrom_L2_C0", "label": "from appenginepatcher import have_appserver, on_production_server", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.5, 519, 0, 2, 0, 0, 519, 0, 0], "semantic": {"name": "appenginepatcher", "arg_names": [], "import_names": ["have_appserver", "on_production_server"], "rhs_call_name": "", "annotation": ""}, "snippet": "from appenginepatcher import have_appserver, on_production_server"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "label": "if", "type": "if", "loc": [3, 11], "level": 0, "parent": null, "vector": [4, 0, 0.6364, 0.8182, 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 have_appserver and not on_production_server and \\\n settings.MEDIA_URL.startswith('/'):\n if settings.ADMIN_MEDIA_PREFIX.startswith(settings.MEDIA_URL):\n settings.ADMIN_MEDIA_PREFIX = '/generated_media' + \\\n settings.ADMIN_MEDIA_PREFIX\n settings.MEDIA_URL = '/generated_media' + settings.MEDIA_URL\n settings.MIDDLEWARE_CLASSES = (\n 'mediautils.middleware.MediaMiddleware',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4", "label": "if", "type": "if", "loc": [5, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "vector": [4, 1, 0.5455, 0.2727, 1, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.ADMIN_MEDIA_PREFIX.startswith(settings.MEDIA_URL):\n settings.ADMIN_MEDIA_PREFIX = '/generated_media' + \\\n settings.ADMIN_MEDIA_PREFIX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L6_C8", "label": "settings.ADMIN_MEDIA_PREFIX =", "type": "assigned_variable", "loc": [6, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4", "vector": [14, 2, 0.5909, 0.1818, 2, 0.37, 0.0, 382, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.ADMIN_MEDIA_PREFIX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.ADMIN_MEDIA_PREFIX = '/generated_media' + \\\n settings.ADMIN_MEDIA_PREFIX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L8_C4", "label": "settings.MEDIA_URL =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "vector": [14, 1, 0.7273, 0.0909, 1, 0.25, 0.5, 511, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.MEDIA_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.MEDIA_URL = '/generated_media' + settings.MEDIA_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L9_C4", "label": "settings.MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "vector": [14, 1, 0.9091, 0.2727, 1, 0.25, 1.0, 955, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.MIDDLEWARE_CLASSES = (\n 'mediautils.middleware.MediaMiddleware',\n ) + settings.MIDDLEWARE_CLASSES"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_225:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_225:Assign_L9_C4"}] |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.simplejson import dumps
from os.path import getmtime
import os, codecs, shutil, logging, re
path_re = re.compile(r'/[^/]+/\.\./')
MEDIA_VERSION = unicode(settings.MEDIA_VERSION)
COMPRESSOR = os.path.join(os.path.dirname(__file__), '.yuicompressor.jar')
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.dirname(__file__)))))
GENERATED_MEDIA = os.path.join(PROJECT_ROOT, '_generated_media')
MEDIA_ROOT = os.path.join(GENERATED_MEDIA, MEDIA_VERSION)
DYNAMIC_MEDIA = os.path.join(PROJECT_ROOT, '.dynamic_media')
# A list of file types that have to be combined
MUST_COMBINE = ['.js', '.css']
# Detect language codes
if not settings.USE_I18N:
LANGUAGES = (settings.LANGUAGE_CODE,)
else:
LANGUAGES = [code for code, _ in settings.LANGUAGES]
# Dynamic source handlers
def site_data(**kwargs):
"""Provide site_data variable with settings (currently only MEDIA_URL)."""
content = 'window.site_data = {};'
content += 'window.site_data.settings = %s;' % dumps({
'MEDIA_URL': settings.MEDIA_URL
})
return content
def lang_data(LANGUAGE_CODE, **kwargs):
# These are needed for i18n
from django.http import HttpRequest
from django.views.i18n import javascript_catalog
LANGUAGE_BIDI = LANGUAGE_CODE.split('-')[0] in \
settings.LANGUAGES_BIDI
request = HttpRequest()
request.GET['language'] = LANGUAGE_CODE
# Add some JavaScript data
content = 'var LANGUAGE_CODE = "%s";\n' % LANGUAGE_CODE
content += 'var LANGUAGE_BIDI = ' + \
(LANGUAGE_BIDI and 'true' or 'false') + ';\n'
content += javascript_catalog(request,
packages=settings.INSTALLED_APPS).content
# The hgettext() function just calls gettext() internally, but
# it won't get indexed by makemessages.
content += '\nwindow.hgettext = function(text) { return gettext(text); };\n'
# Add a similar hngettext() function
content += 'window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n'
return content
lang_data.name = 'lang-%(LANGUAGE_CODE)s.js'
def generatemedia(compressed):
if os.path.exists(MEDIA_ROOT):
shutil.rmtree(MEDIA_ROOT)
updatemedia(compressed)
def copy_file(path, generated):
dirpath = os.path.dirname(generated)
if not os.path.exists(dirpath):
os.makedirs(dirpath)
shutil.copyfile(path, generated)
def compress_file(path):
if not path.endswith(('.css', '.js')):
return
from subprocess import Popen
print ' Running yuicompressor...',
try:
cmd = Popen(['java', '-jar', COMPRESSOR, '--charset', 'UTF-8',
path, '-o', path])
if cmd.wait() == 0:
print '%d bytes' % os.path.getsize(path)
else:
print 'Failed!'
except:
raise Exception("Failed to execute Java VM. "
"Please make sure that you have installed Java "
"and that it's in your PATH.")
def get_file_path(handler, target, media_dirs, **kwargs):
if isinstance(handler, basestring):
path = handler % dict(kwargs, target=target)
app, filepath = path.replace('/', os.sep).split(os.sep, 1)
return os.path.abspath(os.path.join(media_dirs[app], filepath))
ext = os.path.splitext(target)[1]
owner = ''
for app in settings.INSTALLED_APPS:
if handler.__module__.startswith(app + '.') and len(app) > len(owner):
owner = app
owner = owner or handler.__module__
name = getattr(handler, 'name', handler.__name__ + ext) % dict(kwargs,
target=target)
assert '/' not in name
return os.path.join(DYNAMIC_MEDIA, '%s-%s' % (owner, name))
def get_css_content(handler, content, **kwargs):
# Add $MEDIA_URL variable to CSS files
content = content.replace('$MEDIA_URL/', settings.MEDIA_URL)
# Remove @charset rules
content = re.sub(r'@charset(.*?);', '', content)
if not isinstance(handler, basestring):
return content
def fixurls(path):
# Resolve ../ paths
path = '%s%s/%s' % (settings.MEDIA_URL,
os.path.dirname(handler % dict(kwargs)),
path.group(1))
while path_re.search(path):
path = path_re.sub('/', path, 1)
return 'url("%s")' % path
# Make relative paths work with MEDIA_URL
content = re.sub(r'url\s*\(["\']?([\w\.][^:]*?)["\']?\)',
fixurls, content)
return content
def get_file_content(handler, cache, **kwargs):
path = get_file_path(handler, **kwargs)
if path not in cache:
if isinstance(handler, basestring):
try:
file = codecs.open(path, 'r', 'utf-8')
cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')
).replace('\r\n', '\n').replace('\r', '\n')
except:
logging.error('Error in %s' % path)
raise
file.close()
elif callable(handler):
cache[path] = handler(**kwargs)
else:
raise ValueError('Media generator source "%r" not valid!' % handler)
# Rewrite url() paths in CSS files
ext = os.path.splitext(path)[1]
if ext == '.css':
cache[path] = get_css_content(handler, cache[path], **kwargs)
return cache[path]
def update_dynamic_file(handler, cache, **kwargs):
assert callable(handler)
path = get_file_path(handler, **kwargs)
content = get_file_content(handler, cache, **kwargs)
needs_update = not os.path.exists(path)
if not needs_update:
file = codecs.open(path, 'r', 'utf-8')
if content != file.read():
needs_update = True
file.close()
if needs_update:
file = codecs.open(path, 'w', 'utf-8')
file.write(content)
file.close()
return needs_update
def get_target_content(group, cache, **kwargs):
content = ''
for handler in group:
content += get_file_content(handler, cache, **kwargs)
content += '\n'
return content
def get_targets(combine_media=settings.COMBINE_MEDIA, **kwargs):
"""Returns all files that must be combined."""
targets = []
for target in sorted(combine_media.keys()):
group = combine_media[target]
if '.site_data.js' in group:
# site_data must always come first because other modules might
# depend on it
group.remove('.site_data.js')
group.insert(0, site_data)
if '%(LANGUAGE_CODE)s' in target:
# This file uses i18n, so generate a separate file per language.
# The language data is always added before all other files.
for LANGUAGE_CODE in LANGUAGES:
data = kwargs.copy()
data['LANGUAGE_CODE'] = LANGUAGE_CODE
filename = target % data
data['target'] = filename
group.insert(0, lang_data)
targets.append((filename, data, group))
elif '%(LANGUAGE_DIR)s' in target:
# Generate CSS files for both text directions
for LANGUAGE_DIR in ('ltr', 'rtl'):
data = kwargs.copy()
data['LANGUAGE_DIR'] = LANGUAGE_DIR
filename = target % data
data['target'] = filename
targets.append((filename, data, group))
else:
data = kwargs.copy()
filename = target % data
data['target'] = filename
targets.append((filename, data, group))
return targets
def get_copy_targets(media_dirs, **kwargs):
"""Returns paths of files that must be copied directly."""
# Some files types (MUST_COMBINE) never get copied.
# They must always be combined.
targets = {}
for app, media_dir in media_dirs.items():
for root, dirs, files in os.walk(media_dir):
for name in dirs[:]:
if name.startswith('.'):
dirs.remove(name)
for file in files:
if file.startswith('.') or file.endswith(tuple(MUST_COMBINE)):
continue
path = os.path.abspath(os.path.join(root, file))
base = app + path[len(media_dir):]
targets[base.replace(os.sep, '/')] = path
return targets
def cleanup_dir(dir, paths):
# Remove old generated files
keep = []
dir = os.path.abspath(dir)
for path in paths:
if not os.path.isabs(path):
path = os.path.join(dir, path)
path = os.path.abspath(path)
while path not in keep and path != dir:
keep.append(path)
path = os.path.dirname(path)
for root, dirs, files in os.walk(dir):
for name in dirs[:]:
path = os.path.abspath(os.path.join(root, name))
if path not in keep:
shutil.rmtree(path)
dirs.remove(name)
for file in files:
path = os.path.abspath(os.path.join(root, file))
if path not in keep:
os.remove(path)
def get_media_dirs():
from ragendja.apputils import get_app_dirs
media_dirs = get_app_dirs('media')
media_dirs['global'] = os.path.join(PROJECT_ROOT, 'media')
return media_dirs
def updatemedia(compressed=None):
if 'mediautils' not in settings.INSTALLED_APPS:
return
# Remove unused media versions
if os.path.exists(GENERATED_MEDIA):
entries = os.listdir(GENERATED_MEDIA)
if len(entries) != 1 or MEDIA_VERSION not in entries:
shutil.rmtree(GENERATED_MEDIA)
from ragendja.apputils import get_app_dirs
# Remove old media if settings got modified (too much work to check
# if COMBINE_MEDIA was changed)
mtime = getmtime(os.path.join(PROJECT_ROOT, 'settings.py'))
for app_path in get_app_dirs().values():
path = os.path.join(app_path, 'settings.py')
if os.path.exists(path) and os.path.getmtime(path) > mtime:
mtime = os.path.getmtime(path)
if os.path.exists(MEDIA_ROOT) and getmtime(MEDIA_ROOT) <= mtime:
shutil.rmtree(MEDIA_ROOT)
if not os.path.exists(MEDIA_ROOT):
os.makedirs(MEDIA_ROOT)
if not os.path.exists(DYNAMIC_MEDIA):
os.makedirs(DYNAMIC_MEDIA)
if compressed is None:
compressed = not getattr(settings, 'FORCE_UNCOMPRESSED_MEDIA', False)
media_dirs = get_media_dirs()
data = {'media_dirs': media_dirs}
targets = get_targets(**data)
copy_targets = get_copy_targets(**data)
target_names = [target[0] for target in targets]
# Remove unneeded files
cleanup_dir(MEDIA_ROOT, target_names + copy_targets.keys())
dynamic_files = []
for target, kwargs, group in targets:
for handler in group:
if callable(handler):
dynamic_files.append(get_file_path(handler, **kwargs))
cleanup_dir(DYNAMIC_MEDIA, dynamic_files)
# Copy files
for target in sorted(copy_targets.keys()):
# Only overwrite files if they've been modified. Also, only
# copy files that won't get combined.
path = copy_targets[target]
generated = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))
if os.path.exists(generated) and \
getmtime(generated) >= getmtime(path):
continue
print 'Copying %s...' % target
copy_file(path, generated)
# Update dynamic files
cache = {}
for target, kwargs, group in targets:
for handler in group:
if callable(handler):
update_dynamic_file(handler, cache, **kwargs)
# Combine media files
for target, kwargs, group in targets:
files = [get_file_path(handler, **kwargs) for handler in group]
path = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))
# Only overwrite files if they've been modified
if os.path.exists(path):
target_mtime = getmtime(path)
if not [1 for name in files if os.path.exists(name) and
getmtime(name) >= target_mtime]:
continue
print 'Combining %s...' % target
dirpath = os.path.dirname(path)
if not os.path.exists(dirpath):
os.makedirs(dirpath)
file = codecs.open(path, 'w', 'utf-8')
file.write(get_target_content(group, cache, **kwargs))
file.close()
if compressed:
compress_file(path)
| ajibawa-2023/Python-Code-Large/train/row_226 | 231 | 342 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0029, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L3_C0", "label": "from django.utils.simplejson import dumps", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0029, 0, 0.66, 0.0357, 480, 0, 1, 0, 0, 480, 0, 0], "semantic": {"name": "django.utils.simplejson", "arg_names": [], "import_names": ["dumps"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.simplejson import dumps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L4_C0", "label": "from os.path import getmtime", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0117, 0.0029, 0, 0.66, 0.0714, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["getmtime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os.path import getmtime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Import_L5_C0", "label": "os import os, codecs, shutil\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0146, 0.0029, 0, 0.66, 0.1071, 688, 0, 5, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "codecs", "shutil", "logging", "re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, codecs, shutil, logging, re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L7_C0", "label": "path_re = compile()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0205, 0.0029, 0, 0.66, 0.1429, 73, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "path_re", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "path_re = re.compile(r'/[^/]+/\\.\\./')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L9_C0", "label": "MEDIA_VERSION = unicode()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0263, 0.0029, 0, 0.66, 0.1786, 130, 3, 1, 0, 0, 733, 10, 1], "semantic": {"name": "MEDIA_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": "MEDIA_VERSION = unicode(settings.MEDIA_VERSION)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L10_C0", "label": "COMPRESSOR = join()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.0292, 0.0029, 0, 0.66, 0.2143, 111, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "COMPRESSOR", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "COMPRESSOR = os.path.join(os.path.dirname(__file__), '.yuicompressor.jar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L11_C0", "label": "PROJECT_ROOT = abspath()", "type": "assigned_variable", "loc": [11, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0336, 0.0058, 0, 0.66, 0.25, 692, 3, 1, 0, 0, 142, 10, 5], "semantic": {"name": "PROJECT_ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": "PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(\n os.path.dirname(__file__)))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L13_C0", "label": "GENERATED_MEDIA = join()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.038, 0.0029, 0, 0.66, 0.2857, 478, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "GENERATED_MEDIA", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "GENERATED_MEDIA = os.path.join(PROJECT_ROOT, '_generated_media')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L14_C0", "label": "MEDIA_ROOT = join()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0409, 0.0029, 0, 0.66, 0.3214, 764, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "MEDIA_ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "MEDIA_ROOT = os.path.join(GENERATED_MEDIA, MEDIA_VERSION)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L15_C0", "label": "DYNAMIC_MEDIA = join()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0439, 0.0029, 0, 0.66, 0.3571, 579, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "DYNAMIC_MEDIA", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "DYNAMIC_MEDIA = os.path.join(PROJECT_ROOT, '.dynamic_media')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L18_C0", "label": "MUST_COMBINE =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.0526, 0.0029, 0, 0.66, 0.3929, 831, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "MUST_COMBINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MUST_COMBINE = ['.js', '.css']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "label": "if", "type": "if", "loc": [21, 24], "level": 0, "parent": null, "vector": [4, 0, 0.0658, 0.0117, 0, 0.66, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not settings.USE_I18N:\n LANGUAGES = (settings.LANGUAGE_CODE,)\nelse:\n LANGUAGES = [code for code, _ in settings.LANGUAGES]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L22_C4", "label": "LANGUAGES =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "vector": [14, 1, 0.0643, 0.0029, 1, 0.56, 0.0, 598, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "LANGUAGES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LANGUAGES = (settings.LANGUAGE_CODE,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L24_C4", "label": "LANGUAGES =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "vector": [14, 1, 0.0702, 0.0029, 1, 0.56, 1.0, 598, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LANGUAGES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LANGUAGES = [code for code, _ in settings.LANGUAGES]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "label": "site_data", "type": "function", "loc": [27, 33], "level": 0, "parent": null, "vector": [2, 0, 0.0877, 0.0205, 0, 0.66, 0.4643, 658, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "site_data", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def site_data(**kwargs):\n \"\"\"Provide site_data variable with settings (currently only MEDIA_URL).\"\"\"\n content = 'window.site_data = {};'\n content += 'window.site_data.settings = %s;' % dumps({\n 'MEDIA_URL': settings.MEDIA_URL\n })\n return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L28_C4", "label": "expression", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "vector": [8, 1, 0.0819, 0.0029, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Provide site_data variable with settings (currently only MEDIA_URL).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L29_C4", "label": "content =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "vector": [14, 1, 0.0848, 0.0029, 1, 0.33, 0.5, 273, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = 'window.site_data = {};'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "vector": [13, 1, 0.0965, 0.0029, 1, 0.33, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "label": "lang_data", "type": "function", "loc": [35, 59], "level": 0, "parent": null, "vector": [2, 0, 0.1374, 0.0731, 0, 0.66, 0.5, 873, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "lang_data", "arg_names": ["LANGUAGE_CODE", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def lang_data(LANGUAGE_CODE, **kwargs):\n # These are needed for i18n\n from django.http import HttpRequest\n from django.views.i18n import javascript_catalog\n\n LANGUAGE_BIDI = LANGUAGE_CODE.split('-')[0] in \\\n settings.LANGUAGES_BIDI\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L37_C4", "label": "from django.http import HttpRequest", "type": "import", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [1, 1, 0.1082, 0.0029, 1, 0.76, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpRequest"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.http import HttpRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L38_C4", "label": "from django.views.i18n import javascript_catalog", "type": "import", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [1, 1, 0.1111, 0.0029, 1, 0.76, 0.1667, 122, 0, 1, 0, 0, 122, 0, 0], "semantic": {"name": "django.views.i18n", "arg_names": [], "import_names": ["javascript_catalog"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.views.i18n import javascript_catalog"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L40_C4", "label": "LANGUAGE_BIDI =", "type": "assigned_variable", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [14, 1, 0.1184, 0.0058, 1, 0.76, 0.3333, 25, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "LANGUAGE_BIDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LANGUAGE_BIDI = LANGUAGE_CODE.split('-')[0] in \\\n settings.LANGUAGES_BIDI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L43_C4", "label": "request = HttpRequest()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [14, 1, 0.1257, 0.0029, 1, 0.76, 0.5, 50, 3, 0, 0, 0, 159, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "HttpRequest", "annotation": ""}, "snippet": " request = HttpRequest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L44_C4", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [14, 1, 0.1287, 0.0029, 1, 0.76, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.GET['language'] = LANGUAGE_CODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L47_C4", "label": "content =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [14, 1, 0.1374, 0.0029, 1, 0.76, 0.8333, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = 'var LANGUAGE_CODE = \"%s\";\\n' % LANGUAGE_CODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "vector": [13, 1, 0.1725, 0.0029, 1, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L60_C0", "label": "lang_data.name =", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.1754, 0.0029, 0, 0.66, 0.5357, 751, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "lang_data.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "lang_data.name = 'lang-%(LANGUAGE_CODE)s.js'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L62_C0", "label": "generatemedia", "type": "function", "loc": [62, 66], "level": 0, "parent": null, "vector": [2, 0, 0.1871, 0.0146, 0, 0.66, 0.5714, 974, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "generatemedia", "arg_names": ["compressed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generatemedia(compressed):\n if os.path.exists(MEDIA_ROOT):\n shutil.rmtree(MEDIA_ROOT)\n\n updatemedia(compressed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L63_C4", "label": "if", "type": "if", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L62_C0", "vector": [4, 1, 0.1857, 0.0058, 1, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(MEDIA_ROOT):\n shutil.rmtree(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L64_C8", "label": "rmtree()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L63_C4", "vector": [8, 2, 0.1871, 0.0029, 2, 0.36, 0.0, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L66_C4", "label": "updatemedia()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L62_C0", "vector": [8, 1, 0.193, 0.0029, 1, 0.27, 1.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updatemedia", "arg_names": [], "import_names": [], "rhs_call_name": "updatemedia", "annotation": ""}, "snippet": " updatemedia(compressed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "label": "copy_file", "type": "function", "loc": [68, 72], "level": 0, "parent": null, "vector": [2, 0, 0.2047, 0.0146, 0, 0.66, 0.6071, 196, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "copy_file", "arg_names": ["path", "generated"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def copy_file(path, generated):\n dirpath = os.path.dirname(generated)\n if not os.path.exists(dirpath):\n os.makedirs(dirpath)\n shutil.copyfile(path, generated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L69_C4", "label": "dirpath = dirname()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "vector": [14, 1, 0.2018, 0.0029, 1, 0.83, 0.0, 600, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "dirpath", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " dirpath = os.path.dirname(generated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L70_C4", "label": "if", "type": "if", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "vector": [4, 1, 0.2061, 0.0058, 1, 0.83, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(dirpath):\n os.makedirs(dirpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L71_C8", "label": "makedirs()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L70_C4", "vector": [8, 2, 0.2076, 0.0029, 2, 0.43, 0.0, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "makedirs", "arg_names": [], "import_names": [], "rhs_call_name": "makedirs", "annotation": ""}, "snippet": " os.makedirs(dirpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L72_C4", "label": "copyfile()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "vector": [8, 1, 0.2105, 0.0029, 1, 0.83, 1.0, 918, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copyfile", "arg_names": [], "import_names": [], "rhs_call_name": "copyfile", "annotation": ""}, "snippet": " shutil.copyfile(path, generated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "label": "compress_file", "type": "function", "loc": [74, 89], "level": 0, "parent": null, "vector": [2, 0, 0.2383, 0.0468, 0, 0.66, 0.6429, 505, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "compress_file", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compress_file(path):\n if not path.endswith(('.css', '.js')):\n return\n from subprocess import Popen\n print(' Running yuicompressor...',)\n try:\n cmd = Popen(['java', '-jar', COMPRESSOR, '--charset', 'UTF-8',\n path, '-o', path])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L75_C4", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "vector": [4, 1, 0.2208, 0.0058, 1, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not path.endswith(('.css', '.js')):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L76_C8", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L75_C4", "vector": [13, 2, 0.2222, 0.0029, 2, 0.33, 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_226:ImportFrom_L77_C4", "label": "from subprocess import Popen", "type": "import", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "vector": [1, 1, 0.2251, 0.0029, 1, 0.87, 0.3333, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["Popen"], "rhs_call_name": "", "annotation": ""}, "snippet": " from subprocess import Popen"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L78_C4", "label": "print()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "vector": [8, 1, 0.2281, 0.0029, 1, 0.87, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Running yuicompressor...',)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4", "label": "try", "type": "try", "loc": [79, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "vector": [7, 1, 0.2456, 0.0322, 1, 0.87, 1.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cmd = Popen(['java', '-jar', COMPRESSOR, '--charset', 'UTF-8',\n path, '-o', path])\n if cmd.wait() == 0:\n print('%d bytes' % os.path.getsize(path))\n else:\n print('Failed!')\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L80_C8", "label": "cmd = Popen()", "type": "assigned_variable", "loc": [80, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4", "vector": [14, 2, 0.2354, 0.0058, 2, 0.95, 0.0, 604, 3, 1, 0, 0, 568, 10, 1], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " cmd = Popen(['java', '-jar', COMPRESSOR, '--charset', 'UTF-8',\n path, '-o', path])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8", "label": "if", "type": "if", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4", "vector": [4, 2, 0.2442, 0.0117, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cmd.wait() == 0:\n print('%d bytes' % os.path.getsize(path))\n else:\n print('Failed!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L83_C12", "label": "print()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8", "vector": [8, 3, 0.2427, 0.0029, 3, 0.2, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%d bytes' % os.path.getsize(path))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L85_C12", "label": "print()", "type": "expression", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8", "vector": [8, 3, 0.2485, 0.0029, 3, 0.2, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Failed!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "label": "get_file_path", "type": "function", "loc": [91, 106], "level": 0, "parent": null, "vector": [2, 0, 0.288, 0.0468, 0, 0.66, 0.6786, 206, 0, 4, 1, 0, 0, 0, 13], "semantic": {"name": "get_file_path", "arg_names": ["handler", "target", "media_dirs", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_file_path(handler, target, media_dirs, **kwargs):\n if isinstance(handler, basestring):\n path = handler % dict(kwargs, target=target)\n app, filepath = path.replace('/', os.sep).split(os.sep, 1)\n return os.path.abspath(os.path.join(media_dirs[app], filepath))\n\n ext = os.path.splitext(target)[1]\n owner = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "label": "if", "type": "if", "loc": [92, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [4, 1, 0.2734, 0.0117, 1, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(handler, basestring):\n path = handler % dict(kwargs, target=target)\n app, filepath = path.replace('/', os.sep).split(os.sep, 1)\n return os.path.abspath(os.path.join(media_dirs[app], filepath))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L93_C8", "label": "path =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "vector": [14, 2, 0.2719, 0.0029, 2, 0.39, 0.0, 358, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = handler % dict(kwargs, target=target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L94_C8", "label": "app, filepath = split()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "vector": [14, 2, 0.2749, 0.0029, 2, 0.39, 0.5, 13, 3, 2, 0, 0, 908, 10, 2], "semantic": {"name": "app, filepath", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " app, filepath = path.replace('/', os.sep).split(os.sep, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "vector": [13, 2, 0.2778, 0.0029, 2, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.abspath(os.path.join(media_dirs[app], filepath))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L97_C4", "label": "ext =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [14, 1, 0.2836, 0.0029, 1, 0.38, 0.1667, 916, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ext", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ext = os.path.splitext(target)[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L98_C4", "label": "owner =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [14, 1, 0.2865, 0.0029, 1, 0.38, 0.3333, 365, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "owner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " owner = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L99_C4", "label": "for app", "type": "for", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [6, 1, 0.2924, 0.0088, 1, 0.38, 0.5, 494, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app in settings.INSTALLED_APPS:\n if handler.__module__.startswith(app + '.') and len(app) > len(owner):\n owner = app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L100_C8", "label": "if", "type": "if", "loc": [100, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L99_C4", "vector": [4, 2, 0.2939, 0.0058, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if handler.__module__.startswith(app + '.') and len(app) > len(owner):\n owner = app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L101_C12", "label": "owner =", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L100_C8", "vector": [14, 3, 0.2953, 0.0029, 3, 0.1, 0.0, 365, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "owner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " owner = app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L102_C4", "label": "owner =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [14, 1, 0.2982, 0.0029, 1, 0.38, 0.6667, 365, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "owner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " owner = owner or handler.__module__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L103_C4", "label": "name =", "type": "assigned_variable", "loc": [103, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [14, 1, 0.3026, 0.0058, 1, 0.38, 0.8333, 57, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = getattr(handler, 'name', handler.__name__ + ext) % dict(kwargs,\n target=target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L106_C4", "label": "return", "type": "return", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "vector": [13, 1, 0.3099, 0.0029, 1, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(DYNAMIC_MEDIA, '%s-%s' % (owner, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "label": "get_css_content", "type": "function", "loc": [108, 131], "level": 0, "parent": null, "vector": [2, 0, 0.3494, 0.0702, 0, 0.66, 0.7143, 575, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "get_css_content", "arg_names": ["handler", "content", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_css_content(handler, content, **kwargs):\n # Add $MEDIA_URL variable to CSS files\n content = content.replace('$MEDIA_URL/', settings.MEDIA_URL)\n\n # Remove @charset rules\n content = re.sub(r'@charset(.*?);', '', content)\n\n if not isinstance(handler, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L110_C4", "label": "content = replace()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [14, 1, 0.3216, 0.0029, 1, 0.66, 0.0, 273, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " content = content.replace('$MEDIA_URL/', settings.MEDIA_URL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L113_C4", "label": "content = sub()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [14, 1, 0.3304, 0.0029, 1, 0.66, 0.2, 273, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " content = re.sub(r'@charset(.*?);', '', content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [4, 1, 0.3377, 0.0058, 1, 0.66, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(handler, basestring):\n return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L115_C4", "vector": [13, 2, 0.3392, 0.0029, 2, 0.83, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "label": "fixurls", "type": "function", "loc": [118, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [2, 1, 0.3553, 0.0234, 1, 0.66, 0.6, 753, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "fixurls", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fixurls(path):\n # Resolve ../ paths\n path = '%s%s/%s' % (settings.MEDIA_URL,\n os.path.dirname(handler % dict(kwargs)),\n path.group(1))\n while path_re.search(path):\n path = path_re.sub('/', path, 1)\n return 'url(\"%s\")' % path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L120_C8", "label": "path =", "type": "assigned_variable", "loc": [120, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "vector": [14, 2, 0.3538, 0.0088, 2, 0.97, 0.0, 358, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '%s%s/%s' % (settings.MEDIA_URL,\n os.path.dirname(handler % dict(kwargs)),\n path.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:While_L123_C8", "label": "while", "type": "while", "loc": [123, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "vector": [5, 2, 0.3611, 0.0058, 2, 0.97, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while path_re.search(path):\n path = path_re.sub('/', path, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L124_C12", "label": "path = sub()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:While_L123_C8", "vector": [14, 3, 0.3626, 0.0029, 3, 0.54, 0.0, 358, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " path = path_re.sub('/', path, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L125_C8", "label": "return", "type": "return", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "vector": [13, 2, 0.3655, 0.0029, 2, 0.97, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'url(\"%s\")' % path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L128_C4", "label": "content = sub()", "type": "assigned_variable", "loc": [128, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [14, 1, 0.3757, 0.0058, 1, 0.66, 0.8, 273, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " content = re.sub(r'url\\s*\\([\"\\']?([\\w\\.][^:]*?)[\"\\']?\\)',\n fixurls, content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L131_C4", "label": "return", "type": "return", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "vector": [13, 1, 0.383, 0.0029, 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 content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "label": "get_file_content", "type": "function", "loc": [133, 153], "level": 0, "parent": null, "vector": [2, 0, 0.4181, 0.0614, 0, 0.66, 0.75, 132, 0, 3, 1, 0, 0, 0, 15], "semantic": {"name": "get_file_content", "arg_names": ["handler", "cache", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_file_content(handler, cache, **kwargs):\n path = get_file_path(handler, **kwargs)\n if path not in cache:\n if isinstance(handler, basestring):\n try:\n file = codecs.open(path, 'r', 'utf-8')\n cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')\n ).replace('\\r\\n', '\\n').replace('\\r', '\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L134_C4", "label": "path = get_file_path()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "vector": [14, 1, 0.3918, 0.0029, 1, 0.18, 0.0, 358, 3, 2, 0, 0, 206, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "get_file_path", "annotation": ""}, "snippet": " path = get_file_path(handler, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L135_C4", "label": "if", "type": "if", "loc": [135, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "vector": [4, 1, 0.4137, 0.0409, 1, 0.18, 0.25, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path not in cache:\n if isinstance(handler, basestring):\n try:\n file = codecs.open(path, 'r', 'utf-8')\n cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')\n ).replace('\\r\\n', '\\n').replace('\\r', '\\n')\n except:\n logging.error('Error in %s' % path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "label": "if", "type": "if", "loc": [136, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L135_C4", "vector": [4, 2, 0.4152, 0.038, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(handler, basestring):\n try:\n file = codecs.open(path, 'r', 'utf-8')\n cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')\n ).replace('\\r\\n', '\\n').replace('\\r', '\\n')\n except:\n logging.error('Error in %s' % path)\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "label": "try", "type": "try", "loc": [137, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "vector": [7, 3, 0.4094, 0.0205, 3, 0.05, 0.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n file = codecs.open(path, 'r', 'utf-8')\n cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')\n ).replace('\\r\\n', '\\n').replace('\\r', '\\n')\n except:\n logging.error('Error in %s' % path)\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L138_C16", "label": "file = open()", "type": "assigned_variable", "loc": [138, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "vector": [14, 4, 0.4035, 0.0029, 4, 0.64, 0.0, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(path, 'r', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L139_C16", "label": " = replace()", "type": "assigned_variable", "loc": [139, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "vector": [14, 4, 0.4079, 0.0058, 4, 0.64, 1.0, 0, 3, 2, 0, 0, 293, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " cache[path] = file.read().lstrip(codecs.BOM_UTF8.decode('utf-8')\n ).replace('\\r\\n', '\\n').replace('\\r', '\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L142_C16", "label": "error()", "type": "expression", "loc": [142, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "vector": [8, 4, 0.4152, 0.0029, 4, 0.64, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error('Error in %s' % path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L144_C12", "label": "close()", "type": "expression", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "vector": [8, 3, 0.4211, 0.0029, 3, 0.05, 0.5, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L145_C8", "label": "if", "type": "if", "loc": [145, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "vector": [4, 3, 0.4284, 0.0117, 3, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(handler):\n cache[path] = handler(**kwargs)\n else:\n raise ValueError('Media generator source \"%r\" not valid!' % handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L146_C12", "label": " = handler()", "type": "assigned_variable", "loc": [146, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L145_C8", "vector": [14, 4, 0.4269, 0.0029, 4, 0.88, 0.0, 0, 3, 1, 0, 0, 388, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "handler", "annotation": ""}, "snippet": " cache[path] = handler(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L150_C4", "label": "ext =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "vector": [14, 1, 0.4386, 0.0029, 1, 0.18, 0.5, 916, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ext", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ext = os.path.splitext(path)[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L151_C4", "label": "if", "type": "if", "loc": [151, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "vector": [4, 1, 0.443, 0.0058, 1, 0.18, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ext == '.css':\n cache[path] = get_css_content(handler, cache[path], **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L152_C8", "label": " = get_css_content()", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L151_C4", "vector": [14, 2, 0.4444, 0.0029, 2, 0.22, 0.0, 0, 3, 3, 0, 0, 575, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_css_content", "annotation": ""}, "snippet": " cache[path] = get_css_content(handler, cache[path], **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L153_C4", "label": "return", "type": "return", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "vector": [13, 1, 0.4474, 0.0029, 1, 0.18, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cache[path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "label": "update_dynamic_file", "type": "function", "loc": [155, 169], "level": 0, "parent": null, "vector": [2, 0, 0.4737, 0.0439, 0, 0.66, 0.7857, 81, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "update_dynamic_file", "arg_names": ["handler", "cache", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update_dynamic_file(handler, cache, **kwargs):\n assert callable(handler)\n path = get_file_path(handler, **kwargs)\n content = get_file_content(handler, cache, **kwargs)\n needs_update = not os.path.exists(path)\n if not needs_update:\n file = codecs.open(path, 'r', 'utf-8')\n if content != file.read():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L157_C4", "label": "path = get_file_path()", "type": "assigned_variable", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [14, 1, 0.4591, 0.0029, 1, 0.44, 0.0, 358, 3, 2, 0, 0, 206, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "get_file_path", "annotation": ""}, "snippet": " path = get_file_path(handler, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L158_C4", "label": "content = get_file_content()", "type": "assigned_variable", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [14, 1, 0.462, 0.0029, 1, 0.44, 0.2, 273, 3, 3, 0, 0, 132, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "get_file_content", "annotation": ""}, "snippet": " content = get_file_content(handler, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L159_C4", "label": "needs_update =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [14, 1, 0.4649, 0.0029, 1, 0.44, 0.4, 786, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "needs_update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " needs_update = not os.path.exists(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "label": "if", "type": "if", "loc": [160, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [4, 1, 0.4737, 0.0146, 1, 0.44, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not needs_update:\n file = codecs.open(path, 'r', 'utf-8')\n if content != file.read():\n needs_update = True\n file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L161_C8", "label": "file = open()", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "vector": [14, 2, 0.4708, 0.0029, 2, 0.08, 0.0, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(path, 'r', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L162_C8", "label": "if", "type": "if", "loc": [162, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "vector": [4, 2, 0.4751, 0.0058, 2, 0.08, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if content != file.read():\n needs_update = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L163_C12", "label": "needs_update =", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L162_C8", "vector": [14, 3, 0.4766, 0.0029, 3, 0.46, 0.0, 786, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "needs_update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " needs_update = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L164_C8", "label": "close()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "vector": [8, 2, 0.4795, 0.0029, 2, 0.08, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "label": "if", "type": "if", "loc": [165, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [4, 1, 0.4868, 0.0117, 1, 0.44, 0.8, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if needs_update:\n file = codecs.open(path, 'w', 'utf-8')\n file.write(content)\n file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L166_C8", "label": "file = open()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "vector": [14, 2, 0.4854, 0.0029, 2, 0.43, 0.0, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(path, 'w', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L167_C8", "label": "write()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "vector": [8, 2, 0.4883, 0.0029, 2, 0.43, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L168_C8", "label": "close()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "vector": [8, 2, 0.4912, 0.0029, 2, 0.43, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L169_C4", "label": "return", "type": "return", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "vector": [13, 1, 0.4942, 0.0029, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return needs_update"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "label": "get_target_content", "type": "function", "loc": [171, 176], "level": 0, "parent": null, "vector": [2, 0, 0.5073, 0.0175, 0, 0.66, 0.8214, 500, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get_target_content", "arg_names": ["group", "cache", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_target_content(group, cache, **kwargs):\n content = ''\n for handler in group:\n content += get_file_content(handler, cache, **kwargs)\n content += '\\n'\n return content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L172_C4", "label": "content =", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "vector": [14, 1, 0.5029, 0.0029, 1, 0.13, 0.0, 273, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L173_C4", "label": "for handler", "type": "for", "loc": [173, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "vector": [6, 1, 0.5088, 0.0088, 1, 0.13, 0.5, 388, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for handler in group:\n content += get_file_content(handler, cache, **kwargs)\n content += '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L176_C4", "label": "return", "type": "return", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "vector": [13, 1, 0.5146, 0.0029, 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 content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "label": "get_targets", "type": "function", "loc": [178, 211], "level": 0, "parent": null, "vector": [2, 0, 0.5687, 0.0994, 0, 0.66, 0.8571, 396, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "get_targets", "arg_names": ["combine_media", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_targets(combine_media=settings.COMBINE_MEDIA, **kwargs):\n \"\"\"Returns all files that must be combined.\"\"\"\n targets = []\n for target in sorted(combine_media.keys()):\n group = combine_media[target]\n if '.site_data.js' in group:\n # site_data must always come first because other modules might\n # depend on it"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L179_C4", "label": "expression", "type": "expression", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "vector": [8, 1, 0.5234, 0.0029, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns all files that must be combined.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L180_C4", "label": "targets =", "type": "assigned_variable", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "vector": [14, 1, 0.5263, 0.0029, 1, 0.4, 0.3333, 409, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "targets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " targets = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "label": "for target", "type": "for", "loc": [181, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "vector": [6, 1, 0.5716, 0.0877, 1, 0.4, 0.6667, 766, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target in sorted(combine_media.keys()):\n group = combine_media[target]\n if '.site_data.js' in group:\n # site_data must always come first because other modules might\n # depend on it\n group.remove('.site_data.js')\n group.insert(0, site_data)\n if '%(LANGUAGE_CODE)s' in target:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L182_C8", "label": "group =", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "vector": [14, 2, 0.5322, 0.0029, 2, 0.4, 0.0, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = combine_media[target]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8", "label": "if", "type": "if", "loc": [183, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "vector": [4, 2, 0.5409, 0.0146, 2, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '.site_data.js' in group:\n # site_data must always come first because other modules might\n # depend on it\n group.remove('.site_data.js')\n group.insert(0, site_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L186_C12", "label": "remove()", "type": "expression", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8", "vector": [8, 3, 0.5439, 0.0029, 3, 0.7, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " group.remove('.site_data.js')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L187_C12", "label": "insert()", "type": "expression", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8", "vector": [8, 3, 0.5468, 0.0029, 3, 0.7, 1.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " group.insert(0, site_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8", "label": "if", "type": "if", "loc": [188, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "vector": [4, 2, 0.5819, 0.0673, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '%(LANGUAGE_CODE)s' in target:\n # This file uses i18n, so generate a separate file per language.\n # The language data is always added before all other files.\n for LANGUAGE_CODE in LANGUAGES:\n data = kwargs.copy()\n data['LANGUAGE_CODE'] = LANGUAGE_CODE\n filename = target % data\n data['target'] = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "label": "for LANGUAGE_CODE", "type": "for", "loc": [191, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8", "vector": [6, 3, 0.5673, 0.0205, 3, 0.17, 0.0, 450, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "LANGUAGE_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for LANGUAGE_CODE in LANGUAGES:\n data = kwargs.copy()\n data['LANGUAGE_CODE'] = LANGUAGE_CODE\n filename = target % data\n data['target'] = filename\n group.insert(0, lang_data)\n targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L192_C16", "label": "data = copy()", "type": "assigned_variable", "loc": [192, 192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [14, 4, 0.5614, 0.0029, 4, 0.8, 0.0, 929, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data = kwargs.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L193_C16", "label": "assign", "type": "assigned_variable", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [14, 4, 0.5643, 0.0029, 4, 0.8, 0.2, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['LANGUAGE_CODE'] = LANGUAGE_CODE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L194_C16", "label": "filename =", "type": "assigned_variable", "loc": [194, 194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [14, 4, 0.5673, 0.0029, 4, 0.8, 0.4, 275, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = target % data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L195_C16", "label": "assign", "type": "assigned_variable", "loc": [195, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [14, 4, 0.5702, 0.0029, 4, 0.8, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['target'] = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L196_C16", "label": "insert()", "type": "expression", "loc": [196, 196], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [8, 4, 0.5731, 0.0029, 4, 0.8, 0.8, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " group.insert(0, lang_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L197_C16", "label": "append()", "type": "expression", "loc": [197, 197], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "vector": [8, 4, 0.576, 0.0029, 4, 0.8, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "label": "if", "type": "if", "loc": [198, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8", "vector": [4, 3, 0.5965, 0.038, 3, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif '%(LANGUAGE_DIR)s' in target:\n # Generate CSS files for both text directions\n for LANGUAGE_DIR in ('ltr', 'rtl'):\n data = kwargs.copy()\n data['LANGUAGE_DIR'] = LANGUAGE_DIR\n filename = target % data\n data['target'] = filename\n targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "label": "for LANGUAGE_DIR", "type": "for", "loc": [200, 205], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "vector": [6, 4, 0.5921, 0.0175, 4, 0.46, 0.0, 953, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "LANGUAGE_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for LANGUAGE_DIR in ('ltr', 'rtl'):\n data = kwargs.copy()\n data['LANGUAGE_DIR'] = LANGUAGE_DIR\n filename = target % data\n data['target'] = filename\n targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L201_C16", "label": "data = copy()", "type": "assigned_variable", "loc": [201, 201], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "vector": [14, 5, 0.5877, 0.0029, 5, 0.53, 0.0, 929, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data = kwargs.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L202_C16", "label": "assign", "type": "assigned_variable", "loc": [202, 202], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "vector": [14, 5, 0.5906, 0.0029, 5, 0.53, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['LANGUAGE_DIR'] = LANGUAGE_DIR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L203_C16", "label": "filename =", "type": "assigned_variable", "loc": [203, 203], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "vector": [14, 5, 0.5936, 0.0029, 5, 0.53, 0.5, 275, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = target % data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L204_C16", "label": "assign", "type": "assigned_variable", "loc": [204, 204], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "vector": [14, 5, 0.5965, 0.0029, 5, 0.53, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['target'] = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L205_C16", "label": "append()", "type": "expression", "loc": [205, 205], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "vector": [8, 5, 0.5994, 0.0029, 5, 0.53, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L207_C12", "label": "data = copy()", "type": "assigned_variable", "loc": [207, 207], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "vector": [14, 4, 0.6053, 0.0029, 4, 0.46, 0.25, 929, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data = kwargs.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L208_C12", "label": "filename =", "type": "assigned_variable", "loc": [208, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "vector": [14, 4, 0.6082, 0.0029, 4, 0.46, 0.5, 275, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = target % data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L209_C12", "label": "assign", "type": "assigned_variable", "loc": [209, 209], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "vector": [14, 4, 0.6111, 0.0029, 4, 0.46, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['target'] = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L210_C12", "label": "append()", "type": "expression", "loc": [210, 210], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "vector": [8, 4, 0.614, 0.0029, 4, 0.46, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " targets.append((filename, data, group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L211_C4", "label": "return", "type": "return", "loc": [211, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "vector": [13, 1, 0.617, 0.0029, 1, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return targets"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "label": "get_copy_targets", "type": "function", "loc": [213, 229], "level": 0, "parent": null, "vector": [2, 0, 0.6462, 0.0497, 0, 0.66, 0.8929, 103, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "get_copy_targets", "arg_names": ["media_dirs", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_copy_targets(media_dirs, **kwargs):\n \"\"\"Returns paths of files that must be copied directly.\"\"\"\n # Some files types (MUST_COMBINE) never get copied.\n # They must always be combined.\n targets = {}\n for app, media_dir in media_dirs.items():\n for root, dirs, files in os.walk(media_dir):\n for name in dirs[:]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L214_C4", "label": "expression", "type": "expression", "loc": [214, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "vector": [8, 1, 0.6257, 0.0029, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns paths of files that must be copied directly.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L217_C4", "label": "targets =", "type": "assigned_variable", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "vector": [14, 1, 0.6345, 0.0029, 1, 0.28, 0.3333, 409, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "targets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " targets = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L218_C4", "label": "for app, media_dir", "type": "for", "loc": [218, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "vector": [6, 1, 0.652, 0.0322, 1, 0.28, 0.6667, 42, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "app, media_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app, media_dir in media_dirs.items():\n for root, dirs, files in os.walk(media_dir):\n for name in dirs[:]:\n if name.startswith('.'):\n dirs.remove(name)\n for file in files:\n if file.startswith('.') or file.endswith(tuple(MUST_COMBINE)):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8", "label": "for root, dirs, files", "type": "for", "loc": [219, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L218_C4", "vector": [6, 2, 0.6535, 0.0292, 2, 0.62, 0.0, 129, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(media_dir):\n for name in dirs[:]:\n if name.startswith('.'):\n dirs.remove(name)\n for file in files:\n if file.startswith('.') or file.endswith(tuple(MUST_COMBINE)):\n continue\n path = os.path.abspath(os.path.join(root, file))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L220_C12", "label": "for name", "type": "for", "loc": [220, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8", "vector": [6, 3, 0.6462, 0.0088, 3, 0.05, 0.0, 57, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in dirs[:]:\n if name.startswith('.'):\n dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L221_C16", "label": "if", "type": "if", "loc": [221, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L220_C12", "vector": [4, 4, 0.6477, 0.0058, 4, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name.startswith('.'):\n dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L222_C20", "label": "remove()", "type": "expression", "loc": [222, 222], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L221_C16", "vector": [8, 5, 0.6491, 0.0029, 5, 0.04, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "label": "for file", "type": "for", "loc": [223, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8", "vector": [6, 3, 0.6594, 0.0175, 3, 0.05, 1.0, 107, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n if file.startswith('.') or file.endswith(tuple(MUST_COMBINE)):\n continue\n path = os.path.abspath(os.path.join(root, file))\n base = app + path[len(media_dir):]\n targets[base.replace(os.sep, '/')] = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L224_C16", "label": "if", "type": "if", "loc": [224, 225], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "vector": [4, 4, 0.6564, 0.0058, 4, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if file.startswith('.') or file.endswith(tuple(MUST_COMBINE)):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L226_C16", "label": "path = abspath()", "type": "assigned_variable", "loc": [226, 226], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "vector": [14, 4, 0.6608, 0.0029, 4, 0.9, 0.3333, 358, 3, 1, 0, 0, 142, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " path = os.path.abspath(os.path.join(root, file))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L227_C16", "label": "base =", "type": "assigned_variable", "loc": [227, 227], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "vector": [14, 4, 0.6637, 0.0029, 4, 0.9, 0.6667, 47, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " base = app + path[len(media_dir):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L228_C16", "label": "assign", "type": "assigned_variable", "loc": [228, 228], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "vector": [14, 4, 0.6667, 0.0029, 4, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " targets[base.replace(os.sep, '/')] = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L229_C4", "label": "return", "type": "return", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "vector": [13, 1, 0.6696, 0.0029, 1, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return targets"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "label": "cleanup_dir", "type": "function", "loc": [231, 251], "level": 0, "parent": null, "vector": [2, 0, 0.7047, 0.0614, 0, 0.66, 0.9286, 634, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "cleanup_dir", "arg_names": ["dir", "paths"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cleanup_dir(dir, paths):\n # Remove old generated files\n keep = []\n dir = os.path.abspath(dir)\n for path in paths:\n if not os.path.isabs(path):\n path = os.path.join(dir, path)\n path = os.path.abspath(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L233_C4", "label": "keep =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "vector": [14, 1, 0.6813, 0.0029, 1, 0.95, 0.0, 918, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "keep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " keep = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L234_C4", "label": "dir = abspath()", "type": "assigned_variable", "loc": [234, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "vector": [14, 1, 0.6842, 0.0029, 1, 0.95, 0.3333, 152, 3, 1, 0, 0, 142, 10, 1], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " dir = os.path.abspath(dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "label": "for path", "type": "for", "loc": [235, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "vector": [6, 1, 0.6959, 0.0205, 1, 0.95, 0.6667, 358, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for path in paths:\n if not os.path.isabs(path):\n path = os.path.join(dir, path)\n path = os.path.abspath(path)\n while path not in keep and path != dir:\n keep.append(path)\n path = os.path.dirname(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L236_C8", "label": "if", "type": "if", "loc": [236, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "vector": [4, 2, 0.6915, 0.0058, 2, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isabs(path):\n path = os.path.join(dir, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L237_C12", "label": "path = join()", "type": "assigned_variable", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L236_C8", "vector": [14, 3, 0.693, 0.0029, 3, 0.55, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(dir, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L238_C8", "label": "path = abspath()", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "vector": [14, 2, 0.6959, 0.0029, 2, 0.69, 0.5, 358, 3, 1, 0, 0, 142, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " path = os.path.abspath(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8", "label": "while", "type": "while", "loc": [239, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "vector": [5, 2, 0.7018, 0.0088, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while path not in keep and path != dir:\n keep.append(path)\n path = os.path.dirname(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L240_C12", "label": "append()", "type": "expression", "loc": [240, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8", "vector": [8, 3, 0.7018, 0.0029, 3, 0.6, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " keep.append(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L241_C12", "label": "path = dirname()", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8", "vector": [14, 3, 0.7047, 0.0029, 3, 0.6, 1.0, 358, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " path = os.path.dirname(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4", "label": "for root, dirs, files", "type": "for", "loc": [242, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "vector": [6, 1, 0.7208, 0.0292, 1, 0.95, 1.0, 129, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(dir):\n for name in dirs[:]:\n path = os.path.abspath(os.path.join(root, name))\n if path not in keep:\n shutil.rmtree(path)\n dirs.remove(name)\n for file in files:\n path = os.path.abspath(os.path.join(root, file))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8", "label": "for name", "type": "for", "loc": [243, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4", "vector": [6, 2, 0.7164, 0.0146, 2, 0.38, 0.0, 57, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in dirs[:]:\n path = os.path.abspath(os.path.join(root, name))\n if path not in keep:\n shutil.rmtree(path)\n dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L244_C12", "label": "path = abspath()", "type": "assigned_variable", "loc": [244, 244], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8", "vector": [14, 3, 0.7135, 0.0029, 3, 0.57, 0.0, 358, 3, 1, 0, 0, 142, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " path = os.path.abspath(os.path.join(root, name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12", "label": "if", "type": "if", "loc": [245, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8", "vector": [4, 3, 0.7193, 0.0088, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path not in keep:\n shutil.rmtree(path)\n dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L246_C16", "label": "rmtree()", "type": "expression", "loc": [246, 246], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12", "vector": [8, 4, 0.7193, 0.0029, 4, 0.27, 0.0, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L247_C16", "label": "remove()", "type": "expression", "loc": [247, 247], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12", "vector": [8, 4, 0.7222, 0.0029, 4, 0.27, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " dirs.remove(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8", "label": "for file", "type": "for", "loc": [248, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4", "vector": [6, 2, 0.7295, 0.0117, 2, 0.38, 1.0, 107, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n path = os.path.abspath(os.path.join(root, file))\n if path not in keep:\n os.remove(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L249_C12", "label": "path = abspath()", "type": "assigned_variable", "loc": [249, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8", "vector": [14, 3, 0.7281, 0.0029, 3, 0.47, 0.0, 358, 3, 1, 0, 0, 142, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " path = os.path.abspath(os.path.join(root, file))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L250_C12", "label": "if", "type": "if", "loc": [250, 251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8", "vector": [4, 3, 0.7325, 0.0058, 3, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path not in keep:\n os.remove(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L251_C16", "label": "remove()", "type": "expression", "loc": [251, 251], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L250_C12", "vector": [8, 4, 0.7339, 0.0029, 4, 0.13, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "label": "get_media_dirs", "type": "function", "loc": [253, 258], "level": 0, "parent": null, "vector": [2, 0, 0.7471, 0.0175, 0, 0.66, 0.9643, 260, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "get_media_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_media_dirs():\n from ragendja.apputils import get_app_dirs\n\n media_dirs = get_app_dirs('media')\n media_dirs['global'] = os.path.join(PROJECT_ROOT, 'media')\n return media_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L254_C4", "label": "from ragendja.apputils import get_app_dirs", "type": "import", "loc": [254, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "vector": [1, 1, 0.7427, 0.0029, 1, 0.09, 0.0, 831, 0, 1, 0, 0, 831, 0, 0], "semantic": {"name": "ragendja.apputils", "arg_names": [], "import_names": ["get_app_dirs"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ragendja.apputils import get_app_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L256_C4", "label": "media_dirs = get_app_dirs()", "type": "assigned_variable", "loc": [256, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "vector": [14, 1, 0.7485, 0.0029, 1, 0.09, 0.3333, 977, 3, 1, 0, 0, 126, 10, 1], "semantic": {"name": "media_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "get_app_dirs", "annotation": ""}, "snippet": " media_dirs = get_app_dirs('media')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L257_C4", "label": " = join()", "type": "assigned_variable", "loc": [257, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "vector": [14, 1, 0.7515, 0.0029, 1, 0.09, 0.6667, 0, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " media_dirs['global'] = os.path.join(PROJECT_ROOT, 'media')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "vector": [13, 1, 0.7544, 0.0029, 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 media_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "label": "updatemedia", "type": "function", "loc": [260, 342], "level": 0, "parent": null, "vector": [2, 0, 0.8801, 0.2427, 0, 0.66, 1.0, 960, 0, 1, 0, 0, 0, 0, 56], "semantic": {"name": "updatemedia", "arg_names": ["compressed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def updatemedia(compressed=None):\n if 'mediautils' not in settings.INSTALLED_APPS:\n return\n\n # Remove unused media versions\n if os.path.exists(GENERATED_MEDIA):\n entries = os.listdir(GENERATED_MEDIA)\n if len(entries) != 1 or MEDIA_VERSION not in entries:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L261_C4", "label": "if", "type": "if", "loc": [261, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.7646, 0.0058, 1, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'mediautils' not in settings.INSTALLED_APPS:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L262_C8", "label": "return", "type": "return", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L261_C4", "vector": [13, 2, 0.7661, 0.0029, 2, 0.5, 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_226:If_L265_C4", "label": "if", "type": "if", "loc": [265, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.7792, 0.0117, 1, 0.39, 0.0476, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(GENERATED_MEDIA):\n entries = os.listdir(GENERATED_MEDIA)\n if len(entries) != 1 or MEDIA_VERSION not in entries:\n shutil.rmtree(GENERATED_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L266_C8", "label": "entries = listdir()", "type": "assigned_variable", "loc": [266, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L265_C4", "vector": [14, 2, 0.7778, 0.0029, 2, 0.91, 0.0, 764, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "entries", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " entries = os.listdir(GENERATED_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L267_C8", "label": "if", "type": "if", "loc": [267, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L265_C4", "vector": [4, 2, 0.7822, 0.0058, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(entries) != 1 or MEDIA_VERSION not in entries:\n shutil.rmtree(GENERATED_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L268_C12", "label": "rmtree()", "type": "expression", "loc": [268, 268], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L267_C8", "vector": [8, 3, 0.7836, 0.0029, 3, 0.84, 0.0, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(GENERATED_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L270_C4", "label": "from ragendja.apputils import get_app_dirs", "type": "import", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [1, 1, 0.7895, 0.0029, 1, 0.39, 0.0952, 831, 0, 1, 0, 0, 831, 0, 0], "semantic": {"name": "ragendja.apputils", "arg_names": [], "import_names": ["get_app_dirs"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ragendja.apputils import get_app_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L274_C4", "label": "mtime = getmtime()", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8012, 0.0029, 1, 0.39, 0.1429, 900, 3, 1, 0, 0, 561, 10, 2], "semantic": {"name": "mtime", "arg_names": [], "import_names": [], "rhs_call_name": "getmtime", "annotation": ""}, "snippet": " mtime = getmtime(os.path.join(PROJECT_ROOT, 'settings.py'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4", "label": "for app_path", "type": "for", "loc": [275, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [6, 1, 0.8085, 0.0117, 1, 0.39, 0.1905, 899, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "app_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app_path in get_app_dirs().values():\n path = os.path.join(app_path, 'settings.py')\n if os.path.exists(path) and os.path.getmtime(path) > mtime:\n mtime = os.path.getmtime(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L276_C8", "label": "path = join()", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4", "vector": [14, 2, 0.807, 0.0029, 2, 0.98, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(app_path, 'settings.py')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L277_C8", "label": "if", "type": "if", "loc": [277, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4", "vector": [4, 2, 0.8114, 0.0058, 2, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path) and os.path.getmtime(path) > mtime:\n mtime = os.path.getmtime(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L278_C12", "label": "mtime = getmtime()", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L277_C8", "vector": [14, 3, 0.8129, 0.0029, 3, 0.92, 0.0, 900, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "mtime", "arg_names": [], "import_names": [], "rhs_call_name": "getmtime", "annotation": ""}, "snippet": " mtime = os.path.getmtime(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L279_C4", "label": "if", "type": "if", "loc": [279, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.8173, 0.0058, 1, 0.39, 0.2381, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(MEDIA_ROOT) and getmtime(MEDIA_ROOT) <= mtime:\n shutil.rmtree(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L280_C8", "label": "rmtree()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L279_C4", "vector": [8, 2, 0.8187, 0.0029, 2, 0.12, 0.0, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L282_C4", "label": "if", "type": "if", "loc": [282, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.826, 0.0058, 1, 0.39, 0.2857, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(MEDIA_ROOT):\n os.makedirs(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L283_C8", "label": "makedirs()", "type": "expression", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L282_C4", "vector": [8, 2, 0.8275, 0.0029, 2, 0.62, 0.0, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "makedirs", "arg_names": [], "import_names": [], "rhs_call_name": "makedirs", "annotation": ""}, "snippet": " os.makedirs(MEDIA_ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L284_C4", "label": "if", "type": "if", "loc": [284, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.8319, 0.0058, 1, 0.39, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(DYNAMIC_MEDIA):\n os.makedirs(DYNAMIC_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L285_C8", "label": "makedirs()", "type": "expression", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L284_C4", "vector": [8, 2, 0.8333, 0.0029, 2, 0.56, 0.0, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "makedirs", "arg_names": [], "import_names": [], "rhs_call_name": "makedirs", "annotation": ""}, "snippet": " os.makedirs(DYNAMIC_MEDIA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L287_C4", "label": "if", "type": "if", "loc": [287, 288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [4, 1, 0.8406, 0.0058, 1, 0.39, 0.381, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compressed is None:\n compressed = not getattr(settings, 'FORCE_UNCOMPRESSED_MEDIA', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L288_C8", "label": "compressed =", "type": "assigned_variable", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L287_C4", "vector": [14, 2, 0.8421, 0.0029, 2, 0.77, 0.0, 709, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "compressed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compressed = not getattr(settings, 'FORCE_UNCOMPRESSED_MEDIA', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L290_C4", "label": "media_dirs = get_media_dirs()", "type": "assigned_variable", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.848, 0.0029, 1, 0.39, 0.4286, 977, 3, 0, 0, 0, 260, 10, 1], "semantic": {"name": "media_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "get_media_dirs", "annotation": ""}, "snippet": " media_dirs = get_media_dirs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L291_C4", "label": "data =", "type": "assigned_variable", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8509, 0.0029, 1, 0.39, 0.4762, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'media_dirs': media_dirs}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L292_C4", "label": "targets = get_targets()", "type": "assigned_variable", "loc": [292, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8538, 0.0029, 1, 0.39, 0.5238, 409, 3, 1, 0, 0, 396, 10, 1], "semantic": {"name": "targets", "arg_names": [], "import_names": [], "rhs_call_name": "get_targets", "annotation": ""}, "snippet": " targets = get_targets(**data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L293_C4", "label": "copy_targets = get_copy_targets()", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8567, 0.0029, 1, 0.39, 0.5714, 356, 3, 1, 0, 0, 103, 10, 1], "semantic": {"name": "copy_targets", "arg_names": [], "import_names": [], "rhs_call_name": "get_copy_targets", "annotation": ""}, "snippet": " copy_targets = get_copy_targets(**data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L294_C4", "label": "target_names =", "type": "assigned_variable", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8596, 0.0029, 1, 0.39, 0.619, 17, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_names = [target[0] for target in targets]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L297_C4", "label": "cleanup_dir()", "type": "expression", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [8, 1, 0.8684, 0.0029, 1, 0.39, 0.6667, 634, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "cleanup_dir", "arg_names": [], "import_names": [], "rhs_call_name": "cleanup_dir", "annotation": ""}, "snippet": " cleanup_dir(MEDIA_ROOT, target_names + copy_targets.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L298_C4", "label": "dynamic_files =", "type": "assigned_variable", "loc": [298, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.8713, 0.0029, 1, 0.39, 0.7143, 322, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "dynamic_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dynamic_files = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L299_C4", "label": "for target, kwargs, group", "type": "for", "loc": [299, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [6, 1, 0.8787, 0.0117, 1, 0.39, 0.7619, 618, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "target, kwargs, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target, kwargs, group in targets:\n for handler in group:\n if callable(handler):\n dynamic_files.append(get_file_path(handler, **kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L300_C8", "label": "for handler", "type": "for", "loc": [300, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L299_C4", "vector": [6, 2, 0.8801, 0.0088, 2, 0.81, 0.0, 388, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for handler in group:\n if callable(handler):\n dynamic_files.append(get_file_path(handler, **kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L301_C12", "label": "if", "type": "if", "loc": [301, 302], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L300_C8", "vector": [4, 3, 0.8816, 0.0058, 3, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(handler):\n dynamic_files.append(get_file_path(handler, **kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L302_C16", "label": "append()", "type": "expression", "loc": [302, 302], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L301_C12", "vector": [8, 4, 0.883, 0.0029, 4, 0.9, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " dynamic_files.append(get_file_path(handler, **kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L303_C4", "label": "cleanup_dir()", "type": "expression", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [8, 1, 0.886, 0.0029, 1, 0.39, 0.8095, 634, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cleanup_dir", "arg_names": [], "import_names": [], "rhs_call_name": "cleanup_dir", "annotation": ""}, "snippet": " cleanup_dir(DYNAMIC_MEDIA, dynamic_files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "label": "for target", "type": "for", "loc": [306, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [6, 1, 0.9079, 0.0292, 1, 0.39, 0.8571, 766, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target in sorted(copy_targets.keys()):\n # Only overwrite files if they've been modified. Also, only\n # copy files that won't get combined.\n path = copy_targets[target]\n generated = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))\n if os.path.exists(generated) and \\\n getmtime(generated) >= getmtime(path):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L309_C8", "label": "path =", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "vector": [14, 2, 0.9035, 0.0029, 2, 0.84, 0.0, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = copy_targets[target]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L310_C8", "label": "generated = join()", "type": "assigned_variable", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "vector": [14, 2, 0.9064, 0.0029, 2, 0.84, 0.25, 581, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "generated", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " generated = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L311_C8", "label": "if", "type": "if", "loc": [311, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "vector": [4, 2, 0.9123, 0.0088, 2, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(generated) and \\\n getmtime(generated) >= getmtime(path):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L314_C8", "label": "print()", "type": "expression", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "vector": [8, 2, 0.9181, 0.0029, 2, 0.84, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Copying %s...' % target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L315_C8", "label": "copy_file()", "type": "expression", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "vector": [8, 2, 0.9211, 0.0029, 2, 0.84, 1.0, 196, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_file", "arg_names": [], "import_names": [], "rhs_call_name": "copy_file", "annotation": ""}, "snippet": " copy_file(path, generated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L318_C4", "label": "cache =", "type": "assigned_variable", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [14, 1, 0.9298, 0.0029, 1, 0.39, 0.9048, 419, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L319_C4", "label": "for target, kwargs, group", "type": "for", "loc": [319, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [6, 1, 0.9371, 0.0117, 1, 0.39, 0.9524, 618, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "target, kwargs, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target, kwargs, group in targets:\n for handler in group:\n if callable(handler):\n update_dynamic_file(handler, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L320_C8", "label": "for handler", "type": "for", "loc": [320, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L319_C4", "vector": [6, 2, 0.9386, 0.0088, 2, 0.31, 0.0, 388, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for handler in group:\n if callable(handler):\n update_dynamic_file(handler, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L321_C12", "label": "if", "type": "if", "loc": [321, 322], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L320_C8", "vector": [4, 3, 0.9401, 0.0058, 3, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(handler):\n update_dynamic_file(handler, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L322_C16", "label": "update_dynamic_file()", "type": "expression", "loc": [322, 322], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L321_C12", "vector": [8, 4, 0.9415, 0.0029, 4, 0.48, 0.0, 81, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "update_dynamic_file", "arg_names": [], "import_names": [], "rhs_call_name": "update_dynamic_file", "annotation": ""}, "snippet": " update_dynamic_file(handler, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "label": "for target, kwargs, group", "type": "for", "loc": [325, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "vector": [6, 1, 0.9751, 0.0526, 1, 0.39, 1.0, 618, 2, 0, 0, 0, 0, 0, 16], "semantic": {"name": "target, kwargs, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target, kwargs, group in targets:\n files = [get_file_path(handler, **kwargs) for handler in group]\n path = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))\n # Only overwrite files if they've been modified\n if os.path.exists(path):\n target_mtime = getmtime(path)\n if not [1 for name in files if os.path.exists(name) and\n getmtime(name) >= target_mtime]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L326_C8", "label": "files =", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [14, 2, 0.9532, 0.0029, 2, 0.66, 0.0, 598, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " files = [get_file_path(handler, **kwargs) for handler in group]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L327_C8", "label": "path = join()", "type": "assigned_variable", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [14, 2, 0.9561, 0.0029, 2, 0.66, 0.1111, 358, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(MEDIA_ROOT, target.replace('/', os.sep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8", "label": "if", "type": "if", "loc": [329, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [4, 2, 0.9678, 0.0146, 2, 0.66, 0.2222, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path):\n target_mtime = getmtime(path)\n if not [1 for name in files if os.path.exists(name) and\n getmtime(name) >= target_mtime]:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L330_C12", "label": "target_mtime = getmtime()", "type": "assigned_variable", "loc": [330, 330], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8", "vector": [14, 3, 0.9649, 0.0029, 3, 0.3, 0.0, 595, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "target_mtime", "arg_names": [], "import_names": [], "rhs_call_name": "getmtime", "annotation": ""}, "snippet": " target_mtime = getmtime(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L331_C12", "label": "if", "type": "if", "loc": [331, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8", "vector": [4, 3, 0.9708, 0.0088, 3, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not [1 for name in files if os.path.exists(name) and\n getmtime(name) >= target_mtime]:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L334_C8", "label": "print()", "type": "expression", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [8, 2, 0.9766, 0.0029, 2, 0.66, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Combining %s...' % target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L335_C8", "label": "dirpath = dirname()", "type": "assigned_variable", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [14, 2, 0.9795, 0.0029, 2, 0.66, 0.4444, 600, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "dirpath", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " dirpath = os.path.dirname(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L336_C8", "label": "if", "type": "if", "loc": [336, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [4, 2, 0.9839, 0.0058, 2, 0.66, 0.5556, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(dirpath):\n os.makedirs(dirpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L337_C12", "label": "makedirs()", "type": "expression", "loc": [337, 337], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L336_C8", "vector": [8, 3, 0.9854, 0.0029, 3, 0.79, 0.0, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "makedirs", "arg_names": [], "import_names": [], "rhs_call_name": "makedirs", "annotation": ""}, "snippet": " os.makedirs(dirpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L338_C8", "label": "file = open()", "type": "assigned_variable", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [14, 2, 0.9883, 0.0029, 2, 0.66, 0.6667, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(path, 'w', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L339_C8", "label": "write()", "type": "expression", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [8, 2, 0.9912, 0.0029, 2, 0.66, 0.7778, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(get_target_content(group, cache, **kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L340_C8", "label": "close()", "type": "expression", "loc": [340, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [8, 2, 0.9942, 0.0029, 2, 0.66, 0.8889, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:If_L341_C8", "label": "if", "type": "if", "loc": [341, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "vector": [4, 2, 0.9985, 0.0058, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compressed:\n compress_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L342_C12", "label": "compress_file()", "type": "expression", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_226:If_L341_C8", "vector": [8, 3, 1.0, 0.0029, 3, 0.31, 0.0, 505, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "compress_file", "arg_names": [], "import_names": [], "rhs_call_name": "compress_file", "annotation": ""}, "snippet": " compress_file(path)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L100_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:While_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:While_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L139_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:Try_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L142_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L192_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L194_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L196_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L197_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L202_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L204_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L207_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L220_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L221_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L221_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L222_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L226_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L227_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L223_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L228_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L240_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:While_L239_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L244_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L246_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L245_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L247_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L242_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L248_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L250_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L251_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Return_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:ImportFrom_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L300_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L302_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L322_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L330_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L329_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L337_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Assign_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:For_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_226:If_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_226:If_L341_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_226:Expr_L342_C12"}] |
# -*- coding: utf-8 -*-
from os.path import getmtime
import codecs, os
def updatemessages():
from django.conf import settings
if not settings.USE_I18N:
return
from django.core.management.commands.compilemessages import compile_messages
if any([needs_update(path) for path in settings.LOCALE_PATHS]):
compile_messages()
LOCALE_PATHS = settings.LOCALE_PATHS
settings.LOCALE_PATHS = ()
cwd = os.getcwdu()
for app in settings.INSTALLED_APPS:
path = os.path.dirname(__import__(app, {}, {}, ['']).__file__)
locale = os.path.join(path, 'locale')
if os.path.isdir(locale):
# Copy Python translations into JavaScript translations
update_js_translations(locale)
if needs_update(locale):
os.chdir(path)
compile_messages()
settings.LOCALE_PATHS = LOCALE_PATHS
os.chdir(cwd)
def needs_update(locale):
for root, dirs, files in os.walk(locale):
po_files = [os.path.join(root, file)
for file in files if file.endswith('.po')]
for po_file in po_files:
mo_file = po_file[:-2] + 'mo'
if not os.path.exists(mo_file) or \
getmtime(po_file) > getmtime(mo_file):
return True
return False
def update_js_translations(locale):
for lang in os.listdir(locale):
base_path = os.path.join(locale, lang, 'LC_MESSAGES')
py_file = os.path.join(base_path, 'django.po')
js_file = os.path.join(base_path, 'djangojs.po')
modified = False
if os.path.exists(py_file) and os.path.exists(js_file):
py_lines, py_mapping = load_translations(py_file)
js_lines, js_mapping = load_translations(js_file)
for msgid in js_mapping:
if msgid in py_mapping:
py_index = py_mapping[msgid]
js_index = js_mapping[msgid]
if py_lines[py_index] != js_lines[js_index]:
modified = True
# Copy comment to JS, too
if js_index >= 2 and py_index >= 2:
if js_lines[js_index - 2].startswith('#') and \
py_lines[py_index - 2].startswith('#'):
js_lines[js_index - 2] = py_lines[py_index - 2]
js_lines[js_index] = py_lines[py_index]
if modified:
print 'Updating JS locale for %s' % os.path.join(locale, lang)
file = codecs.open(js_file, 'w', 'utf-8')
file.write(''.join(js_lines))
file.close()
def load_translations(path):
"""Loads translations grouped into logical sections."""
file = codecs.open(path, 'r', 'utf-8')
lines = file.readlines()
file.close()
mapping = {}
msgid = None
start = -1
resultlines = []
for index, line in enumerate(lines):
# Group comments
if line.startswith('#'):
if resultlines and resultlines[-1].startswith('#'):
resultlines[-1] = resultlines[-1] + lines[index]
else:
resultlines.append(lines[index])
continue
if msgid is not None and (not line.strip() or line.startswith('msgid ')):
mapping[msgid] = len(resultlines)
resultlines.append(''.join(lines[start:index]))
msgid = None
start = -1
if line.startswith('msgid '):
line = line[len('msgid'):].strip()
start = -1
msgid = ''
if start < 0 and line.startswith('"'):
msgid += line.strip()[1:-1]
resultlines.append(lines[index])
continue
if line.startswith('msgstr') and start < 0:
start = index
if start < 0:
if resultlines and not resultlines[-1].startswith('msgstr'):
resultlines[-1] = resultlines[-1] + lines[index]
else:
resultlines.append(lines[index])
if msgid and start:
mapping[msgid] = len(resultlines)
resultlines.append(''.join(lines[start:]))
return resultlines, mapping
| ajibawa-2023/Python-Code-Large/train/row_227 | 89 | 112 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_227:ImportFrom_L2_C0", "label": "from os.path import getmtime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0089, 0, 0.66, 0.0, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["getmtime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os.path import getmtime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Import_L3_C0", "label": "codecs import codecs, os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0268, 0.0089, 0, 0.66, 0.2, 220, 0, 2, 0, 0, 220, 0, 0], "semantic": {"name": "codecs", "arg_names": [], "import_names": ["codecs", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import codecs, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "label": "updatemessages", "type": "function", "loc": [5, 25], "level": 0, "parent": null, "vector": [2, 0, 0.1339, 0.1875, 0, 0.66, 0.4, 813, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "updatemessages", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def updatemessages():\n from django.conf import settings\n if not settings.USE_I18N:\n return\n from django.core.management.commands.compilemessages import compile_messages\n if any([needs_update(path) for path in settings.LOCALE_PATHS]):\n compile_messages()\n LOCALE_PATHS = settings.LOCALE_PATHS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:ImportFrom_L6_C4", "label": "from django.conf import settings", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [1, 1, 0.0536, 0.0089, 1, 0.91, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L7_C4", "label": "if", "type": "if", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [4, 1, 0.067, 0.0179, 1, 0.91, 0.1111, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not settings.USE_I18N:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L7_C4", "vector": [13, 2, 0.0714, 0.0089, 2, 0.34, 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_227:ImportFrom_L9_C4", "label": "from django.core.management.commands.compilemessages import compile_messages", "type": "import", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [1, 1, 0.0804, 0.0089, 1, 0.91, 0.2222, 914, 0, 1, 0, 0, 914, 0, 0], "semantic": {"name": "django.core.management.commands.compilemessages", "arg_names": [], "import_names": ["compile_messages"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.core.management.commands.compilemessages import compile_messages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L10_C4", "label": "if", "type": "if", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [4, 1, 0.0938, 0.0179, 1, 0.91, 0.3333, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if any([needs_update(path) for path in settings.LOCALE_PATHS]):\n compile_messages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L11_C8", "label": "compile_messages()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L10_C4", "vector": [8, 2, 0.0982, 0.0089, 2, 0.31, 0.0, 217, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "compile_messages", "arg_names": [], "import_names": [], "rhs_call_name": "compile_messages", "annotation": ""}, "snippet": " compile_messages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L12_C4", "label": "LOCALE_PATHS =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [14, 1, 0.1071, 0.0089, 1, 0.91, 0.4444, 801, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCALE_PATHS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCALE_PATHS = settings.LOCALE_PATHS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L13_C4", "label": "settings.LOCALE_PATHS =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [14, 1, 0.1161, 0.0089, 1, 0.91, 0.5556, 252, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "settings.LOCALE_PATHS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.LOCALE_PATHS = ()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L14_C4", "label": "cwd = getcwdu()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [14, 1, 0.125, 0.0089, 1, 0.91, 0.6667, 898, 3, 0, 0, 0, 4, 10, 1], "semantic": {"name": "cwd", "arg_names": [], "import_names": [], "rhs_call_name": "getcwdu", "annotation": ""}, "snippet": " cwd = os.getcwdu()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "label": "for app", "type": "for", "loc": [15, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [6, 1, 0.1696, 0.0804, 1, 0.91, 0.7778, 494, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app in settings.INSTALLED_APPS:\n path = os.path.dirname(__import__(app, {}, {}, ['']).__file__)\n locale = os.path.join(path, 'locale')\n if os.path.isdir(locale):\n # Copy Python translations into JavaScript translations\n update_js_translations(locale)\n if needs_update(locale):\n os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L16_C8", "label": "path = dirname()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "vector": [14, 2, 0.1429, 0.0089, 2, 0.37, 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(__import__(app, {}, {}, ['']).__file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L17_C8", "label": "locale = join()", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "vector": [14, 2, 0.1518, 0.0089, 2, 0.37, 0.5, 884, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "locale", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " locale = os.path.join(path, 'locale')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8", "label": "if", "type": "if", "loc": [18, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "vector": [4, 2, 0.183, 0.0536, 2, 0.37, 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(locale):\n # Copy Python translations into JavaScript translations\n update_js_translations(locale)\n if needs_update(locale):\n os.chdir(path)\n compile_messages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L20_C12", "label": "update_js_translations()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8", "vector": [8, 3, 0.1786, 0.0089, 3, 0.09, 0.0, 199, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_js_translations", "arg_names": [], "import_names": [], "rhs_call_name": "update_js_translations", "annotation": ""}, "snippet": " update_js_translations(locale)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12", "label": "if", "type": "if", "loc": [21, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8", "vector": [4, 3, 0.1964, 0.0268, 3, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if needs_update(locale):\n os.chdir(path)\n compile_messages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L22_C16", "label": "chdir()", "type": "expression", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12", "vector": [8, 4, 0.1964, 0.0089, 4, 0.44, 0.0, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L23_C16", "label": "compile_messages()", "type": "expression", "loc": [23, 23], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12", "vector": [8, 4, 0.2054, 0.0089, 4, 0.44, 1.0, 217, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "compile_messages", "arg_names": [], "import_names": [], "rhs_call_name": "compile_messages", "annotation": ""}, "snippet": " compile_messages()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L24_C4", "label": "settings.LOCALE_PATHS =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [14, 1, 0.2143, 0.0089, 1, 0.91, 0.8889, 252, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.LOCALE_PATHS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.LOCALE_PATHS = LOCALE_PATHS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L25_C4", "label": "chdir()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "vector": [8, 1, 0.2232, 0.0089, 1, 0.91, 1.0, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L27_C0", "label": "needs_update", "type": "function", "loc": [27, 36], "level": 0, "parent": null, "vector": [2, 0, 0.2812, 0.0893, 0, 0.66, 0.6, 786, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "needs_update", "arg_names": ["locale"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def needs_update(locale):\n for root, dirs, files in os.walk(locale):\n po_files = [os.path.join(root, file)\n for file in files if file.endswith('.po')]\n for po_file in po_files:\n mo_file = po_file[:-2] + 'mo'\n if not os.path.exists(mo_file) or \\\n getmtime(po_file) > getmtime(mo_file):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4", "label": "for root, dirs, files", "type": "for", "loc": [28, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L27_C0", "vector": [6, 1, 0.2812, 0.0714, 1, 0.24, 0.0, 129, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(locale):\n po_files = [os.path.join(root, file)\n for file in files if file.endswith('.po')]\n for po_file in po_files:\n mo_file = po_file[:-2] + 'mo'\n if not os.path.exists(mo_file) or \\\n getmtime(po_file) > getmtime(mo_file):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L29_C8", "label": "po_files =", "type": "assigned_variable", "loc": [29, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4", "vector": [14, 2, 0.2634, 0.0179, 2, 0.85, 0.0, 628, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "po_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " po_files = [os.path.join(root, file)\n for file in files if file.endswith('.po')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8", "label": "for po_file", "type": "for", "loc": [31, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4", "vector": [6, 2, 0.2946, 0.0446, 2, 0.85, 1.0, 318, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "po_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for po_file in po_files:\n mo_file = po_file[:-2] + 'mo'\n if not os.path.exists(mo_file) or \\\n getmtime(po_file) > getmtime(mo_file):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L32_C12", "label": "mo_file =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8", "vector": [14, 3, 0.2857, 0.0089, 3, 0.94, 0.0, 437, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mo_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mo_file = po_file[:-2] + 'mo'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L33_C12", "label": "if", "type": "if", "loc": [33, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8", "vector": [4, 3, 0.3036, 0.0268, 3, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(mo_file) or \\\n getmtime(po_file) > getmtime(mo_file):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L35_C16", "label": "return", "type": "return", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L33_C12", "vector": [13, 4, 0.3125, 0.0089, 4, 0.17, 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_227:Return_L36_C4", "label": "return", "type": "return", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L27_C0", "vector": [13, 1, 0.3214, 0.0089, 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_227:FunctionDef_L38_C0", "label": "update_js_translations", "type": "function", "loc": [38, 64], "level": 0, "parent": null, "vector": [2, 0, 0.4554, 0.2411, 0, 0.66, 0.8, 199, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "update_js_translations", "arg_names": ["locale"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update_js_translations(locale):\n for lang in os.listdir(locale):\n base_path = os.path.join(locale, lang, 'LC_MESSAGES')\n py_file = os.path.join(base_path, 'django.po')\n js_file = os.path.join(base_path, 'djangojs.po')\n modified = False\n if os.path.exists(py_file) and os.path.exists(js_file):\n py_lines, py_mapping = load_translations(py_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "label": "for lang", "type": "for", "loc": [39, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L38_C0", "vector": [6, 1, 0.4598, 0.2321, 1, 0.8, 0.0, 312, 3, 0, 0, 0, 0, 0, 16], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang in os.listdir(locale):\n base_path = os.path.join(locale, lang, 'LC_MESSAGES')\n py_file = os.path.join(base_path, 'django.po')\n js_file = os.path.join(base_path, 'djangojs.po')\n modified = False\n if os.path.exists(py_file) and os.path.exists(js_file):\n py_lines, py_mapping = load_translations(py_file)\n js_lines, js_mapping = load_translations(js_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L40_C8", "label": "base_path = join()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [14, 2, 0.3571, 0.0089, 2, 0.24, 0.0, 815, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "base_path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " base_path = os.path.join(locale, lang, 'LC_MESSAGES')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L41_C8", "label": "py_file = join()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [14, 2, 0.3661, 0.0089, 2, 0.24, 0.2, 44, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " py_file = os.path.join(base_path, 'django.po')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L42_C8", "label": "js_file = join()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [14, 2, 0.375, 0.0089, 2, 0.24, 0.4, 922, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "js_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " js_file = os.path.join(base_path, 'djangojs.po')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L43_C8", "label": "modified =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [14, 2, 0.3839, 0.0089, 2, 0.24, 0.6, 150, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "label": "if", "type": "if", "loc": [44, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [4, 2, 0.4554, 0.1339, 2, 0.24, 0.8, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(py_file) and os.path.exists(js_file):\n py_lines, py_mapping = load_translations(py_file)\n js_lines, js_mapping = load_translations(js_file)\n for msgid in js_mapping:\n if msgid in py_mapping:\n py_index = py_mapping[msgid]\n js_index = js_mapping[msgid]\n if py_lines[py_index] != js_lines[js_index]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L45_C12", "label": "py_lines, py_mapping = load_translations()", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "vector": [14, 3, 0.4018, 0.0089, 3, 0.08, 0.0, 688, 3, 1, 0, 0, 942, 10, 1], "semantic": {"name": "py_lines, py_mapping", "arg_names": [], "import_names": [], "rhs_call_name": "load_translations", "annotation": ""}, "snippet": " py_lines, py_mapping = load_translations(py_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L46_C12", "label": "js_lines, js_mapping = load_translations()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "vector": [14, 3, 0.4107, 0.0089, 3, 0.08, 0.5, 577, 3, 1, 0, 0, 942, 10, 1], "semantic": {"name": "js_lines, js_mapping", "arg_names": [], "import_names": [], "rhs_call_name": "load_translations", "annotation": ""}, "snippet": " js_lines, js_mapping = load_translations(js_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L47_C12", "label": "for msgid", "type": "for", "loc": [47, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "vector": [6, 3, 0.4688, 0.1071, 3, 0.08, 1.0, 837, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "msgid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for msgid in js_mapping:\n if msgid in py_mapping:\n py_index = py_mapping[msgid]\n js_index = js_mapping[msgid]\n if py_lines[py_index] != js_lines[js_index]:\n modified = True\n # Copy comment to JS, too\n if js_index >= 2 and py_index >= 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "label": "if", "type": "if", "loc": [48, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L47_C12", "vector": [4, 4, 0.4732, 0.0982, 4, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if msgid in py_mapping:\n py_index = py_mapping[msgid]\n js_index = js_mapping[msgid]\n if py_lines[py_index] != js_lines[js_index]:\n modified = True\n # Copy comment to JS, too\n if js_index >= 2 and py_index >= 2:\n if js_lines[js_index - 2].startswith('#') and \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L49_C20", "label": "py_index =", "type": "assigned_variable", "loc": [49, 49], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "vector": [14, 5, 0.4375, 0.0089, 5, 0.03, 0.0, 984, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_index = py_mapping[msgid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L50_C20", "label": "js_index =", "type": "assigned_variable", "loc": [50, 50], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "vector": [14, 5, 0.4464, 0.0089, 5, 0.03, 0.5, 563, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "js_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " js_index = js_mapping[msgid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "label": "if", "type": "if", "loc": [51, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "vector": [4, 5, 0.4866, 0.0714, 5, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if py_lines[py_index] != js_lines[js_index]:\n modified = True\n # Copy comment to JS, too\n if js_index >= 2 and py_index >= 2:\n if js_lines[js_index - 2].startswith('#') and \\\n py_lines[py_index - 2].startswith('#'):\n js_lines[js_index - 2] = py_lines[py_index - 2]\n js_lines[js_index] = py_lines[py_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L52_C24", "label": "modified =", "type": "assigned_variable", "loc": [52, 52], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "vector": [14, 6, 0.4643, 0.0089, 6, 0.17, 0.0, 150, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L54_C24", "label": "if", "type": "if", "loc": [54, 57], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "vector": [4, 6, 0.4955, 0.0357, 6, 0.17, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if js_index >= 2 and py_index >= 2:\n if js_lines[js_index - 2].startswith('#') and \\\n py_lines[py_index - 2].startswith('#'):\n js_lines[js_index - 2] = py_lines[py_index - 2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L55_C28", "label": "if", "type": "if", "loc": [55, 57], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L54_C24", "vector": [4, 7, 0.5, 0.0268, 7, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if js_lines[js_index - 2].startswith('#') and \\\n py_lines[py_index - 2].startswith('#'):\n js_lines[js_index - 2] = py_lines[py_index - 2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L57_C32", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L55_C28", "vector": [14, 8, 0.5089, 0.0089, 8, 0.65, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " js_lines[js_index - 2] = py_lines[py_index - 2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L58_C24", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "vector": [14, 6, 0.5179, 0.0089, 6, 0.17, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " js_lines[js_index] = py_lines[py_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "label": "if", "type": "if", "loc": [60, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "vector": [4, 2, 0.5536, 0.0446, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modified:\n print('Updating JS locale for %s' % os.path.join(locale, lang))\n file = codecs.open(js_file, 'w', 'utf-8')\n file.write(''.join(js_lines))\n file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L61_C12", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "vector": [8, 3, 0.5446, 0.0089, 3, 0.52, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Updating JS locale for %s' % os.path.join(locale, lang))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L62_C12", "label": "file = open()", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "vector": [14, 3, 0.5536, 0.0089, 3, 0.52, 0.3333, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(js_file, 'w', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L63_C12", "label": "write()", "type": "expression", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "vector": [8, 3, 0.5625, 0.0089, 3, 0.52, 0.6667, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(''.join(js_lines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L64_C12", "label": "close()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "vector": [8, 3, 0.5714, 0.0089, 3, 0.52, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "label": "load_translations", "type": "function", "loc": [66, 112], "level": 0, "parent": null, "vector": [2, 0, 0.7946, 0.4196, 0, 0.66, 1.0, 942, 0, 1, 1, 0, 0, 0, 24], "semantic": {"name": "load_translations", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load_translations(path):\n \"\"\"Loads translations grouped into logical sections.\"\"\"\n file = codecs.open(path, 'r', 'utf-8')\n lines = file.readlines()\n file.close()\n mapping = {}\n msgid = None\n start = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [8, 1, 0.5982, 0.0089, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Loads translations grouped into logical sections.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L68_C4", "label": "file = open()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6071, 0.0089, 1, 0.46, 0.1, 107, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = codecs.open(path, 'r', 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L69_C4", "label": "lines = readlines()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6161, 0.0089, 1, 0.46, 0.2, 73, 3, 0, 0, 0, 841, 10, 1], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "readlines", "annotation": ""}, "snippet": " lines = file.readlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L70_C4", "label": "close()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [8, 1, 0.625, 0.0089, 1, 0.46, 0.3, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L71_C4", "label": "mapping =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6339, 0.0089, 1, 0.46, 0.4, 351, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "mapping", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mapping = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L72_C4", "label": "msgid =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6429, 0.0089, 1, 0.46, 0.5, 837, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "msgid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msgid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L73_C4", "label": "start =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6518, 0.0089, 1, 0.46, 0.6, 511, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L74_C4", "label": "resultlines =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [14, 1, 0.6607, 0.0089, 1, 0.46, 0.7, 410, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultlines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultlines = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "label": "for index, line", "type": "for", "loc": [75, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [6, 1, 0.808, 0.2857, 1, 0.46, 0.8, 364, 3, 0, 0, 0, 0, 0, 18], "semantic": {"name": "index, line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index, line in enumerate(lines):\n # Group comments\n if line.startswith('#'):\n if resultlines and resultlines[-1].startswith('#'):\n resultlines[-1] = resultlines[-1] + lines[index]\n else:\n resultlines.append(lines[index])\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L77_C8", "label": "if", "type": "if", "loc": [77, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.7098, 0.0536, 2, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('#'):\n if resultlines and resultlines[-1].startswith('#'):\n resultlines[-1] = resultlines[-1] + lines[index]\n else:\n resultlines.append(lines[index])\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12", "label": "if", "type": "if", "loc": [78, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L77_C8", "vector": [4, 3, 0.7098, 0.0357, 3, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resultlines and resultlines[-1].startswith('#'):\n resultlines[-1] = resultlines[-1] + lines[index]\n else:\n resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L79_C16", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12", "vector": [14, 4, 0.7054, 0.0089, 4, 0.21, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultlines[-1] = resultlines[-1] + lines[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L81_C16", "label": "append()", "type": "expression", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12", "vector": [8, 4, 0.7232, 0.0089, 4, 0.21, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "label": "if", "type": "if", "loc": [84, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.7679, 0.0446, 2, 0.32, 0.2, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if msgid is not None and (not line.strip() or line.startswith('msgid ')):\n mapping[msgid] = len(resultlines)\n resultlines.append(''.join(lines[start:index]))\n msgid = None\n start = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L85_C12", "label": " = len()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "vector": [14, 3, 0.7589, 0.0089, 3, 0.24, 0.0, 0, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " mapping[msgid] = len(resultlines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L86_C12", "label": "append()", "type": "expression", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "vector": [8, 3, 0.7679, 0.0089, 3, 0.24, 0.3333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " resultlines.append(''.join(lines[start:index]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L87_C12", "label": "msgid =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "vector": [14, 3, 0.7768, 0.0089, 3, 0.24, 0.6667, 837, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "msgid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msgid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L88_C12", "label": "start =", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "vector": [14, 3, 0.7857, 0.0089, 3, 0.24, 1.0, 511, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "label": "if", "type": "if", "loc": [90, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.817, 0.0357, 2, 0.32, 0.4, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('msgid '):\n line = line[len('msgid'):].strip()\n start = -1\n msgid = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L91_C12", "label": "line = strip()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "vector": [14, 3, 0.8125, 0.0089, 3, 0.13, 0.0, 373, 3, 0, 0, 0, 973, 10, 2], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " line = line[len('msgid'):].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L92_C12", "label": "start =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "vector": [14, 3, 0.8214, 0.0089, 3, 0.13, 0.5, 511, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L93_C12", "label": "msgid =", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "vector": [14, 3, 0.8304, 0.0089, 3, 0.13, 1.0, 837, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msgid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msgid = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L94_C8", "label": "if", "type": "if", "loc": [94, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.8527, 0.0357, 2, 0.32, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start < 0 and line.startswith('\"'):\n msgid += line.strip()[1:-1]\n resultlines.append(lines[index])\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L96_C12", "label": "append()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L94_C8", "vector": [8, 3, 0.8571, 0.0089, 3, 0.01, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L99_C8", "label": "if", "type": "if", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.8884, 0.0179, 2, 0.32, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('msgstr') and start < 0:\n start = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L100_C12", "label": "start =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L99_C8", "vector": [14, 3, 0.8929, 0.0089, 3, 0.01, 0.0, 511, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L102_C8", "label": "if", "type": "if", "loc": [102, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "vector": [4, 2, 0.9286, 0.0446, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start < 0:\n if resultlines and not resultlines[-1].startswith('msgstr'):\n resultlines[-1] = resultlines[-1] + lines[index]\n else:\n resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12", "label": "if", "type": "if", "loc": [103, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L102_C8", "vector": [4, 3, 0.933, 0.0357, 3, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resultlines and not resultlines[-1].startswith('msgstr'):\n resultlines[-1] = resultlines[-1] + lines[index]\n else:\n resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L104_C16", "label": "assign", "type": "assigned_variable", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12", "vector": [14, 4, 0.9286, 0.0089, 4, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultlines[-1] = resultlines[-1] + lines[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L106_C16", "label": "append()", "type": "expression", "loc": [106, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12", "vector": [8, 4, 0.9464, 0.0089, 4, 0.51, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " resultlines.append(lines[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4", "label": "if", "type": "if", "loc": [108, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [4, 1, 0.9732, 0.0268, 1, 0.46, 0.9, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if msgid and start:\n mapping[msgid] = len(resultlines)\n resultlines.append(''.join(lines[start:]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L109_C8", "label": " = len()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4", "vector": [14, 2, 0.9732, 0.0089, 2, 0.29, 0.0, 0, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " mapping[msgid] = len(resultlines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L110_C8", "label": "append()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4", "vector": [8, 2, 0.9821, 0.0089, 2, 0.29, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " resultlines.append(''.join(lines[start:]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "vector": [13, 1, 1.0, 0.0089, 1, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resultlines, mapping"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L22_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L23_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L33_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L35_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L47_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L49_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L50_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L48_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L52_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L54_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L54_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L55_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L55_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L57_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L51_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L58_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:For_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L106_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:If_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_227:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_227:Return_L112_C4"}] |
# -*- coding: utf-8 -*-
"""
This app combines media files specified in the COMBINE_MEDIA setting into one
single file. It's a dictionary mapping the combined name to a tuple of files
that should be combined:
COMBINE_MEDIA = {
'global/js/combined.js': (
'global/js/main.js',
'app/js/other.js',
),
'global/css/main.css': (
'global/css/base.css',
'app/css/app.css',
)
}
The files will automatically be combined if you use manage.py runserver.
Files that shouldn't be combined are simply copied. Also, all css and js files
get compressed with yuicompressor. The result is written in a folder named
_generated_media.
If the target is a JavaScript file whose name contains the string
'%(LANGUAGE_CODE)s' it'll automatically be internationalized and multiple
files will be generated (one for each language code).
"""
from django.core.management.base import NoArgsCommand
from optparse import make_option
from mediautils.generatemedia import generatemedia, updatemedia, MEDIA_ROOT
import os, shutil
class Command(NoArgsCommand):
help = 'Combines and compresses your media files and saves them in _generated_media.'
option_list = NoArgsCommand.option_list + (
make_option('--uncompressed', action='store_true', dest='uncompressed',
help='Do not run yuicompressor on generated media.'),
make_option('--update', action='store_true', dest='update',
help='Only update changed files instead of regenerating everything.'),
)
requires_model_validation = False
def handle_noargs(self, **options):
compressed = None
if options.get('uncompressed'):
compressed = False
if options.get('update'):
updatemedia(compressed)
else:
generatemedia(compressed)
| ajibawa-2023/Python-Code-Large/train/row_228 | 16 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_228:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 26], "level": 0, "parent": null, "vector": [8, 0, 0.28, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis app combines media files specified in the COMBINE_MEDIA setting into one\nsingle file. It's a dictionary mapping the combined name to a tuple of files\nthat should be combined:\n\nCOMBINE_MEDIA = {\n 'global/js/combined.js': (\n 'global/js/main.js',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:ImportFrom_L27_C0", "label": "from django.core.management.base import NoArgsCommand", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.54, 0.02, 0, 0.66, 0.2, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.base", "arg_names": [], "import_names": ["NoArgsCommand"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management.base import NoArgsCommand"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:ImportFrom_L28_C0", "label": "from optparse import make_option", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.56, 0.02, 0, 0.66, 0.4, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["make_option"], "rhs_call_name": "", "annotation": ""}, "snippet": "from optparse import make_option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:ImportFrom_L29_C0", "label": "from mediautils.generatemedia import generatemedia, updatemedia, MEDIA_ROOT", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.58, 0.02, 0, 0.66, 0.6, 547, 0, 3, 0, 0, 547, 0, 0], "semantic": {"name": "mediautils.generatemedia", "arg_names": [], "import_names": ["generatemedia", "updatemedia", "MEDIA_ROOT"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mediautils.generatemedia import generatemedia, updatemedia, MEDIA_ROOT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Import_L30_C0", "label": "os import os, shutil", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.6, 0.02, 0, 0.66, 0.8, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "label": "Command", "type": "class", "loc": [32, 50], "level": 0, "parent": null, "vector": [3, 0, 0.82, 0.38, 0, 0.66, 1.0, 73, 0, 1, 0, 0, 795, 0, 6], "semantic": {"name": "Command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Command(NoArgsCommand):\n help = 'Combines and compresses your media files and saves them in _generated_media.'\n option_list = NoArgsCommand.option_list + (\n make_option('--uncompressed', action='store_true', dest='uncompressed',\n help='Do not run yuicompressor on generated media.'),\n make_option('--update', action='store_true', dest='update',\n help='Only update changed files instead of regenerating everything.'),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L33_C4", "label": "help =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "vector": [14, 1, 0.66, 0.02, 1, 0.65, 0.0, 868, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "help", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " help = 'Combines and compresses your media files and saves them in _generated_media.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L34_C4", "label": "option_list =", "type": "assigned_variable", "loc": [34, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "vector": [14, 1, 0.73, 0.12, 1, 0.65, 0.3333, 318, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "option_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option_list = NoArgsCommand.option_list + (\n make_option('--uncompressed', action='store_true', dest='uncompressed',\n help='Do not run yuicompressor on generated media.'),\n make_option('--update', action='store_true', dest='update',\n help='Only update changed files instead of regenerating everything.'),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L41_C4", "label": "requires_model_validation =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "vector": [14, 1, 0.82, 0.02, 1, 0.65, 0.6667, 343, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "requires_model_validation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " requires_model_validation = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "label": "handle_noargs", "type": "function", "loc": [43, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "vector": [2, 1, 0.93, 0.16, 1, 0.65, 1.0, 28, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "handle_noargs", "arg_names": ["self", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_noargs(self, **options):\n compressed = None\n if options.get('uncompressed'):\n compressed = False\n if options.get('update'):\n updatemedia(compressed)\n else:\n generatemedia(compressed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L44_C8", "label": "compressed =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "vector": [14, 2, 0.88, 0.02, 2, 0.63, 0.0, 709, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "compressed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compressed = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:If_L45_C8", "label": "if", "type": "if", "loc": [45, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "vector": [4, 2, 0.91, 0.04, 2, 0.63, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.get('uncompressed'):\n compressed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L46_C12", "label": "compressed =", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:If_L45_C8", "vector": [14, 3, 0.92, 0.02, 3, 0.14, 0.0, 709, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "compressed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compressed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8", "label": "if", "type": "if", "loc": [47, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "vector": [4, 2, 0.97, 0.08, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.get('update'):\n updatemedia(compressed)\n else:\n generatemedia(compressed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Expr_L48_C12", "label": "updatemedia()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8", "vector": [8, 3, 0.96, 0.02, 3, 0.66, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updatemedia", "arg_names": [], "import_names": [], "rhs_call_name": "updatemedia", "annotation": ""}, "snippet": " updatemedia(compressed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_228:Expr_L50_C12", "label": "generatemedia()", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8", "vector": [8, 3, 1.0, 0.02, 3, 0.66, 1.0, 974, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "generatemedia", "arg_names": [], "import_names": [], "rhs_call_name": "generatemedia", "annotation": ""}, "snippet": " generatemedia(compressed)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_228:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_228:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_228:Expr_L50_C12"}] |
# -*- coding: utf-8 -*-
from django.http import HttpResponse, Http404
from django.views.decorators.cache import cache_control
from mediautils.generatemedia import get_targets, get_copy_targets, \
get_target_content, get_media_dirs
from mimetypes import guess_type
from ragendja.template import render_to_response
@cache_control(public=True, max_age=3600*24*60*60)
def get_file(request, path):
media_dirs = get_media_dirs()
data = {'media_dirs': media_dirs}
targets = get_targets(**data)
copy_targets = get_copy_targets(**data)
target_names = [target[0] for target in targets]
name = path.rsplit('/', 1)[-1]
cache = {}
if path in target_names:
target, kwargs, group = targets[target_names.index(path)]
content = get_target_content(group, cache, **kwargs)
elif path in copy_targets:
fp = open(copy_targets[path], 'rb')
content = fp.read()
fp.close()
else:
raise Http404('Media file not found: %s' % path)
return HttpResponse(content,
content_type=guess_type(name)[0] or 'application/octet-stream')
| ajibawa-2023/Python-Code-Large/train/row_230 | 21 | 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_230:ImportFrom_L2_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.069, 0.0345, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponse", "Http404"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponse, Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:ImportFrom_L3_C0", "label": "from django.views.decorators.cache import cache_control", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1034, 0.0345, 0, 0.66, 0.2, 305, 0, 1, 0, 0, 305, 0, 0], "semantic": {"name": "django.views.decorators.cache", "arg_names": [], "import_names": ["cache_control"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.decorators.cache import cache_control"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:ImportFrom_L4_C0", "label": "from mediautils.generatemedia import get_targets, get_copy_targets, get_target_content\u2026", "type": "import", "loc": [4, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1552, 0.069, 0, 0.66, 0.4, 547, 0, 4, 0, 0, 547, 0, 0], "semantic": {"name": "mediautils.generatemedia", "arg_names": [], "import_names": ["get_targets", "get_copy_targets", "get_target_content", "get_media_dirs"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mediautils.generatemedia import get_targets, get_copy_targets, \\\n get_target_content, get_media_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:ImportFrom_L6_C0", "label": "from mimetypes import guess_type", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2069, 0.0345, 0, 0.66, 0.6, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["guess_type"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mimetypes import guess_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:ImportFrom_L7_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.2414, 0.0345, 0, 0.66, 0.8, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "label": "get_file", "type": "function", "loc": [10, 29], "level": 0, "parent": null, "vector": [2, 0, 0.6724, 0.6897, 0, 0.66, 1.0, 380, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "get_file", "arg_names": ["request", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_file(request, path):\n media_dirs = get_media_dirs()\n data = {'media_dirs': media_dirs}\n targets = get_targets(**data)\n copy_targets = get_copy_targets(**data)\n target_names = [target[0] for target in targets]\n\n name = path.rsplit('/', 1)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L11_C4", "label": "media_dirs = get_media_dirs()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.3793, 0.0345, 1, 0.22, 0.0, 977, 3, 0, 0, 0, 260, 10, 1], "semantic": {"name": "media_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "get_media_dirs", "annotation": ""}, "snippet": " media_dirs = get_media_dirs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L12_C4", "label": "data =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.4138, 0.0345, 1, 0.22, 0.125, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'media_dirs': media_dirs}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L13_C4", "label": "targets = get_targets()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.4483, 0.0345, 1, 0.22, 0.25, 409, 3, 1, 0, 0, 396, 10, 1], "semantic": {"name": "targets", "arg_names": [], "import_names": [], "rhs_call_name": "get_targets", "annotation": ""}, "snippet": " targets = get_targets(**data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L14_C4", "label": "copy_targets = get_copy_targets()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.4828, 0.0345, 1, 0.22, 0.375, 356, 3, 1, 0, 0, 103, 10, 1], "semantic": {"name": "copy_targets", "arg_names": [], "import_names": [], "rhs_call_name": "get_copy_targets", "annotation": ""}, "snippet": " copy_targets = get_copy_targets(**data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L15_C4", "label": "target_names =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.5172, 0.0345, 1, 0.22, 0.5, 17, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_names = [target[0] for target in targets]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L17_C4", "label": "name =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.5862, 0.0345, 1, 0.22, 0.625, 57, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = path.rsplit('/', 1)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L18_C4", "label": "cache =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [14, 1, 0.6207, 0.0345, 1, 0.22, 0.75, 419, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "label": "if", "type": "if", "loc": [19, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [4, 1, 0.7931, 0.3103, 1, 0.22, 0.875, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path in target_names:\n target, kwargs, group = targets[target_names.index(path)]\n content = get_target_content(group, cache, **kwargs)\n elif path in copy_targets:\n fp = open(copy_targets[path], 'rb')\n content = fp.read() \n fp.close()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L20_C8", "label": "target, kwargs, group =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "vector": [14, 2, 0.6897, 0.0345, 2, 0.03, 0.0, 618, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "target, kwargs, group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target, kwargs, group = targets[target_names.index(path)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L21_C8", "label": "content = get_target_content()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "vector": [14, 2, 0.7241, 0.0345, 2, 0.03, 0.5, 273, 3, 3, 0, 0, 500, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "get_target_content", "annotation": ""}, "snippet": " content = get_target_content(group, cache, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "label": "if", "type": "if", "loc": [22, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "vector": [4, 2, 0.8448, 0.2069, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif path in copy_targets:\n fp = open(copy_targets[path], 'rb')\n content = fp.read() \n fp.close()\n else:\n raise Http404('Media file not found: %s' % path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L23_C8", "label": "fp = open()", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "vector": [14, 3, 0.7931, 0.0345, 3, 0.19, 0.0, 392, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fp = open(copy_targets[path], 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L24_C8", "label": "content = read()", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "vector": [14, 3, 0.8276, 0.0345, 3, 0.19, 0.5, 273, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " content = fp.read() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Expr_L25_C8", "label": "close()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "vector": [8, 3, 0.8621, 0.0345, 3, 0.19, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_230:Return_L28_C4", "label": "return", "type": "return", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "vector": [13, 1, 0.9828, 0.069, 1, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(content,\n content_type=guess_type(name)[0] or 'application/octet-stream')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_230:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_230:Return_L28_C4"}] |
# -*- coding: utf-8 -*-
from django.conf import settings
from mediautils.views import get_file
class MediaMiddleware(object):
"""Returns media files.
This is a middleware, so it can handle the request as early as possible
and thus with minimum overhead."""
def process_request(self, request):
if request.path.startswith(settings.MEDIA_URL):
path = request.path[len(settings.MEDIA_URL):]
return get_file(request, path)
return None
| ajibawa-2023/Python-Code-Large/train/row_231 | 9 | 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_231:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:ImportFrom_L3_C0", "label": "from mediautils.views import get_file", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2143, 0.0714, 0, 0.66, 0.5, 376, 0, 1, 0, 0, 376, 0, 0], "semantic": {"name": "mediautils.views", "arg_names": [], "import_names": ["get_file"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mediautils.views import get_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "label": "MediaMiddleware", "type": "class", "loc": [5, 14], "level": 0, "parent": null, "vector": [3, 0, 0.6786, 0.7143, 0, 0.66, 1.0, 711, 0, 1, 0, 0, 186, 0, 3], "semantic": {"name": "MediaMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MediaMiddleware(object):\n \"\"\"Returns media files.\n \n This is a middleware, so it can handle the request as early as possible\n and thus with minimum overhead.\"\"\"\n def process_request(self, request):\n if request.path.startswith(settings.MEDIA_URL):\n path = request.path[len(settings.MEDIA_URL):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "vector": [8, 1, 0.5357, 0.2857, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns media files.\n \n This is a middleware, so it can handle the request as early as possible\n and thus with minimum overhead.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4", "label": "process_request", "type": "function", "loc": [10, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "vector": [2, 1, 0.8571, 0.3571, 1, 0.53, 1.0, 81, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "process_request", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_request(self, request):\n if request.path.startswith(settings.MEDIA_URL):\n path = request.path[len(settings.MEDIA_URL):]\n return get_file(request, path)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8", "label": "if", "type": "if", "loc": [11, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4", "vector": [4, 2, 0.8571, 0.2143, 2, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.path.startswith(settings.MEDIA_URL):\n path = request.path[len(settings.MEDIA_URL):]\n return get_file(request, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:Assign_L12_C12", "label": "path =", "type": "assigned_variable", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8", "vector": [14, 3, 0.8571, 0.0714, 3, 0.61, 0.0, 358, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = request.path[len(settings.MEDIA_URL):]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:Return_L13_C12", "label": "return", "type": "return", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8", "vector": [13, 3, 0.9286, 0.0714, 3, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return get_file(request, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_231:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4", "vector": [13, 2, 1.0, 0.0714, 2, 0.94, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_231:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_231:Assign_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_231:Return_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_231:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_231:Return_L14_C8"}] |
from django.conf import settings
from django.core.cache import cache
from django.contrib.sites.models import Site
from ragendja.dbutils import db_create
from ragendja.pyutils import make_tls_property
_default_site_id = getattr(settings, 'SITE_ID', None)
SITE_ID = settings.__class__.SITE_ID = make_tls_property()
class DynamicSiteIDMiddleware(object):
"""Sets settings.SIDE_ID based on request's domain"""
def process_request(self, request):
# Ignore port if it's 80 or 443
if ':' in request.get_host():
domain, port = request.get_host().split(':')
if int(port) not in (80, 443):
domain = request.get_host()
else:
domain = request.get_host().split(':')[0]
# We cache the SITE_ID
cache_key = 'Site:domain:%s' % domain
site = cache.get(cache_key)
if site:
SITE_ID.value = site
else:
site = Site.all().filter('domain =', domain).get()
if not site:
# Fall back to with/without 'www.'
if domain.startswith('www.'):
fallback_domain = domain[4:]
else:
fallback_domain = 'www.' + domain
site = Site.all().filter('domain =', fallback_domain).get()
# Add site if it doesn't exist
if not site and getattr(settings, 'CREATE_SITES_AUTOMATICALLY',
True):
site = db_create(Site, domain=domain, name=domain)
site.put()
# Set SITE_ID for this thread/request
if site:
SITE_ID.value = str(site.key())
else:
SITE_ID.value = _default_site_id
cache.set(cache_key, SITE_ID.value, 5*60)
| ajibawa-2023/Python-Code-Large/train/row_232 | 32 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_232:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:ImportFrom_L2_C0", "label": "from django.core.cache import cache", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0208, 0, 0.66, 0.1429, 734, 0, 1, 0, 0, 734, 0, 0], "semantic": {"name": "django.core.cache", "arg_names": [], "import_names": ["cache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.cache import cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:ImportFrom_L3_C0", "label": "from django.contrib.sites.models import Site", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0208, 0, 0.66, 0.2857, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "django.contrib.sites.models", "arg_names": [], "import_names": ["Site"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sites.models import Site"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:ImportFrom_L4_C0", "label": "from ragendja.dbutils import db_create", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0208, 0, 0.66, 0.4286, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["db_create"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import db_create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:ImportFrom_L5_C0", "label": "from ragendja.pyutils import make_tls_property", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1042, 0.0208, 0, 0.66, 0.5714, 223, 0, 1, 0, 0, 223, 0, 0], "semantic": {"name": "ragendja.pyutils", "arg_names": [], "import_names": ["make_tls_property"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.pyutils import make_tls_property"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L7_C0", "label": "_default_site_id = getattr()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1458, 0.0208, 0, 0.66, 0.7143, 216, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "_default_site_id", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": "_default_site_id = getattr(settings, 'SITE_ID', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L8_C0", "label": "SITE_ID = make_tls_property()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1667, 0.0208, 0, 0.66, 0.8571, 122, 3, 0, 0, 0, 317, 10, 1], "semantic": {"name": "SITE_ID", "arg_names": [], "import_names": [], "rhs_call_name": "make_tls_property", "annotation": ""}, "snippet": "SITE_ID = settings.__class__.SITE_ID = make_tls_property()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "label": "DynamicSiteIDMiddleware", "type": "class", "loc": [10, 48], "level": 0, "parent": null, "vector": [3, 0, 0.6042, 0.8125, 0, 0.66, 1.0, 121, 0, 1, 0, 0, 186, 0, 21], "semantic": {"name": "DynamicSiteIDMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DynamicSiteIDMiddleware(object):\n \"\"\"Sets settings.SIDE_ID based on request's domain\"\"\"\n def process_request(self, request):\n # Ignore port if it's 80 or 443\n if ':' in request.get_host():\n domain, port = request.get_host().split(':')\n if int(port) not in (80, 443):\n domain = request.get_host()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "vector": [8, 1, 0.2292, 0.0208, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets settings.SIDE_ID based on request's domain\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "label": "process_request", "type": "function", "loc": [12, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "vector": [2, 1, 0.625, 0.7708, 1, 0.84, 1.0, 81, 0, 2, 0, 0, 0, 0, 21], "semantic": {"name": "process_request", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_request(self, request):\n # Ignore port if it's 80 or 443\n if ':' in request.get_host():\n domain, port = request.get_host().split(':')\n if int(port) not in (80, 443):\n domain = request.get_host()\n else:\n domain = request.get_host().split(':')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "label": "if", "type": "if", "loc": [14, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "vector": [4, 2, 0.3438, 0.125, 2, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ':' in request.get_host():\n domain, port = request.get_host().split(':')\n if int(port) not in (80, 443):\n domain = request.get_host()\n else:\n domain = request.get_host().split(':')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L15_C12", "label": "domain, port = split()", "type": "assigned_variable", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "vector": [14, 3, 0.3125, 0.0208, 3, 0.19, 0.0, 143, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "domain, port", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " domain, port = request.get_host().split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L16_C12", "label": "if", "type": "if", "loc": [16, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "vector": [4, 3, 0.3438, 0.0417, 3, 0.19, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if int(port) not in (80, 443):\n domain = request.get_host()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L17_C16", "label": "domain = get_host()", "type": "assigned_variable", "loc": [17, 17], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L16_C12", "vector": [14, 4, 0.3542, 0.0208, 4, 0.92, 0.0, 438, 3, 0, 0, 0, 946, 10, 1], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "get_host", "annotation": ""}, "snippet": " domain = request.get_host()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L19_C12", "label": "domain =", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "vector": [14, 3, 0.3958, 0.0208, 3, 0.19, 1.0, 438, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " domain = request.get_host().split(':')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L22_C8", "label": "cache_key =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "vector": [14, 2, 0.4583, 0.0208, 2, 0.47, 0.3333, 62, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cache_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cache_key = 'Site:domain:%s' % domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L23_C8", "label": "site = get()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "vector": [14, 2, 0.4792, 0.0208, 2, 0.47, 0.6667, 681, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "site", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " site = cache.get(cache_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "label": "if", "type": "if", "loc": [24, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "vector": [4, 2, 0.75, 0.5208, 2, 0.47, 1.0, 0, 2, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if site:\n SITE_ID.value = site\n else:\n site = Site.all().filter('domain =', domain).get()\n if not site:\n # Fall back to with/without 'www.'\n if domain.startswith('www.'):\n fallback_domain = domain[4:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L25_C12", "label": "SITE_ID.value =", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [14, 3, 0.5208, 0.0208, 3, 0.0, 0.0, 397, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SITE_ID.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SITE_ID.value = site"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L27_C12", "label": "site = get()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [14, 3, 0.5625, 0.0208, 3, 0.0, 0.2, 681, 3, 0, 0, 0, 607, 10, 3], "semantic": {"name": "site", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " site = Site.all().filter('domain =', domain).get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12", "label": "if", "type": "if", "loc": [28, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [4, 3, 0.6458, 0.1458, 3, 0.0, 0.4, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not site:\n # Fall back to with/without 'www.'\n if domain.startswith('www.'):\n fallback_domain = domain[4:]\n else:\n fallback_domain = 'www.' + domain\n site = Site.all().filter('domain =', fallback_domain).get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16", "label": "if", "type": "if", "loc": [30, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12", "vector": [4, 4, 0.6562, 0.0833, 4, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if domain.startswith('www.'):\n fallback_domain = domain[4:]\n else:\n fallback_domain = 'www.' + domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L31_C20", "label": "fallback_domain =", "type": "assigned_variable", "loc": [31, 31], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16", "vector": [14, 5, 0.6458, 0.0208, 5, 0.98, 0.0, 285, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fallback_domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fallback_domain = domain[4:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L33_C20", "label": "fallback_domain =", "type": "assigned_variable", "loc": [33, 33], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16", "vector": [14, 5, 0.6875, 0.0208, 5, 0.98, 1.0, 285, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fallback_domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fallback_domain = 'www.' + domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L34_C16", "label": "site = get()", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12", "vector": [14, 4, 0.7083, 0.0208, 4, 0.84, 1.0, 681, 3, 0, 0, 0, 607, 10, 3], "semantic": {"name": "site", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " site = Site.all().filter('domain =', fallback_domain).get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12", "label": "if", "type": "if", "loc": [37, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [4, 3, 0.8021, 0.0833, 3, 0.0, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not site and getattr(settings, 'CREATE_SITES_AUTOMATICALLY',\n True):\n site = db_create(Site, domain=domain, name=domain)\n site.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L39_C16", "label": "site = db_create()", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12", "vector": [14, 4, 0.8125, 0.0208, 4, 0.84, 0.0, 681, 3, 3, 0, 0, 18, 10, 1], "semantic": {"name": "site", "arg_names": [], "import_names": [], "rhs_call_name": "db_create", "annotation": ""}, "snippet": " site = db_create(Site, domain=domain, name=domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L40_C16", "label": "put()", "type": "expression", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12", "vector": [8, 4, 0.8333, 0.0208, 4, 0.84, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " site.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12", "label": "if", "type": "if", "loc": [43, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [4, 3, 0.9271, 0.0833, 3, 0.0, 0.8, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if site:\n SITE_ID.value = str(site.key())\n else:\n SITE_ID.value = _default_site_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L44_C16", "label": "SITE_ID.value = str()", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12", "vector": [14, 4, 0.9167, 0.0208, 4, 0.98, 0.0, 397, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "SITE_ID.value", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " SITE_ID.value = str(site.key())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L46_C16", "label": "SITE_ID.value =", "type": "assigned_variable", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12", "vector": [14, 4, 0.9583, 0.0208, 4, 0.98, 1.0, 397, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SITE_ID.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SITE_ID.value = _default_site_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L48_C12", "label": "set()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "vector": [8, 3, 1.0, 0.0208, 3, 0.0, 1.0, 21, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " cache.set(cache_key, SITE_ID.value, 5*60)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L16_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L17_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L31_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L30_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L33_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L28_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L39_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Assign_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_232:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_232:Expr_L48_C12"}] |
# -*- coding: utf-8 -*-
"""
Imports urlpatterns from apps, so we can have nice plug-n-play installation. :)
"""
from django.conf.urls.defaults import *
from django.conf import settings
IGNORE_APP_URLSAUTO = getattr(settings, 'IGNORE_APP_URLSAUTO', ())
check_app_imports = getattr(settings, 'check_app_imports', None)
urlpatterns = patterns('')
for app in settings.INSTALLED_APPS:
if app == 'ragendja' or app.startswith('django.') or \
app in IGNORE_APP_URLSAUTO:
continue
appname = app.rsplit('.', 1)[-1]
try:
if check_app_imports:
check_app_imports(app)
module = __import__(app + '.urlsauto', {}, {}, [''])
except ImportError:
pass
else:
if hasattr(module, 'urlpatterns'):
urlpatterns += patterns('', (r'^%s/' % appname,
include(app + '.urlsauto')),)
if hasattr(module, 'rootpatterns'):
urlpatterns += module.rootpatterns
| ajibawa-2023/Python-Code-Large/train/row_233 | 15 | 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_233:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1034, 0.1034, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nImports urlpatterns from apps, so we can have nice plug-n-play installation. :)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:ImportFrom_L5_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1724, 0.0345, 0, 0.66, 0.1667, 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_233:ImportFrom_L6_C0", "label": "from django.conf import settings", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2069, 0.0345, 0, 0.66, 0.3333, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L8_C0", "label": "IGNORE_APP_URLSAUTO = getattr()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2759, 0.0345, 0, 0.66, 0.5, 430, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "IGNORE_APP_URLSAUTO", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": "IGNORE_APP_URLSAUTO = getattr(settings, 'IGNORE_APP_URLSAUTO', ())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L9_C0", "label": "check_app_imports = getattr()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.3103, 0.0345, 0, 0.66, 0.6667, 587, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "check_app_imports", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": "check_app_imports = getattr(settings, 'check_app_imports', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L11_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.3793, 0.0345, 0, 0.66, 0.8333, 990, 3, 1, 0, 0, 75, 10, 1], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "label": "for app", "type": "for", "loc": [13, 29], "level": 0, "parent": null, "vector": [6, 0, 0.7241, 0.5862, 0, 0.66, 1.0, 494, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for app in settings.INSTALLED_APPS:\n if app == 'ragendja' or app.startswith('django.') or \\\n app in IGNORE_APP_URLSAUTO:\n continue\n appname = app.rsplit('.', 1)[-1]\n try:\n if check_app_imports:\n check_app_imports(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:If_L14_C4", "label": "if", "type": "if", "loc": [14, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "vector": [4, 1, 0.5172, 0.1034, 1, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if app == 'ragendja' or app.startswith('django.') or \\\n app in IGNORE_APP_URLSAUTO:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L17_C4", "label": "appname =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "vector": [14, 1, 0.5862, 0.0345, 1, 0.16, 0.5, 562, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "appname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " appname = app.rsplit('.', 1)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "label": "try", "type": "try", "loc": [18, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "vector": [7, 1, 0.8103, 0.4138, 1, 0.16, 1.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if check_app_imports:\n check_app_imports(app)\n module = __import__(app + '.urlsauto', {}, {}, [''])\n except ImportError:\n pass\n else:\n if hasattr(module, 'urlpatterns'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:If_L19_C8", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "vector": [4, 2, 0.6724, 0.069, 2, 0.24, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if check_app_imports:\n check_app_imports(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Expr_L20_C12", "label": "check_app_imports()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:If_L19_C8", "vector": [8, 3, 0.6897, 0.0345, 3, 0.83, 0.0, 587, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_app_imports", "arg_names": [], "import_names": [], "rhs_call_name": "check_app_imports", "annotation": ""}, "snippet": " check_app_imports(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L21_C8", "label": "module = __import__()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "vector": [14, 2, 0.7241, 0.0345, 2, 0.24, 0.3333, 98, 3, 4, 0, 0, 744, 10, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "__import__", "annotation": ""}, "snippet": " module = __import__(app + '.urlsauto', {}, {}, [''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:If_L25_C8", "label": "if", "type": "if", "loc": [25, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "vector": [4, 2, 0.8966, 0.1034, 2, 0.24, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(module, 'urlpatterns'):\n urlpatterns += patterns('', (r'^%s/' % appname,\n include(app + '.urlsauto')),)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_233:If_L28_C8", "label": "if", "type": "if", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "vector": [4, 2, 0.9828, 0.069, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(module, 'rootpatterns'):\n urlpatterns += module.rootpatterns"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_233:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_233:If_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_233:Expr_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_233:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_233:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_233:Try_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_233:If_L28_C8"}] |
from django.conf import settings
import os
def import_module(module_name):
return __import__(module_name, {}, {}, [''])
def import_package(package_name):
package = [import_module(package_name)]
if package[0].__file__.rstrip('.pyc').rstrip('.py').endswith('__init__'):
package.extend([import_module(package_name + '.' + name)
for name in list_modules(package[0])])
return package
def list_modules(package):
dir = os.path.normpath(os.path.dirname(package.__file__))
try:
return set([name.rsplit('.', 1)[0] for name in os.listdir(dir)
if not name.startswith('_') and name.endswith(('.py', '.pyc'))])
except OSError:
return []
def get_app_modules(module_name=None):
app_map = {}
for app in settings.INSTALLED_APPS:
appname = app.rsplit('.', 1)[-1]
try:
if module_name:
app_map[appname] = import_package(app + '.' + module_name)
else:
app_map[appname] = [import_module(app)]
except ImportError:
if module_name in list_modules(import_module(app)):
raise
return app_map
def get_app_dirs(subdir=None):
app_map = {}
for appname, module in get_app_modules().items():
dir = os.path.abspath(os.path.dirname(module[0].__file__))
if subdir:
dir = os.path.join(dir, subdir)
if os.path.isdir(dir):
app_map[appname] = dir
return app_map
| ajibawa-2023/Python-Code-Large/train/row_234 | 33 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_234:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0227, 0, 0.66, 0.1667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L4_C0", "label": "import_module", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.1023, 0.0455, 0, 0.66, 0.3333, 637, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "import_module", "arg_names": ["module_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def import_module(module_name):\n return __import__(module_name, {}, {}, [''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L4_C0", "vector": [13, 1, 0.1136, 0.0227, 1, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return __import__(module_name, {}, {}, [''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "label": "import_package", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.2159, 0.1364, 0, 0.66, 0.5, 671, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "import_package", "arg_names": ["package_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def import_package(package_name):\n package = [import_module(package_name)]\n if package[0].__file__.rstrip('.pyc').rstrip('.py').endswith('__init__'):\n package.extend([import_module(package_name + '.' + name)\n for name in list_modules(package[0])])\n return package"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L8_C4", "label": "package =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "vector": [14, 1, 0.1818, 0.0227, 1, 0.1, 0.0, 187, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "package", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " package = [import_module(package_name)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:If_L9_C4", "label": "if", "type": "if", "loc": [9, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "vector": [4, 1, 0.2273, 0.0682, 1, 0.1, 0.5, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if package[0].__file__.rstrip('.pyc').rstrip('.py').endswith('__init__'):\n package.extend([import_module(package_name + '.' + name)\n for name in list_modules(package[0])])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Expr_L10_C8", "label": "extend()", "type": "expression", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:If_L9_C4", "vector": [8, 2, 0.2386, 0.0455, 2, 0.86, 0.0, 660, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " package.extend([import_module(package_name + '.' + name)\n for name in list_modules(package[0])])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L12_C4", "label": "return", "type": "return", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "vector": [13, 1, 0.2727, 0.0227, 1, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return package"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L14_C0", "label": "list_modules", "type": "function", "loc": [14, 20], "level": 0, "parent": null, "vector": [2, 0, 0.3864, 0.1591, 0, 0.66, 0.6667, 516, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "list_modules", "arg_names": ["package"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_modules(package):\n dir = os.path.normpath(os.path.dirname(package.__file__))\n try:\n return set([name.rsplit('.', 1)[0] for name in os.listdir(dir)\n if not name.startswith('_') and name.endswith(('.py', '.pyc'))])\n except OSError:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L15_C4", "label": "dir = normpath()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L14_C0", "vector": [14, 1, 0.3409, 0.0227, 1, 0.32, 0.0, 152, 3, 1, 0, 0, 638, 10, 2], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "normpath", "annotation": ""}, "snippet": " dir = os.path.normpath(os.path.dirname(package.__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4", "label": "try", "type": "try", "loc": [16, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L14_C0", "vector": [7, 1, 0.4091, 0.1136, 1, 0.32, 1.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return set([name.rsplit('.', 1)[0] for name in os.listdir(dir)\n if not name.startswith('_') and name.endswith(('.py', '.pyc'))])\n except OSError:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4", "vector": [13, 2, 0.3977, 0.0455, 2, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([name.rsplit('.', 1)[0] for name in os.listdir(dir)\n if not name.startswith('_') and name.endswith(('.py', '.pyc'))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4", "vector": [13, 2, 0.4545, 0.0227, 2, 0.85, 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_234:FunctionDef_L22_C0", "label": "get_app_modules", "type": "function", "loc": [22, 34], "level": 0, "parent": null, "vector": [2, 0, 0.6364, 0.2955, 0, 0.66, 0.8333, 281, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_app_modules", "arg_names": ["module_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_app_modules(module_name=None):\n app_map = {}\n for app in settings.INSTALLED_APPS:\n appname = app.rsplit('.', 1)[-1]\n try:\n if module_name:\n app_map[appname] = import_package(app + '.' + module_name)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L23_C4", "label": "app_map =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "vector": [14, 1, 0.5227, 0.0227, 1, 0.06, 0.0, 287, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "app_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_map = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4", "label": "for app", "type": "for", "loc": [24, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "vector": [6, 1, 0.6477, 0.2273, 1, 0.06, 0.5, 494, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app in settings.INSTALLED_APPS:\n appname = app.rsplit('.', 1)[-1]\n try:\n if module_name:\n app_map[appname] = import_package(app + '.' + module_name)\n else:\n app_map[appname] = [import_module(app)]\n except ImportError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L25_C8", "label": "appname =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4", "vector": [14, 2, 0.5682, 0.0227, 2, 0.99, 0.0, 562, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "appname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " appname = app.rsplit('.', 1)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8", "label": "try", "type": "try", "loc": [26, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4", "vector": [7, 2, 0.6705, 0.1818, 2, 0.99, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if module_name:\n app_map[appname] = import_package(app + '.' + module_name)\n else:\n app_map[appname] = [import_module(app)]\n except ImportError:\n if module_name in list_modules(import_module(app)):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12", "label": "if", "type": "if", "loc": [27, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8", "vector": [4, 3, 0.6477, 0.0909, 3, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if module_name:\n app_map[appname] = import_package(app + '.' + module_name)\n else:\n app_map[appname] = [import_module(app)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L28_C16", "label": " = import_package()", "type": "assigned_variable", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12", "vector": [14, 4, 0.6364, 0.0227, 4, 0.11, 0.0, 0, 3, 1, 0, 0, 671, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "import_package", "annotation": ""}, "snippet": " app_map[appname] = import_package(app + '.' + module_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L30_C16", "label": "assign", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12", "vector": [14, 4, 0.6818, 0.0227, 4, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_map[appname] = [import_module(app)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:If_L32_C12", "label": "if", "type": "if", "loc": [32, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8", "vector": [4, 3, 0.7386, 0.0455, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if module_name in list_modules(import_module(app)):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "vector": [13, 1, 0.7727, 0.0227, 1, 0.06, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app_map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "label": "get_app_dirs", "type": "function", "loc": [36, 44], "level": 0, "parent": null, "vector": [2, 0, 0.9091, 0.2045, 0, 0.66, 1.0, 126, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "get_app_dirs", "arg_names": ["subdir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_app_dirs(subdir=None):\n app_map = {}\n for appname, module in get_app_modules().items():\n dir = os.path.abspath(os.path.dirname(module[0].__file__))\n if subdir:\n dir = os.path.join(dir, subdir)\n if os.path.isdir(dir):\n app_map[appname] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L37_C4", "label": "app_map =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "vector": [14, 1, 0.8409, 0.0227, 1, 0.57, 0.0, 287, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "app_map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_map = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "label": "for appname, module", "type": "for", "loc": [38, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "vector": [6, 1, 0.9205, 0.1364, 1, 0.57, 0.5, 339, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "appname, module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for appname, module in get_app_modules().items():\n dir = os.path.abspath(os.path.dirname(module[0].__file__))\n if subdir:\n dir = os.path.join(dir, subdir)\n if os.path.isdir(dir):\n app_map[appname] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L39_C8", "label": "dir = abspath()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "vector": [14, 2, 0.8864, 0.0227, 2, 0.34, 0.0, 152, 3, 1, 0, 0, 142, 10, 2], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " dir = os.path.abspath(os.path.dirname(module[0].__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:If_L40_C8", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "vector": [4, 2, 0.9205, 0.0455, 2, 0.34, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subdir:\n dir = os.path.join(dir, subdir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L41_C12", "label": "dir = join()", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:If_L40_C8", "vector": [14, 3, 0.9318, 0.0227, 3, 0.94, 0.0, 152, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " dir = os.path.join(dir, subdir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:If_L42_C8", "label": "if", "type": "if", "loc": [42, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "vector": [4, 2, 0.9659, 0.0455, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(dir):\n app_map[appname] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L43_C12", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:If_L42_C8", "vector": [14, 3, 0.9773, 0.0227, 3, 0.4, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_map[appname] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L44_C4", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "vector": [13, 1, 1.0, 0.0227, 1, 0.57, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app_map"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:Try_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_234:If_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:If_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:If_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:For_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_234:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_234:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_234:Return_L44_C4"}] |
# -*- coding: utf-8 -*-
from django.utils._threading_local import local
def make_tls_property(default=None):
"""Creates a class-wide instance property with a thread-specific value."""
class TLSProperty(object):
def __init__(self):
self.local = local()
def __get__(self, instance, cls):
if not instance:
return self
return self.value
def __set__(self, instance, value):
self.value = value
def _get_value(self):
return getattr(self.local, 'value', default)
def _set_value(self, value):
self.local.value = value
value = property(_get_value, _set_value)
return TLSProperty()
def getattr_by_path(obj, attr, *default):
"""Like getattr(), but can go down a hierarchy like 'attr.subattr'"""
value = obj
for part in attr.split('.'):
if not hasattr(value, part) and len(default):
return default[0]
value = getattr(value, part)
if callable(value):
value = value()
return value
def subdict(data, *attrs):
"""Returns a subset of the keys of a dictionary."""
result = {}
result.update([(key, data[key]) for key in attrs])
return result
def equal_lists(left, right):
"""
Compares two lists and returs True if they contain the same elements, but
doesn't require that they have the same order.
"""
right = list(right)
if len(left) != len(right):
return False
for item in left:
if item in right:
del right[right.index(item)]
else:
return False
return True
def object_list_to_table(headings, dict_list):
"""
Converts objects to table-style list of rows with heading:
Example:
x.a = 1
x.b = 2
x.c = 3
y.a = 11
y.b = 12
y.c = 13
object_list_to_table(('a', 'b', 'c'), [x, y])
results in the following (dict keys reordered for better readability):
[
('a', 'b', 'c'),
(1, 2, 3),
(11, 12, 13),
]
"""
return [headings] + [tuple([getattr_by_path(row, heading, None)
for heading in headings])
for row in dict_list]
def dict_list_to_table(headings, dict_list):
"""
Converts dict to table-style list of rows with heading:
Example:
dict_list_to_table(('a', 'b', 'c'),
[{'a': 1, 'b': 2, 'c': 3}, {'a': 11, 'b': 12, 'c': 13}])
results in the following (dict keys reordered for better readability):
[
('a', 'b', 'c'),
(1, 2, 3),
(11, 12, 13),
]
"""
return [headings] + [tuple([row[heading] for heading in headings])
for row in dict_list]
| ajibawa-2023/Python-Code-Large/train/row_235 | 48 | 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_235:ImportFrom_L2_C0", "label": "from django.utils._threading_local import local", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0104, 0, 0.66, 0.0, 561, 0, 1, 0, 0, 561, 0, 0], "semantic": {"name": "django.utils._threading_local", "arg_names": [], "import_names": ["local"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils._threading_local import local"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "label": "make_tls_property", "type": "function", "loc": [4, 24], "level": 0, "parent": null, "vector": [2, 0, 0.1458, 0.2188, 0, 0.66, 0.1667, 317, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "make_tls_property", "arg_names": ["default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_tls_property(default=None):\n \"\"\"Creates a class-wide instance property with a thread-specific value.\"\"\"\n class TLSProperty(object):\n def __init__(self):\n self.local = local()\n\n def __get__(self, instance, cls):\n if not instance:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "vector": [8, 1, 0.0521, 0.0104, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates a class-wide instance property with a thread-specific value.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "label": "TLSProperty", "type": "class", "loc": [6, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "vector": [3, 1, 0.1458, 0.1771, 1, 0.97, 0.5, 481, 0, 5, 0, 0, 186, 0, 3], "semantic": {"name": "TLSProperty", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class TLSProperty(object):\n def __init__(self):\n self.local = local()\n\n def __get__(self, instance, cls):\n if not instance:\n return self\n return self.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L7_C8", "label": "__init__", "type": "function", "loc": [7, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [2, 2, 0.0781, 0.0208, 2, 0.63, 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.local = local()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L8_C12", "label": "self.local = local()", "type": "assigned_variable", "loc": [8, 8], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L7_C8", "vector": [14, 3, 0.0833, 0.0104, 3, 0.09, 0.0, 486, 3, 0, 0, 0, 605, 10, 1], "semantic": {"name": "self.local", "arg_names": [], "import_names": [], "rhs_call_name": "local", "annotation": ""}, "snippet": " self.local = local()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8", "label": "__get__", "type": "function", "loc": [10, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [2, 2, 0.1198, 0.0417, 2, 0.63, 0.2, 93, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "__get__", "arg_names": ["self", "instance", "cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __get__(self, instance, cls):\n if not instance:\n return self\n return self.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:If_L11_C12", "label": "if", "type": "if", "loc": [11, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8", "vector": [4, 3, 0.1198, 0.0208, 3, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not instance:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L12_C16", "label": "return", "type": "return", "loc": [12, 12], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:If_L11_C12", "vector": [13, 4, 0.125, 0.0104, 4, 0.02, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L13_C12", "label": "return", "type": "return", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8", "vector": [13, 3, 0.1354, 0.0104, 3, 0.29, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L15_C8", "label": "__set__", "type": "function", "loc": [15, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [2, 2, 0.1615, 0.0208, 2, 0.63, 0.4, 145, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__set__", "arg_names": ["self", "instance", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __set__(self, instance, value):\n self.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L16_C12", "label": "self.value =", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L15_C8", "vector": [14, 3, 0.1667, 0.0104, 3, 0.36, 0.0, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L18_C8", "label": "_get_value", "type": "function", "loc": [18, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [2, 2, 0.1927, 0.0208, 2, 0.63, 0.6, 479, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self):\n return getattr(self.local, 'value', default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L19_C12", "label": "return", "type": "return", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L18_C8", "vector": [13, 3, 0.1979, 0.0104, 3, 0.05, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getattr(self.local, 'value', default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L20_C8", "label": "_set_value", "type": "function", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [2, 2, 0.2135, 0.0208, 2, 0.63, 0.8, 565, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n self.local.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L21_C12", "label": "self.local.value =", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L20_C8", "vector": [14, 3, 0.2188, 0.0104, 3, 0.25, 0.0, 407, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.local.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.local.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L22_C8", "label": "value = property()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "vector": [14, 2, 0.2292, 0.0104, 2, 0.63, 1.0, 441, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " value = property(_get_value, _set_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "vector": [13, 1, 0.25, 0.0104, 1, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return TLSProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "label": "getattr_by_path", "type": "function", "loc": [26, 35], "level": 0, "parent": null, "vector": [2, 0, 0.3177, 0.1042, 0, 0.66, 0.3333, 709, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "getattr_by_path", "arg_names": ["obj", "attr", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getattr_by_path(obj, attr, *default):\n \"\"\"Like getattr(), but can go down a hierarchy like 'attr.subattr'\"\"\"\n value = obj\n for part in attr.split('.'):\n if not hasattr(value, part) and len(default):\n return default[0]\n value = getattr(value, part)\n if callable(value):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L27_C4", "label": "expression", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "vector": [8, 1, 0.2812, 0.0104, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Like getattr(), but can go down a hierarchy like 'attr.subattr'\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L28_C4", "label": "value =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "vector": [14, 1, 0.2917, 0.0104, 1, 0.22, 0.3333, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "label": "for part", "type": "for", "loc": [29, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "vector": [6, 1, 0.3281, 0.0625, 1, 0.22, 0.6667, 374, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "part", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for part in attr.split('.'):\n if not hasattr(value, part) and len(default):\n return default[0]\n value = getattr(value, part)\n if callable(value):\n value = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:If_L30_C8", "label": "if", "type": "if", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "vector": [4, 2, 0.3177, 0.0208, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(value, part) and len(default):\n return default[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L31_C12", "label": "return", "type": "return", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:If_L30_C8", "vector": [13, 3, 0.3229, 0.0104, 3, 0.95, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return default[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L32_C8", "label": "value = getattr()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "vector": [14, 2, 0.3333, 0.0104, 2, 0.72, 0.5, 441, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " value = getattr(value, part)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:If_L33_C8", "label": "if", "type": "if", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "vector": [4, 2, 0.349, 0.0208, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(value):\n value = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L34_C12", "label": "value = value()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:If_L33_C8", "vector": [14, 3, 0.3542, 0.0104, 3, 0.87, 0.0, 441, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " value = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "vector": [13, 1, 0.3646, 0.0104, 1, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "label": "subdict", "type": "function", "loc": [37, 41], "level": 0, "parent": null, "vector": [2, 0, 0.4062, 0.0521, 0, 0.66, 0.5, 413, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "subdict", "arg_names": ["data", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def subdict(data, *attrs):\n \"\"\"Returns a subset of the keys of a dictionary.\"\"\"\n result = {}\n result.update([(key, data[key]) for key in attrs])\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L38_C4", "label": "expression", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "vector": [8, 1, 0.3958, 0.0104, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns a subset of the keys of a dictionary.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L39_C4", "label": "result =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "vector": [14, 1, 0.4062, 0.0104, 1, 0.91, 0.3333, 51, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L40_C4", "label": "update()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "vector": [8, 1, 0.4167, 0.0104, 1, 0.91, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " result.update([(key, data[key]) for key in attrs])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "vector": [13, 1, 0.4271, 0.0104, 1, 0.91, 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_235:FunctionDef_L43_C0", "label": "equal_lists", "type": "function", "loc": [43, 56], "level": 0, "parent": null, "vector": [2, 0, 0.5156, 0.1458, 0, 0.66, 0.6667, 1, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "equal_lists", "arg_names": ["left", "right"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def equal_lists(left, right):\n \"\"\"\n Compares two lists and returs True if they contain the same elements, but\n doesn't require that they have the same order.\n \"\"\"\n right = list(right)\n if len(left) != len(right):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "vector": [8, 1, 0.474, 0.0417, 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 Compares two lists and returs True if they contain the same elements, but\n doesn't require that they have the same order.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L48_C4", "label": "right = list()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "vector": [14, 1, 0.5, 0.0104, 1, 0.24, 0.25, 724, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "right", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " right = list(right)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:If_L49_C4", "label": "if", "type": "if", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "vector": [4, 1, 0.5156, 0.0208, 1, 0.24, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(left) != len(right):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L50_C8", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:If_L49_C4", "vector": [13, 2, 0.5208, 0.0104, 2, 0.74, 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_235:For_L51_C4", "label": "for item", "type": "for", "loc": [51, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "vector": [6, 1, 0.5521, 0.0521, 1, 0.24, 0.75, 434, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in left:\n if item in right:\n del right[right.index(item)]\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:For_L51_C4", "vector": [4, 2, 0.5573, 0.0417, 2, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item in right:\n del right[right.index(item)]\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:If_L52_C8", "vector": [13, 3, 0.5729, 0.0104, 3, 0.74, 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_235:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "vector": [13, 1, 0.5833, 0.0104, 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 True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L58_C0", "label": "object_list_to_table", "type": "function", "loc": [58, 79], "level": 0, "parent": null, "vector": [2, 0, 0.7135, 0.2292, 0, 0.66, 0.8333, 671, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "object_list_to_table", "arg_names": ["headings", "dict_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def object_list_to_table(headings, dict_list):\n \"\"\"\n Converts objects to table-style list of rows with heading:\n\n Example:\n x.a = 1\n x.b = 2\n x.c = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L59_C4", "label": "expression", "type": "expression", "loc": [59, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L58_C0", "vector": [8, 1, 0.7031, 0.1875, 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 Converts objects to table-style list of rows with heading:\n\n Example:\n x.a = 1\n x.b = 2\n x.c = 3\n y.a = 11"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L58_C0", "vector": [13, 1, 0.8125, 0.0312, 1, 0.12, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [headings] + [tuple([getattr_by_path(row, heading, None)\n for heading in headings])\n for row in dict_list]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L81_C0", "label": "dict_list_to_table", "type": "function", "loc": [81, 96], "level": 0, "parent": null, "vector": [2, 0, 0.9219, 0.1667, 0, 0.66, 1.0, 15, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_list_to_table", "arg_names": ["headings", "dict_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dict_list_to_table(headings, dict_list):\n \"\"\"\n Converts dict to table-style list of rows with heading:\n\n Example:\n dict_list_to_table(('a', 'b', 'c'),\n [{'a': 1, 'b': 2, 'c': 3}, {'a': 11, 'b': 12, 'c': 13}])\n results in the following (dict keys reordered for better readability):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L81_C0", "vector": [8, 1, 0.9167, 0.1354, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Converts dict to table-style list of rows with heading:\n\n Example:\n dict_list_to_table(('a', 'b', 'c'),\n [{'a': 1, 'b': 2, 'c': 3}, {'a': 11, 'b': 12, 'c': 13}])\n results in the following (dict keys reordered for better readability):\n ["}, {"id": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L95_C4", "label": "return", "type": "return", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L81_C0", "vector": [13, 1, 0.9948, 0.0208, 1, 0.82, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [headings] + [tuple([row[heading] for heading in headings])\n for row in dict_list]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L7_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L8_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:If_L11_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:If_L11_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L12_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L10_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:ClassDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:If_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:If_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:For_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:For_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_235:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_235:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_235:Return_L95_C4"}] |
# -*- coding: utf-8 -*-
from django.test import TestCase
from google.appengine.ext import db
from pyutils import object_list_to_table, equal_lists
import os
class ModelTestCase(TestCase):
"""
A test case for models that provides an easy way to validate the DB
contents against a given list of row-values.
You have to specify the model to validate using the 'model' attribute:
class MyTestCase(ModelTestCase):
model = MyModel
"""
def validate_state(self, columns, *state_table):
"""
Validates that the DB contains exactly the values given in the state
table. The list of columns is given in the columns tuple.
Example:
self.validate_state(
('a', 'b', 'c'),
(1, 2, 3),
(11, 12, 13),
)
validates that the table contains exactly two rows and that their
'a', 'b', and 'c' attributes are 1, 2, 3 for one row and 11, 12, 13
for the other row. The order of the rows doesn't matter.
"""
current_state = object_list_to_table(columns,
self.model.all())[1:]
if not equal_lists(current_state, state_table):
print 'DB state not valid:'
print 'Current state:'
print columns
for state in current_state:
print state
print 'Should be:'
for state in state_table:
print state
self.fail('DB state not valid')
| ajibawa-2023/Python-Code-Large/train/row_236 | 19 | 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_236:ImportFrom_L2_C0", "label": "from django.test import TestCase", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0238, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0238, 0, 0.66, 0.25, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:ImportFrom_L4_C0", "label": "from pyutils import object_list_to_table, equal_lists", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0238, 0, 0.66, 0.5, 858, 0, 2, 0, 0, 858, 0, 0], "semantic": {"name": "pyutils", "arg_names": [], "import_names": ["object_list_to_table", "equal_lists"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pyutils import object_list_to_table, equal_lists"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.119, 0.0238, 0, 0.66, 0.75, 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_236:ClassDef_L7_C0", "label": "ModelTestCase", "type": "class", "loc": [7, 42], "level": 0, "parent": null, "vector": [3, 0, 0.5833, 0.8571, 0, 0.66, 1.0, 870, 0, 1, 0, 0, 3, 0, 10], "semantic": {"name": "ModelTestCase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModelTestCase(TestCase):\n \"\"\"\n A test case for models that provides an easy way to validate the DB\n contents against a given list of row-values.\n\n You have to specify the model to validate using the 'model' attribute:\n class MyTestCase(ModelTestCase):\n model = MyModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "vector": [8, 1, 0.2738, 0.1905, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A test case for models that provides an easy way to validate the DB\n contents against a given list of row-values.\n\n You have to specify the model to validate using the 'model' attribute:\n class MyTestCase(ModelTestCase):\n model = MyModel\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "label": "validate_state", "type": "function", "loc": [16, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "vector": [2, 1, 0.6905, 0.6429, 1, 0.57, 1.0, 93, 0, 3, 0, 0, 0, 0, 10], "semantic": {"name": "validate_state", "arg_names": ["self", "columns", "state_table"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def validate_state(self, columns, *state_table):\n \"\"\"\n Validates that the DB contains exactly the values given in the state\n table. The list of columns is given in the columns tuple.\n\n Example:\n self.validate_state(\n ('a', 'b', 'c'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "vector": [8, 2, 0.5595, 0.3333, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validates that the DB contains exactly the values given in the state\n table. The list of columns is given in the columns tuple.\n\n Example:\n self.validate_state(\n ('a', 'b', 'c'),\n (1, 2, 3),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Assign_L31_C8", "label": "current_state =", "type": "assigned_variable", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "vector": [14, 2, 0.75, 0.0476, 2, 0.83, 0.5, 24, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "current_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current_state = object_list_to_table(columns,\n self.model.all())[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "label": "if", "type": "if", "loc": [33, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "vector": [4, 2, 0.8929, 0.2381, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not equal_lists(current_state, state_table):\n print('DB state not valid:')\n print('Current state:')\n print(columns)\n for state in current_state:\n print(state)\n print('Should be:')\n for state in state_table:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L34_C12", "label": "print()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [8, 3, 0.8095, 0.0238, 3, 0.67, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('DB state not valid:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L35_C12", "label": "print()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [8, 3, 0.8333, 0.0238, 3, 0.67, 0.1667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Current state:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L36_C12", "label": "print()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [8, 3, 0.8571, 0.0238, 3, 0.67, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(columns)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:For_L37_C12", "label": "for state", "type": "for", "loc": [37, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [6, 3, 0.8929, 0.0476, 3, 0.67, 0.5, 688, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for state in current_state:\n print(state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L38_C16", "label": "print()", "type": "expression", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:For_L37_C12", "vector": [8, 4, 0.9048, 0.0238, 4, 0.95, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L39_C12", "label": "print()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [8, 3, 0.9286, 0.0238, 3, 0.67, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Should be:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:For_L40_C12", "label": "for state", "type": "for", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [6, 3, 0.9643, 0.0476, 3, 0.67, 0.8333, 688, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for state in state_table:\n print(state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L41_C16", "label": "print()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:For_L40_C12", "vector": [8, 4, 0.9762, 0.0238, 4, 0.79, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L42_C12", "label": "fail()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "vector": [8, 3, 1.0, 0.0238, 3, 0.67, 1.0, 364, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "fail", "arg_names": [], "import_names": [], "rhs_call_name": "fail", "annotation": ""}, "snippet": " self.fail('DB state not valid')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:For_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:For_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:For_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:For_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_236:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_236:Expr_L42_C12"}] |
# -*- coding: utf-8 -*-
from copy import deepcopy
from django.forms.forms import NON_FIELD_ERRORS
from django.template import Library
from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from ragendja.dbutils import prefetch_references
register = Library()
register.filter('prefetch_references', prefetch_references)
_js_escapes = {
'>': r'\x3E',
'<': r'\x3C',
'&': r'\x26',
'=': r'\x3D',
'-': r'\x2D',
';': r'\x3B',
}
@register.filter
def encodejs(value):
from django.utils import simplejson
from ragendja.json import LazyEncoder
value = simplejson.dumps(value, cls=LazyEncoder)
for bad, good in _js_escapes.items():
value = value.replace(bad, good)
return mark_safe(value)
@register.filter
def urlquerybase(url):
"""
Appends '?' or '&' to an url, so you can easily add extra GET parameters.
"""
if url:
if '?' in url:
url += '&'
else:
url += '?'
return url
@register.simple_tag
def htrans(value):
"""
Creates a "hidden" translation.
Translates a string, but doesn't add it to django.po. This is useful
if you use the same string in multiple apps and don't want to translate
it in each of them (the translations will get overriden by the last app,
anyway).
"""
return _(value)
@register.simple_tag
def exclude_form_fields(form=None, fields=None, as_choice='as_table',
global_errors=True):
fields=fields.replace(' ', '').split(',')
if not global_errors:
form.errors[NON_FIELD_ERRORS] = form.error_class()
fields_backup = deepcopy(form.fields)
for field in fields:
if field in form.fields:
del form.fields[field]
resulting_text = getattr(form, as_choice)()
form.fields = fields_backup
return resulting_text
@register.simple_tag
def include_form_fields(form=None, fields=None, as_choice='as_table',
global_errors=True):
fields=fields.replace(' ', '').split(',')
if not global_errors:
form.errors[NON_FIELD_ERRORS] = form.error_class()
fields_backup = deepcopy(form.fields)
form.fields = SortedDict()
for field in fields:
if field in fields_backup:
form.fields[field] = fields_backup[field]
resulting_text = getattr(form, as_choice)()
form.fields = fields_backup
return resulting_text
@register.simple_tag
def ordered_form(form=None, fields=None, as_choice='as_table'):
resulting_text = ''
if len(form.non_field_errors()) != 0:
fields_backup = deepcopy(form.fields)
form.fields = {}
resulting_text = getattr(form, as_choice)()
form.fields = fields_backup
resulting_text = resulting_text + include_form_fields(form, fields,
as_choice, False) + exclude_form_fields(form, fields, as_choice, False)
return resulting_text
| ajibawa-2023/Python-Code-Large/train/row_238 | 56 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L2_C0", "label": "from copy import deepcopy", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0098, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["deepcopy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from copy import deepcopy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L3_C0", "label": "from django.forms.forms import NON_FIELD_ERRORS", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0294, 0.0098, 0, 0.66, 0.0667, 975, 0, 1, 0, 0, 975, 0, 0], "semantic": {"name": "django.forms.forms", "arg_names": [], "import_names": ["NON_FIELD_ERRORS"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.forms import NON_FIELD_ERRORS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L4_C0", "label": "from django.template import Library", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0098, 0, 0.66, 0.1333, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Library"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Library"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L5_C0", "label": "from django.utils.datastructures import SortedDict", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.049, 0.0098, 0, 0.66, 0.2, 757, 0, 1, 0, 0, 757, 0, 0], "semantic": {"name": "django.utils.datastructures", "arg_names": [], "import_names": ["SortedDict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.datastructures import SortedDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L6_C0", "label": "from django.utils.safestring import mark_safe", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0098, 0, 0.66, 0.2667, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.safestring", "arg_names": [], "import_names": ["mark_safe"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.safestring import mark_safe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L7_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0686, 0.0098, 0, 0.66, 0.3333, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L8_C0", "label": "from ragendja.dbutils import prefetch_references", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0784, 0.0098, 0, 0.66, 0.4, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "ragendja.dbutils", "arg_names": [], "import_names": ["prefetch_references"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.dbutils import prefetch_references"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L10_C0", "label": "register = Library()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.098, 0.0098, 0, 0.66, 0.4667, 276, 3, 0, 0, 0, 77, 10, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "Library", "annotation": ""}, "snippet": "register = Library()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Expr_L12_C0", "label": "filter()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.0098, 0, 0.66, 0.5333, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": "register.filter('prefetch_references', prefetch_references)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L14_C0", "label": "_js_escapes =", "type": "assigned_variable", "loc": [14, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1716, 0.0784, 0, 0.66, 0.6, 42, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_js_escapes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_js_escapes = {\n '>': r'\\x3E',\n '<': r'\\x3C',\n '&': r'\\x26',\n '=': r'\\x3D',\n '-': r'\\x2D',\n ';': r'\\x3B',\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "label": "encodejs", "type": "function", "loc": [24, 30], "level": 0, "parent": null, "vector": [2, 0, 0.2647, 0.0686, 0, 0.66, 0.6667, 562, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "encodejs", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encodejs(value):\n from django.utils import simplejson\n from ragendja.json import LazyEncoder\n value = simplejson.dumps(value, cls=LazyEncoder)\n for bad, good in _js_escapes.items():\n value = value.replace(bad, good)\n return mark_safe(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L25_C4", "label": "from django.utils import simplejson", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "vector": [1, 1, 0.2451, 0.0098, 1, 0.73, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.utils import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L26_C4", "label": "from ragendja.json import LazyEncoder", "type": "import", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "vector": [1, 1, 0.2549, 0.0098, 1, 0.73, 0.25, 363, 0, 1, 0, 0, 363, 0, 0], "semantic": {"name": "ragendja.json", "arg_names": [], "import_names": ["LazyEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ragendja.json import LazyEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L27_C4", "label": "value = dumps()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "vector": [14, 1, 0.2647, 0.0098, 1, 0.73, 0.5, 441, 3, 2, 0, 0, 160, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " value = simplejson.dumps(value, cls=LazyEncoder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:For_L28_C4", "label": "for bad, good", "type": "for", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "vector": [6, 1, 0.2794, 0.0196, 1, 0.73, 0.75, 968, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "bad, good", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for bad, good in _js_escapes.items():\n value = value.replace(bad, good)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L29_C8", "label": "value = replace()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:For_L28_C4", "vector": [14, 2, 0.2843, 0.0098, 2, 0.77, 0.0, 441, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " value = value.replace(bad, good)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "vector": [13, 1, 0.2941, 0.0098, 1, 0.73, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "label": "urlquerybase", "type": "function", "loc": [33, 42], "level": 0, "parent": null, "vector": [2, 0, 0.3676, 0.098, 0, 0.66, 0.7333, 553, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "urlquerybase", "arg_names": ["url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def urlquerybase(url):\n \"\"\"\n Appends '?' or '&' to an url, so you can easily add extra GET parameters.\n \"\"\"\n if url:\n if '?' in url:\n url += '&'\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "vector": [8, 1, 0.3431, 0.0294, 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 Appends '?' or '&' to an url, so you can easily add extra GET parameters.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L37_C4", "label": "if", "type": "if", "loc": [37, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "vector": [4, 1, 0.3824, 0.049, 1, 0.44, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url:\n if '?' in url:\n url += '&'\n else:\n url += '?'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L38_C8", "label": "if", "type": "if", "loc": [38, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L37_C4", "vector": [4, 2, 0.3873, 0.0392, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '?' in url:\n url += '&'\n else:\n url += '?'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L42_C4", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "vector": [13, 1, 0.4118, 0.0098, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L45_C0", "label": "htrans", "type": "function", "loc": [45, 54], "level": 0, "parent": null, "vector": [2, 0, 0.4853, 0.098, 0, 0.66, 0.8, 844, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "htrans", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def htrans(value):\n \"\"\"\n Creates a \"hidden\" translation.\n\n Translates a string, but doesn't add it to django.po. This is useful\n if you use the same string in multiple apps and don't want to translate\n it in each of them (the translations will get overriden by the last app,\n anyway)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Expr_L46_C4", "label": "expression", "type": "expression", "loc": [46, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L45_C0", "vector": [8, 1, 0.4853, 0.0784, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a \"hidden\" translation.\n\n Translates a string, but doesn't add it to django.po. This is useful\n if you use the same string in multiple apps and don't want to translate\n it in each of them (the translations will get overriden by the last app,\n anyway).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L54_C4", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L45_C0", "vector": [13, 1, 0.5294, 0.0098, 1, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "label": "exclude_form_fields", "type": "function", "loc": [57, 70], "level": 0, "parent": null, "vector": [2, 0, 0.6225, 0.1373, 0, 0.66, 0.8667, 816, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "exclude_form_fields", "arg_names": ["form", "fields", "as_choice", "global_errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def exclude_form_fields(form=None, fields=None, as_choice='as_table',\n global_errors=True):\n fields=fields.replace(' ', '').split(',')\n if not global_errors:\n form.errors[NON_FIELD_ERRORS] = form.error_class()\n \n fields_backup = deepcopy(form.fields)\n for field in fields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L59_C4", "label": "fields = split()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [14, 1, 0.5784, 0.0098, 1, 0.73, 0.0, 358, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " fields=fields.replace(' ', '').split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L60_C4", "label": "if", "type": "if", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [4, 1, 0.5931, 0.0196, 1, 0.73, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not global_errors:\n form.errors[NON_FIELD_ERRORS] = form.error_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L61_C8", "label": " = error_class()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L60_C4", "vector": [14, 2, 0.598, 0.0098, 2, 0.5, 0.0, 0, 3, 0, 0, 0, 541, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "error_class", "annotation": ""}, "snippet": " form.errors[NON_FIELD_ERRORS] = form.error_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L63_C4", "label": "fields_backup = deepcopy()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [14, 1, 0.6176, 0.0098, 1, 0.73, 0.3333, 524, 3, 1, 0, 0, 44, 10, 1], "semantic": {"name": "fields_backup", "arg_names": [], "import_names": [], "rhs_call_name": "deepcopy", "annotation": ""}, "snippet": " fields_backup = deepcopy(form.fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:For_L64_C4", "label": "for field", "type": "for", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [6, 1, 0.6373, 0.0294, 1, 0.73, 0.5, 480, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in fields:\n if field in form.fields:\n del form.fields[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L65_C8", "label": "if", "type": "if", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:For_L64_C4", "vector": [4, 2, 0.6422, 0.0196, 2, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field in form.fields:\n del form.fields[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L68_C4", "label": "resulting_text =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [14, 1, 0.6667, 0.0098, 1, 0.73, 0.6667, 594, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "resulting_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resulting_text = getattr(form, as_choice)()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L69_C4", "label": "form.fields =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [14, 1, 0.6765, 0.0098, 1, 0.73, 0.8333, 258, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "form.fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form.fields = fields_backup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "vector": [13, 1, 0.6863, 0.0098, 1, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resulting_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "label": "include_form_fields", "type": "function", "loc": [73, 89], "level": 0, "parent": null, "vector": [2, 0, 0.7941, 0.1667, 0, 0.66, 0.9333, 986, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "include_form_fields", "arg_names": ["form", "fields", "as_choice", "global_errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def include_form_fields(form=None, fields=None, as_choice='as_table',\n global_errors=True):\n fields=fields.replace(' ', '').split(',')\n if not global_errors:\n form.errors[NON_FIELD_ERRORS] = form.error_class()\n \n fields_backup = deepcopy(form.fields)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L75_C4", "label": "fields = split()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [14, 1, 0.7353, 0.0098, 1, 0.15, 0.0, 358, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " fields=fields.replace(' ', '').split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L76_C4", "label": "if", "type": "if", "loc": [76, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [4, 1, 0.75, 0.0196, 1, 0.15, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not global_errors:\n form.errors[NON_FIELD_ERRORS] = form.error_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L77_C8", "label": " = error_class()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L76_C4", "vector": [14, 2, 0.7549, 0.0098, 2, 0.46, 0.0, 0, 3, 0, 0, 0, 541, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "error_class", "annotation": ""}, "snippet": " form.errors[NON_FIELD_ERRORS] = form.error_class()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L79_C4", "label": "fields_backup = deepcopy()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [14, 1, 0.7745, 0.0098, 1, 0.15, 0.2857, 524, 3, 1, 0, 0, 44, 10, 1], "semantic": {"name": "fields_backup", "arg_names": [], "import_names": [], "rhs_call_name": "deepcopy", "annotation": ""}, "snippet": " fields_backup = deepcopy(form.fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L81_C4", "label": "form.fields = SortedDict()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [14, 1, 0.7941, 0.0098, 1, 0.15, 0.4286, 258, 3, 0, 0, 0, 525, 10, 1], "semantic": {"name": "form.fields", "arg_names": [], "import_names": [], "rhs_call_name": "SortedDict", "annotation": ""}, "snippet": " form.fields = SortedDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:For_L82_C4", "label": "for field", "type": "for", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [6, 1, 0.8137, 0.0294, 1, 0.15, 0.5714, 480, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in fields:\n if field in fields_backup:\n form.fields[field] = fields_backup[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L83_C8", "label": "if", "type": "if", "loc": [83, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:For_L82_C4", "vector": [4, 2, 0.8186, 0.0196, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field in fields_backup:\n form.fields[field] = fields_backup[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L84_C12", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L83_C8", "vector": [14, 3, 0.8235, 0.0098, 3, 0.81, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form.fields[field] = fields_backup[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L86_C4", "label": "resulting_text =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [14, 1, 0.8431, 0.0098, 1, 0.15, 0.7143, 594, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "resulting_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resulting_text = getattr(form, as_choice)()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L88_C4", "label": "form.fields =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [14, 1, 0.8627, 0.0098, 1, 0.15, 0.8571, 258, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "form.fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form.fields = fields_backup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L89_C4", "label": "return", "type": "return", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "vector": [13, 1, 0.8725, 0.0098, 1, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resulting_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "label": "ordered_form", "type": "function", "loc": [92, 102], "level": 0, "parent": null, "vector": [2, 0, 0.951, 0.1078, 0, 0.66, 1.0, 901, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "ordered_form", "arg_names": ["form", "fields", "as_choice"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ordered_form(form=None, fields=None, as_choice='as_table'):\n resulting_text = ''\n if len(form.non_field_errors()) != 0:\n fields_backup = deepcopy(form.fields)\n form.fields = {}\n resulting_text = getattr(form, as_choice)()\n form.fields = fields_backup\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L93_C4", "label": "resulting_text =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "vector": [14, 1, 0.9118, 0.0098, 1, 0.14, 0.0, 594, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "resulting_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resulting_text = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "label": "if", "type": "if", "loc": [94, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "vector": [4, 1, 0.9412, 0.049, 1, 0.14, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(form.non_field_errors()) != 0:\n fields_backup = deepcopy(form.fields)\n form.fields = {}\n resulting_text = getattr(form, as_choice)()\n form.fields = fields_backup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L95_C8", "label": "fields_backup = deepcopy()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "vector": [14, 2, 0.9314, 0.0098, 2, 0.14, 0.0, 524, 3, 1, 0, 0, 44, 10, 1], "semantic": {"name": "fields_backup", "arg_names": [], "import_names": [], "rhs_call_name": "deepcopy", "annotation": ""}, "snippet": " fields_backup = deepcopy(form.fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L96_C8", "label": "form.fields =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "vector": [14, 2, 0.9412, 0.0098, 2, 0.14, 0.3333, 258, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "form.fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form.fields = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L97_C8", "label": "resulting_text =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "vector": [14, 2, 0.951, 0.0098, 2, 0.14, 0.6667, 594, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "resulting_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resulting_text = getattr(form, as_choice)()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L98_C8", "label": "form.fields =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "vector": [14, 2, 0.9608, 0.0098, 2, 0.14, 1.0, 258, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "form.fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form.fields = fields_backup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L100_C4", "label": "resulting_text =", "type": "assigned_variable", "loc": [100, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "vector": [14, 1, 0.9853, 0.0196, 1, 0.14, 0.6667, 594, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "resulting_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resulting_text = resulting_text + include_form_fields(form, fields,\n as_choice, False) + exclude_form_fields(form, fields, as_choice, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L102_C4", "label": "return", "type": "return", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "vector": [13, 1, 1.0, 0.0098, 1, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resulting_text"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:ImportFrom_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:For_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:For_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:For_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:For_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:For_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:If_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_238:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_238:Return_L102_C4"}] |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.template import Library
from django.utils.html import escape
from google.appengine.api import users
register = Library()
@register.simple_tag
def google_login_url(redirect=settings.LOGIN_REDIRECT_URL):
return escape(users.create_login_url(redirect))
@register.simple_tag
def google_logout_url(redirect='/'):
prefixes = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())
if any(redirect.startswith(prefix) for prefix in prefixes):
redirect = '/'
return escape(users.create_logout_url(redirect))
| ajibawa-2023/Python-Code-Large/train/row_239 | 12 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_239:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0556, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:ImportFrom_L3_C0", "label": "from django.template import Library", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0556, 0, 0.66, 0.1667, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Library"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Library"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:ImportFrom_L4_C0", "label": "from django.utils.html import escape", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0556, 0, 0.66, 0.3333, 535, 0, 1, 0, 0, 535, 0, 0], "semantic": {"name": "django.utils.html", "arg_names": [], "import_names": ["escape"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.html import escape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:ImportFrom_L5_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2778, 0.0556, 0, 0.66, 0.5, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L7_C0", "label": "register = Library()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.3889, 0.0556, 0, 0.66, 0.6667, 276, 3, 0, 0, 0, 77, 10, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "Library", "annotation": ""}, "snippet": "register = Library()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L10_C0", "label": "google_login_url", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.5833, 0.1111, 0, 0.66, 0.8333, 457, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "google_login_url", "arg_names": ["redirect"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_login_url(redirect=settings.LOGIN_REDIRECT_URL):\n return escape(users.create_login_url(redirect))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L10_C0", "vector": [13, 1, 0.6111, 0.0556, 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 escape(users.create_login_url(redirect))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "label": "google_logout_url", "type": "function", "loc": [14, 18], "level": 0, "parent": null, "vector": [2, 0, 0.8889, 0.2778, 0, 0.66, 1.0, 193, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "google_logout_url", "arg_names": ["redirect"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_logout_url(redirect='/'):\n prefixes = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())\n if any(redirect.startswith(prefix) for prefix in prefixes):\n redirect = '/'\n return escape(users.create_logout_url(redirect))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L15_C4", "label": "prefixes = getattr()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "vector": [14, 1, 0.8333, 0.0556, 1, 0.98, 0.0, 948, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "prefixes", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " prefixes = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:If_L16_C4", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "vector": [4, 1, 0.9167, 0.1111, 1, 0.98, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if any(redirect.startswith(prefix) for prefix in prefixes):\n redirect = '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L17_C8", "label": "redirect =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_239:If_L16_C4", "vector": [14, 2, 0.9444, 0.0556, 2, 0.76, 0.0, 206, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " redirect = '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_239:Return_L18_C4", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "vector": [13, 1, 1.0, 0.0556, 1, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return escape(users.create_logout_url(redirect))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_239:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_239:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_239:Return_L18_C4"}] |
from django.contrib.auth.models import *
from django.contrib.auth.models import DjangoCompatibleUser as User
| ajibawa-2023/Python-Code-Large/train/row_240 | 2 | 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_240:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_240:ImportFrom_L2_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.5, 0, 0.66, 1.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.models import DjangoCompatibleUser as User"}] | [] |
# -*- coding: utf-8 -*-
"""
Provides basic set of auth urls.
"""
from django.conf.urls.defaults import *
from django.conf import settings
urlpatterns = patterns('')
LOGIN = '^%s$' % settings.LOGIN_URL.lstrip('/')
LOGOUT = '^%s$' % settings.LOGOUT_URL.lstrip('/')
# If user set a LOGOUT_REDIRECT_URL we do a redirect.
# Otherwise we display the default template.
LOGOUT_DATA = {'next_page': getattr(settings, 'LOGOUT_REDIRECT_URL', None)}
# register auth urls depending on whether we use google or hybrid auth
if 'ragendja.auth.middleware.GoogleAuthenticationMiddleware' in \
settings.MIDDLEWARE_CLASSES:
urlpatterns += patterns('',
url(LOGIN, 'ragendja.auth.views.google_login',
name='django.contrib.auth.views.login'),
url(LOGOUT, 'ragendja.auth.views.google_logout', LOGOUT_DATA,
name='django.contrib.auth.views.logout'),
)
elif 'ragendja.auth.middleware.HybridAuthenticationMiddleware' in \
settings.MIDDLEWARE_CLASSES:
urlpatterns += patterns('',
url(LOGIN, 'ragendja.auth.views.hybrid_login',
name='django.contrib.auth.views.login'),
url(LOGOUT, 'ragendja.auth.views.hybrid_logout', LOGOUT_DATA,
name='django.contrib.auth.views.logout'),
)
# When faking a real function we always have to add the real function, too.
urlpatterns += patterns('',
url(LOGIN, 'django.contrib.auth.views.login'),
url(LOGOUT, 'django.contrib.auth.views.logout', LOGOUT_DATA,),
)
| ajibawa-2023/Python-Code-Large/train/row_241 | 9 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_241:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nProvides basic set of auth urls.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:ImportFrom_L5_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1282, 0.0256, 0, 0.66, 0.1429, 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_241:ImportFrom_L6_C0", "label": "from django.conf import settings", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0256, 0, 0.66, 0.2857, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:Assign_L8_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2051, 0.0256, 0, 0.66, 0.4286, 990, 3, 1, 0, 0, 75, 10, 1], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:Assign_L10_C0", "label": "LOGIN =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.2564, 0.0256, 0, 0.66, 0.5714, 324, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "LOGIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGIN = '^%s$' % settings.LOGIN_URL.lstrip('/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:Assign_L11_C0", "label": "LOGOUT =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2821, 0.0256, 0, 0.66, 0.7143, 451, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "LOGOUT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGOUT = '^%s$' % settings.LOGOUT_URL.lstrip('/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:Assign_L15_C0", "label": "LOGOUT_DATA =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.3846, 0.0256, 0, 0.66, 0.8571, 325, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "LOGOUT_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGOUT_DATA = {'next_page': getattr(settings, 'LOGOUT_REDIRECT_URL', None)}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:If_L18_C0", "label": "if", "type": "if", "loc": [18, 33], "level": 0, "parent": null, "vector": [4, 0, 0.6538, 0.4103, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if 'ragendja.auth.middleware.GoogleAuthenticationMiddleware' in \\\n settings.MIDDLEWARE_CLASSES:\n urlpatterns += patterns('',\n url(LOGIN, 'ragendja.auth.views.google_login',\n name='django.contrib.auth.views.login'),\n url(LOGOUT, 'ragendja.auth.views.google_logout', LOGOUT_DATA,\n name='django.contrib.auth.views.logout'),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_241:If_L26_C0", "label": "if", "type": "if", "loc": [26, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_241:If_L18_C0", "vector": [4, 1, 0.7564, 0.2051, 1, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif 'ragendja.auth.middleware.HybridAuthenticationMiddleware' in \\\n settings.MIDDLEWARE_CLASSES:\n urlpatterns += patterns('',\n url(LOGIN, 'ragendja.auth.views.hybrid_login',\n name='django.contrib.auth.views.login'),\n url(LOGOUT, 'ragendja.auth.views.hybrid_logout', LOGOUT_DATA,\n name='django.contrib.auth.views.logout'),\n )"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_241:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_241:If_L26_C0"}] |
# -*- coding: utf-8 -*-
from google.appengine.api import users
def google_user(request):
return {'google_user': users.get_current_user()}
| ajibawa-2023/Python-Code-Large/train/row_242 | 3 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_242:ImportFrom_L2_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_242:FunctionDef_L4_C0", "label": "google_user", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.9, 0.4, 0, 0.66, 1.0, 708, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "google_user", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_user(request):\n return {'google_user': users.get_current_user()}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_242:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_242:FunctionDef_L4_C0", "vector": [13, 1, 1.0, 0.2, 1, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'google_user': users.get_current_user()}"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_242:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_242:Return_L5_C4"}] |
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from google.appengine.api import users
from google.appengine.ext import db
from ragendja.auth.models import EmailUserTraits
class GoogleUserTraits(EmailUserTraits):
@classmethod
def get_djangouser_for_user(cls, user):
django_user = cls.all().filter('user =', user).get()
if django_user:
if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):
is_admin = users.is_current_user_admin()
if django_user.is_staff != is_admin or \
django_user.is_superuser != is_admin:
django_user.is_superuser = django_user.is_staff = is_admin
django_user.put()
else:
django_user = cls.create_djangouser_for_user(user)
django_user.is_active = True
if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True) and \
users.is_current_user_admin():
django_user.is_staff = True
django_user.is_superuser = True
django_user.put()
return django_user
class Meta:
abstract = True
class User(GoogleUserTraits):
"""Extended User class that provides support for Google Accounts."""
user = db.UserProperty(required=True)
class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
@property
def username(self):
return self.user.nickname()
@property
def email(self):
return self.user.email()
@classmethod
def create_djangouser_for_user(cls, user):
return cls(user=user)
| ajibawa-2023/Python-Code-Large/train/row_243 | 35 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_243:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0408, 0.0204, 0, 0.66, 0.1667, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ImportFrom_L3_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0204, 0, 0.66, 0.3333, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ImportFrom_L4_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0204, 0, 0.66, 0.5, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ImportFrom_L5_C0", "label": "from ragendja.auth.models import EmailUserTraits", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.102, 0.0204, 0, 0.66, 0.6667, 7, 0, 1, 0, 0, 7, 0, 0], "semantic": {"name": "ragendja.auth.models", "arg_names": [], "import_names": ["EmailUserTraits"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.models import EmailUserTraits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "label": "GoogleUserTraits", "type": "class", "loc": [7, 29], "level": 0, "parent": null, "vector": [3, 0, 0.3673, 0.4694, 0, 0.66, 0.8333, 917, 0, 1, 0, 0, 228, 0, 10], "semantic": {"name": "GoogleUserTraits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GoogleUserTraits(EmailUserTraits):\n @classmethod\n def get_djangouser_for_user(cls, user):\n django_user = cls.all().filter('user =', user).get()\n if django_user:\n if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):\n is_admin = users.is_current_user_admin()\n if django_user.is_staff != is_admin or \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "label": "get_djangouser_for_user", "type": "function", "loc": [9, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "vector": [2, 1, 0.3571, 0.3673, 1, 0.12, 0.0, 617, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "get_djangouser_for_user", "arg_names": ["cls", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_djangouser_for_user(cls, user):\n django_user = cls.all().filter('user =', user).get()\n if django_user:\n if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):\n is_admin = users.is_current_user_admin()\n if django_user.is_staff != is_admin or \\\n django_user.is_superuser != is_admin:\n django_user.is_superuser = django_user.is_staff = is_admin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L10_C8", "label": "django_user = get()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "vector": [14, 2, 0.2041, 0.0204, 2, 0.97, 0.0, 467, 3, 0, 0, 0, 607, 10, 3], "semantic": {"name": "django_user", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " django_user = cls.all().filter('user =', user).get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "label": "if", "type": "if", "loc": [11, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "vector": [4, 2, 0.3673, 0.3061, 2, 0.97, 0.5, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if django_user:\n if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):\n is_admin = users.is_current_user_admin()\n if django_user.is_staff != is_admin or \\\n django_user.is_superuser != is_admin:\n django_user.is_superuser = django_user.is_staff = is_admin\n django_user.put()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12", "label": "if", "type": "if", "loc": [12, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "vector": [4, 3, 0.2959, 0.1224, 3, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):\n is_admin = users.is_current_user_admin()\n if django_user.is_staff != is_admin or \\\n django_user.is_superuser != is_admin:\n django_user.is_superuser = django_user.is_staff = is_admin\n django_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L13_C16", "label": "is_admin = is_current_user_admin()", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12", "vector": [14, 4, 0.2653, 0.0204, 4, 0.15, 0.0, 220, 3, 0, 0, 0, 948, 10, 1], "semantic": {"name": "is_admin", "arg_names": [], "import_names": [], "rhs_call_name": "is_current_user_admin", "annotation": ""}, "snippet": " is_admin = users.is_current_user_admin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16", "label": "if", "type": "if", "loc": [14, 17], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12", "vector": [4, 4, 0.3163, 0.0816, 4, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if django_user.is_staff != is_admin or \\\n django_user.is_superuser != is_admin:\n django_user.is_superuser = django_user.is_staff = is_admin\n django_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L16_C20", "label": "django_user.is_superuser =", "type": "assigned_variable", "loc": [16, 16], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16", "vector": [14, 5, 0.3265, 0.0204, 5, 0.37, 0.0, 488, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "django_user.is_superuser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " django_user.is_superuser = django_user.is_staff = is_admin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L17_C20", "label": "put()", "type": "expression", "loc": [17, 17], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16", "vector": [8, 5, 0.3469, 0.0204, 5, 0.37, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " django_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L19_C12", "label": "django_user = create_djangouser_for_user()", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "vector": [14, 3, 0.3878, 0.0204, 3, 0.58, 0.25, 467, 3, 1, 0, 0, 108, 10, 1], "semantic": {"name": "django_user", "arg_names": [], "import_names": [], "rhs_call_name": "create_djangouser_for_user", "annotation": ""}, "snippet": " django_user = cls.create_djangouser_for_user(user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L20_C12", "label": "django_user.is_active =", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "vector": [14, 3, 0.4082, 0.0204, 3, 0.58, 0.5, 555, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "django_user.is_active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " django_user.is_active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12", "label": "if", "type": "if", "loc": [21, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "vector": [4, 3, 0.4592, 0.0816, 3, 0.58, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True) and \\\n users.is_current_user_admin():\n django_user.is_staff = True\n django_user.is_superuser = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L23_C16", "label": "django_user.is_staff =", "type": "assigned_variable", "loc": [23, 23], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12", "vector": [14, 4, 0.4694, 0.0204, 4, 0.23, 0.0, 379, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "django_user.is_staff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " django_user.is_staff = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L24_C16", "label": "django_user.is_superuser =", "type": "assigned_variable", "loc": [24, 24], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12", "vector": [14, 4, 0.4898, 0.0204, 4, 0.23, 1.0, 488, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "django_user.is_superuser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " django_user.is_superuser = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L25_C12", "label": "put()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "vector": [8, 3, 0.5102, 0.0204, 3, 0.58, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " django_user.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "vector": [13, 2, 0.5306, 0.0204, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return django_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L28_C4", "label": "Meta", "type": "class", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "vector": [3, 1, 0.5816, 0.0408, 1, 0.12, 1.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n abstract = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L29_C8", "label": "abstract =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L28_C4", "vector": [14, 2, 0.5918, 0.0204, 2, 0.73, 0.0, 301, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "abstract", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " abstract = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "label": "User", "type": "class", "loc": [31, 49], "level": 0, "parent": null, "vector": [3, 0, 0.8163, 0.3878, 0, 0.66, 1.0, 61, 0, 3, 0, 0, 917, 0, 6], "semantic": {"name": "User", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class User(GoogleUserTraits):\n \"\"\"Extended User class that provides support for Google Accounts.\"\"\"\n user = db.UserProperty(required=True)\n\n class Meta:\n verbose_name = _('user')\n verbose_name_plural = _('users')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L32_C4", "label": "expression", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [8, 1, 0.6531, 0.0204, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extended User class that provides support for Google Accounts.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L33_C4", "label": "user = UserProperty()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [14, 1, 0.6735, 0.0204, 1, 0.86, 0.2, 503, 3, 1, 0, 0, 730, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "UserProperty", "annotation": ""}, "snippet": " user = db.UserProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4", "label": "Meta", "type": "class", "loc": [35, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [3, 1, 0.7347, 0.0612, 1, 0.86, 0.4, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n verbose_name = _('user')\n verbose_name_plural = _('users')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L36_C8", "label": "verbose_name = _()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4", "vector": [14, 2, 0.7347, 0.0204, 2, 0.04, 0.0, 616, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name = _('user')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L37_C8", "label": "verbose_name_plural = _()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4", "vector": [14, 2, 0.7551, 0.0204, 2, 0.04, 1.0, 329, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name_plural", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name_plural = _('users')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L40_C4", "label": "username", "type": "function", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [2, 1, 0.8265, 0.0408, 1, 0.86, 0.6, 718, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "username", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def username(self):\n return self.user.nickname()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L40_C4", "vector": [13, 2, 0.8367, 0.0204, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.user.nickname()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L44_C4", "label": "email", "type": "function", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [2, 1, 0.9082, 0.0408, 1, 0.86, 0.8, 413, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "email", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def email(self):\n return self.user.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L45_C8", "label": "return", "type": "return", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L44_C4", "vector": [13, 2, 0.9184, 0.0204, 2, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.user.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L48_C4", "label": "create_djangouser_for_user", "type": "function", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "vector": [2, 1, 0.9898, 0.0408, 1, 0.86, 1.0, 108, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "create_djangouser_for_user", "arg_names": ["cls", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_djangouser_for_user(cls, user):\n return cls(user=user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L49_C8", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L48_C4", "vector": [13, 2, 1.0, 0.0204, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(user=user)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L13_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L16_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L14_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L17_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L23_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L24_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_243:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_243:Return_L49_C8"}] |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from functools import wraps
from ragendja.auth.views import google_redirect_to_login
from ragendja.template import render_to_response
def staff_only(view):
"""
Decorator that requires user.is_staff. Otherwise renders no_access.html.
"""
@login_required
def wrapped(request, *args, **kwargs):
if request.user.is_active and request.user.is_staff:
return view(request, *args, **kwargs)
return render_to_response(request, 'no_access.html')
return wraps(view)(wrapped)
def google_login_required(function):
def login_required_wrapper(request, *args, **kw):
if request.user.is_authenticated():
return function(request, *args, **kw)
return google_redirect_to_login(request.get_full_path())
return wraps(function)(login_required_wrapper)
| ajibawa-2023/Python-Code-Large/train/row_244 | 17 | 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_244:ImportFrom_L2_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.auth.decorators", "arg_names": [], "import_names": ["login_required"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.decorators import login_required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:ImportFrom_L3_C0", "label": "from functools import wraps", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1304, 0.0435, 0, 0.66, 0.2, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["wraps"], "rhs_call_name": "", "annotation": ""}, "snippet": "from functools import wraps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:ImportFrom_L4_C0", "label": "from ragendja.auth.views import google_redirect_to_login", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0435, 0, 0.66, 0.4, 731, 0, 1, 0, 0, 731, 0, 0], "semantic": {"name": "ragendja.auth.views", "arg_names": [], "import_names": ["google_redirect_to_login"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.views import google_redirect_to_login"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:ImportFrom_L5_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2174, 0.0435, 0, 0.66, 0.6, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "label": "staff_only", "type": "function", "loc": [7, 16], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.4348, 0, 0.66, 0.8, 499, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "staff_only", "arg_names": ["view"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def staff_only(view):\n \"\"\"\n Decorator that requires user.is_staff. Otherwise renders no_access.html.\n \"\"\"\n @login_required\n def wrapped(request, *args, **kwargs):\n if request.user.is_active and request.user.is_staff:\n return view(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "vector": [8, 1, 0.3913, 0.1304, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Decorator that requires user.is_staff. Otherwise renders no_access.html.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4", "label": "wrapped", "type": "function", "loc": [12, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "vector": [2, 1, 0.587, 0.1739, 1, 0.39, 0.5, 745, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "wrapped", "arg_names": ["request", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wrapped(request, *args, **kwargs):\n if request.user.is_active and request.user.is_staff:\n return view(request, *args, **kwargs)\n return render_to_response(request, 'no_access.html')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:If_L13_C8", "label": "if", "type": "if", "loc": [13, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4", "vector": [4, 2, 0.587, 0.087, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.user.is_active and request.user.is_staff:\n return view(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L14_C12", "label": "return", "type": "return", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:If_L13_C8", "vector": [13, 3, 0.6087, 0.0435, 3, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return view(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L15_C8", "label": "return", "type": "return", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4", "vector": [13, 2, 0.6522, 0.0435, 2, 0.0, 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(request, 'no_access.html')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "vector": [13, 1, 0.6957, 0.0435, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wraps(view)(wrapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L18_C0", "label": "google_login_required", "type": "function", "loc": [18, 23], "level": 0, "parent": null, "vector": [2, 0, 0.8913, 0.2609, 0, 0.66, 1.0, 871, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "google_login_required", "arg_names": ["function"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_login_required(function):\n def login_required_wrapper(request, *args, **kw):\n if request.user.is_authenticated():\n return function(request, *args, **kw)\n return google_redirect_to_login(request.get_full_path())\n return wraps(function)(login_required_wrapper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4", "label": "login_required_wrapper", "type": "function", "loc": [19, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L18_C0", "vector": [2, 1, 0.8913, 0.1739, 1, 0.48, 0.0, 557, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "login_required_wrapper", "arg_names": ["request", "args", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_required_wrapper(request, *args, **kw):\n if request.user.is_authenticated():\n return function(request, *args, **kw)\n return google_redirect_to_login(request.get_full_path())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:If_L20_C8", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4", "vector": [4, 2, 0.8913, 0.087, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.user.is_authenticated():\n return function(request, *args, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L21_C12", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:If_L20_C8", "vector": [13, 3, 0.913, 0.0435, 3, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return function(request, *args, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4", "vector": [13, 2, 0.9565, 0.0435, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return google_redirect_to_login(request.get_full_path())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L23_C4", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L18_C0", "vector": [13, 1, 1.0, 0.0435, 1, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wraps(function)(login_required_wrapper)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_244:If_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:If_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L14_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_244:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_244:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_244:Return_L23_C4"}] |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import login, logout
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext as _
from google.appengine.api import users
from ragendja.template import render_to_response
def get_redirect_to(request, redirect_field_name):
redirect_to = request.REQUEST.get(redirect_field_name)
# Light security check -- make sure redirect_to isn't garbage.
if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
redirect_to = settings.LOGIN_REDIRECT_URL
return redirect_to
def google_login(request, template_name=None,
redirect_field_name=REDIRECT_FIELD_NAME):
redirect_to = get_redirect_to(request, redirect_field_name)
return HttpResponseRedirect(users.create_login_url(redirect_to))
def hybrid_login(request, template_name='registration/login.html',
redirect_field_name=REDIRECT_FIELD_NAME):
# Don't login using both authentication systems at the same time
if request.user.is_authenticated():
redirect_to = get_redirect_to(request, redirect_field_name)
return HttpResponseRedirect(redirect_to)
return login(request, template_name, redirect_field_name)
def google_logout(request, next_page=None,
template_name='registration/logged_out.html'):
if users.get_current_user():
# Redirect to this page until the session has been cleared.
logout_url = users.create_logout_url(next_page or request.path)
return HttpResponseRedirect(logout_url)
if not next_page:
return render_to_response(request, template_name,
{'title': _('Logged out')})
return HttpResponseRedirect(next_page)
def hybrid_logout(request, next_page=None,
template_name='registration/logged_out.html'):
if users.get_current_user():
return google_logout(request, next_page)
return logout(request, next_page, template_name)
def google_logout_then_login(request, login_url=None):
if not login_url:
login_url = settings.LOGIN_URL
return google_logout(request, login_url)
def hybrid_logout_then_login(request, login_url=None):
if not login_url:
login_url = settings.LOGIN_URL
return hybrid_logout(request, login_url)
def google_redirect_to_login(next, login_url=None, redirect_field_name=None):
return HttpResponseRedirect(users.create_login_url(next))
| ajibawa-2023/Python-Code-Large/train/row_245 | 41 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0172, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L3_C0", "label": "from django.contrib.auth import REDIRECT_FIELD_NAME", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0517, 0.0172, 0, 0.66, 0.0714, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names": [], "import_names": ["REDIRECT_FIELD_NAME"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth import REDIRECT_FIELD_NAME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L4_C0", "label": "from django.contrib.auth.views import login, logout", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.069, 0.0172, 0, 0.66, 0.1429, 745, 0, 2, 0, 0, 745, 0, 0], "semantic": {"name": "django.contrib.auth.views", "arg_names": [], "import_names": ["login", "logout"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.auth.views import login, logout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L5_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0862, 0.0172, 0, 0.66, 0.2143, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L6_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1034, 0.0172, 0, 0.66, 0.2857, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L7_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1207, 0.0172, 0, 0.66, 0.3571, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:ImportFrom_L8_C0", "label": "from ragendja.template import render_to_response", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1379, 0.0172, 0, 0.66, 0.4286, 136, 0, 1, 0, 0, 136, 0, 0], "semantic": {"name": "ragendja.template", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.template import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "label": "get_redirect_to", "type": "function", "loc": [10, 15], "level": 0, "parent": null, "vector": [2, 0, 0.2155, 0.1034, 0, 0.66, 0.5, 835, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_redirect_to", "arg_names": ["request", "redirect_field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_redirect_to(request, redirect_field_name):\n redirect_to = request.REQUEST.get(redirect_field_name)\n # Light security check -- make sure redirect_to isn't garbage.\n if not redirect_to or '//' in redirect_to or ' ' in redirect_to:\n redirect_to = settings.LOGIN_REDIRECT_URL\n return redirect_to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L11_C4", "label": "redirect_to = get()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "vector": [14, 1, 0.1897, 0.0172, 1, 0.16, 0.0, 754, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "redirect_to", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " redirect_to = request.REQUEST.get(redirect_field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L13_C4", "label": "if", "type": "if", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "vector": [4, 1, 0.2328, 0.0345, 1, 0.16, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not redirect_to or '//' in redirect_to or ' ' in redirect_to:\n redirect_to = settings.LOGIN_REDIRECT_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L14_C8", "label": "redirect_to =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L13_C4", "vector": [14, 2, 0.2414, 0.0172, 2, 0.67, 0.0, 754, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "redirect_to", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " redirect_to = settings.LOGIN_REDIRECT_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L15_C4", "label": "return", "type": "return", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "vector": [13, 1, 0.2586, 0.0172, 1, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return redirect_to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L17_C0", "label": "google_login", "type": "function", "loc": [17, 20], "level": 0, "parent": null, "vector": [2, 0, 0.319, 0.069, 0, 0.66, 0.5714, 502, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "google_login", "arg_names": ["request", "template_name", "redirect_field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_login(request, template_name=None,\n redirect_field_name=REDIRECT_FIELD_NAME):\n redirect_to = get_redirect_to(request, redirect_field_name)\n return HttpResponseRedirect(users.create_login_url(redirect_to))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L19_C4", "label": "redirect_to = get_redirect_to()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L17_C0", "vector": [14, 1, 0.3276, 0.0172, 1, 0.3, 0.0, 754, 3, 2, 0, 0, 835, 10, 1], "semantic": {"name": "redirect_to", "arg_names": [], "import_names": [], "rhs_call_name": "get_redirect_to", "annotation": ""}, "snippet": " redirect_to = get_redirect_to(request, redirect_field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L17_C0", "vector": [13, 1, 0.3448, 0.0172, 1, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(users.create_login_url(redirect_to))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L22_C0", "label": "hybrid_login", "type": "function", "loc": [22, 28], "level": 0, "parent": null, "vector": [2, 0, 0.431, 0.1207, 0, 0.66, 0.6429, 157, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "hybrid_login", "arg_names": ["request", "template_name", "redirect_field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hybrid_login(request, template_name='registration/login.html',\n redirect_field_name=REDIRECT_FIELD_NAME):\n # Don't login using both authentication systems at the same time\n if request.user.is_authenticated():\n redirect_to = get_redirect_to(request, redirect_field_name)\n return HttpResponseRedirect(redirect_to)\n return login(request, template_name, redirect_field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4", "label": "if", "type": "if", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L22_C0", "vector": [4, 1, 0.4483, 0.0517, 1, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.user.is_authenticated():\n redirect_to = get_redirect_to(request, redirect_field_name)\n return HttpResponseRedirect(redirect_to)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L26_C8", "label": "redirect_to = get_redirect_to()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4", "vector": [14, 2, 0.4483, 0.0172, 2, 0.4, 0.0, 754, 3, 2, 0, 0, 835, 10, 1], "semantic": {"name": "redirect_to", "arg_names": [], "import_names": [], "rhs_call_name": "get_redirect_to", "annotation": ""}, "snippet": " redirect_to = get_redirect_to(request, redirect_field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4", "vector": [13, 2, 0.4655, 0.0172, 2, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(redirect_to)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L28_C4", "label": "return", "type": "return", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L22_C0", "vector": [13, 1, 0.4828, 0.0172, 1, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return login(request, template_name, redirect_field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "label": "google_logout", "type": "function", "loc": [30, 39], "level": 0, "parent": null, "vector": [2, 0, 0.5948, 0.1724, 0, 0.66, 0.7143, 734, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "google_logout", "arg_names": ["request", "next_page", "template_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_logout(request, next_page=None,\n template_name='registration/logged_out.html'):\n if users.get_current_user():\n # Redirect to this page until the session has been cleared.\n logout_url = users.create_logout_url(next_page or request.path)\n return HttpResponseRedirect(logout_url)\n if not next_page:\n return render_to_response(request, template_name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4", "label": "if", "type": "if", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "vector": [4, 1, 0.5776, 0.069, 1, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if users.get_current_user():\n # Redirect to this page until the session has been cleared.\n logout_url = users.create_logout_url(next_page or request.path)\n return HttpResponseRedirect(logout_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L34_C8", "label": "logout_url = create_logout_url()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4", "vector": [14, 2, 0.5862, 0.0172, 2, 0.66, 0.0, 181, 3, 1, 0, 0, 416, 10, 1], "semantic": {"name": "logout_url", "arg_names": [], "import_names": [], "rhs_call_name": "create_logout_url", "annotation": ""}, "snippet": " logout_url = users.create_logout_url(next_page or request.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4", "vector": [13, 2, 0.6034, 0.0172, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(logout_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L36_C4", "label": "if", "type": "if", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "vector": [4, 1, 0.6379, 0.0517, 1, 0.24, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not next_page:\n return render_to_response(request, template_name,\n {'title': _('Logged out')})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L36_C4", "vector": [13, 2, 0.6466, 0.0345, 2, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(request, template_name,\n {'title': _('Logged out')})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "vector": [13, 1, 0.6724, 0.0172, 1, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(next_page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L41_C0", "label": "hybrid_logout", "type": "function", "loc": [41, 45], "level": 0, "parent": null, "vector": [2, 0, 0.7414, 0.0862, 0, 0.66, 0.7857, 506, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "hybrid_logout", "arg_names": ["request", "next_page", "template_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hybrid_logout(request, next_page=None,\n template_name='registration/logged_out.html'):\n if users.get_current_user():\n return google_logout(request, next_page)\n return logout(request, next_page, template_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L43_C4", "label": "if", "type": "if", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L41_C0", "vector": [4, 1, 0.75, 0.0345, 1, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if users.get_current_user():\n return google_logout(request, next_page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L44_C8", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L43_C4", "vector": [13, 2, 0.7586, 0.0172, 2, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return google_logout(request, next_page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L45_C4", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L41_C0", "vector": [13, 1, 0.7759, 0.0172, 1, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return logout(request, next_page, template_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L47_C0", "label": "google_logout_then_login", "type": "function", "loc": [47, 50], "level": 0, "parent": null, "vector": [2, 0, 0.8362, 0.069, 0, 0.66, 0.8571, 264, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "google_logout_then_login", "arg_names": ["request", "login_url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_logout_then_login(request, login_url=None):\n if not login_url:\n login_url = settings.LOGIN_URL\n return google_logout(request, login_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L48_C4", "label": "if", "type": "if", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L47_C0", "vector": [4, 1, 0.8362, 0.0345, 1, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not login_url:\n login_url = settings.LOGIN_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L49_C8", "label": "login_url =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L48_C4", "vector": [14, 2, 0.8448, 0.0172, 2, 0.77, 0.0, 704, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "login_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " login_url = settings.LOGIN_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L47_C0", "vector": [13, 1, 0.8621, 0.0172, 1, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return google_logout(request, login_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L52_C0", "label": "hybrid_logout_then_login", "type": "function", "loc": [52, 55], "level": 0, "parent": null, "vector": [2, 0, 0.9224, 0.069, 0, 0.66, 0.9286, 881, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "hybrid_logout_then_login", "arg_names": ["request", "login_url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hybrid_logout_then_login(request, login_url=None):\n if not login_url:\n login_url = settings.LOGIN_URL\n return hybrid_logout(request, login_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:If_L53_C4", "label": "if", "type": "if", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L52_C0", "vector": [4, 1, 0.9224, 0.0345, 1, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not login_url:\n login_url = settings.LOGIN_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L54_C8", "label": "login_url =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:If_L53_C4", "vector": [14, 2, 0.931, 0.0172, 2, 0.36, 0.0, 704, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "login_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " login_url = settings.LOGIN_URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L52_C0", "vector": [13, 1, 0.9483, 0.0172, 1, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hybrid_logout(request, login_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L57_C0", "label": "google_redirect_to_login", "type": "function", "loc": [57, 58], "level": 0, "parent": null, "vector": [2, 0, 0.9914, 0.0345, 0, 0.66, 1.0, 121, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "google_redirect_to_login", "arg_names": ["next", "login_url", "redirect_field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def google_redirect_to_login(next, login_url=None, redirect_field_name=None):\n return HttpResponseRedirect(users.create_login_url(next))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L57_C0", "vector": [13, 1, 1.0, 0.0172, 1, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect(users.create_login_url(next))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:If_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_245:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_245:Return_L58_C4"}] |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
class UserAdmin(admin.ModelAdmin):
fieldsets = (
(_('Personal info'), {'fields': ('user',)}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),
(_('Important dates'), {'fields': ('date_joined',)}),
(_('Groups'), {'fields': ('groups',)}),
)
list_display = ('email', 'username', 'is_staff')
list_filter = ('is_staff', 'is_superuser', 'is_active')
search_fields = ('user',)
filter_horizontal = ('user_permissions',)
| ajibawa-2023/Python-Code-Large/train/row_246 | 8 | 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_246:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 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_246:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.5, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "label": "UserAdmin", "type": "class", "loc": [4, 14], "level": 0, "parent": null, "vector": [3, 0, 0.6429, 0.7857, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 823, 0, 4], "semantic": {"name": "UserAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UserAdmin(admin.ModelAdmin):\n fieldsets = (\n (_('Personal info'), {'fields': ('user',)}),\n (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),\n (_('Important dates'), {'fields': ('date_joined',)}),\n (_('Groups'), {'fields': ('groups',)}),\n )\n list_display = ('email', 'username', 'is_staff')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L5_C4", "label": "fieldsets =", "type": "assigned_variable", "loc": [5, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "vector": [14, 1, 0.5357, 0.4286, 1, 0.81, 0.0, 340, 0, 0, 0, 0, 0, 8, 4], "semantic": {"name": "fieldsets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fieldsets = (\n (_('Personal info'), {'fields': ('user',)}),\n (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),\n (_('Important dates'), {'fields': ('date_joined',)}),\n (_('Groups'), {'fields': ('groups',)}),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L11_C4", "label": "list_display =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "vector": [14, 1, 0.7857, 0.0714, 1, 0.81, 0.25, 489, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_display", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_display = ('email', 'username', 'is_staff')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L12_C4", "label": "list_filter =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "vector": [14, 1, 0.8571, 0.0714, 1, 0.81, 0.5, 851, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "list_filter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_filter = ('is_staff', 'is_superuser', 'is_active')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L13_C4", "label": "search_fields =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "vector": [14, 1, 0.9286, 0.0714, 1, 0.81, 0.75, 834, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "search_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_fields = ('user',)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L14_C4", "label": "filter_horizontal =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "vector": [14, 1, 1.0, 0.0714, 1, 0.81, 1.0, 258, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "filter_horizontal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filter_horizontal = ('user_permissions',)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_246:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_246:Assign_L14_C4"}] |
# Parts of this code are taken from Google's django-helper (license: Apache 2)
class LazyGoogleUser(object):
def __init__(self, middleware_class):
self._middleware_class = middleware_class
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
from django.contrib.auth.models import AnonymousUser, User
from google.appengine.api import users
if self._middleware_class is HybridAuthenticationMiddleware:
request._cached_user = get_user(request)
else:
request._cached_user = AnonymousUser()
if request._cached_user.is_anonymous():
user = users.get_current_user()
if user:
request._cached_user = User.get_djangouser_for_user(user)
return request._cached_user
class GoogleAuthenticationMiddleware(object):
def process_request(self, request):
request.__class__.user = LazyGoogleUser(self.__class__)
class HybridAuthenticationMiddleware(GoogleAuthenticationMiddleware):
pass
| ajibawa-2023/Python-Code-Large/train/row_247 | 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_247:ClassDef_L3_C0", "label": "LazyGoogleUser", "type": "class", "loc": [3, 20], "level": 0, "parent": null, "vector": [3, 0, 0.4259, 0.6667, 0, 0.66, 0.0, 696, 0, 2, 0, 0, 186, 0, 6], "semantic": {"name": "LazyGoogleUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LazyGoogleUser(object):\n def __init__(self, middleware_class):\n self._middleware_class = middleware_class\n\n def __get__(self, request, obj_type=None):\n if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n from django.contrib.auth.models import AnonymousUser, User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L3_C0", "vector": [2, 1, 0.1667, 0.0741, 1, 0.49, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "middleware_class"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, middleware_class):\n self._middleware_class = middleware_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L5_C8", "label": "self._middleware_class =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4", "vector": [14, 2, 0.1852, 0.037, 2, 0.07, 0.0, 395, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._middleware_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._middleware_class = middleware_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4", "label": "__get__", "type": "function", "loc": [7, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L3_C0", "vector": [2, 1, 0.5, 0.5185, 1, 0.49, 1.0, 93, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "__get__", "arg_names": ["self", "request", "obj_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __get__(self, request, obj_type=None):\n if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n from django.contrib.auth.models import AnonymousUser, User\n from google.appengine.api import users\n if self._middleware_class is HybridAuthenticationMiddleware:\n request._cached_user = get_user(request)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "label": "if", "type": "if", "loc": [8, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4", "vector": [4, 2, 0.5, 0.4444, 2, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n from django.contrib.auth.models import AnonymousUser, User\n from google.appengine.api import users\n if self._middleware_class is HybridAuthenticationMiddleware:\n request._cached_user = get_user(request)\n else:\n request._cached_user = AnonymousUser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L9_C12", "label": "from django.contrib.auth import get_user", "type": "import", "loc": [9, 9], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "vector": [1, 3, 0.3333, 0.037, 3, 0.41, 0.0, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names": [], "import_names": ["get_user"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.auth import get_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L10_C12", "label": "from django.contrib.auth.models import AnonymousUser, User", "type": "import", "loc": [10, 10], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "vector": [1, 3, 0.3704, 0.037, 3, 0.41, 0.25, 808, 0, 2, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["AnonymousUser", "User"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.auth.models import AnonymousUser, User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L11_C12", "label": "from google.appengine.api import users", "type": "import", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "vector": [1, 3, 0.4074, 0.037, 3, 0.41, 0.5, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12", "label": "if", "type": "if", "loc": [12, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "vector": [4, 3, 0.5, 0.1481, 3, 0.41, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._middleware_class is HybridAuthenticationMiddleware:\n request._cached_user = get_user(request)\n else:\n request._cached_user = AnonymousUser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L13_C16", "label": "request._cached_user = get_user()", "type": "assigned_variable", "loc": [13, 13], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12", "vector": [14, 4, 0.4815, 0.037, 4, 0.05, 0.0, 789, 3, 1, 0, 0, 174, 10, 1], "semantic": {"name": "request._cached_user", "arg_names": [], "import_names": [], "rhs_call_name": "get_user", "annotation": ""}, "snippet": " request._cached_user = get_user(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L15_C16", "label": "request._cached_user = AnonymousUser()", "type": "assigned_variable", "loc": [15, 15], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12", "vector": [14, 4, 0.5556, 0.037, 4, 0.05, 1.0, 789, 3, 0, 0, 0, 185, 10, 1], "semantic": {"name": "request._cached_user", "arg_names": [], "import_names": [], "rhs_call_name": "AnonymousUser", "annotation": ""}, "snippet": " request._cached_user = AnonymousUser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12", "label": "if", "type": "if", "loc": [16, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "vector": [4, 3, 0.6481, 0.1481, 3, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request._cached_user.is_anonymous():\n user = users.get_current_user()\n if user:\n request._cached_user = User.get_djangouser_for_user(user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L17_C16", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [17, 17], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12", "vector": [14, 4, 0.6296, 0.037, 4, 0.04, 0.0, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:If_L18_C16", "label": "if", "type": "if", "loc": [18, 19], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12", "vector": [4, 4, 0.6852, 0.0741, 4, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user:\n request._cached_user = User.get_djangouser_for_user(user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L19_C20", "label": "request._cached_user = get_djangouser_for_user()", "type": "assigned_variable", "loc": [19, 19], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:If_L18_C16", "vector": [14, 5, 0.7037, 0.037, 5, 0.65, 0.0, 789, 3, 1, 0, 0, 617, 10, 1], "semantic": {"name": "request._cached_user", "arg_names": [], "import_names": [], "rhs_call_name": "get_djangouser_for_user", "annotation": ""}, "snippet": " request._cached_user = User.get_djangouser_for_user(user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4", "vector": [13, 2, 0.7407, 0.037, 2, 0.89, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return request._cached_user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L22_C0", "label": "GoogleAuthenticationMiddleware", "type": "class", "loc": [22, 24], "level": 0, "parent": null, "vector": [3, 0, 0.8519, 0.1111, 0, 0.66, 0.5, 714, 0, 1, 0, 0, 186, 0, 1], "semantic": {"name": "GoogleAuthenticationMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GoogleAuthenticationMiddleware(object):\n def process_request(self, request):\n request.__class__.user = LazyGoogleUser(self.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L23_C4", "label": "process_request", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L22_C0", "vector": [2, 1, 0.8704, 0.0741, 1, 0.85, 0.0, 81, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "process_request", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_request(self, request):\n request.__class__.user = LazyGoogleUser(self.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L24_C8", "label": "request.__class__.user = LazyGoogleUser()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L23_C4", "vector": [14, 2, 0.8889, 0.037, 2, 0.07, 0.0, 512, 3, 1, 0, 0, 696, 10, 1], "semantic": {"name": "request.__class__.user", "arg_names": [], "import_names": [], "rhs_call_name": "LazyGoogleUser", "annotation": ""}, "snippet": " request.__class__.user = LazyGoogleUser(self.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L26_C0", "label": "HybridAuthenticationMiddleware", "type": "class", "loc": [26, 27], "level": 0, "parent": null, "vector": [3, 0, 0.9815, 0.0741, 0, 0.66, 1.0, 434, 0, 0, 0, 0, 714, 0, 0], "semantic": {"name": "HybridAuthenticationMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HybridAuthenticationMiddleware(GoogleAuthenticationMiddleware):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L9_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_247:ImportFrom_L11_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L13_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L12_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L15_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L17_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L16_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_247:If_L18_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:If_L18_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L19_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_247:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_247:Assign_L24_C8"}] |
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext import db
from ragendja.auth.google_models import GoogleUserTraits
class User(GoogleUserTraits):
"""User class that provides support for Django and Google Accounts."""
user = db.UserProperty()
username = db.StringProperty(required=True, verbose_name=_('username'))
email = db.EmailProperty(verbose_name=_('e-mail address'))
first_name = db.StringProperty(verbose_name=_('first name'))
last_name = db.StringProperty(verbose_name=_('last name'))
class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
@classmethod
def create_djangouser_for_user(cls, user):
return cls(user=user, email=user.email(), username=user.email())
| ajibawa-2023/Python-Code-Large/train/row_248 | 15 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_248:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:ImportFrom_L2_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.3333, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:ImportFrom_L3_C0", "label": "from ragendja.auth.google_models import GoogleUserTraits", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0526, 0, 0.66, 0.6667, 555, 0, 1, 0, 0, 555, 0, 0], "semantic": {"name": "ragendja.auth.google_models", "arg_names": [], "import_names": ["GoogleUserTraits"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.auth.google_models import GoogleUserTraits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "label": "User", "type": "class", "loc": [5, 19], "level": 0, "parent": null, "vector": [3, 0, 0.6316, 0.7895, 0, 0.66, 1.0, 61, 0, 1, 0, 0, 917, 0, 14], "semantic": {"name": "User", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class User(GoogleUserTraits):\n \"\"\"User class that provides support for Django and Google Accounts.\"\"\"\n user = db.UserProperty()\n username = db.StringProperty(required=True, verbose_name=_('username'))\n email = db.EmailProperty(verbose_name=_('e-mail address'))\n first_name = db.StringProperty(verbose_name=_('first name'))\n last_name = db.StringProperty(verbose_name=_('last name'))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [8, 1, 0.3158, 0.0526, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"User class that provides support for Django and Google Accounts.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L7_C4", "label": "user = UserProperty()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [14, 1, 0.3684, 0.0526, 1, 0.11, 0.1429, 503, 3, 0, 0, 0, 730, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "UserProperty", "annotation": ""}, "snippet": " user = db.UserProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L8_C4", "label": "username = StringProperty()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [14, 1, 0.4211, 0.0526, 1, 0.11, 0.2857, 718, 3, 2, 0, 0, 882, 10, 2], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " username = db.StringProperty(required=True, verbose_name=_('username'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L9_C4", "label": "email = EmailProperty()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [14, 1, 0.4737, 0.0526, 1, 0.11, 0.4286, 413, 3, 1, 0, 0, 697, 10, 2], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "EmailProperty", "annotation": ""}, "snippet": " email = db.EmailProperty(verbose_name=_('e-mail address'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L10_C4", "label": "first_name = StringProperty()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [14, 1, 0.5263, 0.0526, 1, 0.11, 0.5714, 185, 3, 1, 0, 0, 882, 10, 2], "semantic": {"name": "first_name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " first_name = db.StringProperty(verbose_name=_('first name'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L11_C4", "label": "last_name = StringProperty()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [14, 1, 0.5789, 0.0526, 1, 0.11, 0.7143, 578, 3, 1, 0, 0, 882, 10, 2], "semantic": {"name": "last_name", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " last_name = db.StringProperty(verbose_name=_('last name'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4", "label": "Meta", "type": "class", "loc": [13, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [3, 1, 0.7368, 0.1579, 1, 0.11, 0.8571, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n verbose_name = _('user')\n verbose_name_plural = _('users')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L14_C8", "label": "verbose_name = _()", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4", "vector": [14, 2, 0.7368, 0.0526, 2, 0.91, 0.0, 616, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name = _('user')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L15_C8", "label": "verbose_name_plural = _()", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4", "vector": [14, 2, 0.7895, 0.0526, 2, 0.91, 1.0, 329, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name_plural", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name_plural = _('users')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:FunctionDef_L18_C4", "label": "create_djangouser_for_user", "type": "function", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "vector": [2, 1, 0.9737, 0.1053, 1, 0.11, 1.0, 108, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "create_djangouser_for_user", "arg_names": ["cls", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_djangouser_for_user(cls, user):\n return cls(user=user, email=user.email(), username=user.email())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_248:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_248:FunctionDef_L18_C4", "vector": [13, 2, 1.0, 0.0526, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(user=user, email=user.email(), username=user.email())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_248:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_248:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_248:Return_L19_C8"}] |
# -*- coding: utf-8 -*-
"""
This is a set of utilities for faster development with Django templates.
render_to_response() and render_to_string() use RequestContext internally.
The app_prefixed_loader is a template loader that loads directly from the app's
'templates' folder when you specify an app prefix ('app/template.html').
The JSONResponse() function automatically converts a given Python object into
JSON and returns it as an HttpResponse.
"""
from django.conf import settings
from django.http import HttpResponse
from django.template import RequestContext, loader, \
TemplateDoesNotExist, Library, Node, Variable, generic_tag_compiler
from django.utils.functional import curry
from inspect import getargspec
from ragendja.apputils import get_app_dirs
import os
class Library(Library):
def context_tag(self, func):
params, xx, xxx, defaults = getargspec(func)
class ContextNode(Node):
def __init__(self, vars_to_resolve):
self.vars_to_resolve = map(Variable, vars_to_resolve)
def render(self, context):
resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
return func(context, *resolved_vars)
params = params[1:]
compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, ContextNode)
compile_func.__doc__ = func.__doc__
self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
return func
# The following defines a template loader that loads templates from a specific
# app based on the prefix of the template path:
# get_template("app/template.html") => app/templates/template.html
# This keeps the code DRY and prevents name clashes.
def app_prefixed_loader(template_name, template_dirs=None):
packed = template_name.split('/', 1)
if len(packed) == 2 and packed[0] in app_template_dirs:
path = os.path.join(app_template_dirs[packed[0]], packed[1])
try:
return (open(path).read().decode(settings.FILE_CHARSET), path)
except IOError:
pass
raise TemplateDoesNotExist, template_name
app_prefixed_loader.is_usable = True
def render_to_string(request, template_name, data=None):
return loader.render_to_string(template_name, data,
context_instance=RequestContext(request))
def render_to_response(request, template_name, data=None, mimetype=None):
if mimetype is None:
mimetype = settings.DEFAULT_CONTENT_TYPE
original_mimetype = mimetype
if mimetype == 'application/xhtml+xml':
# Internet Explorer only understands XHTML if it's served as text/html
if request.META.get('HTTP_ACCEPT').find(mimetype) == -1:
mimetype = 'text/html'
response = HttpResponse(render_to_string(request, template_name, data),
content_type='%s; charset=%s' % (mimetype, settings.DEFAULT_CHARSET))
if original_mimetype == 'application/xhtml+xml':
# Since XHTML is served with two different MIME types, depending on the
# browser, we need to tell proxies to serve different versions.
from django.utils.cache import patch_vary_headers
patch_vary_headers(response, ['User-Agent'])
return response
def JSONResponse(pyobj):
from ragendja.json import JSONResponse as real_class
global JSONResponse
JSONResponse = real_class
return JSONResponse(pyobj)
def TextResponse(string=''):
return HttpResponse(string,
content_type='text/plain; charset=%s' % settings.DEFAULT_CHARSET)
# This is needed by app_prefixed_loader.
app_template_dirs = get_app_dirs('templates')
| ajibawa-2023/Python-Code-Large/train/row_249 | 50 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_249:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0787, 0.1236, 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 is a set of utilities for faster development with Django templates.\n\nrender_to_response() and render_to_string() use RequestContext internally.\n\nThe app_prefixed_loader is a template loader that loads directly from the app's\n'templates' folder when you specify an app prefix ('app/template.html').\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L13_C0", "label": "from django.conf import settings", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1461, 0.0112, 0, 0.66, 0.0667, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L14_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1573, 0.0112, 0, 0.66, 0.1333, 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_249:ImportFrom_L15_C0", "label": "from django.template import RequestContext, loader, TemplateDoesNotExist\u2026", "type": "import", "loc": [15, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1742, 0.0225, 0, 0.66, 0.2, 213, 0, 7, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["RequestContext", "loader", "TemplateDoesNotExist", "Library", "Node", "Variable", "generic_tag_compiler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import RequestContext, loader, \\\n TemplateDoesNotExist, Library, Node, Variable, generic_tag_compiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L17_C0", "label": "from django.utils.functional import curry", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.191, 0.0112, 0, 0.66, 0.2667, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.functional", "arg_names": [], "import_names": ["curry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.functional import curry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L18_C0", "label": "from inspect import getargspec", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2022, 0.0112, 0, 0.66, 0.3333, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["getargspec"], "rhs_call_name": "", "annotation": ""}, "snippet": "from inspect import getargspec"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L19_C0", "label": "from ragendja.apputils import get_app_dirs", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2135, 0.0112, 0, 0.66, 0.4, 831, 0, 1, 0, 0, 831, 0, 0], "semantic": {"name": "ragendja.apputils", "arg_names": [], "import_names": ["get_app_dirs"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ragendja.apputils import get_app_dirs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Import_L20_C0", "label": "os import os", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2247, 0.0112, 0, 0.66, 0.4667, 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_249:ClassDef_L22_C0", "label": "Library", "type": "class", "loc": [22, 38], "level": 0, "parent": null, "vector": [3, 0, 0.3371, 0.191, 0, 0.66, 0.5333, 77, 0, 3, 0, 0, 77, 0, 8], "semantic": {"name": "Library", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Library(Library):\n def context_tag(self, func):\n params, xx, xxx, defaults = getargspec(func)\n\n class ContextNode(Node):\n def __init__(self, vars_to_resolve):\n self.vars_to_resolve = map(Variable, vars_to_resolve)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "label": "context_tag", "type": "function", "loc": [23, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L22_C0", "vector": [2, 1, 0.3427, 0.1798, 1, 0.42, 0.0, 114, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "context_tag", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def context_tag(self, func):\n params, xx, xxx, defaults = getargspec(func)\n\n class ContextNode(Node):\n def __init__(self, vars_to_resolve):\n self.vars_to_resolve = map(Variable, vars_to_resolve)\n\n def render(self, context):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L24_C8", "label": "params, xx, xxx, defaults = getargspec()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [14, 2, 0.2697, 0.0112, 2, 0.46, 0.0, 589, 3, 1, 0, 0, 179, 10, 1], "semantic": {"name": "params, xx, xxx, defaults", "arg_names": [], "import_names": [], "rhs_call_name": "getargspec", "annotation": ""}, "snippet": " params, xx, xxx, defaults = getargspec(func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8", "label": "ContextNode", "type": "class", "loc": [26, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [3, 2, 0.3258, 0.0787, 2, 0.46, 0.1667, 220, 0, 2, 0, 0, 345, 0, 3], "semantic": {"name": "ContextNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class ContextNode(Node):\n def __init__(self, vars_to_resolve):\n self.vars_to_resolve = map(Variable, vars_to_resolve)\n\n def render(self, context):\n resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]\n return func(context, *resolved_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L27_C12", "label": "__init__", "type": "function", "loc": [27, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8", "vector": [2, 3, 0.309, 0.0225, 3, 0.15, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "vars_to_resolve"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, vars_to_resolve):\n self.vars_to_resolve = map(Variable, vars_to_resolve)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L28_C16", "label": "self.vars_to_resolve = map()", "type": "assigned_variable", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L27_C12", "vector": [14, 4, 0.3146, 0.0112, 4, 0.82, 0.0, 936, 3, 2, 0, 0, 53, 10, 1], "semantic": {"name": "self.vars_to_resolve", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " self.vars_to_resolve = map(Variable, vars_to_resolve)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12", "label": "render", "type": "function", "loc": [30, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8", "vector": [2, 3, 0.3483, 0.0337, 3, 0.15, 1.0, 24, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "render", "arg_names": ["self", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def render(self, context):\n resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]\n return func(context, *resolved_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L31_C16", "label": "resolved_vars =", "type": "assigned_variable", "loc": [31, 31], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12", "vector": [14, 4, 0.3483, 0.0112, 4, 0.04, 0.0, 124, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "resolved_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L32_C16", "label": "return", "type": "return", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12", "vector": [13, 4, 0.3596, 0.0112, 4, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func(context, *resolved_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L34_C8", "label": "params =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [14, 2, 0.382, 0.0112, 2, 0.46, 0.3333, 206, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = params[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L35_C8", "label": "compile_func = curry()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [14, 2, 0.3933, 0.0112, 2, 0.46, 0.5, 941, 3, 5, 0, 0, 553, 10, 2], "semantic": {"name": "compile_func", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, \"_decorated_function\", func).__name__, ContextNode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L36_C8", "label": "compile_func.__doc__ =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [14, 2, 0.4045, 0.0112, 2, 0.46, 0.6667, 879, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "compile_func.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compile_func.__doc__ = func.__doc__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Expr_L37_C8", "label": "tag()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [8, 2, 0.4157, 0.0112, 2, 0.46, 0.8333, 732, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "tag", "annotation": ""}, "snippet": " self.tag(getattr(func, \"_decorated_function\", func).__name__, compile_func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "vector": [13, 2, 0.427, 0.0112, 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 func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L44_C0", "label": "app_prefixed_loader", "type": "function", "loc": [44, 51], "level": 0, "parent": null, "vector": [2, 0, 0.5337, 0.0899, 0, 0.66, 0.6, 944, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "app_prefixed_loader", "arg_names": ["template_name", "template_dirs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def app_prefixed_loader(template_name, template_dirs=None):\n packed = template_name.split('/', 1)\n if len(packed) == 2 and packed[0] in app_template_dirs:\n path = os.path.join(app_template_dirs[packed[0]], packed[1])\n try:\n return (open(path).read().decode(settings.FILE_CHARSET), path)\n except IOError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L45_C4", "label": "packed = split()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L44_C0", "vector": [14, 1, 0.5056, 0.0112, 1, 0.49, 0.0, 321, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "packed", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " packed = template_name.split('/', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4", "label": "if", "type": "if", "loc": [46, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L44_C0", "vector": [4, 1, 0.5449, 0.0674, 1, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(packed) == 2 and packed[0] in app_template_dirs:\n path = os.path.join(app_template_dirs[packed[0]], packed[1])\n try:\n return (open(path).read().decode(settings.FILE_CHARSET), path)\n except IOError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L47_C8", "label": "path = join()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4", "vector": [14, 2, 0.5281, 0.0112, 2, 0.58, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(app_template_dirs[packed[0]], packed[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Try_L48_C8", "label": "try", "type": "try", "loc": [48, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4", "vector": [7, 2, 0.5562, 0.0449, 2, 0.58, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return (open(path).read().decode(settings.FILE_CHARSET), path)\n except IOError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L49_C12", "label": "return", "type": "return", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:Try_L48_C8", "vector": [13, 3, 0.5506, 0.0112, 3, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (open(path).read().decode(settings.FILE_CHARSET), path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L52_C0", "label": "app_prefixed_loader.is_usable =", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.5843, 0.0112, 0, 0.66, 0.6667, 127, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "app_prefixed_loader.is_usable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "app_prefixed_loader.is_usable = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L54_C0", "label": "render_to_string", "type": "function", "loc": [54, 56], "level": 0, "parent": null, "vector": [2, 0, 0.618, 0.0337, 0, 0.66, 0.7333, 851, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "render_to_string", "arg_names": ["request", "template_name", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def render_to_string(request, template_name, data=None):\n return loader.render_to_string(template_name, data,\n context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L54_C0", "vector": [13, 1, 0.6236, 0.0225, 1, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loader.render_to_string(template_name, data,\n context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "label": "render_to_response", "type": "function", "loc": [58, 76], "level": 0, "parent": null, "vector": [2, 0, 0.7528, 0.2135, 0, 0.66, 0.8, 503, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "render_to_response", "arg_names": ["request", "template_name", "data", "mimetype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def render_to_response(request, template_name, data=None, mimetype=None):\n if mimetype is None:\n mimetype = settings.DEFAULT_CONTENT_TYPE\n original_mimetype = mimetype\n if mimetype == 'application/xhtml+xml':\n # Internet Explorer only understands XHTML if it's served as text/html\n if request.META.get('HTTP_ACCEPT').find(mimetype) == -1:\n mimetype = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [4, 1, 0.6685, 0.0225, 1, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype is None:\n mimetype = settings.DEFAULT_CONTENT_TYPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L60_C8", "label": "mimetype =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L59_C4", "vector": [14, 2, 0.6742, 0.0112, 2, 0.09, 0.0, 290, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimetype = settings.DEFAULT_CONTENT_TYPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L61_C4", "label": "original_mimetype =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [14, 1, 0.6854, 0.0112, 1, 0.64, 0.2, 616, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "original_mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " original_mimetype = mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:If_L62_C4", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [4, 1, 0.7135, 0.0449, 1, 0.64, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype == 'application/xhtml+xml':\n # Internet Explorer only understands XHTML if it's served as text/html\n if request.META.get('HTTP_ACCEPT').find(mimetype) == -1:\n mimetype = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L62_C4", "vector": [4, 2, 0.7247, 0.0225, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.META.get('HTTP_ACCEPT').find(mimetype) == -1:\n mimetype = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L65_C12", "label": "mimetype =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L64_C8", "vector": [14, 3, 0.7303, 0.0112, 3, 0.24, 0.0, 290, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimetype = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L67_C4", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [14, 1, 0.7584, 0.0225, 1, 0.64, 0.6, 511, 3, 2, 0, 0, 994, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(render_to_string(request, template_name, data),\n content_type='%s; charset=%s' % (mimetype, settings.DEFAULT_CHARSET))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4", "label": "if", "type": "if", "loc": [70, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [4, 1, 0.809, 0.0562, 1, 0.64, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if original_mimetype == 'application/xhtml+xml':\n # Since XHTML is served with two different MIME types, depending on the\n # browser, we need to tell proxies to serve different versions.\n from django.utils.cache import patch_vary_headers\n patch_vary_headers(response, ['User-Agent'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L73_C8", "label": "from django.utils.cache import patch_vary_headers", "type": "import", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4", "vector": [1, 2, 0.8202, 0.0112, 2, 0.44, 0.0, 53, 0, 1, 0, 0, 53, 0, 0], "semantic": {"name": "django.utils.cache", "arg_names": [], "import_names": ["patch_vary_headers"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.utils.cache import patch_vary_headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Expr_L74_C8", "label": "patch_vary_headers()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4", "vector": [8, 2, 0.8315, 0.0112, 2, 0.44, 1.0, 726, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "patch_vary_headers", "arg_names": [], "import_names": [], "rhs_call_name": "patch_vary_headers", "annotation": ""}, "snippet": " patch_vary_headers(response, ['User-Agent'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "vector": [13, 1, 0.8539, 0.0112, 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 response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "label": "JSONResponse", "type": "function", "loc": [78, 82], "level": 0, "parent": null, "vector": [2, 0, 0.8989, 0.0562, 0, 0.66, 0.8667, 153, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "JSONResponse", "arg_names": ["pyobj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def JSONResponse(pyobj):\n from ragendja.json import JSONResponse as real_class\n global JSONResponse\n JSONResponse = real_class\n return JSONResponse(pyobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L79_C4", "label": "from ragendja.json import real_class", "type": "import", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "vector": [1, 1, 0.8876, 0.0112, 1, 0.91, 0.0, 363, 0, 1, 0, 0, 363, 0, 0], "semantic": {"name": "ragendja.json", "arg_names": [], "import_names": ["real_class"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ragendja.json import JSONResponse as real_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L81_C4", "label": "JSONResponse =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "vector": [14, 1, 0.9101, 0.0112, 1, 0.91, 0.5, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "JSONResponse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " JSONResponse = real_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L82_C4", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "vector": [13, 1, 0.9213, 0.0112, 1, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return JSONResponse(pyobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L84_C0", "label": "TextResponse", "type": "function", "loc": [84, 86], "level": 0, "parent": null, "vector": [2, 0, 0.9551, 0.0337, 0, 0.66, 0.9333, 672, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "TextResponse", "arg_names": ["string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def TextResponse(string=''):\n return HttpResponse(string,\n content_type='text/plain; charset=%s' % settings.DEFAULT_CHARSET)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L85_C4", "label": "return", "type": "return", "loc": [85, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L84_C0", "vector": [13, 1, 0.9607, 0.0225, 1, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(string,\n content_type='text/plain; charset=%s' % settings.DEFAULT_CHARSET)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L89_C0", "label": "app_template_dirs = get_app_dirs()", "type": "assigned_variable", "loc": [89, 89], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0112, 0, 0.66, 1.0, 97, 3, 1, 0, 0, 126, 10, 1], "semantic": {"name": "app_template_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "get_app_dirs", "annotation": ""}, "snippet": "app_template_dirs = get_app_dirs('templates')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:ClassDef_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L31_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L32_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Try_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:Try_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:ImportFrom_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_249:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_249:Return_L85_C4"}] |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class LazyEncoder(DjangoJSONEncoder):
def default(self, obj):
if isinstance(obj, Promise):
return force_unicode(obj)
return super(LazyEncoder, self).default(obj)
class JSONResponse(HttpResponse):
def __init__(self, pyobj, **kwargs):
super(JSONResponse, self).__init__(
simplejson.dumps(pyobj, cls=LazyEncoder),
content_type='application/json; charset=%s' %
settings.DEFAULT_CHARSET,
**kwargs)
| ajibawa-2023/Python-Code-Large/train/row_250 | 14 | 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_250:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ImportFrom_L3_C0", "label": "from django.core.serializers.json import DjangoJSONEncoder", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.1429, 521, 0, 1, 0, 0, 521, 0, 0], "semantic": {"name": "django.core.serializers.json", "arg_names": [], "import_names": ["DjangoJSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.serializers.json import DjangoJSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ImportFrom_L4_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1905, 0.0476, 0, 0.66, 0.2857, 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_250:ImportFrom_L5_C0", "label": "from django.utils import simplejson", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2381, 0.0476, 0, 0.66, 0.4286, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ImportFrom_L6_C0", "label": "from django.utils.encoding import force_unicode", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0476, 0, 0.66, 0.5714, 96, 0, 1, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.encoding", "arg_names": [], "import_names": ["force_unicode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.encoding import force_unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ImportFrom_L7_C0", "label": "from django.utils.functional import Promise", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0476, 0, 0.66, 0.7143, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.functional", "arg_names": [], "import_names": ["Promise"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.functional import Promise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L9_C0", "label": "LazyEncoder", "type": "class", "loc": [9, 13], "level": 0, "parent": null, "vector": [3, 0, 0.5238, 0.2381, 0, 0.66, 0.8571, 294, 0, 1, 0, 0, 791, 0, 4], "semantic": {"name": "LazyEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LazyEncoder(DjangoJSONEncoder):\n def default(self, obj):\n if isinstance(obj, Promise):\n return force_unicode(obj)\n return super(LazyEncoder, self).default(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "label": "default", "type": "function", "loc": [10, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L9_C0", "vector": [2, 1, 0.5476, 0.1905, 1, 0.92, 0.0, 977, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "default", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, obj):\n if isinstance(obj, Promise):\n return force_unicode(obj)\n return super(LazyEncoder, self).default(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:If_L11_C8", "label": "if", "type": "if", "loc": [11, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "vector": [4, 2, 0.5476, 0.0952, 2, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(obj, Promise):\n return force_unicode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:Return_L12_C12", "label": "return", "type": "return", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:If_L11_C8", "vector": [13, 3, 0.5714, 0.0476, 3, 0.05, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return force_unicode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:Return_L13_C8", "label": "return", "type": "return", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "vector": [13, 2, 0.619, 0.0476, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(LazyEncoder, self).default(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L15_C0", "label": "JSONResponse", "type": "class", "loc": [15, 21], "level": 0, "parent": null, "vector": [3, 0, 0.8571, 0.3333, 0, 0.66, 1.0, 153, 0, 1, 0, 0, 994, 0, 3], "semantic": {"name": "JSONResponse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONResponse(HttpResponse):\n def __init__(self, pyobj, **kwargs):\n super(JSONResponse, self).__init__(\n simplejson.dumps(pyobj, cls=LazyEncoder),\n content_type='application/json; charset=%s' %\n settings.DEFAULT_CHARSET,\n **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L16_C4", "label": "__init__", "type": "function", "loc": [16, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L15_C0", "vector": [2, 1, 0.881, 0.2857, 1, 0.28, 0.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "pyobj", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, pyobj, **kwargs):\n super(JSONResponse, self).__init__(\n simplejson.dumps(pyobj, cls=LazyEncoder),\n content_type='application/json; charset=%s' %\n settings.DEFAULT_CHARSET,\n **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_250:Expr_L17_C8", "label": "__init__()", "type": "expression", "loc": [17, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L16_C4", "vector": [8, 2, 0.9048, 0.2381, 2, 0.07, 0.0, 555, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(JSONResponse, self).__init__(\n simplejson.dumps(pyobj, cls=LazyEncoder),\n content_type='application/json; charset=%s' %\n settings.DEFAULT_CHARSET,\n **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_250:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_250:Return_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_250:Return_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_250:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_250:Expr_L17_C8"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.