lines
sequencelengths 1
444
| raw_lines
sequencelengths 1
444
| label
sequencelengths 1
444
| type
sequencelengths 1
444
|
---|---|---|---|
[
"def __init__(self, VAR_7=None, VAR_8=None, VAR_9=True, VAR_10=True, VAR_11=True...\n",
"if VAR_7:\n",
"self.param = VAR_7\n",
"self.param = self.default_param\n",
"self.default = VAR_8\n",
"self.post, self.get, self.url = VAR_9, VAR_10, VAR_11\n"
] | [
"def __init__(self, param=None, default=None, post=True, get=True, url=True):...\n",
"if param:\n",
"self.param = param\n",
"self.param = self.default_param\n",
"self.default = default\n",
"self.post, self.get, self.url = post, get, url\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_14(self):...\n",
"VAR_36 = self.builder.get_object('unlock_failed_revealer')\n",
"VAR_36.set_reveal_child(not VAR_36.get_reveal_child())\n"
] | [
"def hide_unlock_failed_revealer(self):...\n",
"unlock_failed_revealer = self.builder.get_object('unlock_failed_revealer')\n",
"unlock_failed_revealer.set_reveal_child(not unlock_failed_revealer.\n get_reveal_child())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.update()\n",
"return self.data.keys()\n"
] | [
"def get_module_names(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.update()\n",
"return self.data.keys()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Return'"
] |
[
"def FUNC_12(VAR_15):...\n",
"return \"'%s'\" % VAR_15.replace('\\\\', '\\\\\\\\').replace(\"'\", \"''\")\n"
] | [
"def QuotedString(s):...\n",
"return \"'%s'\" % s.replace('\\\\', '\\\\\\\\').replace(\"'\", \"''\")\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_6 = self.client.get('/api/apps')\n",
"VAR_8 = VAR_6.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n",
"VAR_5 = '/api/apps/{}/perms'.format(VAR_8)\n",
"VAR_7 = {'username': 'autotest-2'}\n",
"VAR_6 = self.client.post(VAR_5, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_6.status_code, 403)\n"
] | [
"def test_create_errors(self):...\n",
"response = self.client.get('/api/apps')\n",
"app_id = response.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(username='autotest-2', password='password'))\n",
"url = '/api/apps/{}/perms'.format(app_id)\n",
"body = {'username': 'autotest-2'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 403)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"import urllib, re, html\n",
"from settings import MAX_BASENAME_LENGTH, ITEMS_PER_PAGE, PASSWORD_KEY, SECRET_KEY, BASE_URL, BASE_URL_ROOT\n",
"from core.libs.bottle import redirect, response\n",
"import hashlib, base64\n",
"from core.libs.bottle import _stderr\n",
"VAR_0 = '%Y-%m-%d %H:%M:%S'\n",
"def FUNC_0(VAR_1):...\n",
"import datetime\n",
"if isinstance(VAR_1, datetime.datetime):\n",
"return datetime.datetime.strftime(VAR_1, '%Y-%m-%d %H:%M:%S')\n",
"def FUNC_1(VAR_1):...\n",
"import json\n",
"from core.libs.playhouse.shortcuts import model_to_dict\n",
"return json.loads(json.dumps(model_to_dict(VAR_1, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n"
] | [
"import urllib, re, html\n",
"from settings import MAX_BASENAME_LENGTH, ITEMS_PER_PAGE, PASSWORD_KEY, SECRET_KEY, BASE_URL, BASE_URL_ROOT\n",
"from core.libs.bottle import redirect, response\n",
"import hashlib, base64\n",
"from core.libs.bottle import _stderr\n",
"DATE_FORMAT = '%Y-%m-%d %H:%M:%S'\n",
"def default(obj):...\n",
"import datetime\n",
"if isinstance(obj, datetime.datetime):\n",
"return datetime.datetime.strftime(obj, '%Y-%m-%d %H:%M:%S')\n",
"def json_dump(obj):...\n",
"import json\n",
"from core.libs.playhouse.shortcuts import model_to_dict\n",
"return json.loads(json.dumps(model_to_dict(obj, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Import'",
"Condition",
"Return'",
"FunctionDef'",
"Import'",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_11(VAR_22, VAR_23):...\n",
"if not VAR_23:\n",
"return VAR_22\n",
"for k in VAR_23.split('.'):\n",
"if k in VAR_22 and isinstance(VAR_22[k], dict):\n",
"return VAR_22\n",
"VAR_22 = VAR_22[k]\n"
] | [
"def strip_hash(h, keys):...\n",
"if not keys:\n",
"return h\n",
"for k in keys.split('.'):\n",
"if k in h and isinstance(h[k], dict):\n",
"return h\n",
"h = h[k]\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_15(self):...\n",
""
] | [
"def _listen(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"async def FUNC_8(self, VAR_24, VAR_21, VAR_26='table'):...\n",
"VAR_42 = list(await self.execute(VAR_24,\n 'select sql from sqlite_master where name = :n and type=:t', {'n':\n VAR_21, 't': VAR_26}))\n",
"if not VAR_42:\n",
"return None\n",
"return VAR_42[0][0]\n"
] | [
"async def get_table_definition(self, database_name, table, type_='table'):...\n",
"table_definition_rows = list(await self.execute(database_name,\n 'select sql from sqlite_master where name = :n and type=:t', {'n':\n table, 't': type_}))\n",
"if not table_definition_rows:\n",
"return None\n",
"return table_definition_rows[0][0]\n"
] | [
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_22(VAR_30, VAR_3):...\n",
"if not isinstance(VAR_30, _IOFile):\n",
"return IOFile(VAR_30, VAR_16=self)\n",
"return VAR_30.apply_wildcards(VAR_3, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n"
] | [
"def concretize_iofile(f, wildcards):...\n",
"if not isinstance(f, _IOFile):\n",
"return IOFile(f, rule=self)\n",
"return f.apply_wildcards(wildcards, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_1):...\n",
"return CLASS_0.all().filter('token =', VAR_1).get()\n"
] | [
"def check_token(token):...\n",
"return Authorization.all().filter('token =', token).get()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_8):...\n",
"self._idle = True\n",
"self._loop = VAR_8\n",
"self._idleSince = self._loop.time()\n"
] | [
"def __init__(self, loop):...\n",
"self._idle = True\n",
"self._loop = loop\n",
"self._idleSince = self._loop.time()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_10(self):...\n",
"self.loud_reply('TODO jupper {}'.format(self.vpath))\n"
] | [
"def tx_jupper(self):...\n",
"self.loud_reply('TODO jupper {}'.format(self.vpath))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_3():...\n",
"return '<input name=\"_csrftoken\" type=\"hidden\" value=\"%s\" />' % FUNC_1()\n"
] | [
"def field_token():...\n",
"return '<input name=\"_csrftoken\" type=\"hidden\" value=\"%s\" />' % make_token()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@classmethod...\n",
"assert engine\n",
"VAR_9 = text(\n 'SELECT * FROM users WHERE username = :username AND expire_date is null')\n",
"VAR_7 = engine.connect()\n",
"VAR_10 = False if VAR_7.execute(VAR_9, VAR_1=username).fetchone(\n ) is None else True\n",
"VAR_7.close()\n",
"return VAR_10\n"
] | [
"@classmethod...\n",
"assert engine\n",
"s = text(\n 'SELECT * FROM users WHERE username = :username AND expire_date is null')\n",
"connection = engine.connect()\n",
"rc = False if connection.execute(s, username=username).fetchone(\n ) is None else True\n",
"connection.close()\n",
"return rc\n"
] | [
0,
0,
0,
0,
4,
0,
0
] | [
"Condition",
"Assert'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"async def FUNC_10(VAR_6):...\n",
"VAR_10 = {'Authorization': f'Bearer {VAR_1}'}\n",
"VAR_8 = await VAR_6.get('/results?page=-1&count=2', VAR_10=headers)\n",
"assert VAR_8.status == 400\n",
"VAR_8 = await VAR_6.get('/results?page=1&count=0', VAR_10=headers)\n",
"assert VAR_8.status == 400\n"
] | [
"async def test_negative_bad_paging(test_cli):...\n",
"headers = {'Authorization': f'Bearer {access_token}'}\n",
"resp = await test_cli.get('/results?page=-1&count=2', headers=headers)\n",
"assert resp.status == 400\n",
"resp = await test_cli.get('/results?page=1&count=0', headers=headers)\n",
"assert resp.status == 400\n"
] | [
0,
0,
4,
0,
4,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"from __future__ import print_function\n",
"from __future__ import unicode_literals\n",
"from __future__ import division\n",
"from django.conf.urls import patterns, url\n",
"from apps.home.views import home_page, projects, project, project_clone\n",
"VAR_0 = patterns('', url('^$', home_page, name='home_page'), url('^draw/?$',\n home_page, name='home_page'), url('^account/?$', home_page, name=\n 'account'), url('^projects/$', projects, name='projects'), url(\n '^project/$', project, name='project'), url('^project/new/', project,\n name='project'), url('^project/(?P<proj_id>[0-9]+)/$', project, name=\n 'project'), url('^project/(?P<proj_id>[0-9]+)/clone/?$', project_clone,\n name='project_clone'), url(\n '^project/(?P<proj_id>[0-9]+)/scenario/(?P<scenario_id>[0-9]+)/$',\n project, name='project'), url('^project/compare/$', project, name=\n 'project'), url('^project/(?P<proj_id>[0-9]+)/compare/$', project, name\n ='project'), url('^analyze$', home_page, name='analyze'), url(\n '^search$', home_page, name='search'), url('^error', home_page, name=\n 'error'), url('^sign-up', home_page, name='sign_up'))\n"
] | [
"from __future__ import print_function\n",
"from __future__ import unicode_literals\n",
"from __future__ import division\n",
"from django.conf.urls import patterns, url\n",
"from apps.home.views import home_page, projects, project, project_clone\n",
"urlpatterns = patterns('', url('^$', home_page, name='home_page'), url(\n '^draw/?$', home_page, name='home_page'), url('^account/?$', home_page,\n name='account'), url('^projects/$', projects, name='projects'), url(\n '^project/$', project, name='project'), url('^project/new/', project,\n name='project'), url('^project/(?P<proj_id>[0-9]+)/$', project, name=\n 'project'), url('^project/(?P<proj_id>[0-9]+)/clone/?$', project_clone,\n name='project_clone'), url(\n '^project/(?P<proj_id>[0-9]+)/scenario/(?P<scenario_id>[0-9]+)/$',\n project, name='project'), url('^project/compare/$', project, name=\n 'project'), url('^project/(?P<proj_id>[0-9]+)/compare/$', project, name\n ='project'), url('^analyze$', home_page, name='analyze'), url(\n '^search$', home_page, name='search'), url('^error', home_page, name=\n 'error'), url('^sign-up', home_page, name='sign_up'))\n"
] | [
0,
0,
0,
0,
6,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'"
] |
[
"def FUNC_5(self, VAR_13, VAR_14=1):...\n",
"utils.check_ssh_injection(VAR_13)\n",
"VAR_11 = ' '.join(VAR_13)\n",
"if not self.sshpool:\n",
"VAR_39 = self.configuration.san_password\n",
"VAR_43 = VAR_14\n",
"VAR_0.error(_('Error running SSH command: %s') % VAR_11)\n",
"VAR_40 = self.configuration.san_private_key\n",
"while VAR_14 > 0:\n",
"VAR_41 = self.configuration.ssh_min_pool_conn\n",
"VAR_14 -= 1\n",
"VAR_49 = _(\n \"SSH Command failed after '%(total_attempts)r' attempts : '%(command)s'\"\n ) % {'total_attempts': VAR_43, 'command': VAR_11}\n",
"VAR_42 = self.configuration.ssh_max_pool_conn\n",
"VAR_0.info(_('EQL-driver: executing \"%s\"') % VAR_11)\n",
"VAR_0.exception(e)\n",
"self.sshpool = utils.SSHPool(self.configuration.san_ip, self.configuration.\n san_ssh_port, self.configuration.ssh_conn_timeout, self.configuration.\n san_login, VAR_39=password, VAR_40=privatekey, VAR_41=min_size, VAR_42=\n max_size)\n",
"return self._ssh_execute(VAR_10, VAR_11, VAR_23=self.configuration.\n eqlx_cli_timeout)\n",
"greenthread.sleep(random.randint(20, 500) / 100.0)\n"
] | [
"def _run_ssh(self, cmd_list, attempts=1):...\n",
"utils.check_ssh_injection(cmd_list)\n",
"command = ' '.join(cmd_list)\n",
"if not self.sshpool:\n",
"password = self.configuration.san_password\n",
"total_attempts = attempts\n",
"LOG.error(_('Error running SSH command: %s') % command)\n",
"privatekey = self.configuration.san_private_key\n",
"while attempts > 0:\n",
"min_size = self.configuration.ssh_min_pool_conn\n",
"attempts -= 1\n",
"msg = _(\n \"SSH Command failed after '%(total_attempts)r' attempts : '%(command)s'\"\n ) % {'total_attempts': total_attempts, 'command': command}\n",
"max_size = self.configuration.ssh_max_pool_conn\n",
"LOG.info(_('EQL-driver: executing \"%s\"') % command)\n",
"LOG.exception(e)\n",
"self.sshpool = utils.SSHPool(self.configuration.san_ip, self.configuration.\n san_ssh_port, self.configuration.ssh_conn_timeout, self.configuration.\n san_login, password=password, privatekey=privatekey, min_size=min_size,\n max_size=max_size)\n",
"return self._ssh_execute(ssh, command, timeout=self.configuration.\n eqlx_cli_timeout)\n",
"greenthread.sleep(random.randint(20, 500) / 100.0)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"AugAssign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_41):...\n",
"if VAR_41:\n",
"VAR_95 = Thing._by_fullname(VAR_41, False, data=True)\n",
"abort(403, 'forbidden')\n",
"if isinstance(VAR_95, Message):\n",
"return VAR_95\n",
"VAR_52 = VAR_95.subreddit_slow\n",
"if VAR_101.user_is_loggedin and VAR_52.can_comment(VAR_101.user):\n",
"return VAR_95\n"
] | [
"def run(self, fullname):...\n",
"if fullname:\n",
"parent = Thing._by_fullname(fullname, False, data=True)\n",
"abort(403, 'forbidden')\n",
"if isinstance(parent, Message):\n",
"return parent\n",
"sr = parent.subreddit_slow\n",
"if c.user_is_loggedin and sr.can_comment(c.user):\n",
"return parent\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def __init__(self):...\n",
"self.conn = MySQLdb.connect(*self.dsn)\n",
"self.cur = self.conn.cursor()\n"
] | [
"def __init__(self):...\n",
"self.conn = MySQLdb.connect(*self.dsn)\n",
"self.cur = self.conn.cursor()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_3(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def create_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_10():...\n",
"return {'divider': True}\n"
] | [
"def divider_entry():...\n",
"return {'divider': True}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self, VAR_10, VAR_13=True):...\n",
"VAR_26 = 'string' % {'database': VAR_10}\n",
"self.db.executescript(VAR_26)\n",
"if VAR_13:\n",
"self.db.commit()\n"
] | [
"def create_indexes(self, database, commit=True):...\n",
"sqlstr = (\n \"\"\"\n CREATE INDEX IF NOT EXISTS %(database)s.phrases_index_p ON phrases\n (input_phrase, mlen ASC, freq DESC, id ASC);\n CREATE INDEX IF NOT EXISTS %(database)s.phrases_index_i ON phrases\n (phrase, mlen ASC);\"\"\"\n % {'database': database})\n",
"self.db.executescript(sqlstr)\n",
"if commit:\n",
"self.db.commit()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_7(VAR_18, VAR_16):...\n",
"VAR_34 = renderers.JsonRenderer(missing_tags='ignore')\n",
"return VAR_34.render(VAR_18, VAR_16)\n"
] | [
"def render_moustache(text, config):...\n",
"r = renderers.JsonRenderer(missing_tags='ignore')\n",
"return r.render(text, config)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.cursor.execute('select listid, listhash from lists')\n"
] | [
"def get_all_shoppinglists(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.cursor.execute('select listid, listhash from lists')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"GenericRequest._prepare(self)\n",
"VAR_17 = os.path.join(self.submissions_path, self.task[1])\n",
"VAR_18 = os.listdir(VAR_17)\n",
"VAR_19 = random.choice(VAR_18)\n",
"self.source_path = os.path.join(VAR_17, VAR_19)\n",
"self.files = []\n",
"if os.path.isdir(self.source_path):\n",
"VAR_22 = os.listdir(self.source_path)\n",
"VAR_8 = os.path.splitext(VAR_19)[0]\n",
"self.files = [('%s.%%l' % os.path.splitext(sf)[0], os.path.join(self.\n source_path, sf)) for sf in VAR_22]\n",
"self.files = [('%s.%%l' % VAR_8, self.source_path)]\n"
] | [
"def _prepare(self):...\n",
"\"\"\"docstring\"\"\"\n",
"GenericRequest._prepare(self)\n",
"task_path = os.path.join(self.submissions_path, self.task[1])\n",
"sources = os.listdir(task_path)\n",
"source = random.choice(sources)\n",
"self.source_path = os.path.join(task_path, source)\n",
"self.files = []\n",
"if os.path.isdir(self.source_path):\n",
"submission_formats = os.listdir(self.source_path)\n",
"submission_format = os.path.splitext(source)[0]\n",
"self.files = [('%s.%%l' % os.path.splitext(sf)[0], os.path.join(self.\n source_path, sf)) for sf in submission_formats]\n",
"self.files = [('%s.%%l' % submission_format, self.source_path)]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(VAR_4, VAR_5):...\n",
"VAR_11 = normalize_request(VAR_5)\n",
"validate_request(VAR_11=request, VAR_4=schema)\n"
] | [
"def validate_api_request(schema, raw_request):...\n",
"request = normalize_request(raw_request)\n",
"validate_request(request=request, schema=schema)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2, **VAR_1):...\n",
"if VAR_2.GET.get('keyword'):\n",
"VAR_4 = VAR_2.GET.get('keyword')\n",
"VAR_3 = self.get_context_data()\n",
"return HttpResponseRedirect(VAR_4)\n",
"return self.render_to_response(VAR_3)\n"
] | [
"def get(self, request, **kwargs):...\n",
"if request.GET.get('keyword'):\n",
"ip = request.GET.get('keyword')\n",
"context = self.get_context_data()\n",
"return HttpResponseRedirect(ip)\n",
"return self.render_to_response(context)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(VAR_0):\n",
"shutil.rmtree(VAR_0, ignore_errors=True)\n"
] | [
"def remove_directory_tree(path):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(path):\n",
"shutil.rmtree(path, ignore_errors=True)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"return format_html('<td>{}</td>', self.format(self.get_value()))\n"
] | [
"def render(self):...\n",
"return format_html('<td>{}</td>', self.format(self.get_value()))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_26(*VAR_29, **VAR_30):...\n",
""
] | [
"def raiseOSError(*_a, **_k):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"\"\"\"Bot interface used in bot_config.py.\"\"\"\n",
"import logging\n",
"import os\n",
"import threading\n",
"import time\n",
"import os_utilities\n",
"from utils import zip_package\n",
"VAR_0 = os.path.abspath(zip_package.get_main_script_path())\n",
"def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6):...\n",
"self._attributes = VAR_2\n",
"self._base_dir = VAR_5\n",
"self._remote = VAR_1\n",
"self._server = VAR_3\n",
"self._server_version = VAR_4\n",
"self._shutdown_hook = VAR_6\n",
"self._timers = []\n",
"self._timers_dying = False\n",
"self._timers_lock = threading.Lock()\n",
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._base_dir\n"
] | [
"\"\"\"Bot interface used in bot_config.py.\"\"\"\n",
"import logging\n",
"import os\n",
"import threading\n",
"import time\n",
"import os_utilities\n",
"from utils import zip_package\n",
"THIS_FILE = os.path.abspath(zip_package.get_main_script_path())\n",
"def __init__(self, remote, attributes, server, server_version, base_dir,...\n",
"self._attributes = attributes\n",
"self._base_dir = base_dir\n",
"self._remote = remote\n",
"self._server = server\n",
"self._server_version = server_version\n",
"self._shutdown_hook = shutdown_hook\n",
"self._timers = []\n",
"self._timers_dying = False\n",
"self._timers_lock = threading.Lock()\n",
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._base_dir\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Docstring",
"Return'"
] |
[
"@memoized_property...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = {self.dist.real_home: '/dev/null/remapped_by_pants/java_home/',\n get_buildroot(): '/dev/null/remapped_by_pants/buildroot/', self.\n _zinc_factory.get_options().pants_workdir:\n '/dev/null/remapped_by_pants/workdir/'}\n",
"return '-rebase-map', ','.join('{}:{}'.format(src, dst) for src, dst in\n VAR_15.items())\n"
] | [
"@memoized_property...\n",
"\"\"\"docstring\"\"\"\n",
"rebases = {self.dist.real_home: '/dev/null/remapped_by_pants/java_home/',\n get_buildroot(): '/dev/null/remapped_by_pants/buildroot/', self.\n _zinc_factory.get_options().pants_workdir:\n '/dev/null/remapped_by_pants/workdir/'}\n",
"return '-rebase-map', ','.join('{}:{}'.format(src, dst) for src, dst in\n rebases.items())\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_3(VAR_1, VAR_2=None, **VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = schema_validator(VAR_1, **kwargs)\n",
"if VAR_2 is not None:\n",
"validate_object(VAR_2, VAR_4=schema, **kwargs)\n"
] | [
"def validate(raw_schema, target=None, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"schema = schema_validator(raw_schema, **kwargs)\n",
"if target is not None:\n",
"validate_object(target, schema=schema, **kwargs)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"VAR_6 = ('\"normal_string\"', '\"string with spaces\"',\n '\"string with quotes\\\\\"a\"', '\"string with s-quotes\\'b\"', '\"bsn \\n A\"',\n '\"unrecognized \\\\q escape\"')\n",
"for string, result in zip(self.test_strings, VAR_6):\n",
"self.assertEqual(prepare_string_argument(string, 'sh'), result)\n"
] | [
"def test_prepare_string_argument_sh(self):...\n",
"expected_results = ('\"normal_string\"', '\"string with spaces\"',\n '\"string with quotes\\\\\"a\"', '\"string with s-quotes\\'b\"', '\"bsn \\n A\"',\n '\"unrecognized \\\\q escape\"')\n",
"for string, result in zip(self.test_strings, expected_results):\n",
"self.assertEqual(prepare_string_argument(string, 'sh'), result)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"return {'user_id': self.user_id, 'username': self.username}\n"
] | [
"def to_dict(self):...\n",
"return {'user_id': self.user_id, 'username': self.username}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self, VAR_5, VAR_6, VAR_19, VAR_8, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_58 = FUNC_2(VAR_5, VAR_6, VAR_19, VAR_8, VAR_9, VAR_10)\n",
"if self.execute('string', VAR_58):\n",
"self.save()\n",
"logging.info('Added job %s to history', VAR_5.final_name)\n"
] | [
"def add_history_db(self, nzo, storage, path, postproc_time, script_output,...\n",
"\"\"\"docstring\"\"\"\n",
"t = build_history_info(nzo, storage, path, postproc_time, script_output,\n script_line)\n",
"if self.execute(\n",
"self.save()\n",
"logging.info('Added job %s to history', nzo.final_name)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@VAR_1.route('/chartdemoORIG', methods=['GET'])...\n",
"return render_template('chartdemoORIG.html')\n"
] | [
"@app.route('/chartdemoORIG', methods=['GET'])...\n",
"return render_template('chartdemoORIG.html')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_3(self, VAR_3, VAR_11=None):...\n",
"if super(CLASS_3, self).allowed(VAR_3, VAR_11):\n",
"self.verbose_name = _('Create Key Pair')\n",
"return True\n"
] | [
"def allowed(self, request, keypair=None):...\n",
"if super(CreateKeyPair, self).allowed(request, keypair):\n",
"self.verbose_name = _('Create Key Pair')\n",
"return True\n"
] | [
0,
5,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"VAR_5 = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'disableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'user': 'integration-tests'}]\n",
"VAR_6 = gcp.GceContractBuilder(self.gce_observer)\n",
"VAR_6.new_clause_builder('Server Group Disabled', retryable_for_secs=90\n ).list_resources('managed-instance-groups').contains_path_value(\n 'baseInstanceName', self.__server_group_name).excludes_pred_list([jc.\n PathContainsPredicate('baseInstanceName', self.__server_group_name), jc\n .PathContainsPredicate('targetPools', 'https')])\n",
"VAR_7 = self.agent.make_json_payload_from_kwargs(VAR_5=job, description=\n 'Server Group Test - disable server group', application=self.TEST_APP)\n",
"return st.OperationContract(self.new_post_operation(title=\n 'disable_server_group', data=payload, path=self.__path), contract=\n builder.build())\n"
] | [
"def disable_server_group(self):...\n",
"job = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'disableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'user': 'integration-tests'}]\n",
"builder = gcp.GceContractBuilder(self.gce_observer)\n",
"builder.new_clause_builder('Server Group Disabled', retryable_for_secs=90\n ).list_resources('managed-instance-groups').contains_path_value(\n 'baseInstanceName', self.__server_group_name).excludes_pred_list([jc.\n PathContainsPredicate('baseInstanceName', self.__server_group_name), jc\n .PathContainsPredicate('targetPools', 'https')])\n",
"payload = self.agent.make_json_payload_from_kwargs(job=job, description=\n 'Server Group Test - disable server group', application=self.TEST_APP)\n",
"return st.OperationContract(self.new_post_operation(title=\n 'disable_server_group', data=payload, path=self.__path), contract=\n builder.build())\n"
] | [
0,
0,
0,
1,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"@template_utility...\n",
"VAR_3 = VAR_3 or get_current_http_request()\n",
"assert VAR_3._xsrf_token is not None\n",
"return VAR_3._xsrf_token\n"
] | [
"@template_utility...\n",
"request = request or get_current_http_request()\n",
"assert request._xsrf_token is not None\n",
"return request._xsrf_token\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assert'",
"Return'"
] |
[
"def FUNC_18(self, VAR_19, VAR_13):...\n",
"VAR_46 = self.container.page_num(VAR_13)\n",
"for VAR_24 in self.opened_databases:\n",
"if VAR_24.window.container.page_num(VAR_24.parent_widget) == VAR_46:\n",
"self.container.remove_page(VAR_46)\n",
"self.opened_databases.remove(VAR_24)\n",
"self.update_tab_bar_visibility()\n"
] | [
"def on_tab_close_button_clicked(self, sender, widget):...\n",
"page_num = self.container.page_num(widget)\n",
"for db in self.opened_databases:\n",
"if db.window.container.page_num(db.parent_widget) == page_num:\n",
"self.container.remove_page(page_num)\n",
"self.opened_databases.remove(db)\n",
"self.update_tab_bar_visibility()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from __future__ import unicode_literals\n",
"from django.db import models, migrations\n",
"VAR_0 = [('exercise', '0006_auto_20150625_1823'), ('userprofile',\n '0002_auto_20150427_1717')]\n",
"VAR_1 = [migrations.CreateModel(name='DeadlineRuleDeviation', fields=[('id',\n models.AutoField(primary_key=True, serialize=False, auto_created=True,\n verbose_name='ID')), ('extra_minutes', models.IntegerField()), (\n 'exercise', models.ForeignKey(to='exercise.BaseExercise')), (\n 'submitter', models.ForeignKey(to='userprofile.UserProfile'))], options\n ={'abstract': False}, bases=(models.Model,)), migrations.CreateModel(\n name='MaxSubmissionsRuleDeviation', fields=[('id', models.AutoField(\n primary_key=True, serialize=False, auto_created=True, verbose_name='ID'\n )), ('extra_submissions', models.IntegerField()), ('exercise', models.\n ForeignKey(to='exercise.BaseExercise')), ('submitter', models.\n ForeignKey(to='userprofile.UserProfile'))], options={'abstract': False},\n bases=(models.Model,)), migrations.AlterUniqueTogether(name=\n 'maxsubmissionsruledeviation', unique_together=set([('exercise',\n 'submitter')])), migrations.AlterUniqueTogether(name=\n 'deadlineruledeviation', unique_together=set([('exercise', 'submitter')]))]\n",
"VAR_2 = [migrations.SeparateDatabaseAndState(VAR_1=state_operations)]\n"
] | [
"from __future__ import unicode_literals\n",
"from django.db import models, migrations\n",
"dependencies = [('exercise', '0006_auto_20150625_1823'), ('userprofile',\n '0002_auto_20150427_1717')]\n",
"state_operations = [migrations.CreateModel(name='DeadlineRuleDeviation',\n fields=[('id', models.AutoField(primary_key=True, serialize=False,\n auto_created=True, verbose_name='ID')), ('extra_minutes', models.\n IntegerField()), ('exercise', models.ForeignKey(to=\n 'exercise.BaseExercise')), ('submitter', models.ForeignKey(to=\n 'userprofile.UserProfile'))], options={'abstract': False}, bases=(\n models.Model,)), migrations.CreateModel(name=\n 'MaxSubmissionsRuleDeviation', fields=[('id', models.AutoField(\n primary_key=True, serialize=False, auto_created=True, verbose_name='ID'\n )), ('extra_submissions', models.IntegerField()), ('exercise', models.\n ForeignKey(to='exercise.BaseExercise')), ('submitter', models.\n ForeignKey(to='userprofile.UserProfile'))], options={'abstract': False},\n bases=(models.Model,)), migrations.AlterUniqueTogether(name=\n 'maxsubmissionsruledeviation', unique_together=set([('exercise',\n 'submitter')])), migrations.AlterUniqueTogether(name=\n 'deadlineruledeviation', unique_together=set([('exercise', 'submitter')]))]\n",
"operations = [migrations.SeparateDatabaseAndState(state_operations=\n state_operations)]\n"
] | [
0,
0,
0,
4,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(self, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = self.file_db\n",
"VAR_26 = VAR_25.getFileList()\n",
"for f in VAR_26:\n",
"if not f in VAR_14:\n",
"VAR_25.deleteFile(f)\n"
] | [
"def checkFilesForDeletion(self, files):...\n",
"\"\"\"docstring\"\"\"\n",
"file_db = self.file_db\n",
"DB_files = file_db.getFileList()\n",
"for f in DB_files:\n",
"if not f in files:\n",
"file_db.deleteFile(f)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_1(self, VAR_8, VAR_9):...\n",
"if not VAR_9:\n",
"VAR_22 = self.output_path(self.create_filename(VAR_9))\n",
"VAR_23 = Header.parse(VAR_22)\n",
"return VAR_8.is_newer_than(VAR_23)\n"
] | [
"def _is_newer(self, header_source, hostname):...\n",
"if not hostname:\n",
"output_path = self.output_path(self.create_filename(hostname))\n",
"old_header = Header.parse(output_path)\n",
"return header_source.is_newer_than(old_header)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(VAR_1, VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = frozenset(VAR_2)\n",
"VAR_7 = VAR_1 - VAR_2\n",
"if VAR_7:\n",
"VAR_22 = ' missing: %s' % sorted(VAR_7) if VAR_7 else ''\n",
"return 'Unexpected %s%s; did you make a typo?' % (VAR_3, VAR_22)\n"
] | [
"def has_missing_keys(minimum_keys, actual_keys, name):...\n",
"\"\"\"docstring\"\"\"\n",
"actual_keys = frozenset(actual_keys)\n",
"missing = minimum_keys - actual_keys\n",
"if missing:\n",
"msg_missing = ' missing: %s' % sorted(missing) if missing else ''\n",
"return 'Unexpected %s%s; did you make a typo?' % (name, msg_missing)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
"def test_prepare_string_argument_unsupported(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'"
] |
[
"def FUNC_2(self, VAR_1, VAR_2, *VAR_3, **VAR_4):...\n",
"self.handled_resp = VAR_1\n",
"self.handled_remote = VAR_2\n",
"self.handled_args = VAR_3\n",
"self.handled_kwargs = VAR_4\n",
"return 'TEST'\n"
] | [
"def handler(self, resp, remote, *args, **kwargs):...\n",
"self.handled_resp = resp\n",
"self.handled_remote = remote\n",
"self.handled_args = args\n",
"self.handled_kwargs = kwargs\n",
"return 'TEST'\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = argparse.ArgumentParser()\n",
"VAR_14.add_argument('message')\n",
"return VAR_14.parse_args(VAR_3)\n"
] | [
"def parse_arguments(arguments):...\n",
"\"\"\"docstring\"\"\"\n",
"parser = argparse.ArgumentParser()\n",
"parser.add_argument('message')\n",
"return parser.parse_args(arguments)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_29(VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = str(VAR_42)\n",
"if len(VAR_42) < 4:\n",
"VAR_42 += '__'\n",
"VAR_54 = VAR_42[0:3]\n",
"VAR_55 = VAR_42[3].replace('_', '')\n",
"VAR_56 = VAR_42[4].replace('_', '')\n",
"return VAR_54, VAR_55, VAR_56\n"
] | [
"def _parse_marc_code(field):...\n",
"\"\"\"docstring\"\"\"\n",
"field = str(field)\n",
"if len(field) < 4:\n",
"field += '__'\n",
"tag = field[0:3]\n",
"ind1 = field[3].replace('_', '')\n",
"ind2 = field[4].replace('_', '')\n",
"return tag, ind1, ind2\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_18._check_executable(VAR_0):\n",
"if VAR_19 is None:\n",
"return repr(VAR_0) + ' is not installed.'\n",
"return True\n",
"check_call(VAR_19, stdout=DEVNULL, stderr=DEVNULL)\n",
"return VAR_20\n",
"return True\n"
] | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if cls._check_executable(executable):\n",
"if command is None:\n",
"return repr(executable) + ' is not installed.'\n",
"return True\n",
"check_call(command, stdout=DEVNULL, stderr=DEVNULL)\n",
"return fail_msg\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_8(self, VAR_12=False):...\n",
"VAR_86 = self.rules\n",
"if VAR_12:\n",
"VAR_86 = filterfalse(Rule.has_wildcards, VAR_86)\n",
"for VAR_13 in VAR_86:\n",
"logger.rule_info(VAR_10=rule.name, docstring=rule.docstring)\n"
] | [
"def list_rules(self, only_targets=False):...\n",
"rules = self.rules\n",
"if only_targets:\n",
"rules = filterfalse(Rule.has_wildcards, rules)\n",
"for rule in rules:\n",
"logger.rule_info(name=rule.name, docstring=rule.docstring)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"For",
"Docstring"
] |
[
"def FUNC_41(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('create table t1(a int, b varchar(10))')\n",
"VAR_28 = [(1, 'test')]\n",
"self.cursor.executemany('insert into t1(a, b) values (?,?)', VAR_28)\n",
"VAR_26 = self.cursor.execute('select count(*) from t1').fetchone()[0]\n",
"self.assertEqual(VAR_26, VAR_23(VAR_28))\n",
"self.cursor.execute('select a, b from t1 order by a')\n",
"VAR_29 = self.cursor.fetchall()\n",
"self.assertEqual(VAR_26, VAR_23(VAR_29))\n",
"for param, VAR_24 in zip(VAR_28, VAR_29):\n",
"self.assertEqual(param[0], VAR_24[0])\n",
"self.assertEqual(param[1], VAR_24[1])\n"
] | [
"def test_executemany_one(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('create table t1(a int, b varchar(10))')\n",
"params = [(1, 'test')]\n",
"self.cursor.executemany('insert into t1(a, b) values (?,?)', params)\n",
"count = self.cursor.execute('select count(*) from t1').fetchone()[0]\n",
"self.assertEqual(count, len(params))\n",
"self.cursor.execute('select a, b from t1 order by a')\n",
"rows = self.cursor.fetchall()\n",
"self.assertEqual(count, len(rows))\n",
"for param, row in zip(params, rows):\n",
"self.assertEqual(param[0], row[0])\n",
"self.assertEqual(param[1], row[1])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_1, VAR_2, VAR_3='', VAR_4=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_4(VAR_1, VAR_2['access_token'], VAR_6='', VAR_3=token_type,\n VAR_4=extra_data)\n"
] | [
"def oauth2_token_setter(remote, resp, token_type='', extra_data=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return token_setter(remote, resp['access_token'], secret='', token_type=\n token_type, extra_data=extra_data)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0(self, VAR_1):...\n",
"VAR_4 = 'string' % (VAR_1, VAR_1, VAR_1)\n",
"VAR_5 = sql.queryDB(self.conn, VAR_4)\n",
"return VAR_5\n"
] | [
"def getAllPosts(self, userid):...\n",
"sqlText = (\n 'select users.name,post.comment,post.postid,(select Count(*) from post_like where post.postid = post_like.postid) as like, (select Count(*) from post_like where post.postid =post_like.postid and post_like.userid=%d) as flag from users,post where post.userid=users.userid and (post.userid in (select friendid from friends where userid =%d) or post.userid=%d ) order by post.date desc;'\n % (userid, userid, userid))\n",
"result = sql.queryDB(self.conn, sqlText)\n",
"return result\n"
] | [
0,
4,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self, VAR_12, VAR_13):...\n",
"super().validate(VAR_12, VAR_13)\n",
"VAR_21 = {'cls': self.encoder} if self.encoder else {}\n",
"json.dumps(VAR_12, **options)\n"
] | [
"def validate(self, value, model_instance):...\n",
"super().validate(value, model_instance)\n",
"options = {'cls': self.encoder} if self.encoder else {}\n",
"json.dumps(value, **options)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"from pykeg.core import models\n",
"from django.core.urlresolvers import reverse\n",
"from django.http import HttpResponse\n",
"from django.http import HttpResponseRedirect\n",
"from django.shortcuts import get_object_or_404\n",
"def FUNC_0(self, VAR_0, VAR_1, VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_3.pop('kbsite_name', None)\n",
"if not VAR_6:\n",
"VAR_6 = 'default'\n",
"VAR_0.kbsite = models.KegbotSite.objects.get(name=kbsite_name)\n",
"return None\n"
] | [
"from pykeg.core import models\n",
"from django.core.urlresolvers import reverse\n",
"from django.http import HttpResponse\n",
"from django.http import HttpResponseRedirect\n",
"from django.shortcuts import get_object_or_404\n",
"def process_view(self, request, view_func, view_args, view_kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"kbsite_name = view_kwargs.pop('kbsite_name', None)\n",
"if not kbsite_name:\n",
"kbsite_name = 'default'\n",
"request.kbsite = models.KegbotSite.objects.get(name=kbsite_name)\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = '[email protected]'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import sys\n",
"import base64\n",
"import json\n",
"from collections import defaultdict\n",
"from itertools import chain\n",
"from functools import partial\n",
"from operator import attrgetter\n",
"from snakemake.io import IOFile, Wildcards, Resources, _IOFile\n",
"from snakemake.utils import format, listfiles\n",
"from snakemake.exceptions import RuleException, ProtectedOutputException\n",
"from snakemake.exceptions import UnexpectedOutputException\n",
"from snakemake.logging import logger\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"return chain(*map(attrgetter(VAR_1), VAR_0))\n"
] | [
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = '[email protected]'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import sys\n",
"import base64\n",
"import json\n",
"from collections import defaultdict\n",
"from itertools import chain\n",
"from functools import partial\n",
"from operator import attrgetter\n",
"from snakemake.io import IOFile, Wildcards, Resources, _IOFile\n",
"from snakemake.utils import format, listfiles\n",
"from snakemake.exceptions import RuleException, ProtectedOutputException\n",
"from snakemake.exceptions import UnexpectedOutputException\n",
"from snakemake.logging import logger\n",
"def jobfiles(jobs, type):...\n",
"return chain(*map(attrgetter(type), jobs))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
7,
0,
0,
0,
0,
0,
0
] | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_7, *VAR_15, **VAR_16):...\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n"
] | [
"def __init__(self, param, *a, **kw):...\n",
"Validator.__init__(self, param, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, VAR_61=False, VAR_62=False, VAR_63='rate_', *VAR_15, **...\n",
"self.rate_user = VAR_61\n",
"self.rate_ip = VAR_62\n",
"self.prefix = VAR_63\n",
"CLASS_0.__init__(self, *VAR_15, **kw)\n"
] | [
"def __init__(self, rate_user=False, rate_ip=False, prefix='rate_', *a, **kw):...\n",
"self.rate_user = rate_user\n",
"self.rate_ip = rate_ip\n",
"self.prefix = prefix\n",
"Validator.__init__(self, *a, **kw)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_1, VAR_7, VAR_11, VAR_4=None):...\n",
"GenericRequest.__init__(self, VAR_1, VAR_4)\n",
"self.url = '%stasks/%s/submissions/%s/token' % (self.base_url, VAR_7[1], VAR_11\n )\n",
"self.task = VAR_7\n",
"self.submission_num = VAR_11\n",
"self.data = {}\n"
] | [
"def __init__(self, browser, task, submission_num, base_url=None):...\n",
"GenericRequest.__init__(self, browser, base_url)\n",
"self.url = '%stasks/%s/submissions/%s/token' % (self.base_url, task[1],\n submission_num)\n",
"self.task = task\n",
"self.submission_num = submission_num\n",
"self.data = {}\n"
] | [
0,
0,
5,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'MCGREGOR', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='MACGREGOR', VAR_10=[{'name': '----MACGREGOR'},\n {'name': 'MCGREGOR'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'MCGREGOR', id='1')\n",
"verify_results(client, jwt, query='MACGREGOR', expected=[{'name':\n '----MACGREGOR'}, {'name': 'MCGREGOR'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"def FUNC_13(self, *VAR_16, **VAR_10):...\n",
"if not self.current_user or not self.current_user.admin:\n",
"return VAR_7(self, *VAR_16, **kwargs)\n"
] | [
"@staticmethod...\n",
"def wrapper(self, *args, **kwargs):...\n",
"if not self.current_user or not self.current_user.admin:\n",
"return method(self, *args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_6(self, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = self.redirect_url\n",
"if is_authenticated(VAR_1.user):\n",
"VAR_13 = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n",
"return HttpResponseRedirect(VAR_12)\n",
"if VAR_13:\n",
"VAR_12 = import_string(VAR_13)()\n",
"auth.logout(VAR_1)\n"
] | [
"def post(self, request):...\n",
"\"\"\"docstring\"\"\"\n",
"logout_url = self.redirect_url\n",
"if is_authenticated(request.user):\n",
"logout_from_op = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n",
"return HttpResponseRedirect(logout_url)\n",
"if logout_from_op:\n",
"logout_url = import_string(logout_from_op)()\n",
"auth.logout(request)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_29(self, VAR_77):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.priority = VAR_77\n",
"return VAR_101\n"
] | [
"def priority(self, priority):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.priority = priority\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self, VAR_18):...\n",
"if type(VAR_18) == str:\n",
"VAR_18 = self.locate(VAR_18)\n",
"if not VAR_18:\n",
"return False\n",
"if not VAR_18.is_dir:\n",
"VAR_18 = VAR_18.parent\n",
"VAR_30, VAR_41, VAR_42, VAR_43, VAR_46, VAR_47 = self._sqlify_fsnode(VAR_18)\n",
"if not VAR_18.is_dir:\n",
"VAR_5 = 'string' % (VAR_41, VAR_42, VAR_43, VAR_46, VAR_47, VAR_30)\n",
"return False\n",
"self.fs_db.execute(VAR_5)\n",
"return True\n"
] | [
"def _update_in_db(self, item):...\n",
"if type(item) == str:\n",
"item = self.locate(item)\n",
"if not item:\n",
"return False\n",
"if not item.is_dir:\n",
"item = item.parent\n",
"(n_uuid, n_file_name, n_owner, n_upload_time, n_sub_folders_str,\n n_sub_files_str) = self._sqlify_fsnode(item)\n",
"if not item.is_dir:\n",
"command = (\n \"UPDATE file_system SET file_name = '%s', owner = '%s', upload_time = %f, sub_folders = %s, sub_files = %s WHERE uuid = '%s';\"\n % (n_file_name, n_owner, n_upload_time, n_sub_folders_str,\n n_sub_files_str, n_uuid))\n",
"return False\n",
"self.fs_db.execute(command)\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_25(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 8}, 'CONFIDENCE': {'MEDIUM': 8}}\n",
"self.check_example('os-exec.py', VAR_2)\n"
] | [
"def test_os_exec(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 8}, 'CONFIDENCE': {'MEDIUM': 8}}\n",
"self.check_example('os-exec.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_14):...\n",
""
] | [
"def is_date(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_8(VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = pyramid.request.Request({'HTTP_COOKIE': '{0}={1}'.format(VAR_5.\n registry.settings['session.cookie_name'], VAR_12)})\n",
"VAR_20 = VAR_8(VAR_14)\n",
"return VAR_20 and VAR_20.get('admin')\n"
] | [
"def authenticator(key):...\n",
"\"\"\"docstring\"\"\"\n",
"request = pyramid.request.Request({'HTTP_COOKIE': '{0}={1}'.format(config.\n registry.settings['session.cookie_name'], key)})\n",
"session_data = session_factory(request)\n",
"return session_data and session_data.get('admin')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_17 = [VAR_28.mtime for VAR_28 in self.expanded_output if VAR_28.exists]\n",
"if self.benchmark and self.benchmark.exists:\n",
"VAR_17.append(self.benchmark.mtime)\n",
"if VAR_17:\n",
"return min(VAR_17)\n",
"return None\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"existing = [f.mtime for f in self.expanded_output if f.exists]\n",
"if self.benchmark and self.benchmark.exists:\n",
"existing.append(self.benchmark.mtime)\n",
"if existing:\n",
"return min(existing)\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_25(self, VAR_14):...\n",
""
] | [
"def is_fk(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def __gt__(self, VAR_16):...\n",
"VAR_39 = self.workflow._ruleorder.compare(self, VAR_16)\n",
"return VAR_39 > 0\n"
] | [
"def __gt__(self, rule):...\n",
"comp = self.workflow._ruleorder.compare(self, rule)\n",
"return comp > 0\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_2, VAR_3, VAR_4, VAR_5, VAR_1, VAR_6, VAR_7):...\n",
"if ' ' in VAR_2:\n",
"VAR_6('Invalid nick')\n",
"VAR_14 = database.get(VAR_1, 'channels', 'votekick', 'chan', VAR_4)\n",
"VAR_14 = 10\n",
"VAR_15 = database.get(VAR_1, 'channels', 'voteban', 'chan', VAR_4)\n",
"VAR_15 = 10\n",
"if len(VAR_2) is 0:\n",
"return\n",
"if VAR_3 is 'kick':\n",
"VAR_10 = False\n",
"VAR_6('Votes required to kick: {}'.format(VAR_14))\n",
"if VAR_3 is 'ban':\n",
"if not VAR_0:\n",
"return\n",
"VAR_6('Votes required to ban: {}'.format(VAR_15))\n",
"FUNC_0(VAR_1)\n",
"VAR_4 = VAR_4.lower()\n",
"VAR_2 = VAR_2.lower()\n",
"VAR_11 = user.format_hostmask(VAR_5)\n",
"VAR_12 = VAR_1.execute(\n \"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\"\n .format(VAR_4, VAR_3, VAR_2)).fetchone()\n",
"if VAR_7.nick.lower() in VAR_2:\n",
"return 'I dont think so Tim.'\n",
"if VAR_12:\n",
"VAR_12 = VAR_12[0]\n",
"VAR_12 = VAR_11\n",
"if VAR_11 in VAR_12:\n",
"VAR_13 = len(VAR_12.split(' '))\n",
"VAR_6('You have already voted.')\n",
"VAR_12 = '{} {}'.format(VAR_12, VAR_11).strip()\n",
"if 'kick' in VAR_3:\n",
"return\n",
"VAR_6('Thank you for your vote!')\n",
"VAR_16 = int(VAR_14)\n",
"if 'ban' in VAR_3:\n",
"if VAR_13 >= VAR_16:\n",
"VAR_16 = int(VAR_15)\n",
"if VAR_10:\n",
"VAR_10 = True\n",
"if VAR_13 >= VAR_16:\n",
"VAR_1.execute(\n \"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\"\n .format(VAR_4, VAR_3, VAR_2))\n",
"VAR_1.execute(\n 'insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)'\n , (VAR_4, VAR_3, VAR_2, VAR_12, time.time()))\n",
"VAR_7.send('KICK {} {} :{}'.format(VAR_4, VAR_2,\n 'You have been voted off the island.'))\n",
"VAR_10 = True\n",
"VAR_1.commit()\n",
"VAR_7.send('MODE {} +b {}'.format(VAR_4, user.get_hostmask(VAR_2, VAR_1)))\n",
"return 'Votes to {} {}: {}/{}'.format(VAR_3, VAR_2, VAR_13, VAR_16)\n",
"VAR_7.send('KICK {} {} :'.format(VAR_4, VAR_2,\n 'You have been voted off the island.'))\n"
] | [
"def process_vote(target, action, chan, mask, db, notice, conn):...\n",
"if ' ' in target:\n",
"notice('Invalid nick')\n",
"votes2kick = database.get(db, 'channels', 'votekick', 'chan', chan)\n",
"votes2kick = 10\n",
"votes2ban = database.get(db, 'channels', 'voteban', 'chan', chan)\n",
"votes2ban = 10\n",
"if len(target) is 0:\n",
"return\n",
"if action is 'kick':\n",
"votefinished = False\n",
"notice('Votes required to kick: {}'.format(votes2kick))\n",
"if action is 'ban':\n",
"if not db_ready:\n",
"return\n",
"notice('Votes required to ban: {}'.format(votes2ban))\n",
"db_init(db)\n",
"chan = chan.lower()\n",
"target = target.lower()\n",
"voter = user.format_hostmask(mask)\n",
"voters = db.execute(\n \"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\"\n .format(chan, action, target)).fetchone()\n",
"if conn.nick.lower() in target:\n",
"return 'I dont think so Tim.'\n",
"if voters:\n",
"voters = voters[0]\n",
"voters = voter\n",
"if voter in voters:\n",
"votecount = len(voters.split(' '))\n",
"notice('You have already voted.')\n",
"voters = '{} {}'.format(voters, voter).strip()\n",
"if 'kick' in action:\n",
"return\n",
"notice('Thank you for your vote!')\n",
"votemax = int(votes2kick)\n",
"if 'ban' in action:\n",
"if votecount >= votemax:\n",
"votemax = int(votes2ban)\n",
"if votefinished:\n",
"votefinished = True\n",
"if votecount >= votemax:\n",
"db.execute(\n \"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\"\n .format(chan, action, target))\n",
"db.execute(\n 'insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)'\n , (chan, action, target, voters, time.time()))\n",
"conn.send('KICK {} {} :{}'.format(chan, target,\n 'You have been voted off the island.'))\n",
"votefinished = True\n",
"db.commit()\n",
"conn.send('MODE {} +b {}'.format(chan, user.get_hostmask(target, db)))\n",
"return 'Votes to {} {}: {}/{}'.format(action, target, votecount, votemax)\n",
"conn.send('KICK {} {} :'.format(chan, target,\n 'You have been voted off the island.'))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Expr'"
] |
[
"def FUNC_1(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = 'string'.format(VAR_2)\n",
"return FUNC_0(VAR_1)\n"
] | [
"def get_top_popular(top_num):...\n",
"\"\"\"docstring\"\"\"\n",
"cmd = (\n \"\"\"SELECT title, views FROM articles\n INNER JOIN (\n SELECT path, count(path) AS views\n FROM log GROUP BY log.path\n ) AS log\n ON log.path = '/article/' || articles.slug\n ORDER BY views DESC\n LIMIT {}\"\"\"\n .format(top_num))\n",
"return execute_query(cmd)\n"
] | [
0,
0,
4,
4
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"self.cursor.execute('string', [self.campaign['id']])\n",
"self.cursor.execute('string', [self.campaign['id']])\n",
"self.cursor.execute(\n 'DELETE FROM log_injection WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute(\n 'DELETE FROM log_event WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute('DELETE FROM log_result WHERE campaign_id=?', [self.\n campaign['id']])\n"
] | [
"def delete_results(self):...\n",
"self.cursor.execute(\n 'DELETE FROM log_simics_memory_diff WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute(\n 'DELETE FROM log_simics_register_diff WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute(\n 'DELETE FROM log_injection WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute(\n 'DELETE FROM log_event WHERE result_id IN (SELECT id FROM log_result WHERE campaign_id=?)'\n , [self.campaign['id']])\n",
"self.cursor.execute('DELETE FROM log_result WHERE campaign_id=?', [self.\n campaign['id']])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_30 = list(VAR_1.router.match_routes)\n",
"VAR_30.extend(v for k, v in VAR_1.router.build_routes.iteritems() if v not in\n VAR_1.router.match_routes)\n",
"return [r for r in VAR_30 if issubclass(r.handler, CLASS_2)]\n"
] | [
"def get_authenticated_routes(app):...\n",
"\"\"\"docstring\"\"\"\n",
"routes = list(app.router.match_routes)\n",
"routes.extend(v for k, v in app.router.build_routes.iteritems() if v not in\n app.router.match_routes)\n",
"return [r for r in routes if issubclass(r.handler, AuthenticatingHandler)]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"import os\n",
"from . import vcstool_clients\n",
"def FUNC_0(VAR_0):...\n",
"VAR_1 = []\n",
"VAR_2 = FUNC_1(VAR_0)\n",
"if VAR_2:\n",
"VAR_1.append(VAR_2)\n",
"VAR_3 = os.listdir(VAR_0)\n",
"VAR_3 = []\n",
"for name in VAR_3:\n",
"return VAR_1\n",
"VAR_4 = os.path.join(VAR_0, name)\n",
"if not os.path.isdir(VAR_4):\n",
"VAR_1 += FUNC_0(VAR_4)\n"
] | [
"import os\n",
"from . import vcstool_clients\n",
"def find_repositories(path):...\n",
"repos = []\n",
"client = get_vcs_client(path)\n",
"if client:\n",
"repos.append(client)\n",
"listdir = os.listdir(path)\n",
"listdir = []\n",
"for name in listdir:\n",
"return repos\n",
"subpath = os.path.join(path, name)\n",
"if not os.path.isdir(subpath):\n",
"repos += find_repositories(subpath)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1
] | [
"Import'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"For",
"Return'",
"Assign'",
"Condition",
"AugAssign'"
] |
[
"def __init__(self, VAR_18, VAR_35=200, **VAR_16):...\n",
"CLASS_17.__init__(self, VAR_18, VAR_35=length, VAR_36=errors.NO_TITLE,\n VAR_37=errors.TITLE_TOO_LONG, **kw)\n"
] | [
"def __init__(self, item, length=200, **kw):...\n",
"VLength.__init__(self, item, length=length, empty_error=errors.NO_TITLE,\n length_error=errors.TITLE_TOO_LONG, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __call__(self):...\n",
"return self\n"
] | [
"def __call__(self):...\n",
"return self\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self, VAR_12):...\n",
"if VAR_12 is not None:\n",
"return CLASS_0(VAR_12, VAR_2=self.encoder)\n",
"return VAR_12\n"
] | [
"def get_prep_value(self, value):...\n",
"if value is not None:\n",
"return JsonAdapter(value, encoder=self.encoder)\n",
"return value\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(self, VAR_14):...\n",
""
] | [
"def is_integer(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"import os\n",
"from flask import Flask, g, url_for\n",
"from flask_sqlalchemy import SQLAlchemy\n",
"from flask_migrate import Migrate\n",
"from flask_admin import Admin, helpers\n",
"from flask_security import Security\n",
"from flask_login import LoginManager\n",
"from flask_uploads import patch_request_class, configure_uploads\n",
"from werkzeug.utils import find_modules, import_string\n",
"from config import app_config\n",
"from benwaonline.database import db\n",
"from benwaonline.oauth import oauth\n",
"from benwaonline.admin import setup_adminviews\n",
"from benwaonline.models import user_datastore, User\n",
"from benwaonline.gallery import gallery\n",
"from benwaonline.gallery.forms import images\n",
"from benwaonline.user import user\n",
"from benwaonline.auth import auth\n",
"VAR_0 = 10 * 1024 * 1024\n",
"VAR_1 = Security()\n",
"VAR_2 = LoginManager()\n",
"def FUNC_0(VAR_3=None):...\n",
"VAR_4 = Flask(__name__)\n",
"VAR_4.config.from_object(app_config[VAR_3])\n",
"VAR_4.config.from_envvar('BENWAONLINE_SETTINGS', silent=True)\n",
"VAR_4.config.from_object('secrets')\n",
"db.init_app(VAR_4)\n",
"VAR_5 = Migrate(VAR_4, db)\n",
"oauth.init_app(VAR_4)\n",
"VAR_2.init_app(VAR_4)\n",
"@VAR_2.user_loader...\n",
"return User.get(VAR_6)\n"
] | [
"import os\n",
"from flask import Flask, g, url_for\n",
"from flask_sqlalchemy import SQLAlchemy\n",
"from flask_migrate import Migrate\n",
"from flask_admin import Admin, helpers\n",
"from flask_security import Security\n",
"from flask_login import LoginManager\n",
"from flask_uploads import patch_request_class, configure_uploads\n",
"from werkzeug.utils import find_modules, import_string\n",
"from config import app_config\n",
"from benwaonline.database import db\n",
"from benwaonline.oauth import oauth\n",
"from benwaonline.admin import setup_adminviews\n",
"from benwaonline.models import user_datastore, User\n",
"from benwaonline.gallery import gallery\n",
"from benwaonline.gallery.forms import images\n",
"from benwaonline.user import user\n",
"from benwaonline.auth import auth\n",
"FILE_SIZE_LIMIT = 10 * 1024 * 1024\n",
"security = Security()\n",
"login_manager = LoginManager()\n",
"def create_app(config=None):...\n",
"app = Flask(__name__)\n",
"app.config.from_object(app_config[config])\n",
"app.config.from_envvar('BENWAONLINE_SETTINGS', silent=True)\n",
"app.config.from_object('secrets')\n",
"db.init_app(app)\n",
"migrate = Migrate(app, db)\n",
"oauth.init_app(app)\n",
"login_manager.init_app(app)\n",
"@login_manager.user_loader...\n",
"return User.get(user_id)\n"
] | [
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
6,
6,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n",
"CLASS_3.__init__(self, VAR_18, errors.NO_URL, *VAR_15, **kw)\n"
] | [
"def __init__(self, item, *a, **kw):...\n",
"VRequired.__init__(self, item, errors.NO_URL, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@mock.patch('requests.post', FUNC_0)...\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_7 = {'image': 'autotest/example'}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"VAR_12 = VAR_5.data['results'][0]\n",
"self.assertEqual(VAR_12['type'], 'cmd')\n",
"self.assertEqual(VAR_12['num'], 1)\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_7 = {'image': 'autotest/example', 'sha': 'a' * 40, 'dockerfile':\n 'FROM scratch'}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"VAR_12 = VAR_5.data['results'][0]\n",
"self.assertEqual(VAR_12['type'], 'cmd')\n",
"self.assertEqual(VAR_12['num'], 1)\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_7 = {'image': 'autotest/example', 'sha': 'a' * 40, 'dockerfile':\n 'FROM scratch', 'procfile': {'worker': 'node worker.js'}}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"VAR_12 = VAR_5.data['results'][0]\n",
"self.assertEqual(VAR_12['type'], 'cmd')\n",
"self.assertEqual(VAR_12['num'], 1)\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_7 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_4 = '/api/apps/{app_id}/containers/web'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertEqual(len(VAR_5.data['results']), 1)\n",
"VAR_12 = VAR_5.data['results'][0]\n",
"self.assertEqual(VAR_12['type'], 'web')\n",
"self.assertEqual(VAR_12['num'], 1)\n"
] | [
"@mock.patch('requests.post', mock_import_repository_task)...\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"container = response.data['results'][0]\n",
"self.assertEqual(container['type'], 'cmd')\n",
"self.assertEqual(container['num'], 1)\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example', 'sha': 'a' * 40, 'dockerfile':\n 'FROM scratch'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"container = response.data['results'][0]\n",
"self.assertEqual(container['type'], 'cmd')\n",
"self.assertEqual(container['num'], 1)\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example', 'sha': 'a' * 40, 'dockerfile':\n 'FROM scratch', 'procfile': {'worker': 'node worker.js'}}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"container = response.data['results'][0]\n",
"self.assertEqual(container['type'], 'cmd')\n",
"self.assertEqual(container['num'], 1)\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"url = '/api/apps/{app_id}/containers/web'.format(**locals())\n",
"response = self.client.get(url)\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 1)\n",
"container = response.data['results'][0]\n",
"self.assertEqual(container['type'], 'web')\n",
"self.assertEqual(container['num'], 1)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"import unittest\n",
"import mock\n",
"from nose.tools import eq_\n",
"from opennode.oms.endpoint.ssh.protocol import OmsSshProtocol\n",
"from opennode.oms.endpoint.ssh import cmd\n",
"def FUNC_0(self):...\n",
"self.oms_ssh = OmsSshProtocol()\n",
"self.terminal = mock.Mock()\n",
"self.oms_ssh.terminal = self.terminal\n",
"self.oms_ssh.connectionMade()\n",
"self.orig_commands = cmd.commands\n",
"cmd.commands = lambda : dict(hello=cmd.Cmd, **self.orig_commands())\n",
"def FUNC_1(self):...\n",
"cmd.commands = self.orig_commands\n",
"def FUNC_2(self, VAR_0):...\n",
"for s in VAR_0:\n",
"self.oms_ssh.characterReceived(s, False)\n",
"def FUNC_3(self, VAR_0):...\n",
"self._input(VAR_0)\n",
"self.terminal.reset_mock()\n",
"self.oms_ssh.handle_TAB()\n",
"def FUNC_4(self):...\n",
"self._tab_after('s')\n",
"eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n",
"def FUNC_5(self):...\n",
"self._tab_after(' s')\n",
"eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n",
"def FUNC_6(self):...\n",
"self._tab_after('t')\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"def FUNC_7(self):...\n",
"self._tab_after('ls \"comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes\" ',), {})])\n",
"def FUNC_8(self):...\n",
"self._tab_after('h')\n",
"eq_(self.terminal.method_calls, [('write', ('el',), {})])\n",
"self.terminal.reset_mock()\n",
"self.oms_ssh.handle_TAB()\n",
"eq_(self.terminal.method_calls, [('write', ('',), {}), ('nextLine', (), {}),\n ('write', ('help hello\\n',), {}), ('write', (self.oms_ssh.ps[0] +\n 'hel',), {})])\n",
"def FUNC_9(self):...\n",
"self._tab_after('ls comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes ',), {})])\n",
"def FUNC_10(self):...\n",
"self._tab_after(' ls comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes ',), {})])\n",
"def FUNC_11(self):...\n",
"self._tab_after('cat ')\n",
"eq_(len(self.terminal.method_calls), 4)\n",
"def FUNC_12(self):...\n",
"self._tab_after('quit ')\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"self.oms_ssh.handle_TAB()\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"self._tab_after('-')\n",
"eq_(self.terminal.method_calls, [('write', ('',), {}), ('nextLine', (), {}),\n ('write', ('-h --help\\n',), {}), ('write', (self.oms_ssh.ps[0] +\n 'quit -',), {})])\n",
"self._tab_after('-')\n",
"eq_(self.terminal.method_calls, [('write', ('help ',), {})])\n",
"def FUNC_13(self):...\n",
"self._tab_after('ls --help')\n",
"eq_(self.terminal.method_calls, [('write', (' ',), {})])\n",
"self._tab_after('-')\n",
"assert 'help' not in self.terminal.method_calls[2][1][0]\n",
"assert '-h' not in self.terminal.method_calls[2][1][0]\n"
] | [
"import unittest\n",
"import mock\n",
"from nose.tools import eq_\n",
"from opennode.oms.endpoint.ssh.protocol import OmsSshProtocol\n",
"from opennode.oms.endpoint.ssh import cmd\n",
"def setUp(self):...\n",
"self.oms_ssh = OmsSshProtocol()\n",
"self.terminal = mock.Mock()\n",
"self.oms_ssh.terminal = self.terminal\n",
"self.oms_ssh.connectionMade()\n",
"self.orig_commands = cmd.commands\n",
"cmd.commands = lambda : dict(hello=cmd.Cmd, **self.orig_commands())\n",
"def tearDown(self):...\n",
"cmd.commands = self.orig_commands\n",
"def _input(self, string):...\n",
"for s in string:\n",
"self.oms_ssh.characterReceived(s, False)\n",
"def _tab_after(self, string):...\n",
"self._input(string)\n",
"self.terminal.reset_mock()\n",
"self.oms_ssh.handle_TAB()\n",
"def test_command_completion(self):...\n",
"self._tab_after('s')\n",
"eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n",
"def test_command_completion_spaces(self):...\n",
"self._tab_after(' s')\n",
"eq_(self.terminal.method_calls, [('write', ('et ',), {})])\n",
"def test_complete_not_found(self):...\n",
"self._tab_after('t')\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"def test_complete_quotes(self):...\n",
"self._tab_after('ls \"comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes\" ',), {})])\n",
"def test_complete_prefix(self):...\n",
"self._tab_after('h')\n",
"eq_(self.terminal.method_calls, [('write', ('el',), {})])\n",
"self.terminal.reset_mock()\n",
"self.oms_ssh.handle_TAB()\n",
"eq_(self.terminal.method_calls, [('write', ('',), {}), ('nextLine', (), {}),\n ('write', ('help hello\\n',), {}), ('write', (self.oms_ssh.ps[0] +\n 'hel',), {})])\n",
"def test_spaces_between_arg(self):...\n",
"self._tab_after('ls comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes ',), {})])\n",
"def test_command_arg_spaces_before_command(self):...\n",
"self._tab_after(' ls comp')\n",
"eq_(self.terminal.method_calls, [('write', ('utes ',), {})])\n",
"def test_mandatory_positional(self):...\n",
"self._tab_after('cat ')\n",
"eq_(len(self.terminal.method_calls), 4)\n",
"def test_complete_switches(self):...\n",
"self._tab_after('quit ')\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"self.oms_ssh.handle_TAB()\n",
"eq_(len(self.terminal.method_calls), 0)\n",
"self._tab_after('-')\n",
"eq_(self.terminal.method_calls, [('write', ('',), {}), ('nextLine', (), {}),\n ('write', ('-h --help\\n',), {}), ('write', (self.oms_ssh.ps[0] +\n 'quit -',), {})])\n",
"self._tab_after('-')\n",
"eq_(self.terminal.method_calls, [('write', ('help ',), {})])\n",
"def test_complete_consumed_switches(self):...\n",
"self._tab_after('ls --help')\n",
"eq_(self.terminal.method_calls, [('write', (' ',), {})])\n",
"self._tab_after('-')\n",
"assert 'help' not in self.terminal.method_calls[2][1][0]\n",
"assert '-h' not in self.terminal.method_calls[2][1][0]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"For",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Assert'",
"Assert'"
] |
[
"def FUNC_12(VAR_24):...\n",
"VAR_38 = argparse.ArgumentParser(description=\n 'Reads and merges JSON configuration files specified by colon separated environment variable OS_CONFIG_FILES, unless overridden by command line option --metadata. If no files are specified this way, falls back to legacy behavior of searching the fallback metadata path for a single config file.'\n )\n",
"VAR_38.add_argument('-t', '--templates', metavar='TEMPLATE_ROOT', help=\n \"\"\"path to template root directory (default:\n %(default)s)\"\"\"\n , VAR_12=TEMPLATES_DIR)\n",
"VAR_38.add_argument('-o', '--output', metavar='OUT_DIR', help=\n 'root directory for output (default:%(default)s)', VAR_12='/')\n",
"VAR_38.add_argument('-m', '--metadata', metavar='METADATA_FILE', nargs='*',\n help=\n 'Overrides environment variable OS_CONFIG_FILES. Specify multiple times, rather than separate files with \":\".'\n , VAR_12=[])\n",
"VAR_38.add_argument('--fallback-metadata', metavar='FALLBACK_METADATA',\n nargs='*', help=\n 'Files to search when OS_CONFIG_FILES is empty. (default: %(default)s)',\n VAR_12=['/var/cache/heat-cfntools/last_metadata',\n '/var/lib/heat-cfntools/cfn-init-data',\n '/var/lib/cloud/data/cfn-init-data'])\n",
"VAR_38.add_argument('-v', '--validate', help=\n 'validate only. do not write files', VAR_12=False, action='store_true')\n",
"VAR_38.add_argument('--print-templates', VAR_12=False, action='store_true',\n help='Print templates root and exit.')\n",
"VAR_38.add_argument('-s', '--subhash', help=\n 'use the sub-hash named by this key, instead of the full metadata hash')\n",
"VAR_38.add_argument('--key', metavar='KEY', VAR_12=None, help=\n 'print the specified key and exit. (may be used with --type and --key-default)'\n )\n",
"VAR_38.add_argument('--type', VAR_12='default', help=\n 'exit with error if the specified --key does not match type. Valid types are <int|default|netaddress|netdevice|dsn|swiftdevices|raw>'\n )\n",
"VAR_38.add_argument('--key-default', help=\n 'This option only affects running with --key. Print this if key is not found. This value is not subject to type restrictions. If --key is specified and no default is specified, program exits with an error on missing key.'\n )\n",
"VAR_38.add_argument('--version', action='version', version=version.\n version_info.version_string())\n",
"VAR_38.add_argument('--os-config-files', VAR_12=OS_CONFIG_FILES_PATH, help=\n 'Set path to os_config_files.json')\n",
"VAR_39 = VAR_38.parse_args(VAR_24[1:])\n",
"return VAR_39\n"
] | [
"def parse_opts(argv):...\n",
"parser = argparse.ArgumentParser(description=\n 'Reads and merges JSON configuration files specified by colon separated environment variable OS_CONFIG_FILES, unless overridden by command line option --metadata. If no files are specified this way, falls back to legacy behavior of searching the fallback metadata path for a single config file.'\n )\n",
"parser.add_argument('-t', '--templates', metavar='TEMPLATE_ROOT', help=\n \"\"\"path to template root directory (default:\n %(default)s)\"\"\"\n , default=TEMPLATES_DIR)\n",
"parser.add_argument('-o', '--output', metavar='OUT_DIR', help=\n 'root directory for output (default:%(default)s)', default='/')\n",
"parser.add_argument('-m', '--metadata', metavar='METADATA_FILE', nargs='*',\n help=\n 'Overrides environment variable OS_CONFIG_FILES. Specify multiple times, rather than separate files with \":\".'\n , default=[])\n",
"parser.add_argument('--fallback-metadata', metavar='FALLBACK_METADATA',\n nargs='*', help=\n 'Files to search when OS_CONFIG_FILES is empty. (default: %(default)s)',\n default=['/var/cache/heat-cfntools/last_metadata',\n '/var/lib/heat-cfntools/cfn-init-data',\n '/var/lib/cloud/data/cfn-init-data'])\n",
"parser.add_argument('-v', '--validate', help=\n 'validate only. do not write files', default=False, action='store_true')\n",
"parser.add_argument('--print-templates', default=False, action='store_true',\n help='Print templates root and exit.')\n",
"parser.add_argument('-s', '--subhash', help=\n 'use the sub-hash named by this key, instead of the full metadata hash')\n",
"parser.add_argument('--key', metavar='KEY', default=None, help=\n 'print the specified key and exit. (may be used with --type and --key-default)'\n )\n",
"parser.add_argument('--type', default='default', help=\n 'exit with error if the specified --key does not match type. Valid types are <int|default|netaddress|netdevice|dsn|swiftdevices|raw>'\n )\n",
"parser.add_argument('--key-default', help=\n 'This option only affects running with --key. Print this if key is not found. This value is not subject to type restrictions. If --key is specified and no default is specified, program exits with an error on missing key.'\n )\n",
"parser.add_argument('--version', action='version', version=version.\n version_info.version_string())\n",
"parser.add_argument('--os-config-files', default=OS_CONFIG_FILES_PATH, help\n ='Set path to os_config_files.json')\n",
"opts = parser.parse_args(argv[1:])\n",
"return opts\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.name:\n",
"set_new_name(self)\n",
"if not self.creation:\n",
"self.creation = self.modified = now()\n",
"VAR_6 = self.get_valid_dict(VAR_13=True)\n",
"self.created_by = self.modifield_by = VAR_54.session.user\n",
"VAR_33 = list(VAR_6)\n",
"VAR_54.db.sql(\n \"\"\"insert into `tab{doctype}`\n\t\t\t\t({columns}) values ({values})\"\"\".\n format(VAR_1=self.doctype, VAR_33=', '.join([('`' + c + '`') for c in\n columns]), VAR_57=', '.join(['%s'] * len(columns))), list(VAR_6.values()))\n",
"if VAR_17.args[0] == 1062:\n",
"self.set('__islocal', False)\n",
"if 'PRIMARY' in cstr(VAR_17.args[1]):\n",
"if self.meta.autoname == 'hash':\n",
"if 'Duplicate' in cstr(VAR_17.args[1]):\n",
"self.name = None\n",
"self.show_unique_validation_message(VAR_17)\n",
"self.db_insert()\n",
"return\n"
] | [
"def db_insert(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.name:\n",
"set_new_name(self)\n",
"if not self.creation:\n",
"self.creation = self.modified = now()\n",
"d = self.get_valid_dict(convert_dates_to_str=True)\n",
"self.created_by = self.modifield_by = frappe.session.user\n",
"columns = list(d)\n",
"frappe.db.sql(\n \"\"\"insert into `tab{doctype}`\n\t\t\t\t({columns}) values ({values})\"\"\".\n format(doctype=self.doctype, columns=', '.join([('`' + c + '`') for c in\n columns]), values=', '.join(['%s'] * len(columns))), list(d.values()))\n",
"if e.args[0] == 1062:\n",
"self.set('__islocal', False)\n",
"if 'PRIMARY' in cstr(e.args[1]):\n",
"if self.meta.autoname == 'hash':\n",
"if 'Duplicate' in cstr(e.args[1]):\n",
"self.name = None\n",
"self.show_unique_validation_message(e)\n",
"self.db_insert()\n",
"return\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"if not self._server_popen:\n",
"return -1\n",
"return self._server_popen.pid\n"
] | [
"def ServerPid(self):...\n",
"if not self._server_popen:\n",
"return -1\n",
"return self._server_popen.pid\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7(self, VAR_9, VAR_11=None):...\n",
"get_and_check_project(VAR_9, VAR_11)\n",
"VAR_25 = self.queryset.filter(VAR_1=project_pk)\n",
"VAR_25 = filters.OrderingFilter().filter_queryset(self.request, VAR_25, self)\n",
"VAR_26 = CLASS_1(VAR_25, many=True)\n",
"return Response(VAR_26.data)\n"
] | [
"def list(self, request, project_pk=None):...\n",
"get_and_check_project(request, project_pk)\n",
"tasks = self.queryset.filter(project=project_pk)\n",
"tasks = filters.OrderingFilter().filter_queryset(self.request, tasks, self)\n",
"serializer = TaskSerializer(tasks, many=True)\n",
"return Response(serializer.data)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_1):...\n",
"VAR_3 = [_('Employee') + ':Link/Employee:150', _('Employee Name') + '::200',\n _('Department') + '::150']\n",
"for leave_type in VAR_1:\n",
"VAR_3.append(_(leave_type) + ' ' + _('Opening') + ':Float:160')\n",
"return VAR_3\n",
"VAR_3.append(_(leave_type) + ' ' + _('Taken') + ':Float:160')\n",
"VAR_3.append(_(leave_type) + ' ' + _('Balance') + ':Float:160')\n"
] | [
"def get_columns(leave_types):...\n",
"columns = [_('Employee') + ':Link/Employee:150', _('Employee Name') +\n '::200', _('Department') + '::150']\n",
"for leave_type in leave_types:\n",
"columns.append(_(leave_type) + ' ' + _('Opening') + ':Float:160')\n",
"return columns\n",
"columns.append(_(leave_type) + ' ' + _('Taken') + ':Float:160')\n",
"columns.append(_(leave_type) + ' ' + _('Balance') + ':Float:160')\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_0, *VAR_2, **VAR_3):...\n",
"VAR_11 = ShortUrlForm(VAR_0.POST or None)\n",
"if VAR_11.is_valid():\n",
"VAR_18 = VAR_11.cleaned_data['input_url']\n",
"return render(VAR_0, 'home.html', {'form': VAR_11})\n",
"VAR_19 = VAR_11.cleaned_data['category']\n",
"VAR_20 = JustURL.objects.create(input_url=url, VAR_19=category)\n",
"VAR_21 = create_short_url(VAR_20)\n",
"VAR_20.short_url = f'{VAR_0.get_host()}/{VAR_21}'\n",
"VAR_20.save()\n",
"if VAR_0.user.is_superuser:\n",
"return redirect(reverse('url-detail-view', VAR_3={'pk': created.pk}))\n",
"return redirect(reverse('success-url-view', VAR_3={'pk': created.pk}))\n"
] | [
"def post(self, request, *args, **kwargs):...\n",
"form = ShortUrlForm(request.POST or None)\n",
"if form.is_valid():\n",
"url = form.cleaned_data['input_url']\n",
"return render(request, 'home.html', {'form': form})\n",
"category = form.cleaned_data['category']\n",
"created = JustURL.objects.create(input_url=url, category=category)\n",
"short_url = create_short_url(created)\n",
"created.short_url = f'{request.get_host()}/{short_url}'\n",
"created.save()\n",
"if request.user.is_superuser:\n",
"return redirect(reverse('url-detail-view', kwargs={'pk': created.pk}))\n",
"return redirect(reverse('success-url-view', kwargs={'pk': created.pk}))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"from flask import render_template, request, redirect, url_for\n",
"from flask_login import login_user, logout_user\n",
"from application import app, db\n",
"from application.views import render_form\n",
"from application.auth.models import User\n",
"from application.auth.forms import LoginForm, RegisterForm\n",
"@app.route('/auth/login', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"return FUNC_4()\n",
"VAR_0 = LoginForm(request.form)\n",
"if not VAR_0.validate():\n",
"return FUNC_5(VAR_0)\n",
"VAR_1 = User.query.filter_by(username=form.username.data, password=form.\n password.data).first()\n",
"if not VAR_1:\n",
"return FUNC_6(VAR_0)\n",
"login_user(VAR_1)\n",
"return redirect(url_for('index'))\n"
] | [
"from flask import render_template, request, redirect, url_for\n",
"from flask_login import login_user, logout_user\n",
"from application import app, db\n",
"from application.views import render_form\n",
"from application.auth.models import User\n",
"from application.auth.forms import LoginForm, RegisterForm\n",
"@app.route('/auth/login', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"return render_login()\n",
"form = LoginForm(request.form)\n",
"if not form.validate():\n",
"return render_loginForm(form)\n",
"user = User.query.filter_by(username=form.username.data, password=form.\n password.data).first()\n",
"if not user:\n",
"return render_loginInvalid(form)\n",
"login_user(user)\n",
"return redirect(url_for('index'))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_2):...\n",
"self.read_xsrf_token(VAR_2.base_url)\n",
"VAR_2.execute()\n"
] | [
"def login(self, login_request):...\n",
"self.read_xsrf_token(login_request.base_url)\n",
"login_request.execute()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"VAR_0 = ['', 'home', 'root']\n",
"VAR_1 = []\n",
"VAR_2 = []\n",
"VAR_3 = [] or ['', 'home', 'root']\n",
"def FUNC_0():...\n",
"if VAR_9 in VAR_1:\n",
"print('Directory already exist.')\n",
"VAR_1.append(VAR_9)\n",
"def FUNC_1():...\n",
"VAR_2.append(VAR_9)\n",
"if VAR_2 == VAR_0:\n",
"VAR_2 = VAR_1\n",
"print(*VAR_2, sep='\\n')\n",
"VAR_2 = VAR_2[0]\n",
"def FUNC_2():...\n",
"if VAR_9 == '':\n",
"VAR_3 = VAR_0\n",
"if VAR_9 in VAR_1:\n",
"VAR_2 = VAR_0\n",
"VAR_3.append(VAR_9)\n",
"if VAR_9 == '..':\n",
"def FUNC_3():...\n",
"VAR_2.clear()\n",
"VAR_3.pop()\n",
"print(\"Directory doesn't exist.\")\n",
"print(*VAR_3, sep='/')\n",
"print(*VAR_3, sep='/')\n",
"def FUNC_4():...\n",
"VAR_10 = len(VAR_1) - 1\n",
"if VAR_9 in VAR_1:\n",
"if VAR_1[VAR_10] in VAR_2:\n",
"VAR_1.remove(VAR_9)\n",
"print('Directory does not exist.')\n",
"VAR_10 = VAR_10 - 1\n",
"VAR_2.append(VAR_1[VAR_10])\n",
"if VAR_9 in VAR_2:\n",
"def FUNC_5():...\n",
"VAR_2.pop()\n",
"VAR_2.remove(VAR_9)\n",
"VAR_1.clear()\n",
"VAR_2.append(VAR_1[VAR_10])\n",
"VAR_3.clear()\n",
"VAR_3 = VAR_0\n",
"VAR_2.clear()\n",
"def FUNC_6(VAR_4):...\n",
"VAR_5 = {'mkdir': FUNC_0, 'ls': FUNC_1, 'cd': FUNC_2, 'pwd': FUNC_3, 'rm':\n FUNC_4, 'session_clear': FUNC_5, 'exit': exit}\n",
"if VAR_6 in VAR_5:\n",
"VAR_8 = VAR_5.get(VAR_4)\n",
"print('command does not exist!')\n",
"VAR_8()\n",
"print(\n 'There are total 7 commands: mkdir, ls, cd, pwd, rm, session_clear, exit.')\n",
"while True:\n",
"VAR_6 = input('$: ')\n",
"VAR_7 = []\n",
"VAR_7.append(VAR_6.split(' '))\n",
"VAR_6 = VAR_7[0][0]\n",
"if VAR_6 in ['mkdir', 'rm'] and len(VAR_7[0]) == 1:\n",
"print('{}:missing operand'.format(VAR_6))\n",
"if len(VAR_7[0]) == 1:\n",
"FUNC_6(VAR_6)\n",
"VAR_9 = ''\n",
"if len(VAR_7[0]) == 2:\n",
"VAR_9 = VAR_7[0][1]\n",
"print('Invalid Syntax')\n"
] | [
"root = ['', 'home', 'root']\n",
"dirs = []\n",
"path = []\n",
"curr_path = [] or ['', 'home', 'root']\n",
"def mkdir():...\n",
"if dir in dirs:\n",
"print('Directory already exist.')\n",
"dirs.append(dir)\n",
"def ls():...\n",
"path.append(dir)\n",
"if path == root:\n",
"path = dirs\n",
"print(*path, sep='\\n')\n",
"path = path[0]\n",
"def cd():...\n",
"if dir == '':\n",
"curr_path = root\n",
"if dir in dirs:\n",
"path = root\n",
"curr_path.append(dir)\n",
"if dir == '..':\n",
"def pwd():...\n",
"path.clear()\n",
"curr_path.pop()\n",
"print(\"Directory doesn't exist.\")\n",
"print(*curr_path, sep='/')\n",
"print(*curr_path, sep='/')\n",
"def rm():...\n",
"i = len(dirs) - 1\n",
"if dir in dirs:\n",
"if dirs[i] in path:\n",
"dirs.remove(dir)\n",
"print('Directory does not exist.')\n",
"i = i - 1\n",
"path.append(dirs[i])\n",
"if dir in path:\n",
"def session_clear():...\n",
"path.pop()\n",
"path.remove(dir)\n",
"dirs.clear()\n",
"path.append(dirs[i])\n",
"curr_path.clear()\n",
"curr_path = root\n",
"path.clear()\n",
"def commands(argument):...\n",
"comm = {'mkdir': mkdir, 'ls': ls, 'cd': cd, 'pwd': pwd, 'rm': rm,\n 'session_clear': session_clear, 'exit': exit}\n",
"if n in comm:\n",
"func = comm.get(argument)\n",
"print('command does not exist!')\n",
"func()\n",
"print(\n 'There are total 7 commands: mkdir, ls, cd, pwd, rm, session_clear, exit.')\n",
"while True:\n",
"n = input('$: ')\n",
"a = []\n",
"a.append(n.split(' '))\n",
"n = a[0][0]\n",
"if n in ['mkdir', 'rm'] and len(a[0]) == 1:\n",
"print('{}:missing operand'.format(n))\n",
"if len(a[0]) == 1:\n",
"commands(n)\n",
"dir = ''\n",
"if len(a[0]) == 2:\n",
"dir = a[0][1]\n",
"print('Invalid Syntax')\n"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def __setitem__(self, VAR_3, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.url_to_path(VAR_3)\n",
"VAR_7 = os.path.dirname(VAR_6)\n",
"if not os.path.exists(VAR_7):\n",
"os.makedirs(VAR_7)\n",
"VAR_8 = pickle.dumps(VAR_4)\n",
"if self.compress:\n",
"logger.info('Saving...')\n",
"fp.write(VAR_8)\n",
"VAR_8 = zlib.compress(VAR_8)\n"
] | [
"def __setitem__(self, url, result):...\n",
"\"\"\"docstring\"\"\"\n",
"path = self.url_to_path(url)\n",
"folder = os.path.dirname(path)\n",
"if not os.path.exists(folder):\n",
"os.makedirs(folder)\n",
"data = pickle.dumps(result)\n",
"if self.compress:\n",
"logger.info('Saving...')\n",
"fp.write(data)\n",
"data = zlib.compress(data)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_10(self):...\n",
"self.run_test_case(self.scenario.create_load_balancer())\n"
] | [
"def test_a_create_load_balancer(self):...\n",
"self.run_test_case(self.scenario.create_load_balancer())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.create_snapshot(VAR_9)\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.create_snapshot(snapshot)\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n"
] | [
"def test_filters_2(self):...\n",
"self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_19()\n",
"VAR_6.subject = VAR_20.subject\n",
"VAR_6.message = VAR_20.message\n",
"VAR_6.from_user_id = VAR_20.from_user_id\n",
"VAR_6.to_user_id = VAR_9\n",
"VAR_6.project_id = VAR_20.project_id\n",
"VAR_6.task_id = VAR_20.task_id\n",
"if VAR_20.message_type is not None:\n",
"VAR_6.message_type = CLASS_0(VAR_20.message_type)\n",
"return VAR_6\n"
] | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"message = cls()\n",
"message.subject = dto.subject\n",
"message.message = dto.message\n",
"message.from_user_id = dto.from_user_id\n",
"message.to_user_id = to_user_id\n",
"message.project_id = dto.project_id\n",
"message.task_id = dto.task_id\n",
"if dto.message_type is not None:\n",
"message.message_type = MessageType(dto.message_type)\n",
"return message\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_19(VAR_8, **VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_8.format(**{wildcard: '{{{},{}}}'.format(wildcard, '|'.join(\n values)) for wildcard, values in wildcards.items()})\n"
] | [
"def limit(pattern, **wildcards):...\n",
"\"\"\"docstring\"\"\"\n",
"return pattern.format(**{wildcard: '{{{},{}}}'.format(wildcard, '|'.join(\n values)) for wildcard, values in wildcards.items()})\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.