lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_27(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'LOW': 8}, 'CONFIDENCE': {'MEDIUM': 8}}\n", "self.check_example('os-spawn.py', VAR_2)\n" ]
[ "def test_os_spawn(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'LOW': 8}, 'CONFIDENCE': {'MEDIUM': 8}}\n", "self.check_example('os-spawn.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_17(self, VAR_18):...\n", "VAR_46 = self.container.page_num(VAR_18)\n", "self.container.remove_page(VAR_46)\n", "self.update_tab_bar_visibility()\n" ]
[ "def close_tab(self, child_widget):...\n", "page_num = self.container.page_num(child_widget)\n", "self.container.remove_page(page_num)\n", "self.update_tab_bar_visibility()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n", "def FUNC_0(VAR_0=None):...\n", "VAR_1 = frappe.db.sql_list('select name from `tabLeave Type` order by name asc'\n )\n", "VAR_3 = FUNC_1(VAR_1)\n", "VAR_4 = FUNC_2(VAR_0, VAR_1)\n", "return VAR_3, VAR_4\n" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n", "def execute(filters=None):...\n", "leave_types = frappe.db.sql_list(\n 'select name from `tabLeave Type` order by name asc')\n", "columns = get_columns(leave_types)\n", "data = get_data(filters, leave_types)\n", "return columns, data\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_7 = []\n", "VAR_8 = self.pool.get('ir.model.data')\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('account.journal')\n", "VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n", "VAR_11 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_11)))\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_10.browse(VAR_2, VAR_3, VAR_12):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_13 = self.pool.get('ir.model.data')\n", "if not VAR_4:\n", "VAR_14 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_7.append(VAR_4[0])\n", "VAR_15 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if VAR_14:\n", "VAR_9.button_confirm_cash(VAR_2, VAR_3, VAR_4, VAR_5)\n", "VAR_14 = VAR_13.browse(VAR_2, VAR_3, VAR_14, VAR_5=context).res_id\n", "if VAR_15:\n", "VAR_15 = VAR_13.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "return {'domain': \"[('id','in',\" + str(VAR_7) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(VAR_14, 'tree'), (\n VAR_15, 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ "def close_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "statement_obj = self.pool.get('account.bank.statement')\n", "journal_obj = self.pool.get('account.journal')\n", "cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n", "j_ids = map(lambda x1: x1[0], cr.fetchall())\n", "cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n", "journal_ids = map(lambda x1: x1[0], cr.fetchall())\n", "for journal in journal_obj.browse(cr, uid, journal_ids):\n", "ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n", "data_obj = self.pool.get('ir.model.data')\n", "if not ids:\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "list_statement.append(ids[0])\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if not journal.check_dtls:\n", "if id2:\n", "statement_obj.button_confirm_cash(cr, uid, ids, context)\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('id','in',\" + str(list_statement) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(id2, 'tree'), (id3,\n 'form')], 'type': 'ir.actions.act_window'}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.issue_gcs_flushes:\n", "return\n", "if self.gcs_flush_policy is None:\n", "VAR_45 = self.redis.get('gcs_flushing_policy')\n", "if not self.gcs_flush_policy.should_flush(self.redis_shard):\n", "if VAR_45 is None:\n", "return\n", "VAR_29 = self.gcs_flush_policy.num_entries_to_flush()\n", "return\n", "self.gcs_flush_policy = pickle.loads(VAR_45)\n", "VAR_30 = self.redis_shard.execute_command('HEAD.FLUSH {}'.format(VAR_29))\n", "VAR_0.info('Monitor: num_flushed {}'.format(VAR_30))\n", "ray.experimental.flush_redis_unsafe(self.redis)\n", "self.gcs_flush_policy.record_flush()\n" ]
[ "def _maybe_flush_gcs(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.issue_gcs_flushes:\n", "return\n", "if self.gcs_flush_policy is None:\n", "serialized = self.redis.get('gcs_flushing_policy')\n", "if not self.gcs_flush_policy.should_flush(self.redis_shard):\n", "if serialized is None:\n", "return\n", "max_entries_to_flush = self.gcs_flush_policy.num_entries_to_flush()\n", "return\n", "self.gcs_flush_policy = pickle.loads(serialized)\n", "num_flushed = self.redis_shard.execute_command('HEAD.FLUSH {}'.format(\n max_entries_to_flush))\n", "logger.info('Monitor: num_flushed {}'.format(num_flushed))\n", "ray.experimental.flush_redis_unsafe(self.redis)\n", "self.gcs_flush_policy.record_flush()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Assign'", "Condition", "Condition", "Return'", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def __repr__(self):...\n", "return self.__class__.__name__ + '()'\n" ]
[ "def __repr__(self):...\n", "return self.__class__.__name__ + '()'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_60(self):...\n", "VAR_2 = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('input.py', VAR_2)\n" ]
[ "def test_blacklist_input(self):...\n", "expect = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('input.py', expect)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_3(self, VAR_14):...\n", "if not self.stopThreads:\n", "VAR_13 = VAR_14.result()[0].text\n", "return None\n", "VAR_37 = VAR_14.ext[0]\n", "VAR_28 = self.isASuccessfulUpload(VAR_13)\n", "if VAR_28:\n", "self.validExtensions.append(VAR_37)\n", "return VAR_28\n", "if self.shouldLog:\n", "self.logger.info('\\x1b[1m\\x1b[42mExtension %s seems valid for this form.\\x1b[m'\n , VAR_37)\n", "if VAR_28 != True:\n", "self.logger.info(\n '\\x1b[1;32mTrue regex matched the following information : %s\\x1b[m', VAR_28\n )\n" ]
[ "def detectValidExtension(self, future):...\n", "if not self.stopThreads:\n", "html = future.result()[0].text\n", "return None\n", "ext = future.ext[0]\n", "r = self.isASuccessfulUpload(html)\n", "if r:\n", "self.validExtensions.append(ext)\n", "return r\n", "if self.shouldLog:\n", "self.logger.info('\\x1b[1m\\x1b[42mExtension %s seems valid for this form.\\x1b[m'\n , ext)\n", "if r != True:\n", "self.logger.info(\n '\\x1b[1;32mTrue regex matched the following information : %s\\x1b[m', r)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Return'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_9(self, VAR_16, **VAR_17):...\n", "if self.closed:\n", "VAR_32 = VAR_17.pop('wait', False)\n", "VAR_9 = self._create_request(VAR_16, **args)\n", "if self.VERBOSE:\n", "VAR_21 = parse_message(VAR_9)\n", "if VAR_32:\n", "print(' <-', VAR_21)\n", "self._conn.send(VAR_9)\n", "VAR_39 = self._get_awaiter_for_request(VAR_9, **args)\n", "VAR_39 = CLASS_3(VAR_9, lambda : FUNC_23['msg'])\n", "self._conn.send(VAR_9)\n", "return VAR_39\n" ]
[ "def send_request(self, command, **args):...\n", "if self.closed:\n", "wait = args.pop('wait', False)\n", "req = self._create_request(command, **args)\n", "if self.VERBOSE:\n", "msg = parse_message(req)\n", "if wait:\n", "print(' <-', msg)\n", "self._conn.send(req)\n", "resp_awaiter = self._get_awaiter_for_request(req, **args)\n", "resp_awaiter = AwaitableResponse(req, lambda : resp['msg'])\n", "self._conn.send(req)\n", "return resp_awaiter\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0='_Test Event', VAR_1=None):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.utils import get_datetime\n", "VAR_2 = frappe.get_doc({'doctype': 'Event', 'subject': VAR_0, 'event_type':\n 'Public', 'starts_on': get_datetime(VAR_1)}).insert(ignore_permissions=True\n )\n", "return VAR_2\n" ]
[ "def create_event(subject='_Test Event', starts_on=None):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.utils import get_datetime\n", "event = frappe.get_doc({'doctype': 'Event', 'subject': subject,\n 'event_type': 'Public', 'starts_on': get_datetime(starts_on)}).insert(\n ignore_permissions=True)\n", "return event\n" ]
[ 0, 0, 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Assign'", "Return'" ]
[ "def FUNC_11(self, VAR_13, VAR_12):...\n", "self.send_rep(VAR_13, 0, wzrpc.status.success, VAR_12)\n" ]
[ "def send_success_rep(self, reqid, data):...\n", "self.send_rep(reqid, 0, wzrpc.status.success, data)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_13(self):...\n", "self.assertTrue(os.path.realpath(path2).startswith(os.path.realpath(path1)),\n 'Nested temporary dir should be created within outer dir.')\n" ]
[ "def test_temporary_dir_with_root_dir(self):...\n", "self.assertTrue(os.path.realpath(path2).startswith(os.path.realpath(path1)),\n 'Nested temporary dir should be created within outer dir.')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(self):...\n", "self.expected_requests([('http://localhost/a', {}, 'foo', None)])\n", "VAR_0 = xsrf_client.XsrfRemote('http://localhost/')\n", "self.assertEqual('foo', VAR_0.url_read('/a'))\n" ]
[ "def testXsrfRemoteGET(self):...\n", "self.expected_requests([('http://localhost/a', {}, 'foo', None)])\n", "remote = xsrf_client.XsrfRemote('http://localhost/')\n", "self.assertEqual('foo', remote.url_read('/a'))\n" ]
[ 0, 5, 5, 5 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_1():...\n", "return None\n" ]
[ "def update_history():...\n", "return None\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Return'" ]
[ "@wraps(VAR_3)...\n", "VAR_6 = VAR_5.headers.get(VAR_1)\n", "VAR_11 = VAR_5.session.get_csrf_token()\n", "if VAR_6 == VAR_11:\n", "return VAR_3(VAR_9, VAR_5)\n" ]
[ "@wraps(fn)...\n", "token = request.headers.get(HEADER_NAME)\n", "session_token = request.session.get_csrf_token()\n", "if token == session_token:\n", "return fn(context, request)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Return'" ]
[ "from __future__ import absolute_import, division, print_function, with_statement\n", "import os\n", "import sys\n", "import argparse\n", "if __name__ == '__main__':\n", "VAR_0 = argparse.ArgumentParser(description='See README')\n", "VAR_0.add_argument('-c', '--count', default=3, type=int, help=\n 'with how many failure times it should be considered as an attack')\n", "VAR_1 = VAR_0.parse_args()\n", "VAR_2 = {}\n", "VAR_3 = set()\n", "for line in sys.stdin:\n", "if 'can not parse header when' in line:\n", "VAR_4 = line.split()[-1].split(':')[-2]\n", "if VAR_4 not in VAR_2:\n", "VAR_2[VAR_4] = 1\n", "VAR_2[VAR_4] += 1\n", "print(VAR_4)\n", "if VAR_4 not in VAR_3 and VAR_2[VAR_4] >= VAR_1.count:\n", "sys.stdout.flush()\n", "VAR_3.add(VAR_4)\n", "VAR_5 = 'iptables -A INPUT -s %s -j DROP' % VAR_4\n", "print(VAR_5, file=sys.stderr)\n", "sys.stderr.flush()\n", "os.system(VAR_5)\n" ]
[ "from __future__ import absolute_import, division, print_function, with_statement\n", "import os\n", "import sys\n", "import argparse\n", "if __name__ == '__main__':\n", "parser = argparse.ArgumentParser(description='See README')\n", "parser.add_argument('-c', '--count', default=3, type=int, help=\n 'with how many failure times it should be considered as an attack')\n", "config = parser.parse_args()\n", "ips = {}\n", "banned = set()\n", "for line in sys.stdin:\n", "if 'can not parse header when' in line:\n", "ip = line.split()[-1].split(':')[-2]\n", "if ip not in ips:\n", "ips[ip] = 1\n", "ips[ip] += 1\n", "print(ip)\n", "if ip not in banned and ips[ip] >= config.count:\n", "sys.stdout.flush()\n", "banned.add(ip)\n", "cmd = 'iptables -A INPUT -s %s -j DROP' % ip\n", "print(cmd, file=sys.stderr)\n", "sys.stderr.flush()\n", "os.system(cmd)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 2, 2, 0, 2 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Condition", "Assign'", "AugAssign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@memoized_property...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = self.get_binary_path_from_tgz(VAR_10='bin/yarnpkg', VAR_6=self.\n yarnpkg_version, VAR_11='yarnpkg.tar.gz', VAR_12='dist')\n", "VAR_0.debug('Yarnpkg path: %s', VAR_22)\n", "return VAR_22\n" ]
[ "@memoized_property...\n", "\"\"\"docstring\"\"\"\n", "yarnpkg_path = self.get_binary_path_from_tgz(supportdir='bin/yarnpkg',\n version=self.yarnpkg_version, filename='yarnpkg.tar.gz', inpackage_path\n ='dist')\n", "logger.debug('Yarnpkg path: %s', yarnpkg_path)\n", "return yarnpkg_path\n" ]
[ 2, 0, 2, 2, 2 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = set()\n", "for VAR_28, VAR_27 in zip(self.output, self.rule.output):\n", "if VAR_28 in self.dynamic_output:\n", "VAR_16 = defaultdict(list)\n", "for VAR_28, w in self.expand_dynamic(VAR_27, VAR_13=self.wildcards, VAR_14=\n", "for combination in VAR_15:\n", "VAR_15.add(tuple(w.items()))\n", "for name, value in combination:\n", "return VAR_16\n", "VAR_16[name].append(value)\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "combinations = set()\n", "for f, f_ in zip(self.output, self.rule.output):\n", "if f in self.dynamic_output:\n", "wildcards = defaultdict(list)\n", "for f, w in self.expand_dynamic(f_, restriction=self.wildcards, omit_value=\n", "for combination in combinations:\n", "combinations.add(tuple(w.items()))\n", "for name, value in combination:\n", "return wildcards\n", "wildcards[name].append(value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "For", "Condition", "Assign'", "For", "For", "Expr'", "For", "Return'", "Expr'" ]
[ "def FUNC_1(self):...\n", "return 'submit sources %s for task %s (ID %d) %s' % (repr(self.filenames),\n self.task[1], self.task[0], self.url)\n" ]
[ "def describe(self):...\n", "return 'submit sources %s for task %s (ID %d) %s' % (repr(self.filenames),\n self.task[1], self.task[0], self.url)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@validate(VAR_0=VMeetup('id'), VAR_15=VMenu('controller', CommentSortMenu),...\n", "VAR_18 = Link._byID(VAR_0.assoc_link)\n", "VAR_20 = c.user.pref_num_comments or g.num_comments\n", "VAR_21 = g.max_comments if VAR_16 == 'true' else VAR_20\n", "VAR_22 = CommentBuilder(VAR_18, CommentSortMenu.operator(VAR_15), None, None)\n", "VAR_23 = NestedListing(VAR_22, VAR_21=num, parent_name=article._fullname)\n", "VAR_24 = PaneStack()\n", "if c.user_is_loggedin:\n", "VAR_24.append(CommentReplyBox())\n", "VAR_24.append(VAR_23.listing())\n", "VAR_24.append(CommentReplyBox(link_name=article._fullname))\n", "VAR_25 = CommentSortMenu(default=sort, type='dropdown2')\n", "VAR_26 = [VAR_25, NumCommentsMenu(VAR_18.num_comments, default=num_comments)]\n", "VAR_27 = CommentListing(VAR_27=displayPane, VAR_16=article.num_comments,\n VAR_26=nav_menus)\n", "VAR_28 = None\n", "if c.user_is_loggedin:\n", "VAR_29 = VAR_18._getLastClickTime(c.user)\n", "VAR_2 = ShowMeetup(VAR_0=meetup, VAR_27=content, fullname=article._fullname,\n VAR_28=lastViewed)\n", "VAR_28 = VAR_29._date if VAR_29 else None\n", "return BoringPage(pagename=meetup.title, VAR_27=res, body_class='meetup'\n ).render()\n", "VAR_18._click(c.user)\n" ]
[ "@validate(meetup=VMeetup('id'), sort=VMenu('controller', CommentSortMenu),...\n", "article = Link._byID(meetup.assoc_link)\n", "user_num = c.user.pref_num_comments or g.num_comments\n", "num = g.max_comments if num_comments == 'true' else user_num\n", "builder = CommentBuilder(article, CommentSortMenu.operator(sort), None, None)\n", "listing = NestedListing(builder, num=num, parent_name=article._fullname)\n", "displayPane = PaneStack()\n", "if c.user_is_loggedin:\n", "displayPane.append(CommentReplyBox())\n", "displayPane.append(listing.listing())\n", "displayPane.append(CommentReplyBox(link_name=article._fullname))\n", "sort_menu = CommentSortMenu(default=sort, type='dropdown2')\n", "nav_menus = [sort_menu, NumCommentsMenu(article.num_comments, default=\n num_comments)]\n", "content = CommentListing(content=displayPane, num_comments=article.\n num_comments, nav_menus=nav_menus)\n", "lastViewed = None\n", "if c.user_is_loggedin:\n", "clicked = article._getLastClickTime(c.user)\n", "res = ShowMeetup(meetup=meetup, content=content, fullname=article._fullname,\n lastViewed=lastViewed)\n", "lastViewed = clicked._date if clicked else None\n", "return BoringPage(pagename=meetup.title, content=res, body_class='meetup'\n ).render()\n", "article._click(c.user)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "@api.multi...\n", "return self.write({'has_agreed_child_protection_charter': True,\n 'date_agreed_child_protection_charter': fields.Datetime.now()})\n" ]
[ "@api.multi...\n", "return self.write({'has_agreed_child_protection_charter': True,\n 'date_agreed_child_protection_charter': fields.Datetime.now()})\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_1(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = psycopg2.connect('dbname=forum')\n", "VAR_2 = VAR_1.cursor()\n", "VAR_2.execute(\"INSERT INTO posts (content) VALUES ('%s')\" % VAR_0)\n", "VAR_1.commit()\n", "VAR_1.close()\n" ]
[ "def add_post(content):...\n", "\"\"\"docstring\"\"\"\n", "db = psycopg2.connect('dbname=forum')\n", "c = db.cursor()\n", "c.execute(\"INSERT INTO posts (content) VALUES ('%s')\" % content)\n", "db.commit()\n", "db.close()\n" ]
[ 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self):...\n", "VAR_24 = self.add_argument_group('Facebook Messenger')\n", "VAR_24.add_argument('--debug', dest='is_debug', action='store_true', help=\n 'print and log all server interactions and messages')\n", "VAR_24.add_argument('--verbose', dest='verbose', action='store_true', help=\n 'print all messages sent to and from Turkers')\n", "VAR_24.add_argument('--log-level', dest='log_level', type=int, default=20,\n help=\n 'importance level for what to put into the logs. the lower the level the more that gets logged. values are 0-50'\n )\n", "VAR_24.add_argument('--force-page-token', dest='force_page_token', action=\n 'store_true', help=\n 'override the page token stored in the cache for a new one')\n", "VAR_24.add_argument('--password', dest='password', type=str, default=None,\n help='Require a password for entry to the bot')\n", "VAR_24.add_argument('--local', dest='local', action='store_true', default=\n False, help=\n 'Run the server locally on this server rather than setting up a heroku server.'\n )\n", "VAR_24.set_defaults(is_debug=False)\n", "VAR_24.set_defaults(verbose=False)\n" ]
[ "def add_messenger_args(self):...\n", "messenger = self.add_argument_group('Facebook Messenger')\n", "messenger.add_argument('--debug', dest='is_debug', action='store_true',\n help='print and log all server interactions and messages')\n", "messenger.add_argument('--verbose', dest='verbose', action='store_true',\n help='print all messages sent to and from Turkers')\n", "messenger.add_argument('--log-level', dest='log_level', type=int, default=\n 20, help=\n 'importance level for what to put into the logs. the lower the level the more that gets logged. values are 0-50'\n )\n", "messenger.add_argument('--force-page-token', dest='force_page_token',\n action='store_true', help=\n 'override the page token stored in the cache for a new one')\n", "messenger.add_argument('--password', dest='password', type=str, default=\n None, help='Require a password for entry to the bot')\n", "messenger.add_argument('--local', dest='local', action='store_true',\n default=False, help=\n 'Run the server locally on this server rather than setting up a heroku server.'\n )\n", "messenger.set_defaults(is_debug=False)\n", "messenger.set_defaults(verbose=False)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_32(self, VAR_15):...\n", "for file_col in self.get_file_column_list():\n", "if self.is_file(file_col):\n", "for file_col in self.get_image_column_list():\n", "if getattr(VAR_15, file_col):\n", "if self.is_image(file_col):\n", "VAR_28 = FileManager()\n", "if getattr(VAR_15, file_col):\n", "VAR_28.delete_file(getattr(VAR_15, file_col))\n", "VAR_29 = ImageManager()\n", "VAR_29.delete_file(getattr(VAR_15, file_col))\n" ]
[ "def _delete_files(self, item):...\n", "for file_col in self.get_file_column_list():\n", "if self.is_file(file_col):\n", "for file_col in self.get_image_column_list():\n", "if getattr(item, file_col):\n", "if self.is_image(file_col):\n", "fm = FileManager()\n", "if getattr(item, file_col):\n", "fm.delete_file(getattr(item, file_col))\n", "im = ImageManager()\n", "im.delete_file(getattr(item, file_col))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "For", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "@jwt_required...\n", "if VAR_5:\n", "VAR_11 = {'instance_id': VAR_5, 'user_id': VAR_6}\n", "VAR_10 = {'results': Table.query(), 'status': 'success'}\n", "VAR_12 = Table.filter_by(**query)\n", "return jsonify(VAR_10), 200\n", "if len(VAR_12) < 1:\n", "VAR_10 = {'results': 'Instance not found', 'status': 'error'}\n", "VAR_10 = {'results': VAR_12, 'status': 'success'}\n", "return make_response(jsonify(VAR_10)), 404\n", "return jsonify(VAR_10), 200\n" ]
[ "@jwt_required...\n", "if instance_id:\n", "query = {'instance_id': instance_id, 'user_id': user_id}\n", "response_object = {'results': Table.query(), 'status': 'success'}\n", "results = Table.filter_by(**query)\n", "return jsonify(response_object), 200\n", "if len(results) < 1:\n", "response_object = {'results': 'Instance not found', 'status': 'error'}\n", "response_object = {'results': results, 'status': 'success'}\n", "return make_response(jsonify(response_object)), 404\n", "return jsonify(response_object), 200\n" ]
[ 4, 4, 4, 4, 4, 0, 0, 4, 4, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_24):...\n", "VAR_39 = self.metadata('queries', VAR_20=database_name, VAR_22=False) or {}\n", "VAR_40 = VAR_39.keys()\n", "return [self.get_canned_query(VAR_24, VAR_62) for VAR_62 in VAR_40]\n" ]
[ "def get_canned_queries(self, database_name):...\n", "queries = self.metadata('queries', database=database_name, fallback=False) or {\n }\n", "names = queries.keys()\n", "return [self.get_canned_query(database_name, name) for name in names]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(self):...\n", "VAR_3 = DatabaseQuery('DocField').execute(filters={'parent': 'DocType'},\n fields=['fieldname', 'fieldtype'], or_filters=[{'fieldtype': 'Table'},\n {'fieldtype': 'Select'}])\n", "self.assertTrue({'fieldtype': 'Table', 'fieldname': 'fields'} in VAR_3)\n", "self.assertTrue({'fieldtype': 'Select', 'fieldname': 'document_type'} in VAR_3)\n", "self.assertFalse({'fieldtype': 'Check', 'fieldname': 'issingle'} in VAR_3)\n" ]
[ "def test_or_filters(self):...\n", "data = DatabaseQuery('DocField').execute(filters={'parent': 'DocType'},\n fields=['fieldname', 'fieldtype'], or_filters=[{'fieldtype': 'Table'},\n {'fieldtype': 'Select'}])\n", "self.assertTrue({'fieldtype': 'Table', 'fieldname': 'fields'} in data)\n", "self.assertTrue({'fieldtype': 'Select', 'fieldname': 'document_type'} in data)\n", "self.assertFalse({'fieldtype': 'Check', 'fieldname': 'issingle'} in data)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_14 = self.builder.get_object('headerbar')\n", "VAR_14.set_subtitle(self.database_filepath)\n", "self.window.set_titlebar(VAR_14)\n", "self.parent_widget.set_headerbar(VAR_14)\n", "VAR_15 = self.builder.get_object('back_button')\n", "VAR_15.connect('clicked', self.on_headerbar_back_button_clicked)\n" ]
[ "def set_headerbar(self):...\n", "headerbar = self.builder.get_object('headerbar')\n", "headerbar.set_subtitle(self.database_filepath)\n", "self.window.set_titlebar(headerbar)\n", "self.parent_widget.set_headerbar(headerbar)\n", "back_button = self.builder.get_object('back_button')\n", "back_button.connect('clicked', self.on_headerbar_back_button_clicked)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_28(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_65 = [x[VAR_1] for x in self.get_path(VAR_21)]\n", "return VAR_65\n" ]
[ "def listdir(self, path):...\n", "\"\"\"docstring\"\"\"\n", "names = [x[A_NAME] for x in self.get_path(path)]\n", "return names\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_37(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 'TRUNCATE TABLE players;'\n", "tools.query(VAR_11)\n", "self.assertEqual(FUNC_5(VAR_1='Fissh Fillay', VAR_2='Playland'), 0)\n", "VAR_11 = 'SELECT * FROM matches ORDER BY id LIMIT 1'\n", "VAR_13 = tools.query(VAR_11)\n", "VAR_14 = str(VAR_13[0][0])\n", "self.assertEqual(FUNC_5(VAR_1='Kulv Sangwich', VAR_2='Playland'), 0)\n", "VAR_11 = 'SELECT * FROM matches ORDER BY id LIMIT 1'\n", "VAR_13 = tools.query(VAR_11)\n", "VAR_15 = VAR_13[0][0]\n", "VAR_15 = str(VAR_15 + 2)\n", "tournament.reportMatch(p1=i1, p2=i2)\n" ]
[ "def test_p2_not_valid(self):...\n", "\"\"\"docstring\"\"\"\n", "q = 'TRUNCATE TABLE players;'\n", "tools.query(q)\n", "self.assertEqual(dummy_player(player_name='Fissh Fillay', country=\n 'Playland'), 0)\n", "q = 'SELECT * FROM matches ORDER BY id LIMIT 1'\n", "p = tools.query(q)\n", "i1 = str(p[0][0])\n", "self.assertEqual(dummy_player(player_name='Kulv Sangwich', country=\n 'Playland'), 0)\n", "q = 'SELECT * FROM matches ORDER BY id LIMIT 1'\n", "p = tools.query(q)\n", "i2 = p[0][0]\n", "i2 = str(i2 + 2)\n", "tournament.reportMatch(p1=i1, p2=i2)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(self, VAR_11, VAR_7):...\n", "self.eng.flush(deallocate_qubits=False)\n", "if VAR_11 == 'PauliX' or VAR_11 == 'PauliY' or VAR_11 == 'PauliZ':\n", "VAR_19 = self.eng.backend.get_expectation_value(pq.ops.QubitOperator(str(\n VAR_11)[-1] + '0'), self.reg)\n", "if VAR_11 == 'AllPauliZ':\n", "VAR_20 = 1 - VAR_19 ** 2\n", "VAR_19 = [self.eng.backend.get_expectation_value(pq.ops.QubitOperator('Z' +\n '0'), [qubit]) for qubit in self.reg]\n", "return VAR_19\n", "VAR_20 = [(1 - e ** 2) for e in VAR_19]\n" ]
[ "def expectation(self, observable, wires):...\n", "self.eng.flush(deallocate_qubits=False)\n", "if observable == 'PauliX' or observable == 'PauliY' or observable == 'PauliZ':\n", "expectation_value = self.eng.backend.get_expectation_value(pq.ops.\n QubitOperator(str(observable)[-1] + '0'), self.reg)\n", "if observable == 'AllPauliZ':\n", "variance = 1 - expectation_value ** 2\n", "expectation_value = [self.eng.backend.get_expectation_value(pq.ops.\n QubitOperator('Z' + '0'), [qubit]) for qubit in self.reg]\n", "return expectation_value\n", "variance = [(1 - e ** 2) for e in expectation_value]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_22(VAR_30, VAR_31=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_31 is None:\n", "VAR_31 = threading.Lock()\n", "return CLASS_0(VAR_30, VAR_31)\n" ]
[ "def thread_safe_client(client, lock=None):...\n", "\"\"\"docstring\"\"\"\n", "if lock is None:\n", "lock = threading.Lock()\n", "return _ThreadSafeProxy(client, lock)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "" ]
[ "def json_validate(data_source, schema):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_17(self, VAR_15=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_37 = self._meta.all_fields if VAR_15 else self._meta.fields\n", "return dict((VAR_46.name, v) for VAR_46, v in field_iter_items(self, VAR_37))\n" ]
[ "def to_dict(self, include_virtual=True):...\n", "\"\"\"docstring\"\"\"\n", "fields = self._meta.all_fields if include_virtual else self._meta.fields\n", "return dict((f.name, v) for f, v in field_iter_items(self, fields))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def __init__(self, VAR_1, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "super(CLASS_0, self).__init__(VAR_1, VAR_4)\n", "VAR_1 = self.bindings\n", "VAR_1['TEST_APP_COMPONENT_NAME'] = '{app}-{stack}-{detail}'.format(app=\n bindings['TEST_APP'], stack=bindings['TEST_STACK'], detail=bindings[\n 'TEST_COMPONENT_DETAIL'])\n", "self.TEST_APP = VAR_1['TEST_APP']\n" ]
[ "def __init__(self, bindings, agent=None):...\n", "\"\"\"docstring\"\"\"\n", "super(GoogleSmokeTestScenario, self).__init__(bindings, agent)\n", "bindings = self.bindings\n", "bindings['TEST_APP_COMPONENT_NAME'] = '{app}-{stack}-{detail}'.format(app=\n bindings['TEST_APP'], stack=bindings['TEST_STACK'], detail=bindings[\n 'TEST_COMPONENT_DETAIL'])\n", "self.TEST_APP = bindings['TEST_APP']\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_4(self):...\n", "\"\"\"docstring\"\"\"\n", "self._check_flags()\n" ]
[ "def check_for_setup_error(self):...\n", "\"\"\"docstring\"\"\"\n", "self._check_flags()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_37(self, VAR_16, VAR_21=None):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.meta import get_field_precision\n", "if VAR_21 and not isinstance(VAR_21, string_types):\n", "VAR_21 = VAR_21.parentfield\n", "VAR_45 = VAR_21 or 'main'\n", "if not hasattr(self, '_precision'):\n", "self._precision = VAR_54._dict()\n", "if VAR_45 not in self._precision:\n", "self._precision[VAR_45] = VAR_54._dict()\n", "if VAR_16 not in self._precision[VAR_45]:\n", "self._precision[VAR_45][VAR_16] = None\n", "return self._precision[VAR_45][VAR_16]\n", "VAR_1 = self.meta.get_field(VAR_21).options if VAR_21 else self.doctype\n", "VAR_25 = VAR_54.get_meta(VAR_1).get_field(VAR_16)\n", "if VAR_25.fieldtype in ('Currency', 'Float', 'Percent'):\n", "self._precision[VAR_45][VAR_16] = get_field_precision(VAR_25, self)\n" ]
[ "def precision(self, fieldname, parentfield=None):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.meta import get_field_precision\n", "if parentfield and not isinstance(parentfield, string_types):\n", "parentfield = parentfield.parentfield\n", "cache_key = parentfield or 'main'\n", "if not hasattr(self, '_precision'):\n", "self._precision = frappe._dict()\n", "if cache_key not in self._precision:\n", "self._precision[cache_key] = frappe._dict()\n", "if fieldname not in self._precision[cache_key]:\n", "self._precision[cache_key][fieldname] = None\n", "return self._precision[cache_key][fieldname]\n", "doctype = self.meta.get_field(parentfield\n ).options if parentfield else self.doctype\n", "df = frappe.get_meta(doctype).get_field(fieldname)\n", "if df.fieldtype in ('Currency', 'Float', 'Percent'):\n", "self._precision[cache_key][fieldname] = get_field_precision(df, self)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_6(self, VAR_45):...\n", "" ]
[ "def run(self, uh):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_9 = 'SELECT tid FROM tids'\n", "self.query(VAR_9)\n", "return [i[0] for i in self.c.fetchall()]\n" ]
[ "def get_tids_with_tag(self):...\n", "\"\"\"docstring\"\"\"\n", "q = 'SELECT tid FROM tids'\n", "self.query(q)\n", "return [i[0] for i in self.c.fetchall()]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, *VAR_1, **VAR_2):...\n", "super(CLASS_0, self).__init__(*VAR_1, **kwargs)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "super(BooleanField, self).__init__(*args, **kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@staticmethod...\n", "VAR_38 = os.path.join(VAR_5, VAR_1)\n", "VAR_67 = VAR_7.classname if PY3 else VAR_7.classname.decode('utf-8')\n", "f.write(VAR_67)\n" ]
[ "@staticmethod...\n", "javac_plugin_info_file = os.path.join(resources_dir, _JAVAC_PLUGIN_INFO_FILE)\n", "classname = (javac_plugin_target.classname if PY3 else javac_plugin_target.\n classname.decode('utf-8'))\n", "f.write(classname)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_5(VAR_13):...\n", "return re.sub('{(.*)}', '{\\\\1:[^/\\\\.]+}', VAR_13)\n" ]
[ "def append_format_pattern(route):...\n", "return re.sub('{(.*)}', '{\\\\1:[^/\\\\.]+}', route)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(VAR_39, VAR_40, VAR_41, VAR_42, VAR_48, VAR_43, VAR_44, VAR_45,...\n", "VAR_39.returncode = None\n", "VAR_39._out_file = VAR_7.path.join(self.root_dir, 'work',\n 'task_runner_out.json')\n", "VAR_6 = [sys.executable, bot_main.THIS_FILE, 'task_runner',\n '--swarming-server', VAR_3, '--in-file', VAR_7.path.join(self.root_dir,\n 'work', 'task_runner_in.json'), '--out-file', VAR_39._out_file,\n '--cost-usd-hour', '3600.0', '--start', '100.0', '--min-free-space',\n str(int((os_utilities.get_min_free_space(bot_main.THIS_FILE) + 250.0) *\n 1024 * 1024))]\n", "self.assertEqual(VAR_6, VAR_40)\n", "self.assertEqual(True, VAR_41)\n", "self.assertEqual(self.bot.base_dir, VAR_42)\n", "self.assertEqual('24', VAR_48['SWARMING_TASK_ID'])\n", "self.assertTrue(VAR_43)\n", "self.assertEqual(subprocess42.STDOUT, VAR_44)\n", "self.assertEqual(subprocess42.PIPE, VAR_45)\n", "self.assertEqual(sys.platform != 'win32', VAR_46)\n" ]
[ "def __init__(self2, cmd, detached, cwd, env, stdout, stderr, stdin, close_fds):...\n", "self2.returncode = None\n", "self2._out_file = os.path.join(self.root_dir, 'work', 'task_runner_out.json')\n", "expected = [sys.executable, bot_main.THIS_FILE, 'task_runner',\n '--swarming-server', url, '--in-file', os.path.join(self.root_dir,\n 'work', 'task_runner_in.json'), '--out-file', self2._out_file,\n '--cost-usd-hour', '3600.0', '--start', '100.0', '--min-free-space',\n str(int((os_utilities.get_min_free_space(bot_main.THIS_FILE) + 250.0) *\n 1024 * 1024))]\n", "self.assertEqual(expected, cmd)\n", "self.assertEqual(True, detached)\n", "self.assertEqual(self.bot.base_dir, cwd)\n", "self.assertEqual('24', env['SWARMING_TASK_ID'])\n", "self.assertTrue(stdout)\n", "self.assertEqual(subprocess42.STDOUT, stderr)\n", "self.assertEqual(subprocess42.PIPE, stdin)\n", "self.assertEqual(sys.platform != 'win32', close_fds)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@contextmanager...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = str(uuid.uuid4())\n", "def FUNC_27(VAR_8):...\n", "return '{}#{}'.format(VAR_7, VAR_8)\n" ]
[ "@contextmanager...\n", "\"\"\"docstring\"\"\"\n", "uuid_str = str(uuid.uuid4())\n", "def u(string):...\n", "return '{}#{}'.format(uuid_str, string)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1, VAR_2=None, VAR_3=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = posixpath.normpath(VAR_1)\n", "VAR_1 = VAR_1.lstrip('/')\n", "VAR_10 = ''\n", "for VAR_18 in VAR_1.split('/'):\n", "if not VAR_18:\n", "if VAR_10 and VAR_1 != VAR_10:\n", "VAR_17, VAR_18 = os.path.splitdrive(VAR_18)\n", "return HttpResponseRedirect(VAR_10)\n", "VAR_6 = os.path.join(VAR_2, VAR_10)\n", "VAR_19, VAR_18 = os.path.split(VAR_18)\n", "if os.path.isdir(VAR_6):\n", "if VAR_18 in (os.curdir, os.pardir):\n", "if VAR_3:\n", "if not os.path.exists(VAR_6):\n", "VAR_10 = os.path.join(VAR_10, VAR_18).replace('\\\\', '/')\n", "return FUNC_1(VAR_10, VAR_6)\n", "VAR_11 = os.stat(VAR_6)\n", "if not FUNC_2(VAR_0.META.get('HTTP_IF_MODIFIED_SINCE'), VAR_11.st_mtime,\n", "return HttpResponseNotModified()\n", "VAR_12, VAR_13 = mimetypes.guess_type(VAR_6)\n", "VAR_12 = VAR_12 or 'application/octet-stream'\n", "VAR_14 = FileResponse(open(VAR_6, 'rb'), VAR_12=content_type)\n", "VAR_14['Last-Modified'] = http_date(VAR_11.st_mtime)\n", "if stat.S_ISREG(VAR_11.st_mode):\n", "VAR_14['Content-Length'] = VAR_11.st_size\n", "if VAR_13:\n", "VAR_14['Content-Encoding'] = VAR_13\n", "return VAR_14\n" ]
[ "def serve(request, path, document_root=None, show_indexes=False):...\n", "\"\"\"docstring\"\"\"\n", "path = posixpath.normpath(path)\n", "path = path.lstrip('/')\n", "newpath = ''\n", "for part in path.split('/'):\n", "if not part:\n", "if newpath and path != newpath:\n", "drive, part = os.path.splitdrive(part)\n", "return HttpResponseRedirect(newpath)\n", "fullpath = os.path.join(document_root, newpath)\n", "head, part = os.path.split(part)\n", "if os.path.isdir(fullpath):\n", "if part in (os.curdir, os.pardir):\n", "if show_indexes:\n", "if not os.path.exists(fullpath):\n", "newpath = os.path.join(newpath, part).replace('\\\\', '/')\n", "return directory_index(newpath, fullpath)\n", "statobj = os.stat(fullpath)\n", "if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),\n", "return HttpResponseNotModified()\n", "content_type, encoding = mimetypes.guess_type(fullpath)\n", "content_type = content_type or 'application/octet-stream'\n", "response = FileResponse(open(fullpath, 'rb'), content_type=content_type)\n", "response['Last-Modified'] = http_date(statobj.st_mtime)\n", "if stat.S_ISREG(statobj.st_mode):\n", "response['Content-Length'] = statobj.st_size\n", "if encoding:\n", "response['Content-Encoding'] = encoding\n", "return response\n" ]
[ 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Condition", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1=None, VAR_2=False):...\n", "VAR_3 = None\n", "if conf.eString and conf.eString in VAR_0:\n", "VAR_4 = VAR_0.index(conf.eString)\n", "if conf.eRegexp:\n", "VAR_5 = len(conf.eString)\n", "VAR_3 = re.findall(conf.eRegexp, VAR_0, re.I | re.M)\n", "if conf.string:\n", "VAR_6 = VAR_0[:VAR_4]\n", "if VAR_3:\n", "if conf.string in VAR_0:\n", "if conf.regexp:\n", "VAR_6 += VAR_0[VAR_4 + VAR_5:]\n", "for regExpResult in VAR_3:\n", "return True\n", "return False\n", "if re.search(conf.regexp, VAR_0, re.I | re.M):\n", "conf.seqMatcher.set_seq2(VAR_0)\n", "VAR_0 = VAR_6\n", "VAR_4 = VAR_0.index(regExpResult)\n", "return True\n", "return False\n", "if VAR_2:\n", "VAR_5 = len(regExpResult)\n", "return round(conf.seqMatcher.ratio(), 5)\n", "if round(conf.seqMatcher.ratio(), 5) >= MATCH_RATIO:\n", "VAR_7 = VAR_0[:VAR_4]\n", "return True\n", "return False\n", "VAR_7 += VAR_0[VAR_4 + VAR_5:]\n", "VAR_0 = VAR_7\n" ]
[ "def comparison(page, headers=None, getSeqMatcher=False):...\n", "regExpResults = None\n", "if conf.eString and conf.eString in page:\n", "index = page.index(conf.eString)\n", "if conf.eRegexp:\n", "length = len(conf.eString)\n", "regExpResults = re.findall(conf.eRegexp, page, re.I | re.M)\n", "if conf.string:\n", "pageWithoutString = page[:index]\n", "if regExpResults:\n", "if conf.string in page:\n", "if conf.regexp:\n", "pageWithoutString += page[index + length:]\n", "for regExpResult in regExpResults:\n", "return True\n", "return False\n", "if re.search(conf.regexp, page, re.I | re.M):\n", "conf.seqMatcher.set_seq2(page)\n", "page = pageWithoutString\n", "index = page.index(regExpResult)\n", "return True\n", "return False\n", "if getSeqMatcher:\n", "length = len(regExpResult)\n", "return round(conf.seqMatcher.ratio(), 5)\n", "if round(conf.seqMatcher.ratio(), 5) >= MATCH_RATIO:\n", "pageWithoutRegExp = page[:index]\n", "return True\n", "return False\n", "pageWithoutRegExp += page[index + length:]\n", "page = pageWithoutRegExp\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, 2, 2, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "AugAssign'", "For", "Return'", "Return'", "Condition", "Expr'", "Assign'", "Assign'", "Return'", "Return'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Return'", "Return'", "AugAssign'", "Assign'" ]
[ "@app.route('/people/new/')...\n", "if not current_user.editor:\n", "return redirect(url_for('error403'))\n", "VAR_2 = NameForm()\n", "return render_template('/people/new.html', VAR_2=form)\n" ]
[ "@app.route('/people/new/')...\n", "if not current_user.editor:\n", "return redirect(url_for('error403'))\n", "form = NameForm()\n", "return render_template('/people/new.html', form=form)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Assign'", "Return'" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "import django.core.validators\n", "VAR_0 = [('course', '0005_auto_20150625_1835')]\n", "VAR_1 = [migrations.CreateModel(name='CourseChapter', fields=[('id', models\n .AutoField(auto_created=True, primary_key=True, verbose_name='ID',\n serialize=False)), ('order', models.IntegerField(default=1)), ('name',\n models.CharField(max_length=255)), ('url', models.CharField(help_text=\n 'Input an URL identifier for this chapter.', validators=[django.core.\n validators.RegexValidator(regex='^[\\\\w\\\\-\\\\.]*$')], max_length=255)), (\n 'content_url', models.URLField(help_text='The resource to show.')), (\n 'course_module', models.ForeignKey(related_name='chapters', to=\n 'course.CourseModule'))], options={'ordering': ['course_module',\n 'order', 'id']}, bases=(models.Model,)), migrations.AlterUniqueTogether\n (name='coursechapter', unique_together=set([('course_module', 'url')])),\n migrations.AlterModelOptions(name='coursemodule', options={'ordering':\n ['closing_time', 'order', 'id']}), migrations.RenameField(model_name=\n 'coursemodule', old_name='chapter', new_name='order'), migrations.\n RemoveField(model_name='coursemodule', name='content_url'), migrations.\n RemoveField(model_name='coursemodule', name='subchapter'), migrations.\n AlterField(model_name='course', name='url', field=models.CharField(\n unique=True, validators=[django.core.validators.RegexValidator(regex=\n '^[\\\\w\\\\-\\\\.]*$')], max_length=255, help_text=\n 'Input an URL identifier for this course.'), preserve_default=True),\n migrations.AlterField(model_name='coursemodule', name='url', field=\n models.CharField(help_text='Input an URL identifier for this module.',\n validators=[django.core.validators.RegexValidator(regex=\n '^[\\\\w\\\\-\\\\.]*$')], max_length=255), preserve_default=True)]\n" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "import django.core.validators\n", "dependencies = [('course', '0005_auto_20150625_1835')]\n", "operations = [migrations.CreateModel(name='CourseChapter', fields=[('id',\n models.AutoField(auto_created=True, primary_key=True, verbose_name='ID',\n serialize=False)), ('order', models.IntegerField(default=1)), ('name',\n models.CharField(max_length=255)), ('url', models.CharField(help_text=\n 'Input an URL identifier for this chapter.', validators=[django.core.\n validators.RegexValidator(regex='^[\\\\w\\\\-\\\\.]*$')], max_length=255)), (\n 'content_url', models.URLField(help_text='The resource to show.')), (\n 'course_module', models.ForeignKey(related_name='chapters', to=\n 'course.CourseModule'))], options={'ordering': ['course_module',\n 'order', 'id']}, bases=(models.Model,)), migrations.AlterUniqueTogether\n (name='coursechapter', unique_together=set([('course_module', 'url')])),\n migrations.AlterModelOptions(name='coursemodule', options={'ordering':\n ['closing_time', 'order', 'id']}), migrations.RenameField(model_name=\n 'coursemodule', old_name='chapter', new_name='order'), migrations.\n RemoveField(model_name='coursemodule', name='content_url'), migrations.\n RemoveField(model_name='coursemodule', name='subchapter'), migrations.\n AlterField(model_name='course', name='url', field=models.CharField(\n unique=True, validators=[django.core.validators.RegexValidator(regex=\n '^[\\\\w\\\\-\\\\.]*$')], max_length=255, help_text=\n 'Input an URL identifier for this course.'), preserve_default=True),\n migrations.AlterField(model_name='coursemodule', name='url', field=\n models.CharField(help_text='Input an URL identifier for this module.',\n validators=[django.core.validators.RegexValidator(regex=\n '^[\\\\w\\\\-\\\\.]*$')], max_length=255), preserve_default=True)]\n" ]
[ 0, 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'" ]
[ "@VAR_0.route('/login', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "VAR_5 = CLASS_0(request.form['email'], request.form['password'])\n", "return render_template('login.html')\n", "VAR_1.session.add(VAR_5)\n", "VAR_1.session.commit()\n", "return redirect(url_for('tables'))\n" ]
[ "@app.route('/login', methods=['GET', 'POST'])...\n", "if request.method == 'POST':\n", "user = User(request.form['email'], request.form['password'])\n", "return render_template('login.html')\n", "db.session.add(user)\n", "db.session.commit()\n", "return redirect(url_for('tables'))\n" ]
[ 0, 0, 4, 0, 4, 4, 4 ]
[ "Condition", "Condition", "Assign'", "Return'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_8(VAR_15, VAR_16=None, VAR_17=None):...\n", "VAR_34 = FUNC_0()\n", "return VAR_34.do_request(VAR_6 + VAR_15, VAR_16, VAR_17)\n" ]
[ "def admin_req(path, args=None, files=None):...\n", "browser = get_aws_browser()\n", "return browser.do_request(AWS_BASE_URL + path, args, files)\n" ]
[ 0, 0, 5 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@property...\n", "return self.get_options().version\n" ]
[ "@property...\n", "return self.get_options().version\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_1(VAR_1, VAR_2, VAR_3='NGTREE', VAR_4=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 'CSV', 'TREE', 'JSON', 'YAML', 'NGTREE'\n", "if VAR_3 in VAR_11:\n", "VAR_21, VAR_22, VAR_19 = None, None, None\n", "if re.search('^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$', VAR_1):\n", "VAR_21 = nglib.query.net.get_net(VAR_1, VAR_3='NGTREE')\n", "if re.search('^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$', VAR_2):\n", "VAR_22 = nglib.query.net.get_net(VAR_2, VAR_3='NGTREE')\n", "if VAR_21['_child001']['VRF'] == VAR_22['_child001']['VRF']:\n", "VAR_19 = FUNC_3(VAR_1, VAR_2, VAR_7=False)\n", "VAR_37 = FUNC_4(VAR_1, VAR_2, VAR_3='NGTREE')\n", "return VAR_19\n", "VAR_19 = nglib.ngtree.get_ngtree(VAR_37['Name'], tree_type='L4-PATH')\n", "VAR_38 = True\n", "VAR_26 = None\n", "for key in sorted(VAR_37.keys()):\n", "if '_child' in key:\n", "if VAR_26:\n", "if re.search('(Network|FW)', VAR_37[key]['Name']):\n", "VAR_20 = FUNC_3(VAR_37[VAR_26]['gateway'], VAR_2, VAR_10=dstt['_child001'][\n 'VRF'], VAR_4=l2path)\n", "if VAR_38:\n", "if VAR_20:\n", "VAR_20 = FUNC_3(VAR_1, VAR_37[key]['gateway'], VAR_10=srct['_child001'][\n 'VRF'], VAR_4=l2path)\n", "nglib.ngtree.add_child_ngtree(VAR_19, VAR_37[key])\n", "nglib.ngtree.add_child_ngtree(VAR_19, VAR_20)\n", "if VAR_20:\n", "VAR_26 = key\n", "nglib.ngtree.add_child_ngtree(VAR_19, VAR_20)\n", "VAR_38 = False\n" ]
[ "def get_full_routed_path(src, dst, rtype='NGTREE', l2path=False):...\n", "\"\"\"docstring\"\"\"\n", "rtypes = 'CSV', 'TREE', 'JSON', 'YAML', 'NGTREE'\n", "if rtype in rtypes:\n", "srct, dstt, ngtree = None, None, None\n", "if re.search('^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$', src):\n", "srct = nglib.query.net.get_net(src, rtype='NGTREE')\n", "if re.search('^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$', dst):\n", "dstt = nglib.query.net.get_net(dst, rtype='NGTREE')\n", "if srct['_child001']['VRF'] == dstt['_child001']['VRF']:\n", "ngtree = get_routed_path(src, dst, verbose=False)\n", "secpath = get_fw_path(src, dst, rtype='NGTREE')\n", "return ngtree\n", "ngtree = nglib.ngtree.get_ngtree(secpath['Name'], tree_type='L4-PATH')\n", "first = True\n", "last = None\n", "for key in sorted(secpath.keys()):\n", "if '_child' in key:\n", "if last:\n", "if re.search('(Network|FW)', secpath[key]['Name']):\n", "rtree = get_routed_path(secpath[last]['gateway'], dst, vrf=dstt['_child001'\n ]['VRF'], l2path=l2path)\n", "if first:\n", "if rtree:\n", "rtree = get_routed_path(src, secpath[key]['gateway'], vrf=srct['_child001']\n ['VRF'], l2path=l2path)\n", "nglib.ngtree.add_child_ngtree(ngtree, secpath[key])\n", "nglib.ngtree.add_child_ngtree(ngtree, rtree)\n", "if rtree:\n", "last = key\n", "nglib.ngtree.add_child_ngtree(ngtree, rtree)\n", "first = False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Condition", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_4(self):...\n", "VAR_15 = {'Content-Type': 'application/golang'}\n", "VAR_14 = self.new_mocked_client(client.RESTClient, VAR_15=default_headers,\n url_prefix='/v1/api')\n", "VAR_14.list()\n", "FUNC_1('get', VAR_14, 'https://1.2.3.4/v1/api', VAR_9=_headers(**\n default_headers))\n", "VAR_14 = self.new_mocked_client(client.RESTClient, VAR_15=default_headers,\n url_prefix='/v1/api')\n", "VAR_16 = {'X-API-Key': 'strong-crypt'}\n", "VAR_14.url_list('ports/33', VAR_9=method_headers)\n", "VAR_16.update(VAR_15)\n", "FUNC_1('get', VAR_14, 'https://1.2.3.4/v1/api/ports/33', VAR_9=_headers(**\n method_headers))\n" ]
[ "def test_client_headers(self):...\n", "default_headers = {'Content-Type': 'application/golang'}\n", "api = self.new_mocked_client(client.RESTClient, default_headers=\n default_headers, url_prefix='/v1/api')\n", "api.list()\n", "assert_call('get', api, 'https://1.2.3.4/v1/api', headers=_headers(**\n default_headers))\n", "api = self.new_mocked_client(client.RESTClient, default_headers=\n default_headers, url_prefix='/v1/api')\n", "method_headers = {'X-API-Key': 'strong-crypt'}\n", "api.url_list('ports/33', headers=method_headers)\n", "method_headers.update(default_headers)\n", "assert_call('get', api, 'https://1.2.3.4/v1/api/ports/33', headers=_headers\n (**method_headers))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(VAR_6):...\n", "VAR_18 = VAR_6.result()\n", "if VAR_18.status_code == requests.codes.server_error:\n", "FUNC_4(VAR_18.json())\n", "VAR_18.raise_for_status()\n", "if VAR_18.text:\n", "return VAR_18.json()\n", "return None\n" ]
[ "def JsonFromFuture(future):...\n", "response = future.result()\n", "if response.status_code == requests.codes.server_error:\n", "_RaiseExceptionForData(response.json())\n", "response.raise_for_status()\n", "if response.text:\n", "return response.json()\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Return'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.create_snapshot(VAR_8)\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_3(VAR_2):...\n", "if not VAR_2:\n", "return []\n", "VAR_9 = []\n", "VAR_10 = frappe.db.get_value('Department', {'name': VAR_2}, ['lft', 'rgt'],\n as_dict=True)\n", "VAR_11 = frappe.db.sql(\n \"\"\"select name from `tabDepartment`\n\t\twhere lft >= %s and rgt <= %s order by lft desc\n\t\t\"\"\"\n , (VAR_10.lft, VAR_10.rgt), as_list=True)\n", "for d in VAR_11:\n", "VAR_9.extend([l.leave_approver for l in frappe.db.sql('string', d, as_dict=\n True)])\n", "return VAR_9\n" ]
[ "def get_approvers(department):...\n", "if not department:\n", "return []\n", "approvers = []\n", "department_details = frappe.db.get_value('Department', {'name': department},\n ['lft', 'rgt'], as_dict=True)\n", "department_list = frappe.db.sql(\n \"\"\"select name from `tabDepartment`\n\t\twhere lft >= %s and rgt <= %s order by lft desc\n\t\t\"\"\"\n , (department_details.lft, department_details.rgt), as_list=True)\n", "for d in department_list:\n", "approvers.extend([l.leave_approver for l in frappe.db.sql(\n \"select approver from `tabDepartment Approver` \\t\\t\\twhere parent = %s and parentfield = 'leave_approvers'\"\n , d, as_dict=True)])\n", "return approvers\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = VAR_4\n", "VAR_18 = VAR_17.values[0].num / VAR_17.values[0].den\n", "VAR_19 = VAR_17.values[1].num / VAR_17.values[1].den / 60\n", "VAR_20 = VAR_17.values[2].num / VAR_17.values[2].den / 3600\n", "if VAR_5 in 'WS':\n", "return -(VAR_18 + VAR_19 + VAR_20)\n", "return VAR_18 + VAR_19 + VAR_20\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "ag = angular_distance\n", "degrees = ag.values[0].num / ag.values[0].den\n", "minutes = ag.values[1].num / ag.values[1].den / 60\n", "seconds = ag.values[2].num / ag.values[2].den / 3600\n", "if reference in 'WS':\n", "return -(degrees + minutes + seconds)\n", "return degrees + minutes + seconds\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_14(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return partial(FUNC_5, VAR_1)\n" ]
[ "def make_token_getter(remote):...\n", "\"\"\"docstring\"\"\"\n", "return partial(token_getter, remote)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@staticmethod...\n", "return FUNC_1(CLASS_0.PostDataToHandlerAsync(VAR_9, VAR_7, VAR_10))\n" ]
[ "@staticmethod...\n", "return JsonFromFuture(BaseRequest.PostDataToHandlerAsync(data, handler,\n timeout))\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_36(VAR_11):...\n", "for VAR_51, VAR_58 in VAR_11.items():\n", "if isinstance(VAR_58, str) or not isinstance(VAR_58, Iterable):\n", "VAR_58 = [VAR_58]\n", "yield [(VAR_51, VAR_16) for VAR_16 in VAR_58]\n" ]
[ "def flatten(wildcards):...\n", "for wildcard, values in wildcards.items():\n", "if isinstance(values, str) or not isinstance(values, Iterable):\n", "values = [values]\n", "yield [(wildcard, value) for value in values]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 7, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "@integration_synonym_api...\n", "FUNC_2(VAR_2)\n", "FUNC_3(VAR_2, 'FINGER LIMATED', VAR_7='1')\n", "FUNC_5(VAR_4, VAR_5, VAR_11='SUN LIMITED', VAR_10=[{'name': '----SUN'}])\n" ]
[ "@integration_synonym_api...\n", "clean_database(solr)\n", "seed_database_with(solr, 'FINGER LIMATED', id='1')\n", "verify_results(client, jwt, query='SUN LIMITED', expected=[{'name': '----SUN'}]\n )\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "@login_required()...\n", "VAR_5 = {}\n", "VAR_6, VAR_7 = FUNC_5(**kwargs)\n", "VAR_5['concept'] = VAR_6\n", "VAR_4 = VAR_6.transaction\n", "if VAR_4.closed:\n", "return redirect('message', message=gettext('Transaction Closed'))\n", "VAR_5['transaction'] = VAR_4\n", "VAR_5['header'] = gettext('Delete {}?'.format(VAR_6.concept_type))\n", "VAR_5['message'] = VAR_6.description_short\n", "VAR_5['next'] = VAR_0.META['HTTP_REFERER']\n", "if VAR_0.method == 'POST':\n", "VAR_24 = reverse('transaction_detail', VAR_2={'transaction_code': concept.\n transaction.code})\n", "return render(VAR_0, 'core/delete.html', VAR_5)\n", "VAR_6.delete()\n", "VAR_25 = VAR_0.POST.get('next', VAR_24)\n", "return redirect(VAR_25)\n" ]
[ "@login_required()...\n", "extra_context = {}\n", "concept, concept_form = get_concept_and_form_from_kwargs(**kwargs)\n", "extra_context['concept'] = concept\n", "transaction = concept.transaction\n", "if transaction.closed:\n", "return redirect('message', message=gettext('Transaction Closed'))\n", "extra_context['transaction'] = transaction\n", "extra_context['header'] = gettext('Delete {}?'.format(concept.concept_type))\n", "extra_context['message'] = concept.description_short\n", "extra_context['next'] = request.META['HTTP_REFERER']\n", "if request.method == 'POST':\n", "default_next = reverse('transaction_detail', kwargs={'transaction_code':\n concept.transaction.code})\n", "return render(request, 'core/delete.html', extra_context)\n", "concept.delete()\n", "next_page = request.POST.get('next', default_next)\n", "return redirect(next_page)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Assign'", "Return'" ]
[ "@click.command(help='List monitors')...\n", "VAR_36 = newrelic.get_monitors(VAR_0.obj['ACCOUNT'])\n", "if VAR_11:\n", "print(json.dumps(VAR_36))\n", "if VAR_15:\n", "return\n", "for VAR_12 in VAR_36:\n", "VAR_24 = [['#', 'H', 'S', 'Name', 'ID', 'Success\\nRate', 'Avg Size',\n \"\"\"Load time\n(50th PR)\"\"\", \"\"\"Load time\n(95th PR)\"\"\", 'Frequency',\n 'Loca\\ntions', 'Notif\\nEmails']]\n", "print(VAR_12['id'])\n", "return\n", "for VAR_12 in VAR_36:\n", "VAR_22 = VAR_12.get('severity', 0)\n", "for number, VAR_12 in enumerate(VAR_36, 1):\n", "if VAR_22 == 2:\n", "VAR_24.append([number, VAR_12['health'], VAR_12['status'], VAR_12['name'],\n VAR_12['id'], '{:.1f}%'.format(100 * VAR_12.get('success_ratio', 0)),\n humanize.naturalsize(VAR_12.get('avg_size', 0), binary=True),\n '{:.1f} ms'.format(VAR_12.get('load_time_50th_pr', 0)), '{:.1f} ms'.\n format(VAR_12.get('load_time_95th_pr', 0)), '{} min'.format(VAR_12[\n 'frequency']), len(VAR_12['locations']), len(VAR_12['emails'])])\n", "VAR_25 = SingleTable(VAR_24)\n", "VAR_31 = click.style(u'✔', fg='green')\n", "if VAR_22 == 1:\n", "VAR_25.title = click.style('Monitors', fg='black')\n", "VAR_12['health'] = VAR_31\n", "VAR_31 = click.style(u'❢', fg='yellow')\n", "VAR_31 = click.style(u'✖', fg='red')\n", "for VAR_35 in [1, 2]:\n", "VAR_23 = VAR_12['status'].lower()\n", "VAR_25.justify_columns[VAR_35] = 'center'\n", "for VAR_35 in [0, 5, 6, 7, 8, 9, 10, 11]:\n", "if VAR_23 in ('muted', 'disabled'):\n", "VAR_25.justify_columns[VAR_35] = 'right'\n", "VAR_25.justify_columns[3] = 'left'\n", "VAR_23 = click.style(u'❢', fg='yellow')\n", "VAR_23 = click.style(u'✔', fg='green')\n", "print(VAR_25.table)\n", "VAR_12['status'] = VAR_23\n" ]
[ "@click.command(help='List monitors')...\n", "monitors = newrelic.get_monitors(ctx.obj['ACCOUNT'])\n", "if raw:\n", "print(json.dumps(monitors))\n", "if ids_only:\n", "return\n", "for monitor in monitors:\n", "data = [['#', 'H', 'S', 'Name', 'ID', 'Success\\nRate', 'Avg Size',\n \"\"\"Load time\n(50th PR)\"\"\", \"\"\"Load time\n(95th PR)\"\"\", 'Frequency',\n 'Loca\\ntions', 'Notif\\nEmails']]\n", "print(monitor['id'])\n", "return\n", "for monitor in monitors:\n", "severity = monitor.get('severity', 0)\n", "for number, monitor in enumerate(monitors, 1):\n", "if severity == 2:\n", "data.append([number, monitor['health'], monitor['status'], monitor['name'],\n monitor['id'], '{:.1f}%'.format(100 * monitor.get('success_ratio', 0)),\n humanize.naturalsize(monitor.get('avg_size', 0), binary=True),\n '{:.1f} ms'.format(monitor.get('load_time_50th_pr', 0)), '{:.1f} ms'.\n format(monitor.get('load_time_95th_pr', 0)), '{} min'.format(monitor[\n 'frequency']), len(monitor['locations']), len(monitor['emails'])])\n", "table = SingleTable(data)\n", "health = click.style(u'✔', fg='green')\n", "if severity == 1:\n", "table.title = click.style('Monitors', fg='black')\n", "monitor['health'] = health\n", "health = click.style(u'❢', fg='yellow')\n", "health = click.style(u'✖', fg='red')\n", "for i in [1, 2]:\n", "status = monitor['status'].lower()\n", "table.justify_columns[i] = 'center'\n", "for i in [0, 5, 6, 7, 8, 9, 10, 11]:\n", "if status in ('muted', 'disabled'):\n", "table.justify_columns[i] = 'right'\n", "table.justify_columns[3] = 'left'\n", "status = click.style(u'❢', fg='yellow')\n", "status = click.style(u'✔', fg='green')\n", "print(table.table)\n", "monitor['status'] = status\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 ]
[ "Condition", "Assign'", "Condition", "Expr'", "Condition", "Return'", "For", "Assign'", "Expr'", "Return'", "For", "Assign'", "For", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_11(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name}\n", "self.stubs.Set(self.driver, '_get_iscsi_properties', self.\n _fake_get_iscsi_properties)\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'access',\n 'create', 'initiator', self.connector['initiator'], 'authmethod chap',\n 'username', self.configuration.eqlx_chap_login)\n", "self.mox.ReplayAll()\n", "VAR_8 = self.driver.initialize_connection(VAR_1, self.connector)\n", "self.assertEqual(VAR_8['data'], self._fake_get_iscsi_properties(VAR_1))\n" ]
[ "def test_initialize_connection(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name}\n", "self.stubs.Set(self.driver, '_get_iscsi_properties', self.\n _fake_get_iscsi_properties)\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'access',\n 'create', 'initiator', self.connector['initiator'], 'authmethod chap',\n 'username', self.configuration.eqlx_chap_login)\n", "self.mox.ReplayAll()\n", "iscsi_properties = self.driver.initialize_connection(volume, self.connector)\n", "self.assertEqual(iscsi_properties['data'], self._fake_get_iscsi_properties(\n volume))\n" ]
[ 0, 0, 0, 0, 2, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "@VAR_1.route('/restaurants/<saltiness>/<sweetness>/<sourness>/<bitterness>/')...\n", "\"\"\"docstring\"\"\"\n", "VAR_0.info('GET query_restaurants_by_taste query')\n", "VAR_11, VAR_12, VAR_13, VAR_14 = int(VAR_11), int(VAR_12), int(VAR_13), int(\n VAR_14)\n", "return None\n", "VAR_27 = sql_queries.restaurant_by_taste % (FUNC_7(VAR_11), FUNC_7(VAR_12),\n FUNC_7(VAR_13), FUNC_7(VAR_14), FUNC_7(1 - VAR_11), FUNC_7(1 - VAR_12),\n FUNC_7(1 - VAR_13), FUNC_7(1 - VAR_14))\n", "VAR_19, VAR_20 = request.args.get('loclat'), request.args.get('loclng')\n", "VAR_21 = request.args.get('price_category')\n", "VAR_22 = request.args.get('online_delivery')\n", "VAR_23 = request.args.get('min_review')\n", "if VAR_19 != None and VAR_20 != None:\n", "VAR_31 = [float(VAR_19) - VAR_7, float(VAR_19) + VAR_7]\n", "VAR_31 = None\n", "VAR_32 = [float(VAR_20) - VAR_7, float(VAR_20) + VAR_7]\n", "VAR_32 = None\n", "VAR_25 = VAR_3.restaurant_query_builder(VAR_27, VAR_31, VAR_32, VAR_21,\n VAR_23, VAR_22)\n", "VAR_26 = VAR_3.order_by_and_limit_query(VAR_25, 'agg_review DESC', 20)\n", "VAR_18 = VAR_3.run_sql_query(VAR_26)\n", "if VAR_18 == -1:\n", "return None\n", "return VAR_18\n" ]
[ "@app.route('/restaurants/<saltiness>/<sweetness>/<sourness>/<bitterness>/')...\n", "\"\"\"docstring\"\"\"\n", "logger.info('GET query_restaurants_by_taste query')\n", "saltiness, sweetness, sourness, bitterness = int(saltiness), int(sweetness\n ), int(sourness), int(bitterness)\n", "return None\n", "restaurant_query = sql_queries.restaurant_by_taste % (get_taste_condition(\n saltiness), get_taste_condition(sweetness), get_taste_condition(\n sourness), get_taste_condition(bitterness), get_taste_condition(1 -\n saltiness), get_taste_condition(1 - sweetness), get_taste_condition(1 -\n sourness), get_taste_condition(1 - bitterness))\n", "loclat, loclng = request.args.get('loclat'), request.args.get('loclng')\n", "price_category = request.args.get('price_category')\n", "online_delivery = request.args.get('online_delivery')\n", "min_review = request.args.get('min_review')\n", "if loclat != None and loclng != None:\n", "lat_range = [float(loclat) - geodist, float(loclat) + geodist]\n", "lat_range = None\n", "lng_range = [float(loclng) - geodist, float(loclng) + geodist]\n", "lng_range = None\n", "filtered_query = database.restaurant_query_builder(restaurant_query,\n lat_range, lng_range, price_category, min_review, online_delivery)\n", "limited_query = database.order_by_and_limit_query(filtered_query,\n 'agg_review DESC', 20)\n", "query_res = database.run_sql_query(limited_query)\n", "if query_res == -1:\n", "return None\n", "return query_res\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "VAR_18 = self.common.create_volume(VAR_6)\n", "self.common.client_logout()\n", "return {'metadata': VAR_18}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "metadata = self.common.create_volume(volume)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_11(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n", "self.write_data({'type': 'torrent_info_updated', 'event': dict(infohash=\n hexlify(objectID), **args[0])})\n" ]
[ "def on_torrent_info_updated(self, subject, changetype, objectID, *args):...\n", "self.write_data({'type': 'torrent_info_updated', 'event': dict(infohash=\n hexlify(objectID), **args[0])})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_7(self):...\n", "VAR_23 = []\n", "VAR_25, VAR_26, VAR_27 = self._first_missing()\n", "if VAR_25:\n", "VAR_23.append(f'missing step {VAR_25} {VAR_26} for path ')\n", "VAR_23.append(f'<{type(self._r_root_item_).__name__}>')\n", "VAR_23 += [VAR_31 for VAR_31, VAR_27 in self._r_steps_]\n", "if VAR_25:\n", "VAR_27, VAR_27, VAR_32 = self._last_found()\n", "return ''.join(VAR_23)\n", "if VAR_32:\n", "VAR_23.append(f' at <{type(VAR_32()).__name__}>')\n", "VAR_35 = VAR_32()\n", "if isinstance(VAR_35, (tuple, list, set, range)):\n", "if re.match('\\\\[\\\\d+\\\\]', VAR_26):\n", "if isinstance(VAR_35, (str, int, float, complex, bool, bytes, bytearray)):\n", "VAR_23.append(f' with length {len(VAR_35)}')\n", "VAR_37 = VAR_35.keys()\n", "VAR_38 = dir(VAR_35)\n", "if VAR_37:\n", "if VAR_38 and not isinstance(VAR_35, (str, tuple, list)):\n", "VAR_23.append(f\" with keys [{', '.join([repr(k) for k in VAR_37])}]\")\n", "VAR_23.append(\n f\" with attrs [{', '.join([a for a in VAR_38 if not a.startswith('_')])}]\")\n" ]
[ "def description(self):...\n", "result = []\n", "first_missing_index, first_missing_desc, _ = self._first_missing()\n", "if first_missing_index:\n", "result.append(\n f'missing step {first_missing_index} {first_missing_desc} for path ')\n", "result.append(f'<{type(self._r_root_item_).__name__}>')\n", "result += [desc for desc, _ in self._r_steps_]\n", "if first_missing_index:\n", "_, _, last_found_roamer = self._last_found()\n", "return ''.join(result)\n", "if last_found_roamer:\n", "result.append(f' at <{type(last_found_roamer()).__name__}>')\n", "last_found_data = last_found_roamer()\n", "if isinstance(last_found_data, (tuple, list, set, range)):\n", "if re.match('\\\\[\\\\d+\\\\]', first_missing_desc):\n", "if isinstance(last_found_data, (str, int, float, complex, bool, bytes,\n", "result.append(f' with length {len(last_found_data)}')\n", "keys = last_found_data.keys()\n", "attrs = dir(last_found_data)\n", "if keys:\n", "if attrs and not isinstance(last_found_data, (str, tuple, list)):\n", "result.append(f\" with keys [{', '.join([repr(k) for k in keys])}]\")\n", "result.append(\n f\" with attrs [{', '.join([a for a in attrs if not a.startswith('_')])}]\")\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "AugAssign'", "Condition", "Assign'", "Return'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_1, VAR_6, VAR_7, VAR_3):...\n", "VAR_12 = []\n", "if VAR_7 == True:\n", "VAR_7 = 'TRUE'\n", "if VAR_7 == False:\n", "for choice, VAR_19 in [('', _('(unspecified)')), ('TRUE', _('yes')), (\n", "VAR_7 = 'FALSE'\n", "VAR_7 = ''\n", "VAR_17 = VAR_7 == choice and 'selected' or ''\n", "return '<select name=\"%s\">%s</select>' % (html_escape(VAR_6), ''.join(VAR_12))\n", "VAR_12.append('<option value=\"%s\" %s>%s</option>' % (choice, VAR_17, VAR_19))\n" ]
[ "def make_input(self, version, name, value, attribute):...\n", "options = []\n", "if value == True:\n", "value = 'TRUE'\n", "if value == False:\n", "for choice, title in [('', _('(unspecified)')), ('TRUE', _('yes')), (\n", "value = 'FALSE'\n", "value = ''\n", "selected = value == choice and 'selected' or ''\n", "return '<select name=\"%s\">%s</select>' % (html_escape(name), ''.join(options))\n", "options.append('<option value=\"%s\" %s>%s</option>' % (choice, selected, title))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "For", "Assign'", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\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_7 = Container.objects.create(owner=User.objects.get(username='autotest'\n ), app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', VAR_9=1)\n", "self.assertEqual(VAR_7.state, 'initialized')\n", "self.assertRaises(TransitionNotAllowed, lambda : VAR_7.start())\n", "VAR_7.create()\n", "self.assertEqual(VAR_7.state, 'created')\n", "VAR_7.start()\n", "self.assertEqual(VAR_7.state, 'up')\n", "VAR_7.destroy()\n", "self.assertEqual(VAR_7.state, 'destroyed')\n" ]
[ "def test_container_state_good(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "c = Container.objects.create(owner=User.objects.get(username='autotest'),\n app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', num=1)\n", "self.assertEqual(c.state, 'initialized')\n", "self.assertRaises(TransitionNotAllowed, lambda : c.start())\n", "c.create()\n", "self.assertEqual(c.state, 'created')\n", "c.start()\n", "self.assertEqual(c.state, 'up')\n", "c.destroy()\n", "self.assertEqual(c.state, 'destroyed')\n" ]
[ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n", "VAR_40 = self.create_test('t0')\n", "VAR_41 = self.create_test('t1')\n", "VAR_42 = self.create_test('t2')\n", "VAR_43 = self.create_test('t3')\n", "VAR_44 = self.create_test('t4')\n", "VAR_41.depends_on('t0')\n", "VAR_42.depends_on('t1')\n", "VAR_43.depends_on('t1')\n", "VAR_43.depends_on('t2')\n", "VAR_44.depends_on('t2')\n", "VAR_44.depends_on('t3')\n", "dependency.validate_deps(dependency.build_deps(executors.generate_testcases\n ([VAR_40, VAR_41, VAR_42, VAR_43, VAR_44])))\n" ]
[ "@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n", "t0 = self.create_test('t0')\n", "t1 = self.create_test('t1')\n", "t2 = self.create_test('t2')\n", "t3 = self.create_test('t3')\n", "t4 = self.create_test('t4')\n", "t1.depends_on('t0')\n", "t2.depends_on('t1')\n", "t3.depends_on('t1')\n", "t3.depends_on('t2')\n", "t4.depends_on('t2')\n", "t4.depends_on('t3')\n", "dependency.validate_deps(dependency.build_deps(executors.generate_testcases\n ([t0, t1, t2, t3, t4])))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "VAR_0 = [('exercise', '0006_auto_20150625_1823'), ('course',\n '0005_auto_20150625_1835'), ('deviations', '0001_initial')]\n", "VAR_1 = [migrations.AlterField(model_name='learningobject', name='category',\n field=models.ForeignKey(related_name='learning_objects', to=\n 'course.LearningObjectCategory'), preserve_default=True), migrations.\n AlterField(model_name='learningobject', name='course_module', field=\n models.ForeignKey(related_name='learning_objects', to=\n 'course.CourseModule'), preserve_default=True)]\n" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "dependencies = [('exercise', '0006_auto_20150625_1823'), ('course',\n '0005_auto_20150625_1835'), ('deviations', '0001_initial')]\n", "operations = [migrations.AlterField(model_name='learningobject', name=\n 'category', field=models.ForeignKey(related_name='learning_objects', to\n ='course.LearningObjectCategory'), preserve_default=True), migrations.\n AlterField(model_name='learningobject', name='course_module', field=\n models.ForeignKey(related_name='learning_objects', to=\n 'course.CourseModule'), preserve_default=True)]\n" ]
[ 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'" ]
[ "\"\"\"\nworkflow worker daemon\n\"\"\"\n", "import json\n", "import traceback\n", "from pprint import pformat\n", "import signal\n", "from time import sleep, time\n", "import pika\n", "from tornado.escape import json_decode\n", "from pyoko.conf import settings\n", "from pyoko.lib.utils import get_object_from_path\n", "from zengine.client_queue import ClientQueue, BLOCKING_MQ_PARAMS\n", "from zengine.engine import ZEngine\n", "from zengine.current import Current\n", "from zengine.lib.cache import Session, KeepAlive\n", "from zengine.lib.exceptions import HTTPError\n", "from zengine.log import log\n", "import sys\n", "from zengine.receivers import *\n", "sys._zops_wf_state_log = ''\n", "VAR_0 = ZEngine()\n", "VAR_1 = {'error': 'Login required', 'code': 401}\n", "\"\"\"\n Workflow runner worker object\n \"\"\"\n", "VAR_5 = 'in_queue'\n", "VAR_6 = 'input_exc'\n", "def __init__(self):...\n", "self.connect()\n", "VAR_7.signal(VAR_7.SIGTERM, self.exit)\n", "log.info('Worker starting')\n", "def FUNC_1(self, VAR_7=None, VAR_8=None):...\n", "\"\"\"docstring\"\"\"\n", "self.input_channel.close()\n", "self.client_queue.close()\n", "self.connection.close()\n", "log.info('Worker exiting')\n", "sys.exit(0)\n", "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "self.connection = pika.BlockingConnection(BLOCKING_MQ_PARAMS)\n", "self.client_queue = ClientQueue()\n", "self.input_channel = self.connection.channel()\n", "self.input_channel.exchange_declare(exchange=self.INPUT_EXCHANGE, type=\n 'topic', durable=True)\n", "self.input_channel.queue_declare(queue=self.INPUT_QUEUE_NAME)\n", "self.input_channel.queue_bind(exchange=self.INPUT_EXCHANGE, queue=self.\n INPUT_QUEUE_NAME)\n", "log.info(\"Bind to queue named '%s' queue with exchange '%s'\" % (self.\n INPUT_QUEUE_NAME, self.INPUT_EXCHANGE))\n", "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "self.input_channel.basic_consume(self.handle_message, queue=self.\n INPUT_QUEUE_NAME, no_ack=True)\n", "self.input_channel.start_consuming()\n", "log.info(' Exiting')\n", "def FUNC_4(self, VAR_9):...\n", "self.exit()\n", "return VAR_9 + '\\n\\n' + 'INPUT DATA: %s\\n\\n' % pformat(self.current.input\n ) + \"\"\"OUTPUT DATA: %s\n\n\"\"\" % pformat(self.current.output\n ) + sys._zops_wf_state_log\n", "return VAR_9\n", "def FUNC_5(self, VAR_10, VAR_11):...\n", "VAR_21 = KeepAlive(sess_id=session.sess_id).update_or_expire_session()\n", "VAR_9 = {'msg': 'pong'}\n", "if not VAR_21:\n", "VAR_9.update(VAR_1)\n", "return VAR_9\n" ]
[ "\"\"\"\nworkflow worker daemon\n\"\"\"\n", "import json\n", "import traceback\n", "from pprint import pformat\n", "import signal\n", "from time import sleep, time\n", "import pika\n", "from tornado.escape import json_decode\n", "from pyoko.conf import settings\n", "from pyoko.lib.utils import get_object_from_path\n", "from zengine.client_queue import ClientQueue, BLOCKING_MQ_PARAMS\n", "from zengine.engine import ZEngine\n", "from zengine.current import Current\n", "from zengine.lib.cache import Session, KeepAlive\n", "from zengine.lib.exceptions import HTTPError\n", "from zengine.log import log\n", "import sys\n", "from zengine.receivers import *\n", "sys._zops_wf_state_log = ''\n", "wf_engine = ZEngine()\n", "LOGIN_REQUIRED_MESSAGE = {'error': 'Login required', 'code': 401}\n", "\"\"\"\n Workflow runner worker object\n \"\"\"\n", "INPUT_QUEUE_NAME = 'in_queue'\n", "INPUT_EXCHANGE = 'input_exc'\n", "def __init__(self):...\n", "self.connect()\n", "signal.signal(signal.SIGTERM, self.exit)\n", "log.info('Worker starting')\n", "def exit(self, signal=None, frame=None):...\n", "\"\"\"docstring\"\"\"\n", "self.input_channel.close()\n", "self.client_queue.close()\n", "self.connection.close()\n", "log.info('Worker exiting')\n", "sys.exit(0)\n", "def connect(self):...\n", "\"\"\"docstring\"\"\"\n", "self.connection = pika.BlockingConnection(BLOCKING_MQ_PARAMS)\n", "self.client_queue = ClientQueue()\n", "self.input_channel = self.connection.channel()\n", "self.input_channel.exchange_declare(exchange=self.INPUT_EXCHANGE, type=\n 'topic', durable=True)\n", "self.input_channel.queue_declare(queue=self.INPUT_QUEUE_NAME)\n", "self.input_channel.queue_bind(exchange=self.INPUT_EXCHANGE, queue=self.\n INPUT_QUEUE_NAME)\n", "log.info(\"Bind to queue named '%s' queue with exchange '%s'\" % (self.\n INPUT_QUEUE_NAME, self.INPUT_EXCHANGE))\n", "def run(self):...\n", "\"\"\"docstring\"\"\"\n", "self.input_channel.basic_consume(self.handle_message, queue=self.\n INPUT_QUEUE_NAME, no_ack=True)\n", "self.input_channel.start_consuming()\n", "log.info(' Exiting')\n", "def _prepare_error_msg(self, msg):...\n", "self.exit()\n", "return msg + '\\n\\n' + 'INPUT DATA: %s\\n\\n' % pformat(self.current.input\n ) + 'OUTPUT DATA: %s\\n\\n' % pformat(self.current.output\n ) + sys._zops_wf_state_log\n", "return msg\n", "def _handle_ping_pong(self, data, session):...\n", "still_alive = KeepAlive(sess_id=session.sess_id).update_or_expire_session()\n", "msg = {'msg': 'pong'}\n", "if not still_alive:\n", "msg.update(LOGIN_REQUIRED_MESSAGE)\n", "return msg\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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 ]
[ "Expr'", "Import'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Return'", "Return'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_1 = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "VAR_2 = VAR_1.get_def('meetup_info').render_unicode(VAR_0=meetup)\n", "VAR_3 = url_for(controller='meetups', action='show', id=meetup._id36)\n", "VAR_4 = python_websafe(VAR_0.title)\n", "VAR_5 = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n VAR_3, VAR_4)\n", "return VAR_5 + VAR_2 + VAR_5\n" ]
[ "def meetup_article_text(meetup):...\n", "t = Template(filename='r2/templates/showmeetup.html', output_encoding=\n 'utf-8', encoding_errors='replace')\n", "res = t.get_def('meetup_info').render_unicode(meetup=meetup)\n", "url = url_for(controller='meetups', action='show', id=meetup._id36)\n", "title = python_websafe(meetup.title)\n", "hdr = u\"<h2>Discussion article for the meetup : <a href='%s'>%s</a></h2>\" % (\n url, title)\n", "return hdr + res + hdr\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_15(VAR_27):...\n", "VAR_46 = str(VAR_27.body).lower()\n", "print('Body: **', VAR_46, '**')\n", "if VAR_27.body[0] == ' ':\n", "VAR_28 = str(VAR_27.body[1:]).lower().replace('\\\\', '').split('\\n')[0].split(\n ' ')\n", "VAR_28 = str(VAR_27.body).lower().replace('\\\\', '').split('\\n')[0].split(' ')\n", "print('Parsed Text:', VAR_28)\n", "if VAR_28[0].lower() == 'help':\n", "print('Helping')\n", "if VAR_28[0].lower() == 'minimum':\n", "FUNC_13(VAR_27)\n", "print('Setting Minimum')\n", "if VAR_28[0].lower() == 'create':\n", "FUNC_12(VAR_27)\n", "print('Creating')\n", "if VAR_28[0].lower() == 'private_key':\n", "FUNC_5(VAR_27)\n", "print('private_keying')\n", "if VAR_28[0].lower() == 'new_address':\n", "print('new address')\n", "if VAR_28[0].lower() == 'send':\n", "print('send via PM')\n", "if VAR_28[0].lower() == 'receive':\n", "FUNC_9(VAR_27)\n", "print('receive')\n", "if VAR_28[0].lower() == 'balance':\n", "FUNC_11(VAR_27)\n", "print('balance')\n", "FUNC_2(VAR_14=str(message.author), VAR_26=str(message.body)[:255], VAR_18=\n 'message')\n", "FUNC_7(VAR_27)\n" ]
[ "def handle_message(message):...\n", "message_body = str(message.body).lower()\n", "print('Body: **', message_body, '**')\n", "if message.body[0] == ' ':\n", "parsed_text = str(message.body[1:]).lower().replace('\\\\', '').split('\\n')[0\n ].split(' ')\n", "parsed_text = str(message.body).lower().replace('\\\\', '').split('\\n')[0].split(\n ' ')\n", "print('Parsed Text:', parsed_text)\n", "if parsed_text[0].lower() == 'help':\n", "print('Helping')\n", "if parsed_text[0].lower() == 'minimum':\n", "handle_help(message)\n", "print('Setting Minimum')\n", "if parsed_text[0].lower() == 'create':\n", "handle_minimum(message)\n", "print('Creating')\n", "if parsed_text[0].lower() == 'private_key':\n", "handle_create(message)\n", "print('private_keying')\n", "if parsed_text[0].lower() == 'new_address':\n", "print('new address')\n", "if parsed_text[0].lower() == 'send':\n", "print('send via PM')\n", "if parsed_text[0].lower() == 'receive':\n", "handle_send(message)\n", "print('receive')\n", "if parsed_text[0].lower() == 'balance':\n", "handle_receive(message)\n", "print('balance')\n", "add_history_record(username=str(message.author), comment_text=str(message.\n body)[:255], comment_or_message='message')\n", "handle_balance(message)\n" ]
[ 0, 4, 4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ]
[ "FunctionDef'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_11(self):...\n", "VAR_3 = 5\n", "for i in range(VAR_3):\n", "VAR_11 = urllib.urlencode({url_helper.swarm_constants.COUNT_KEY: i})\n", "self._mox.ReplayAll()\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), VAR_11, timeout=mox.IgnoreArg()\n ).AndRaise(urllib2.URLError('url'))\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=attempts), None)\n", "if i != VAR_3 - 1:\n", "self._mox.VerifyAll()\n", "time.sleep(mox.IgnoreArg())\n" ]
[ "def testEnsureCountKeyIncludedInOpen(self):...\n", "attempts = 5\n", "for i in range(attempts):\n", "encoded_data = urllib.urlencode({url_helper.swarm_constants.COUNT_KEY: i})\n", "self._mox.ReplayAll()\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), encoded_data, timeout=mox.\n IgnoreArg()).AndRaise(urllib2.URLError('url'))\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=attempts), None)\n", "if i != attempts - 1:\n", "self._mox.VerifyAll()\n", "time.sleep(mox.IgnoreArg())\n" ]
[ 0, 0, 0, 0, 0, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_3):...\n", "return VAR_3\n" ]
[ "def run(self, x):...\n", "return x\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "return chain(*map(attrgetter(VAR_1), VAR_0))\n" ]
[ "def jobfiles(jobs, type):...\n", "return chain(*map(attrgetter(type), jobs))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_21, VAR_23=True)\n", "if VAR_24 is not False:\n", "return True\n" ]
[ "def exists(self, path):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(path, follow_symlinks=True)\n", "if f is not False:\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'" ]
[ "def FUNC_16(self, VAR_15):...\n", "\"\"\"docstring\"\"\"\n", "for o in self.products:\n", "if o.match(VAR_15):\n", "return False\n", "return True\n" ]
[ "def is_producer(self, requested_output):...\n", "\"\"\"docstring\"\"\"\n", "for o in self.products:\n", "if o.match(requested_output):\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_4 = [self.program]\n", "VAR_4.extend(self.arguments)\n", "VAR_5 = subprocess.run(VAR_4, stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n", "return {'exit_code': VAR_5.returncode, 'stdout': VAR_5.stdout.decode() if\n VAR_5.stdout else None, 'stderr': VAR_5.stderr.decode() if VAR_5.stderr\n else None}\n" ]
[ "def run(self):...\n", "args = [self.program]\n", "args.extend(self.arguments)\n", "result = subprocess.run(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n", "return {'exit_code': result.returncode, 'stdout': result.stdout.decode() if\n result.stdout else None, 'stderr': result.stderr.decode() if result.\n stderr else None}\n" ]
[ 0, 0, 0, 2, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "@VAR_0.route('/', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'GET':\n", "VAR_21 = uuid4()\n", "return render_template('index.html', VAR_21=cache_id)\n" ]
[ "@app.route('/', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'GET':\n", "cache_id = uuid4()\n", "return render_template('index.html', cache_id=cache_id)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Return'" ]
[ "def FUNC_7(self):...\n", "return self.content\n" ]
[ "def read(self):...\n", "return self.content\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_14(self, VAR_14):...\n", "" ]
[ "def is_boolean(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_10(self):...\n", "if not self.is_ordered():\n", "if self.query_order:\n", "if self.current_columns_length > 1:\n", "return self.get_url_with_query_params({self.ordering_query_param: '{}.{}'.\n format(self.column_id, self.query_order)})\n", "return self.get_url_with_query_params({self.ordering_query_param: self.\n column_id})\n", "VAR_20 = []\n", "return self.get_reverse_sort_by()\n", "for VAR_2 in self.query_order.split('.'):\n", "VAR_23 = VAR_2.replace('-', '')\n", "if not self.is_reverse() and self.current_columns[0] == self.column_id:\n", "if not int(VAR_23) == self.column_id:\n", "return self.get_url_with_query_params({self.ordering_query_param: '-{}.{}'.\n format(self.column_id, '.'.join(VAR_20))})\n", "return self.get_url_with_query_params({self.ordering_query_param: '{}.{}'.\n format(self.column_id, '.'.join(VAR_20))})\n", "VAR_20.append(VAR_2)\n" ]
[ "def get_add_sort_by(self):...\n", "if not self.is_ordered():\n", "if self.query_order:\n", "if self.current_columns_length > 1:\n", "return self.get_url_with_query_params({self.ordering_query_param: '{}.{}'.\n format(self.column_id, self.query_order)})\n", "return self.get_url_with_query_params({self.ordering_query_param: self.\n column_id})\n", "new_query = []\n", "return self.get_reverse_sort_by()\n", "for column in self.query_order.split('.'):\n", "c = column.replace('-', '')\n", "if not self.is_reverse() and self.current_columns[0] == self.column_id:\n", "if not int(c) == self.column_id:\n", "return self.get_url_with_query_params({self.ordering_query_param: '-{}.{}'.\n format(self.column_id, '.'.join(new_query))})\n", "return self.get_url_with_query_params({self.ordering_query_param: '{}.{}'.\n format(self.column_id, '.'.join(new_query))})\n", "new_query.append(column)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Condition", "Return'", "Return'", "Assign'", "Return'", "For", "Assign'", "Condition", "Condition", "Return'", "Return'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_1 = list(self.uut.process_output([\n \"Random line that shouldn't be captured\\n\", '*************\\n'],\n 'a/file.py', ['original_file_lines_placeholder']))\n", "self.assertEqual(len(VAR_1), 0)\n" ]
[ "def test_valid_output(self):...\n", "out = list(self.uut.process_output([\n \"Random line that shouldn't be captured\\n\", '*************\\n'],\n 'a/file.py', ['original_file_lines_placeholder']))\n", "self.assertEqual(len(out), 0)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "from flask import jsonify, request\n", "from . import api\n", "from run import mysql\n", "@api.route('/items', methods=['GET'])...\n", "VAR_1 = 'SELECT id, name_enus from tblDBCItem where auctionable = true;'\n", "VAR_2 = mysql.connection.cursor()\n", "VAR_2.execute(VAR_1)\n", "VAR_3 = VAR_2.fetchall()\n", "VAR_4 = []\n", "for row in VAR_3:\n", "VAR_6 = {}\n", "return jsonify({'items': VAR_4})\n", "for VAR_7 in zip([column[0] for column in VAR_2.description], row):\n", "VAR_6[VAR_7[0]] = VAR_7[1]\n", "VAR_4.append(VAR_6)\n" ]
[ "from flask import jsonify, request\n", "from . import api\n", "from run import mysql\n", "@api.route('/items', methods=['GET'])...\n", "sql = 'SELECT id, name_enus from tblDBCItem where auctionable = true;'\n", "cursor = mysql.connection.cursor()\n", "cursor.execute(sql)\n", "data = cursor.fetchall()\n", "results = []\n", "for row in data:\n", "item = {}\n", "return jsonify({'items': results})\n", "for tup in zip([column[0] for column in cursor.description], row):\n", "item[tup[0]] = tup[1]\n", "results.append(item)\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Return'", "For", "Assign'", "Expr'" ]
[ "import sqlite3\n", "import sys\n", "from recipe import *\n", "def __init__(self):...\n", "VAR_2 = sqlite3.connect('brewdie.db')\n", "if VAR_2:\n", "if VAR_2:\n", "def FUNC_0(self, VAR_0):...\n", "VAR_3 = VAR_2.cursor()\n", "VAR_2.rollback()\n", "VAR_2.close()\n", "VAR_2 = sqlite3.connect('brewdie.db')\n", "print('Something went wrong')\n", "if VAR_2:\n", "def FUNC_1(self):...\n", "VAR_4 = []\n", "sys.exit(1)\n", "VAR_3 = VAR_2.cursor()\n", "print(e)\n", "VAR_2.close()\n", "VAR_1 = []\n", "for row in VAR_3.execute(\"SELECT name FROM sqlite_master WHERE type='table'\"):\n", "VAR_5 = []\n", "if VAR_2:\n", "VAR_2 = sqlite3.connect('brewdie.db')\n", "print('Something went wrong')\n", "if VAR_2:\n", "return VAR_1\n", "VAR_4.append(row[0])\n", "if not 'Recipes' in VAR_4:\n", "for row in VAR_3.execute('SELECT name FROM Recipes'):\n", "VAR_2.rollback()\n", "return\n", "VAR_3 = VAR_2.cursor()\n", "print(e)\n", "VAR_2.close()\n", "VAR_3.execute(\n 'CREATE TABLE Recipes (name TEXT PRIMARY KEY, type TEXT, boiling_minutes INTEGER)'\n )\n", "if not 'Malts' in VAR_4:\n", "VAR_5.append(row[0])\n", "if VAR_0.name in VAR_5:\n", "for row in VAR_3.execute('SELECT * FROM Recipes'):\n", "if VAR_2:\n", "VAR_3.execute(\n 'CREATE TABLE Malts (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, gramms REAL, recipe_name TEXT)'\n )\n", "if not 'Rests' in VAR_4:\n", "print('Recipe is already stored in the database')\n", "VAR_3.execute('INSERT INTO Recipes VALUES(?, ?, ?)', (VAR_0.name, VAR_0.\n style, VAR_0.boiling_minutes))\n", "VAR_0 = Recipe(row[0], row[1], row[2])\n", "VAR_2.rollback()\n", "return\n", "VAR_3.execute('string')\n", "if not 'HopDosages' in VAR_4:\n", "VAR_2.commit()\n", "for malt_name, malt_gramms in VAR_0.malts.items():\n", "for VAR_7 in VAR_3.execute(\"SELECT * FROM Malts WHERE recipe_name='%s'\" %\n", "VAR_3.execute('string')\n", "VAR_2.commit()\n", "VAR_3.execute('INSERT INTO Malts(name, gramms, recipe_name) VALUES(?, ?, ?)',\n (malt_name, malt_gramms, VAR_0.name))\n", "VAR_6 = 0\n", "VAR_0.malts[VAR_7[1]] = VAR_7[2]\n", "for rest_row in VAR_3.execute(\n", "for rest in VAR_0.rests:\n", "VAR_0.rests.append(Rest(rest_row[1], rest_row[2], rest_row[3]))\n", "for hop_dosage_row in VAR_3.execute(\n", "VAR_3.execute(\n 'INSERT INTO Rests(name, degrees, minutes, position, recipe_name) VALUES(?, ?, ?, ?, ?)'\n , (rest.name, rest.degrees, rest.minutes, VAR_6, VAR_0.name))\n", "for hop_dosage in VAR_0.hop_dosages:\n", "VAR_0.hop_dosages.append(HopDosage(hop_dosage_row[1], hop_dosage_row[3],\n hop_dosage_row[2]))\n", "VAR_1.append(VAR_0)\n", "VAR_6 = VAR_6 + 1\n", "VAR_3.execute(\n 'INSERT INTO HopDosages(name, minutes, gramms, recipe_name) VALUES(?, ?, ?, ?)'\n , (hop_dosage.name, hop_dosage.minutes, hop_dosage.gramms, VAR_0.name))\n" ]
[ "import sqlite3\n", "import sys\n", "from recipe import *\n", "def __init__(self):...\n", "connection = sqlite3.connect('brewdie.db')\n", "if connection:\n", "if connection:\n", "def store_recipe(self, recipe):...\n", "cursor = connection.cursor()\n", "connection.rollback()\n", "connection.close()\n", "connection = sqlite3.connect('brewdie.db')\n", "print('Something went wrong')\n", "if connection:\n", "def load_recipes(self):...\n", "table_names = []\n", "sys.exit(1)\n", "cursor = connection.cursor()\n", "print(e)\n", "connection.close()\n", "recipes = []\n", "for row in cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table'\"):\n", "recipe_names = []\n", "if connection:\n", "connection = sqlite3.connect('brewdie.db')\n", "print('Something went wrong')\n", "if connection:\n", "return recipes\n", "table_names.append(row[0])\n", "if not 'Recipes' in table_names:\n", "for row in cursor.execute('SELECT name FROM Recipes'):\n", "connection.rollback()\n", "return\n", "cursor = connection.cursor()\n", "print(e)\n", "connection.close()\n", "cursor.execute(\n 'CREATE TABLE Recipes (name TEXT PRIMARY KEY, type TEXT, boiling_minutes INTEGER)'\n )\n", "if not 'Malts' in table_names:\n", "recipe_names.append(row[0])\n", "if recipe.name in recipe_names:\n", "for row in cursor.execute('SELECT * FROM Recipes'):\n", "if connection:\n", "cursor.execute(\n 'CREATE TABLE Malts (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, gramms REAL, recipe_name TEXT)'\n )\n", "if not 'Rests' in table_names:\n", "print('Recipe is already stored in the database')\n", "cursor.execute('INSERT INTO Recipes VALUES(?, ?, ?)', (recipe.name, recipe.\n style, recipe.boiling_minutes))\n", "recipe = Recipe(row[0], row[1], row[2])\n", "connection.rollback()\n", "return\n", "cursor.execute(\n 'CREATE TABLE Rests (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, degrees REAL, minutes INTEGER, position INTEGER, recipe_name TEXT)'\n )\n", "if not 'HopDosages' in table_names:\n", "connection.commit()\n", "for malt_name, malt_gramms in recipe.malts.items():\n", "for malt_row in cursor.execute(\"SELECT * FROM Malts WHERE recipe_name='%s'\" %\n", "cursor.execute(\n 'CREATE TABLE HopDosages (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, minutes INTEGER, gramms REAL, recipe_name TEXT)'\n )\n", "connection.commit()\n", "cursor.execute('INSERT INTO Malts(name, gramms, recipe_name) VALUES(?, ?, ?)',\n (malt_name, malt_gramms, recipe.name))\n", "index = 0\n", "recipe.malts[malt_row[1]] = malt_row[2]\n", "for rest_row in cursor.execute(\n", "for rest in recipe.rests:\n", "recipe.rests.append(Rest(rest_row[1], rest_row[2], rest_row[3]))\n", "for hop_dosage_row in cursor.execute(\n", "cursor.execute(\n 'INSERT INTO Rests(name, degrees, minutes, position, recipe_name) VALUES(?, ?, ?, ?, ?)'\n , (rest.name, rest.degrees, rest.minutes, index, recipe.name))\n", "for hop_dosage in recipe.hop_dosages:\n", "recipe.hop_dosages.append(HopDosage(hop_dosage_row[1], hop_dosage_row[3],\n hop_dosage_row[2]))\n", "recipes.append(recipe)\n", "index = index + 1\n", "cursor.execute(\n 'INSERT INTO HopDosages(name, minutes, gramms, recipe_name) VALUES(?, ?, ?, ?)'\n , (hop_dosage.name, hop_dosage.minutes, hop_dosage.gramms, recipe.name))\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, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Condition", "Condition", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Return'", "Expr'", "Condition", "For", "Expr'", "Return'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "For", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Return'", "Expr'", "Condition", "Expr'", "For", "For", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "For", "For", "Expr'", "For", "Expr'", "For", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_3, VAR_4):...\n", "self._user_id = VAR_3\n", "self._leap_home = VAR_4\n", "self._uuid = str(VAR_1.uuid4())\n", "self._mail_address = '%[email protected]' % VAR_3\n", "self._soledad = None\n", "self._services = None\n" ]
[ "def __init__(self, user_id, leap_home):...\n", "self._user_id = user_id\n", "self._leap_home = leap_home\n", "self._uuid = str(uuid.uuid4())\n", "self._mail_address = '%[email protected]' % user_id\n", "self._soledad = None\n", "self._services = None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "@staticmethod...\n", "VAR_2 = VAR_2.replace('A', 'Ā', VAR_1)\n", "VAR_2 = VAR_2.replace('A', 'Ă', VAR_1)\n", "VAR_2 = VAR_2.replace('A', 'Ą', VAR_1)\n", "VAR_2 = VAR_2.replace('a', 'α', VAR_1)\n", "VAR_2 = VAR_2.replace('e', 'е', VAR_1)\n", "VAR_2 = VAR_2.replace('a', 'а', VAR_1)\n", "VAR_2 = VAR_2.replace('e', 'ё', VAR_1)\n", "VAR_2 = VAR_2.replace('o', 'о', VAR_1)\n", "return VAR_2\n" ]
[ "@staticmethod...\n", "s = s.replace('A', 'Ā', cnt)\n", "s = s.replace('A', 'Ă', cnt)\n", "s = s.replace('A', 'Ą', cnt)\n", "s = s.replace('a', 'α', cnt)\n", "s = s.replace('e', 'е', cnt)\n", "s = s.replace('a', 'а', cnt)\n", "s = s.replace('e', 'ё', cnt)\n", "s = s.replace('o', 'о', cnt)\n", "return s\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_18, errors.BAD_USERNAME, *VAR_15, **kw)\n" ]
[ "def __init__(self, item, *a, **kw):...\n", "VRequired.__init__(self, item, errors.BAD_USERNAME, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_17(self, VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "self._eql_execute('volume', 'select', VAR_18['volume_name'], 'snapshot',\n 'delete', VAR_18['name'])\n", "VAR_0.error(_('Failed to delete snapshot %(snap)s of volume %(vol)s'), {\n 'snap': VAR_18['name'], 'vol': VAR_18['volume_name']})\n" ]
[ "def delete_snapshot(self, snapshot):...\n", "\"\"\"docstring\"\"\"\n", "self._eql_execute('volume', 'select', snapshot['volume_name'], 'snapshot',\n 'delete', snapshot['name'])\n", "LOG.error(_('Failed to delete snapshot %(snap)s of volume %(vol)s'), {\n 'snap': snapshot['name'], 'vol': snapshot['volume_name']})\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'" ]
[ "def FUNC_22(self):...\n", "\"\"\"docstring\"\"\"\n", "tournament.registerPlayer(VAR_1='James')\n" ]
[ "def test_name_first_and_last(self):...\n", "\"\"\"docstring\"\"\"\n", "tournament.registerPlayer(player_name='James')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['cluster_options']:\n", "for opt in self.config['cluster_options']:\n", "VAR_32 = False\n", "for option in self.clusters[opt.cluster].options:\n", "if opt.name == option.name:\n", "if not VAR_32:\n", "VAR_32 = True\n", "self._exit('Unknown option provided: %s.%s' % (opt.cluster, opt.name))\n", "option.value = self._validate_option(option, opt)\n" ]
[ "def _parse_options(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['cluster_options']:\n", "for opt in self.config['cluster_options']:\n", "match = False\n", "for option in self.clusters[opt.cluster].options:\n", "if opt.name == option.name:\n", "if not match:\n", "match = True\n", "self._exit('Unknown option provided: %s.%s' % (opt.cluster, opt.name))\n", "option.value = self._validate_option(option, opt)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "For", "Assign'", "For", "Condition", "Condition", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_0(VAR_2='cert_db.sqlite3'):...\n", "" ]
[ "def create_connection(db_name='cert_db.sqlite3'):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@VAR_1.route('/upload', methods=['POST'])...\n", "if not 'email' in VAR_18 and not 'social' in VAR_18:\n", "return '', 401\n", "if 'email' in VAR_18:\n", "VAR_12 = VAR_18['email']\n", "if 'social' in VAR_18:\n", "VAR_11 = request.files['file']\n", "VAR_12 = VAR_18['social']\n", "VAR_4 = ''\n", "if VAR_11 and FUNC_1(VAR_11.filename):\n", "VAR_4 = secure_filename(VAR_11.filename)\n", "flash('Invalid file')\n", "VAR_10 = os.path.join(VAR_1.config['UPLOAD_FOLDER'], VAR_12)\n", "return redirect('/openFile')\n", "os.makedirs(VAR_10, exist_ok=True)\n", "VAR_11.save(os.path.join(VAR_10, VAR_4))\n", "VAR_18['currentFile'] = VAR_4\n", "if 'diagram' in request.referrer:\n", "return redirect('/diagram?filename=%s' % VAR_4)\n", "return redirect('/?filename=%s' % VAR_4)\n" ]
[ "@app.route('/upload', methods=['POST'])...\n", "if not 'email' in session and not 'social' in session:\n", "return '', 401\n", "if 'email' in session:\n", "email = session['email']\n", "if 'social' in session:\n", "file = request.files['file']\n", "email = session['social']\n", "filename = ''\n", "if file and allowed_file(file.filename):\n", "filename = secure_filename(file.filename)\n", "flash('Invalid file')\n", "userpath = os.path.join(app.config['UPLOAD_FOLDER'], email)\n", "return redirect('/openFile')\n", "os.makedirs(userpath, exist_ok=True)\n", "file.save(os.path.join(userpath, filename))\n", "session['currentFile'] = filename\n", "if 'diagram' in request.referrer:\n", "return redirect('/diagram?filename=%s' % filename)\n", "return redirect('/?filename=%s' % filename)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Return'", "Expr'", "Expr'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1():...\n", "from optparse import OptionParser\n", "VAR_15 = OptionParser(VAR_0=usage)\n", "VAR_15.add_option('-v', '--verbose', default=0, action='count', help=\n 'Increment test verbosity (can be used multiple times)')\n", "VAR_15.add_option('-d', '--debug', action='store_true', default=False, help\n ='Print debugging items')\n", "VAR_15.add_option('-t', '--test', help='Run only the named test')\n", "VAR_16, VAR_17 = VAR_15.parse_args()\n", "if VAR_23(VAR_17) > 1:\n", "VAR_15.error(\n 'Only one argument is allowed. Do you need quotes around the connection string?'\n )\n", "if not VAR_17:\n", "VAR_11 = load_setup_connection_string('sqlitetests')\n", "VAR_11 = VAR_17[0]\n", "if not VAR_11:\n", "if VAR_16.verbose:\n", "VAR_15.print_help()\n", "VAR_36 = pyodbc.connect(VAR_11)\n", "VAR_18 = load_tests(CLASS_0, VAR_16.test, VAR_11)\n", "print_library_info(VAR_36)\n", "VAR_19 = unittest.TextTestRunner(verbosity=options.verbose)\n", "VAR_36.close()\n", "VAR_20 = VAR_19.run(VAR_18)\n", "sys.exit(VAR_20.errors and 1 or 0)\n" ]
[ "def main():...\n", "from optparse import OptionParser\n", "parser = OptionParser(usage=usage)\n", "parser.add_option('-v', '--verbose', default=0, action='count', help=\n 'Increment test verbosity (can be used multiple times)')\n", "parser.add_option('-d', '--debug', action='store_true', default=False, help\n ='Print debugging items')\n", "parser.add_option('-t', '--test', help='Run only the named test')\n", "options, args = parser.parse_args()\n", "if len(args) > 1:\n", "parser.error(\n 'Only one argument is allowed. Do you need quotes around the connection string?'\n )\n", "if not args:\n", "connection_string = load_setup_connection_string('sqlitetests')\n", "connection_string = args[0]\n", "if not connection_string:\n", "if options.verbose:\n", "parser.print_help()\n", "cnxn = pyodbc.connect(connection_string)\n", "suite = load_tests(SqliteTestCase, options.test, connection_string)\n", "print_library_info(cnxn)\n", "testRunner = unittest.TextTestRunner(verbosity=options.verbose)\n", "cnxn.close()\n", "result = testRunner.run(suite)\n", "sys.exit(result.errors and 1 or 0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "@handler.post(handler.JSON, handler.JSON)...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.request.get('idToken')\n", "VAR_2 = datetime.timedelta(days=SESSION_EXPIRY_DAYS)\n", "VAR_4 = auth.create_session_cookie(VAR_1, VAR_2)\n", "VAR_3 = datetime.datetime.now() + VAR_2\n", "self.response.set_cookie('session', VAR_4, VAR_3=expires, httponly=True,\n secure=True, overwrite=True)\n", "self.render_json({'status': 'success'})\n" ]
[ "@handler.post(handler.JSON, handler.JSON)...\n", "\"\"\"docstring\"\"\"\n", "id_token = self.request.get('idToken')\n", "expires_in = datetime.timedelta(days=SESSION_EXPIRY_DAYS)\n", "session_cookie = auth.create_session_cookie(id_token, expires_in)\n", "expires = datetime.datetime.now() + expires_in\n", "self.response.set_cookie('session', session_cookie, expires=expires,\n httponly=True, secure=True, overwrite=True)\n", "self.render_json({'status': 'success'})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@handled_slot(bool)...\n", "self.log_area.clear()\n" ]
[ "@handled_slot(bool)...\n", "self.log_area.clear()\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]