lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_0(self):...\n", "VAR_0 = Section('some_name')\n", "self.uut = Lint(VAR_0, None)\n" ]
[ "def setUp(self):...\n", "section = Section('some_name')\n", "self.uut = Lint(section, None)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def __init__(self):...\n", "self.updated_input = set()\n", "self.updated_input_run = set()\n", "self.missing_output = set()\n", "self.incomplete_output = set()\n", "self.forced = False\n", "self.noio = False\n", "self.nooutput = False\n", "self.derived = True\n" ]
[ "def __init__(self):...\n", "self.updated_input = set()\n", "self.updated_input_run = set()\n", "self.missing_output = set()\n", "self.incomplete_output = set()\n", "self.forced = False\n", "self.noio = False\n", "self.nooutput = False\n", "self.derived = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_26(VAR_16, VAR_22, VAR_17):...\n", "VAR_53 = (\n \"select date from ranks where scene='{}' and player='{}' order by date desc limit 1;\"\n .format(VAR_22, VAR_17))\n", "VAR_54 = VAR_16.exec(VAR_53)\n", "VAR_23 = VAR_54[0][0]\n", "return VAR_23\n" ]
[ "def get_last_ranked_month(db, scene, player):...\n", "sql = (\n \"select date from ranks where scene='{}' and player='{}' order by date desc limit 1;\"\n .format(scene, player))\n", "res = db.exec(sql)\n", "date = res[0][0]\n", "return date\n" ]
[ 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_17(self):...\n", "def FUNC_23(VAR_11):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ "def test_get_output(self):...\n", "def _fake_recv(ignore_arg):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_7):...\n", "return VAR_7.encode(VAR_3)\n" ]
[ "def output(what):...\n", "return what.encode(ENCODING)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[['DocType', 'name', 'like', 'J%']]))\n" ]
[ "def test_filters_1(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[['DocType', 'name', 'like', 'J%']]))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "for VAR_28, VAR_27 in zip(self.output, self.rule.output):\n", "if VAR_28 in self.dynamic_output:\n", "VAR_29 = self.expand_dynamic(VAR_27, VAR_13=self.wildcards, VAR_14=_IOFile.\n dynamic_fill)\n", "yield VAR_28\n", "if not VAR_29:\n", "yield VAR_27\n", "for VAR_28, _ in VAR_29:\n", "yield IOFile(VAR_28, self.rule)\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "for f, f_ in zip(self.output, self.rule.output):\n", "if f in self.dynamic_output:\n", "expansion = self.expand_dynamic(f_, restriction=self.wildcards, omit_value=\n _IOFile.dynamic_fill)\n", "yield f\n", "if not expansion:\n", "yield f_\n", "for f, _ in expansion:\n", "yield IOFile(f, self.rule)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7 ]
[ "Condition", "Docstring", "For", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "For", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_18 = self.common.create_volume_from_snapshot(VAR_6, VAR_8)\n", "self.common.client_logout()\n", "return {'metadata': VAR_18}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@functools.wraps(VAR_1)...\n", "if g.user is None:\n", "return redirect(url_for('auth.login'))\n", "if g.user['admin'] != 1:\n", "return redirect(url_for('blog.feedpage', VAR_3=0))\n", "return VAR_1(**kwargs)\n" ]
[ "@functools.wraps(view)...\n", "if g.user is None:\n", "return redirect(url_for('auth.login'))\n", "if g.user['admin'] != 1:\n", "return redirect(url_for('blog.feedpage', page=0))\n", "return view(**kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_8(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['volumeName'] = VAR_10['name']\n", "VAR_5['prompt'] = 'false'\n", "VAR_27 = self._cliq_get_volume_info(VAR_10['name'])\n", "VAR_0.error('Volume did not exist. It will not be deleted')\n", "self._cliq_run_xml('deleteVolume', VAR_5)\n", "return\n" ]
[ "def delete_volume(self, volume):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['volumeName'] = volume['name']\n", "cliq_args['prompt'] = 'false'\n", "volume_info = self._cliq_get_volume_info(volume['name'])\n", "LOG.error('Volume did not exist. It will not be deleted')\n", "self._cliq_run_xml('deleteVolume', cliq_args)\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = pq.backends.IBMBackend(**self.filter_kwargs_for_backend(self.kwargs))\n", "self.eng = pq.MainEngine(VAR_18, engine_list=pq.setups.ibm.get_engine_list())\n", "super().reset()\n" ]
[ "def reset(self):...\n", "\"\"\"docstring\"\"\"\n", "backend = pq.backends.IBMBackend(**self.filter_kwargs_for_backend(self.kwargs))\n", "self.eng = pq.MainEngine(backend, engine_list=pq.setups.ibm.get_engine_list())\n", "super().reset()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "import copy\n", "from operator import itemgetter\n", "from openerp.osv import fields, orm, osv\n", "from openerp.tools import DEFAULT_SERVER_DATE_FORMAT\n", "from tools.safe_eval import safe_eval\n", "from openerp.tools.translate import _\n", "\"\"\" Budget Item\n\n This is a link between budgets and financial accounts. \"\"\"\n", "VAR_0 = 'budget.item'\n", "VAR_1 = 'Budget items'\n", "VAR_2 = 'sequence ASC, name ASC'\n", "VAR_3 = {'code': fields.char('Code', required=True), 'name': fields.char(\n 'Name', required=True), 'active': fields.boolean('Active'), 'parent_id':\n fields.many2one('budget.item', string='Parent Item', ondelete='cascade'\n ), 'children_ids': fields.one2many('budget.item', 'parent_id', string=\n 'Children Items'), 'account': fields.many2many('account.account',\n string='Financial Account'), 'note': fields.text('Notes'),\n 'calculation': fields.text('Calculation'), 'type': fields.selection([(\n 'view', 'View'), ('normal', 'Normal')], string='Type', required=True),\n 'sequence': fields.integer('Sequence'), 'style': fields.selection([(\n 'normal', 'Normal'), ('bold', 'Bold'), ('invisible', 'Invisible')],\n string='Style', required=True)}\n", "VAR_4 = {'active': True, 'type': 'normal', 'style': 'normal'}\n", "def FUNC_0(self, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12,...\n", "\"\"\"docstring\"\"\"\n", "if VAR_13 is None:\n", "VAR_13 = {}\n", "VAR_30 = self.pool.get('budget.line')\n", "VAR_31 = VAR_30.filter_by_items(VAR_5, VAR_6, VAR_9, [VAR_7], VAR_13=context)\n", "VAR_32 = VAR_30.get_analytic_accounts(VAR_5, VAR_6, VAR_31, VAR_10, VAR_13=\n context)\n", "VAR_33 = self.get_accounts(VAR_5, VAR_6, [VAR_7], VAR_10, VAR_13=context)\n", "VAR_34 = None\n", "VAR_35 = None\n", "for period in VAR_8:\n", "if VAR_34 is None or VAR_34 > period.date_start:\n", "VAR_36 = self.pool.get('account.analytic.line')\n", "VAR_34 = period.date_start\n", "if VAR_35 is None or VAR_35 < period.date_stop:\n", "VAR_37 = VAR_36.search(VAR_5, VAR_6, [('date', '>=', VAR_34), ('date', '<=',\n VAR_35), ('general_account_id', 'in', VAR_33), ('account_id', 'in',\n VAR_32)], VAR_13=context)\n", "VAR_35 = period.date_stop\n", "VAR_38 = VAR_36.browse(VAR_5, VAR_6, VAR_37, VAR_13=context)\n", "VAR_39 = 0\n", "VAR_40 = self.pool.get('res.currency')\n", "VAR_41 = VAR_13.copy()\n", "VAR_41['date'] = VAR_12.strptime(DEFAULT_SERVER_DATE_FORMAT)\n", "for line in VAR_38:\n", "VAR_59 = line.general_account_id.company_id.currency_id.id\n", "return VAR_39\n", "VAR_39 += VAR_40.compute(VAR_5, VAR_6, VAR_59, VAR_11, line.amount, VAR_13=ctx)\n" ]
[ "import copy\n", "from operator import itemgetter\n", "from openerp.osv import fields, orm, osv\n", "from openerp.tools import DEFAULT_SERVER_DATE_FORMAT\n", "from tools.safe_eval import safe_eval\n", "from openerp.tools.translate import _\n", "\"\"\" Budget Item\n\n This is a link between budgets and financial accounts. \"\"\"\n", "_name = 'budget.item'\n", "_description = 'Budget items'\n", "_order = 'sequence ASC, name ASC'\n", "_columns = {'code': fields.char('Code', required=True), 'name': fields.char\n ('Name', required=True), 'active': fields.boolean('Active'),\n 'parent_id': fields.many2one('budget.item', string='Parent Item',\n ondelete='cascade'), 'children_ids': fields.one2many('budget.item',\n 'parent_id', string='Children Items'), 'account': fields.many2many(\n 'account.account', string='Financial Account'), 'note': fields.text(\n 'Notes'), 'calculation': fields.text('Calculation'), 'type': fields.\n selection([('view', 'View'), ('normal', 'Normal')], string='Type',\n required=True), 'sequence': fields.integer('Sequence'), 'style': fields\n .selection([('normal', 'Normal'), ('bold', 'Bold'), ('invisible',\n 'Invisible')], string='Style', required=True)}\n", "_defaults = {'active': True, 'type': 'normal', 'style': 'normal'}\n", "def get_real_values_from_analytic_accounts(self, cr, uid, item_id, periods,...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "budget_line_obj = self.pool.get('budget.line')\n", "budget_lines = budget_line_obj.filter_by_items(cr, uid, lines, [item_id],\n context=context)\n", "aa_ids = budget_line_obj.get_analytic_accounts(cr, uid, budget_lines,\n company_id, context=context)\n", "general_accounts_ids = self.get_accounts(cr, uid, [item_id], company_id,\n context=context)\n", "start_date = None\n", "end_date = None\n", "for period in periods:\n", "if start_date is None or start_date > period.date_start:\n", "aa_lines_obj = self.pool.get('account.analytic.line')\n", "start_date = period.date_start\n", "if end_date is None or end_date < period.date_stop:\n", "aa_lines_ids = aa_lines_obj.search(cr, uid, [('date', '>=', start_date), (\n 'date', '<=', end_date), ('general_account_id', 'in',\n general_accounts_ids), ('account_id', 'in', aa_ids)], context=context)\n", "end_date = period.date_stop\n", "aa_lines = aa_lines_obj.browse(cr, uid, aa_lines_ids, context=context)\n", "result = 0\n", "currency_obj = self.pool.get('res.currency')\n", "ctx = context.copy()\n", "ctx['date'] = change_date.strptime(DEFAULT_SERVER_DATE_FORMAT)\n", "for line in aa_lines:\n", "from_ccy_id = line.general_account_id.company_id.currency_id.id\n", "return result\n", "result += currency_obj.compute(cr, uid, from_ccy_id, currency_id, line.\n amount, context=ctx)\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 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "AugAssign'" ]
[ "import time\n", "import mox\n", "import paramiko\n", "from cinder import context\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder.openstack.common import processutils\n", "from cinder import test\n", "from cinder.volume import configuration as conf\n", "from cinder.volume.drivers import eqlx\n", "VAR_0 = logging.getLogger(__name__)\n", "def FUNC_0(self):...\n", "super(CLASS_0, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\n", "def FUNC_1(self, VAR_1):...\n", "return self.properties\n" ]
[ "import time\n", "import mox\n", "import paramiko\n", "from cinder import context\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder.openstack.common import processutils\n", "from cinder import test\n", "from cinder.volume import configuration as conf\n", "from cinder.volume.drivers import eqlx\n", "LOG = logging.getLogger(__name__)\n", "def setUp(self):...\n", "super(DellEQLSanISCSIDriverTestCase, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\n", "def _fake_get_iscsi_properties(self, volume):...\n", "return self.properties\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 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_4(VAR_30):...\n", "VAR_39 = 'meal_planner.db'\n", "VAR_50 = 'ingredients_' + str(VAR_13)\n", "conn.execute('CREATE TABLE IF NOT EXISTS ' + VAR_50 + ' (ingredients text)')\n", "conn.execute('INSERT INTO ' + VAR_50 + ' VALUES (?);', (VAR_30,))\n" ]
[ "def save_ingredients(ingredients):...\n", "database_file = 'meal_planner.db'\n", "tableName = 'ingredients_' + str(weekNumber)\n", "conn.execute('CREATE TABLE IF NOT EXISTS ' + tableName + ' (ingredients text)')\n", "conn.execute('INSERT INTO ' + tableName + ' VALUES (?);', (ingredients,))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@property...\n", "return self.type == 'HH'\n" ]
[ "@property...\n", "return self.type == 'HH'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@classmethod...\n", "def FUNC_25(VAR_3, VAR_6):...\n", "VAR_38 = FUNC_1(VAR_3)\n", "VAR_45, VAR_41 = VAR_38.accept()\n", "return Connection(VAR_45, VAR_38)\n" ]
[ "@classmethod...\n", "def connect(addr, timeout):...\n", "server = create_server(addr)\n", "client, _ = server.accept()\n", "return Connection(client, server)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_0.route('/processing')...\n", "VAR_16 = time.time()\n", "VAR_17 = VAR_10.get('domain', None)\n", "if VAR_17 == None:\n", "VAR_18 = 'data/%s' % (VAR_17,)\n", "VAR_19 = path_dict(VAR_18)\n", "VAR_20 = json.dumps(VAR_19, sort_keys=True, indent=4)\n", "VAR_21 = path_number_of_files(VAR_18)\n", "VAR_10['n_files'] = VAR_21\n", "VAR_22, VAR_23, VAR_24 = pdf_stats(VAR_18, VAR_3)\n", "VAR_10['n_error'] = VAR_23\n", "VAR_10['n_success'] = VAR_24\n", "VAR_25 = json.dumps(VAR_22, sort_keys=True, indent=4)\n", "VAR_10['stats'] = VAR_25\n", "VAR_26 = time.time()\n", "VAR_27 = VAR_26 - VAR_16\n", "VAR_28 = VAR_1.connection.cursor()\n", "VAR_28.execute('string', (VAR_21, VAR_24, VAR_23, VAR_17, VAR_10.get('url',\n None), VAR_20, VAR_25, VAR_10.get('crawl_total_time', None), VAR_27))\n", "VAR_1.connection.commit()\n", "VAR_28.close()\n", "return render_template('processing.html', VAR_21=n_success, VAR_17=domain,\n VAR_7=0)\n" ]
[ "@app.route('/processing')...\n", "proc_start_time = time.time()\n", "domain = session.get('domain', None)\n", "if domain == None:\n", "path = 'data/%s' % (domain,)\n", "hierarchy_dict = path_dict(path)\n", "hierarchy_json = json.dumps(hierarchy_dict, sort_keys=True, indent=4)\n", "n_files = path_number_of_files(path)\n", "session['n_files'] = n_files\n", "stats, n_error, n_success = pdf_stats(path, PDF_TO_PROCESS)\n", "session['n_error'] = n_error\n", "session['n_success'] = n_success\n", "stats_json = json.dumps(stats, sort_keys=True, indent=4)\n", "session['stats'] = stats_json\n", "proc_over_time = time.time()\n", "proc_total_time = proc_over_time - proc_start_time\n", "cur = mysql.connection.cursor()\n", "cur.execute(\n 'INSERT INTO Crawls(cid, crawl_date, pdf_crawled, pdf_processed, process_errors, domain, url, hierarchy, stats, crawl_total_time, proc_total_time) VALUES(NULL, NULL, %s ,%s, %s, %s, %s, %s, %s, %s, %s)'\n , (n_files, n_success, n_error, domain, session.get('url', None),\n hierarchy_json, stats_json, session.get('crawl_total_time', None),\n proc_total_time))\n", "mysql.connection.commit()\n", "cur.close()\n", "return render_template('processing.html', n_files=n_success, domain=domain,\n cid=0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_15(self, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "return CLASS_0(self, VAR_6)\n" ]
[ "def create(self, products):...\n", "\"\"\"docstring\"\"\"\n", "return Zinc(self, products)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def __init__(self, VAR_0):...\n", "self.__conn = VAR_0\n" ]
[ "def __init__(self, conn):...\n", "self.__conn = conn\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "\"\"\"\nConfiguration (file) handling for eduID IdP.\n\"\"\"\n", "import os\n", "import ConfigParser\n", "VAR_0 = {'debug': False, 'syslog_debug': '0', 'num_threads': '8', 'logdir':\n None, 'logfile': None, 'syslog_socket': None, 'listen_addr': '0.0.0.0',\n 'listen_port': '8088', 'pysaml2_config': 'idp_conf.py',\n 'fticks_secret_key': None, 'fticks_format_string':\n 'F-TICKS/SWAMID/2.0#TS={ts}#RP={rp}#AP={ap}#PN={pn}#AM={am}#',\n 'static_dir': None, 'ssl_adapter': 'builtin', 'server_cert': None,\n 'server_key': None, 'cert_chain': None, 'userdb_mongo_uri': None,\n 'userdb_mongo_database': None, 'sso_session_lifetime': '15',\n 'sso_session_mongo_uri': None, 'raven_dsn': None, 'content_packages': [\n ], 'verify_request_signatures': '0', 'status_test_usernames': [],\n 'signup_link': '#', 'dashboard_link': '#', 'password_reset_link': '#',\n 'default_language': 'en', 'base_url': None, 'default_eppn_scope': None,\n 'authn_info_mongo_uri': None, 'max_authn_failures_per_month': '50',\n 'login_state_ttl': '5', 'default_scoped_affiliation': None, 'vccs_url':\n 'http://localhost:8550/', 'insecure_cookies': '0'}\n", "VAR_1 = 'eduid_idp'\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_2, VAR_3):...\n", "self._parsed_content_packages = None\n", "self._parsed_status_test_usernames = None\n", "self.section = VAR_1\n", "VAR_0['debug'] = str(VAR_3)\n", "VAR_4 = os.path.dirname(VAR_2)\n", "VAR_0['pysaml2_config'] = os.path.join(VAR_4, VAR_0['pysaml2_config'])\n", "self.config = ConfigParser.ConfigParser(VAR_0)\n", "if not self.config.read([VAR_2]):\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getint(self.section, 'num_threads')\n" ]
[ "\"\"\"\nConfiguration (file) handling for eduID IdP.\n\"\"\"\n", "import os\n", "import ConfigParser\n", "_CONFIG_DEFAULTS = {'debug': False, 'syslog_debug': '0', 'num_threads': '8',\n 'logdir': None, 'logfile': None, 'syslog_socket': None, 'listen_addr':\n '0.0.0.0', 'listen_port': '8088', 'pysaml2_config': 'idp_conf.py',\n 'fticks_secret_key': None, 'fticks_format_string':\n 'F-TICKS/SWAMID/2.0#TS={ts}#RP={rp}#AP={ap}#PN={pn}#AM={am}#',\n 'static_dir': None, 'ssl_adapter': 'builtin', 'server_cert': None,\n 'server_key': None, 'cert_chain': None, 'userdb_mongo_uri': None,\n 'userdb_mongo_database': None, 'sso_session_lifetime': '15',\n 'sso_session_mongo_uri': None, 'raven_dsn': None, 'content_packages': [\n ], 'verify_request_signatures': '0', 'status_test_usernames': [],\n 'signup_link': '#', 'dashboard_link': '#', 'password_reset_link': '#',\n 'default_language': 'en', 'base_url': None, 'default_eppn_scope': None,\n 'authn_info_mongo_uri': None, 'max_authn_failures_per_month': '50',\n 'login_state_ttl': '5', 'default_scoped_affiliation': None, 'vccs_url':\n 'http://localhost:8550/', 'insecure_cookies': '0'}\n", "_CONFIG_SECTION = 'eduid_idp'\n", "\"\"\"\n Class holding IdP application configuration.\n\n Loads configuration from an INI-file at instantiation.\n\n :param filename: string, INI-file name\n :param debug: boolean, default debug value\n :raise ValueError: if INI-file can't be parsed\n \"\"\"\n", "def __init__(self, filename, debug):...\n", "self._parsed_content_packages = None\n", "self._parsed_status_test_usernames = None\n", "self.section = _CONFIG_SECTION\n", "_CONFIG_DEFAULTS['debug'] = str(debug)\n", "cfgdir = os.path.dirname(filename)\n", "_CONFIG_DEFAULTS['pysaml2_config'] = os.path.join(cfgdir, _CONFIG_DEFAULTS[\n 'pysaml2_config'])\n", "self.config = ConfigParser.ConfigParser(_CONFIG_DEFAULTS)\n", "if not self.config.read([filename]):\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getint(self.section, 'num_threads')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Docstring", "Return'" ]
[ "def __repr__(self):...\n", "return json_encode(self, sort_keys=True)\n" ]
[ "def __repr__(self):...\n", "return json_encode(self, sort_keys=True)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_2 = '/api/apps'\n", "VAR_5 = {'id': 'autotest'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "if not os.path.exists(settings.DEIS_LOG_DIR):\n", "os.mkdir(settings.DEIS_LOG_DIR)\n", "VAR_6 = os.path.join(settings.DEIS_LOG_DIR, VAR_4 + '.log')\n", "if os.path.exists(VAR_6):\n", "os.remove(VAR_6)\n", "VAR_2 = '/api/apps/{app_id}/logs'.format(**locals())\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 204)\n", "self.assertEqual(VAR_3.data, 'No logs for {}'.format(VAR_4))\n", "f.write(VAR_0)\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertEqual(VAR_3.data, VAR_0)\n", "os.remove(VAR_6)\n", "VAR_2 = '/api/apps/{app_id}/run'.format(**locals())\n", "VAR_5 = {'command': 'ls -al'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertEqual(VAR_3.data[0], 0)\n", "os.remove(VAR_6)\n" ]
[ "def test_app_actions(self):...\n", "url = '/api/apps'\n", "body = {'id': 'autotest'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "if not os.path.exists(settings.DEIS_LOG_DIR):\n", "os.mkdir(settings.DEIS_LOG_DIR)\n", "path = os.path.join(settings.DEIS_LOG_DIR, app_id + '.log')\n", "if os.path.exists(path):\n", "os.remove(path)\n", "url = '/api/apps/{app_id}/logs'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 204)\n", "self.assertEqual(response.data, 'No logs for {}'.format(app_id))\n", "f.write(FAKE_LOG_DATA)\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(response.data, FAKE_LOG_DATA)\n", "os.remove(path)\n", "url = '/api/apps/{app_id}/run'.format(**locals())\n", "body = {'command': 'ls -al'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(response.data[0], 0)\n", "os.remove(path)\n" ]
[ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(self.fields, string_types):\n", "if self.fields == '*':\n", "for filter_name in ['filters', 'or_filters']:\n", "self.fields = ['*']\n", "self.fields = json.loads(self.fields)\n", "self.fields = [VAR_34.strip() for VAR_34 in self.fields.split(',')]\n", "VAR_4 = getattr(self, filter_name)\n", "if isinstance(VAR_4, string_types):\n", "VAR_4 = json.loads(VAR_4)\n", "if isinstance(VAR_4, dict):\n", "VAR_66 = VAR_4\n", "setattr(self, filter_name, VAR_4)\n", "VAR_4 = []\n", "for key, VAR_5 in iteritems(VAR_66):\n", "VAR_4.append(make_filter_tuple(self.doctype, key, VAR_5))\n" ]
[ "def parse_args(self):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(self.fields, string_types):\n", "if self.fields == '*':\n", "for filter_name in ['filters', 'or_filters']:\n", "self.fields = ['*']\n", "self.fields = json.loads(self.fields)\n", "self.fields = [f.strip() for f in self.fields.split(',')]\n", "filters = getattr(self, filter_name)\n", "if isinstance(filters, string_types):\n", "filters = json.loads(filters)\n", "if isinstance(filters, dict):\n", "fdict = filters\n", "setattr(self, filter_name, filters)\n", "filters = []\n", "for key, value in iteritems(fdict):\n", "filters.append(make_filter_tuple(self.doctype, key, value))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "For", "Expr'" ]
[ "def FUNC_1(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_5['id'] in self.table_maps['confirmations']:\n", "VAR_45 = self.table_maps['confirmations'][VAR_5['id']][0]\n", "VAR_45 = None\n", "VAR_21 = [('customer response recieved', self._val_to_str(bool(VAR_45)))]\n", "for field_name in self.customerresponse_fields:\n", "if field_name in ['win']:\n", "return VAR_21\n", "VAR_46 = self._get_customerresponse_field(field_name)\n", "if VAR_45:\n", "if VAR_46.choices:\n", "VAR_14 = ''\n", "VAR_53 = getattr(VAR_45, 'get_{0}_display'.format(field_name))\n", "VAR_14 = getattr(VAR_45, field_name)\n", "VAR_47 = VAR_46.verbose_name or VAR_46.name\n", "VAR_14 = VAR_53()\n", "if VAR_47 == 'created':\n", "VAR_50 = 'date response received'\n", "VAR_50 = VAR_47\n", "if VAR_14:\n", "VAR_21.append((VAR_50, self._val_to_str(VAR_14)))\n", "VAR_14 = VAR_14.date()\n" ]
[ "def _confirmation(self, win):...\n", "\"\"\"docstring\"\"\"\n", "if win['id'] in self.table_maps['confirmations']:\n", "confirmation = self.table_maps['confirmations'][win['id']][0]\n", "confirmation = None\n", "values = [('customer response recieved', self._val_to_str(bool(confirmation)))]\n", "for field_name in self.customerresponse_fields:\n", "if field_name in ['win']:\n", "return values\n", "model_field = self._get_customerresponse_field(field_name)\n", "if confirmation:\n", "if model_field.choices:\n", "value = ''\n", "display_fn = getattr(confirmation, 'get_{0}_display'.format(field_name))\n", "value = getattr(confirmation, field_name)\n", "model_field_name = model_field.verbose_name or model_field.name\n", "value = display_fn()\n", "if model_field_name == 'created':\n", "csv_field_name = 'date response received'\n", "csv_field_name = model_field_name\n", "if value:\n", "values.append((csv_field_name, self._val_to_str(value)))\n", "value = value.date()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_14(self):...\n", "VAR_35 = {}\n", "VAR_36 = self.configuration.safe_get('volume_backend_name')\n", "VAR_35['volume_backend_name'] = VAR_36 or self.__class__.__name__\n", "VAR_35['driver_version'] = '1.0'\n", "VAR_35['reserved_percentage'] = 0\n", "VAR_35['storage_protocol'] = 'iSCSI'\n", "VAR_35['vendor_name'] = 'Hewlett-Packard'\n", "VAR_18 = self._cliq_run_xml('getClusterInfo', {})\n", "VAR_37 = VAR_18.find('response/cluster')\n", "VAR_38 = VAR_37.attrib.get('spaceTotal')\n", "VAR_39 = VAR_37.attrib.get('unprovisionedSpace')\n", "VAR_40 = 1073741824\n", "VAR_35['total_capacity_gb'] = int(VAR_38) / VAR_40\n", "VAR_35['free_capacity_gb'] = int(VAR_39) / VAR_40\n", "self.device_stats = VAR_35\n" ]
[ "def _update_backend_status(self):...\n", "data = {}\n", "backend_name = self.configuration.safe_get('volume_backend_name')\n", "data['volume_backend_name'] = backend_name or self.__class__.__name__\n", "data['driver_version'] = '1.0'\n", "data['reserved_percentage'] = 0\n", "data['storage_protocol'] = 'iSCSI'\n", "data['vendor_name'] = 'Hewlett-Packard'\n", "result_xml = self._cliq_run_xml('getClusterInfo', {})\n", "cluster_node = result_xml.find('response/cluster')\n", "total_capacity = cluster_node.attrib.get('spaceTotal')\n", "free_capacity = cluster_node.attrib.get('unprovisionedSpace')\n", "GB = 1073741824\n", "data['total_capacity_gb'] = int(total_capacity) / GB\n", "data['free_capacity_gb'] = int(free_capacity) / GB\n", "self.device_stats = data\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_20(self, VAR_14):...\n", "" ]
[ "def is_relation_one_to_one(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_52(self):...\n", "VAR_39 = VAR_36.cursor()\n", "VAR_39.execute('begin')\n", "VAR_39.execute('create table t1(i int)')\n", "VAR_39.execute('rollback')\n", "def FUNC_58():...\n", "VAR_36.execute('rollback')\n", "self.assertRaises(pyodbc.Error, FUNC_58)\n" ]
[ "def _test_context_manager(self):...\n", "cursor = cnxn.cursor()\n", "cursor.execute('begin')\n", "cursor.execute('create table t1(i int)')\n", "cursor.execute('rollback')\n", "def test():...\n", "cnxn.execute('rollback')\n", "self.assertRaises(pyodbc.Error, test)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_4():...\n", "populate_test_database()\n", "FUNC_1('first playlist')\n", "VAR_11 = VAR_3.get('/playlists/1')\n", "assert VAR_11.json['status'] == 'OK'\n", "assert VAR_11.json['data'] == dict(id=1, VAR_8='first playlist',\n video_position=0)\n" ]
[ "def test_should_return_a_playlist():...\n", "populate_test_database()\n", "create_playlist('first playlist')\n", "response = test_app.get('/playlists/1')\n", "assert response.json['status'] == 'OK'\n", "assert response.json['data'] == dict(id=1, name='first playlist',\n video_position=0)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assert'", "Assert'" ]
[ "def FUNC_17(self):...\n", "VAR_12.remove(self)\n" ]
[ "def on_close(self):...\n", "runScriptWebSocketConnections.remove(self)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@rest_utils.ajax(data_required=True)...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.DATA.get('removed'):\n", "api.nova.flavor_extra_delete(VAR_1, VAR_5, VAR_1.DATA.get('removed'))\n", "api.nova.flavor_extra_set(VAR_1, VAR_5, VAR_1.DATA['updated'])\n" ]
[ "@rest_utils.ajax(data_required=True)...\n", "\"\"\"docstring\"\"\"\n", "if request.DATA.get('removed'):\n", "api.nova.flavor_extra_delete(request, flavor_id, request.DATA.get('removed'))\n", "api.nova.flavor_extra_set(request, flavor_id, request.DATA['updated'])\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.content_type in ('application/json', 'text/json'):\n", "return VAR_1\n", "VAR_4 = json.loads(VAR_1.body)\n", "if isinstance(VAR_4, (list, tuple)):\n", "VAR_0.warn('string')\n" ]
[ "def filter_json_xsrf(response):...\n", "\"\"\"docstring\"\"\"\n", "if response.content_type in ('application/json', 'text/json'):\n", "return response\n", "content = json.loads(response.body)\n", "if isinstance(content, (list, tuple)):\n", "log.warn(\n 'returning a json array is a potential security whole, please ensure you really want to do this. See http://wiki.pylonshq.com/display/pylonsfaq/Warnings for more info'\n )\n" ]
[ 0, 0, 0, 0, 5, 5, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_3(self, *VAR_21):...\n", "self.first.execute(*VAR_21)\n", "self.first.wait()\n", "self.second.execute(*VAR_21)\n", "self.second.wait()\n" ]
[ "def execute(self, *args):...\n", "self.first.execute(*args)\n", "self.first.wait()\n", "self.second.execute(*args)\n", "self.second.wait()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@property...\n", "for java_dist_dir in self._java_dist_dirs:\n", "if os.path.isdir(java_dist_dir):\n", "for VAR_3 in os.listdir(java_dist_dir):\n", "VAR_24 = os.path.join(java_dist_dir, VAR_3)\n", "if os.path.isdir(VAR_24):\n", "yield self.Location.from_home(VAR_24)\n" ]
[ "@property...\n", "for java_dist_dir in self._java_dist_dirs:\n", "if os.path.isdir(java_dist_dir):\n", "for path in os.listdir(java_dist_dir):\n", "home = os.path.join(java_dist_dir, path)\n", "if os.path.isdir(home):\n", "yield self.Location.from_home(home)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "For", "Condition", "For", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_14(self):...\n", "return self._get_ancestors().values()\n" ]
[ "def get_ancestors(self):...\n", "return self._get_ancestors().values()\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(VAR_1, VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = frozenset(VAR_2)\n", "VAR_7 = VAR_1 - VAR_2\n", "if VAR_7:\n", "VAR_22 = ' missing: %s' % sorted(VAR_7) if VAR_7 else ''\n", "return 'Unexpected %s%s; did you make a typo?' % (VAR_3, VAR_22)\n" ]
[ "def has_missing_keys(minimum_keys, actual_keys, name):...\n", "\"\"\"docstring\"\"\"\n", "actual_keys = frozenset(actual_keys)\n", "missing = minimum_keys - actual_keys\n", "if missing:\n", "msg_missing = ' missing: %s' % sorted(missing) if missing else ''\n", "return 'Unexpected %s%s; did you make a typo?' % (name, msg_missing)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@VAR_47.middleware('response')...\n", "if VAR_51.status == 404 and VAR_6.path.endswith('/'):\n", "VAR_61 = VAR_6.path.rstrip('/')\n", "if VAR_6.query_string:\n", "VAR_61 = '{}?{}'.format(VAR_61, VAR_6.query_string)\n", "return response.redirect(VAR_61)\n" ]
[ "@app.middleware('response')...\n", "if original_response.status == 404 and request.path.endswith('/'):\n", "path = request.path.rstrip('/')\n", "if request.query_string:\n", "path = '{}?{}'.format(path, request.query_string)\n", "return response.redirect(path)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "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_12(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14, VAR_15 = new_monitor_log_file(self._ray_params.redirect_output)\n", "VAR_16 = ray.services.start_monitor(self._redis_address, self.\n _node_ip_address, VAR_14=stdout_file, VAR_15=stderr_file,\n autoscaling_config=self._ray_params.autoscaling_config, redis_password=\n self._ray_params.redis_password)\n", "assert VAR_13.PROCESS_TYPE_MONITOR not in self.all_processes\n", "self.all_processes[VAR_13.PROCESS_TYPE_MONITOR] = [VAR_16]\n" ]
[ "def start_monitor(self):...\n", "\"\"\"docstring\"\"\"\n", "stdout_file, stderr_file = new_monitor_log_file(self._ray_params.\n redirect_output)\n", "process_info = ray.services.start_monitor(self._redis_address, self.\n _node_ip_address, stdout_file=stdout_file, stderr_file=stderr_file,\n autoscaling_config=self._ray_params.autoscaling_config, redis_password=\n self._ray_params.redis_password)\n", "assert ray_constants.PROCESS_TYPE_MONITOR not in self.all_processes\n", "self.all_processes[ray_constants.PROCESS_TYPE_MONITOR] = [process_info]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assert'", "Assign'" ]
[ "def FUNC_4(self):...\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n" ]
[ "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Expr'" ]
[ "from flask import request\n", "import jwt\n", "import re\n", "import os\n", "from base64 import b64encode, b64decode\n", "import HybridRSA\n", "VAR_0 = open('resources/jwt_key', 'rb').read()\n", "VAR_1 = open('resources/jwt_key.pub', 'rb').read()\n", "VAR_2 = 201\n", "VAR_3 = 400\n", "VAR_4 = 404\n", "VAR_5 = int(10000.0)\n", "def FUNC_0(VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "FUNC_5(VAR_6)\n", "VAR_8 = FUNC_6(VAR_6)\n", "VAR_15 = FUNC_7(request.data, VAR_8)\n", "if re.search('[^a-zA-Z0-9]', VAR_15['key']):\n", "VAR_16 = FUNC_9({'key': VAR_22}, VAR_0, VAR_8)\n", "VAR_22 = open('keys/%s/%s.key' % (VAR_6, VAR_15['key']), 'r').read()\n", "return VAR_16\n" ]
[ "from flask import request\n", "import jwt\n", "import re\n", "import os\n", "from base64 import b64encode, b64decode\n", "import HybridRSA\n", "SERVER_JWT_PRIVATE_KEY = open('resources/jwt_key', 'rb').read()\n", "SERVER_JWT_PUBLIC_KEY = open('resources/jwt_key.pub', 'rb').read()\n", "CREATED = 201\n", "BAD_REQUEST = 400\n", "NOT_FOUND = 404\n", "KEY_SIZE_LIMIT = int(10000.0)\n", "def getKey(client):...\n", "\"\"\"docstring\"\"\"\n", "validateClient(client)\n", "client_pub_key = loadClientRSAKey(client)\n", "token_data = decodeRequestToken(request.data, client_pub_key)\n", "if re.search('[^a-zA-Z0-9]', token_data['key']):\n", "keytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY,\n client_pub_key)\n", "requested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read(\n )\n", "return keytoken\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_11(self, VAR_12=None, VAR_13=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_12 and not VAR_13:\n", "VAR_12, VAR_13 = self.model.rowCount() + 1, self.model.rowCount(\n ) + self.model.item_load_batch\n", "if self.filter_input and self.filter_input.text().lower():\n", "VAR_24 = self.filter_input.text().lower()\n", "VAR_24 = ''\n", "VAR_19, VAR_20 = self._get_sort_parameters()\n", "self.request_mgr = TriblerRequestManager()\n", "self.request_mgr.perform_request('mychannel/torrents', self.on_torrents,\n VAR_23={'sort_by': sort_by, 'sort_asc': sort_asc, 'filter':\n to_fts_query(filter_text), 'exclude_deleted': self.model.exclude_deleted})\n" ]
[ "def load_torrents(self, start=None, end=None):...\n", "\"\"\"docstring\"\"\"\n", "if not start and not end:\n", "start, end = self.model.rowCount() + 1, self.model.rowCount(\n ) + self.model.item_load_batch\n", "if self.filter_input and self.filter_input.text().lower():\n", "filter_text = self.filter_input.text().lower()\n", "filter_text = ''\n", "sort_by, sort_asc = self._get_sort_parameters()\n", "self.request_mgr = TriblerRequestManager()\n", "self.request_mgr.perform_request('mychannel/torrents', self.on_torrents,\n url_params={'sort_by': sort_by, 'sort_asc': sort_asc, 'filter':\n to_fts_query(filter_text), 'exclude_deleted': self.model.exclude_deleted})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_20():...\n", "\"\"\"docstring\"\"\"\n", "assert sys.platform == 'linux' or sys.platform == 'linux2'\n", "VAR_48 = VAR_40.open('/dev/shm', VAR_40.O_RDONLY)\n", "VAR_56 = VAR_40.fstatvfs(VAR_48)\n", "VAR_40.close(VAR_48)\n", "return VAR_57\n", "VAR_57 = VAR_56.f_bsize * VAR_56.f_bavail\n" ]
[ "def get_shared_memory_bytes():...\n", "\"\"\"docstring\"\"\"\n", "assert sys.platform == 'linux' or sys.platform == 'linux2'\n", "shm_fd = os.open('/dev/shm', os.O_RDONLY)\n", "shm_fs_stats = os.fstatvfs(shm_fd)\n", "os.close(shm_fd)\n", "return shm_avail\n", "shm_avail = shm_fs_stats.f_bsize * shm_fs_stats.f_bavail\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'" ]
[ "def FUNC_0(VAR_8, VAR_9, VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = VAR_8.components.netatmo\n", "VAR_13 = CLASS_1(VAR_12.NETATMO_AUTH, VAR_9.get(VAR_2, None))\n", "VAR_14 = []\n", "import pyatmo\n", "if VAR_1 in VAR_9:\n", "return None\n", "VAR_10(VAR_14, True)\n", "for VAR_16, monitored_conditions in VAR_9[VAR_1].items():\n", "for VAR_16 in VAR_13.get_module_names():\n", "if VAR_16 not in VAR_13.get_module_names():\n", "for variable in VAR_13.station_data.monitoredConditions(VAR_16):\n", "VAR_0.error('Module name: \"%s\" not found', VAR_16)\n", "for variable in monitored_conditions:\n", "if variable in VAR_5.keys():\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_0.warning('Ignoring unknown var %s for mod %s', variable, VAR_16)\n" ]
[ "def setup_platform(hass, config, add_devices, discovery_info=None):...\n", "\"\"\"docstring\"\"\"\n", "netatmo = hass.components.netatmo\n", "data = NetAtmoData(netatmo.NETATMO_AUTH, config.get(CONF_STATION, None))\n", "dev = []\n", "import pyatmo\n", "if CONF_MODULES in config:\n", "return None\n", "add_devices(dev, True)\n", "for module_name, monitored_conditions in config[CONF_MODULES].items():\n", "for module_name in data.get_module_names():\n", "if module_name not in data.get_module_names():\n", "for variable in data.station_data.monitoredConditions(module_name):\n", "_LOGGER.error('Module name: \"%s\" not found', module_name)\n", "for variable in monitored_conditions:\n", "if variable in SENSOR_TYPES.keys():\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "_LOGGER.warning('Ignoring unknown var %s for mod %s', variable, module_name)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Import'", "Condition", "Return'", "Expr'", "For", "For", "Condition", "For", "Expr'", "For", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_51):...\n", "VAR_81 = VAR_51\n", "VAR_51 = FUNC_3(VAR_51)\n", "if not VAR_51:\n", "return self.error(FUNC_4(VAR_81))\n", "VAR_15 = Account._by_name(VAR_51, True)\n", "return VAR_51\n", "return self.error(errors.USERNAME_TAKEN)\n" ]
[ "def run(self, user_name):...\n", "original_user_name = user_name\n", "user_name = chkuser(user_name)\n", "if not user_name:\n", "return self.error(whyuserbad(original_user_name))\n", "a = Account._by_name(user_name, True)\n", "return user_name\n", "return self.error(errors.USERNAME_TAKEN)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Return'", "Return'" ]
[ "def __init__(self):...\n", "self.content = VAR_2\n" ]
[ "def __init__(self):...\n", "self.content = content\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "import json\n", "from http import HTTPStatus\n", "from urllib.parse import urlencode\n", "from django import test\n", "from django.conf import settings\n", "from django.contrib.contenttypes.models import ContentType\n", "from django.core import serializers\n", "from django.urls import reverse\n", "from django_comments.models import Comment\n", "from tcms.management.models import Priority\n", "from tcms.management.models import EnvGroup\n", "from tcms.management.models import EnvProperty\n", "from tcms.testcases.forms import CaseAutomatedForm\n", "from tcms.testcases.forms import TestCase\n", "from tcms.testplans.models import TestPlan\n", "from tcms.testruns.models import TestCaseRun\n", "from tcms.testruns.models import TestCaseRunStatus\n", "from tcms.tests import BaseCaseRun\n", "from tcms.tests import BasePlanCase\n", "from tcms.tests import remove_perm_from_user\n", "from tcms.tests import user_should_have_perm\n", "from tcms.tests.factories import UserFactory\n", "from tcms.tests.factories import EnvGroupFactory\n", "from tcms.tests.factories import EnvGroupPropertyMapFactory\n", "from tcms.tests.factories import EnvPropertyFactory\n", "@classmethod...\n", "super(CLASS_0, VAR_0).setUpTestData()\n", "VAR_0.user = UserFactory(email='[email protected]')\n", "VAR_0.user.set_password('testing')\n", "VAR_0.user.save()\n", "def FUNC_1(self):...\n", "self.client.login(username=self.user.username, password='testing')\n", "VAR_1 = self.client.get(reverse('iframe-navigation'))\n", "self.assertContains(VAR_1, urlencode({'people': self.user.email}))\n", "self.assertContains(VAR_1, urlencode({'author__email__startswith': self.\n user.email}))\n", "def FUNC_2(self):...\n", "VAR_1 = self.client.get(reverse('core-views-index'))\n", "self.assertRedirects(VAR_1, reverse('tcms-login'), target_status_code=\n HTTPStatus.OK)\n", "def FUNC_3(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.get(reverse('core-views-index'))\n", "self.assertRedirects(VAR_1, reverse('tcms-recent', args=[self.tester.\n username]), target_status_code=HTTPStatus.OK)\n", "\"\"\"Test case for ajax.comment_case_runs\"\"\"\n", "@classmethod...\n", "super(CLASS_2, VAR_0).setUpTestData()\n", "VAR_0.many_comments_url = reverse('ajax-comment_case_runs')\n", "def FUNC_4(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.many_comments_url, {'run': [self.case_run_1.\n pk, self.case_run_2.pk]})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'Comments needed'})\n", "def FUNC_5(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.many_comments_url, {'comment': 'new comment',\n 'run': []})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'No runs selected.'})\n", "VAR_1 = self.client.post(self.many_comments_url, {'comment': 'new comment'})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'No runs selected.'})\n", "def FUNC_6(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.many_comments_url, {'comment': 'new comment',\n 'run': '99999998,1009900'})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'No caserun found.'})\n", "def FUNC_7(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_2 = 'new comment'\n", "VAR_1 = self.client.post(self.many_comments_url, {'comment': VAR_2, 'run':\n ','.join([str(self.case_run_1.pk), str(self.case_run_2.pk)])})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 0, 'response': 'ok'})\n", "VAR_3 = ContentType.objects.get_for_model(TestCaseRun)\n", "for case_run_pk in (self.case_run_1.pk, self.case_run_2.pk):\n", "VAR_9 = Comment.objects.filter(object_pk=case_run_pk, content_type=case_run_ct)\n", "\"\"\"Test case for update\"\"\"\n", "self.assertEqual(VAR_2, VAR_9[0].comment)\n", "@classmethod...\n", "self.assertEqual(self.tester, VAR_9[0].user)\n", "super(CLASS_3, VAR_0).setUpTestData()\n", "VAR_0.permission = 'testplans.change_testplan'\n", "VAR_0.update_url = reverse('ajax-update')\n", "def FUNC_8(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def FUNC_9(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "remove_perm_from_user(self.tester, self.permission)\n", "VAR_4 = {'content_type': 'testplans.testplan', 'object_pk': self.plan.pk,\n 'field': 'is_active', 'value': 'False', 'value_type': 'bool'}\n", "VAR_1 = self.client.post(self.update_url, VAR_4)\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'Permission Dinied.'})\n", "def FUNC_10(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_4 = {'content_type': 'testplans.testplan', 'object_pk': self.plan.pk,\n 'field': 'is_active', 'value': 'False', 'value_type': 'bool'}\n", "VAR_1 = self.client.post(self.update_url, VAR_4)\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 0, 'response': 'ok'})\n", "VAR_5 = TestPlan.objects.get(pk=self.plan.pk)\n", "self.assertFalse(VAR_5.is_active)\n", "\"\"\"Test case for update_case_run_status\"\"\"\n", "@classmethod...\n", "super(CLASS_4, VAR_0).setUpTestData()\n", "VAR_0.permission = 'testruns.change_testcaserun'\n", "VAR_0.update_url = reverse('ajax-update_case_run_status')\n", "def FUNC_8(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def FUNC_9(self):...\n", "remove_perm_from_user(self.tester, self.permission)\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.update_url, {'content_type':\n 'testruns.testcaserun', 'object_pk': self.case_run_1.pk, 'field':\n 'case_run_status', 'value': str(TestCaseRunStatus.objects.get(name=\n 'PAUSED').pk), 'value_type': 'int'})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response': 'Permission Dinied.'})\n", "def FUNC_11(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.update_url, {'content_type':\n 'testruns.testcaserun', 'object_pk': self.case_run_1.pk, 'field':\n 'case_run_status', 'value': str(TestCaseRunStatus.objects.get(name=\n 'PAUSED').pk), 'value_type': 'int'})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 0, 'response': 'ok'})\n", "self.assertEqual('PAUSED', TestCaseRun.objects.get(pk=self.case_run_1.pk).\n case_run_status.name)\n", "\"\"\"Test case for form\"\"\"\n", "def FUNC_12(self):...\n", "VAR_1 = self.client.get(reverse('ajax-form'), {'app_form':\n 'testcases.CaseAutomatedForm'})\n", "VAR_6 = CaseAutomatedForm()\n", "self.assertHTMLEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n VAR_6.as_p())\n", "\"\"\"Test case for update_cases_default_tester\"\"\"\n", "@classmethod...\n", "super(CLASS_6, VAR_0).setUpTestData()\n", "VAR_0.permission = 'testcases.change_testcase'\n", "VAR_0.case_update_url = reverse('ajax-update_cases_default_tester')\n", "def FUNC_8(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def FUNC_9(self):...\n", "remove_perm_from_user(self.tester, self.permission)\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.case_update_url, {'target_field': 'priority',\n 'from_plan': self.plan.pk, 'case': [self.case_1.pk, self.case_3.pk],\n 'new_value': Priority.objects.get(value='P3').pk})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 1, 'response':\n \"You don't have enough permission to update TestCases.\"})\n", "def FUNC_13(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "VAR_1 = self.client.post(self.case_update_url, {'target_field': 'priority',\n 'from_plan': self.plan.pk, 'case': [self.case_1.pk, self.case_3.pk],\n 'new_value': Priority.objects.get(value='P3').pk})\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n {'rc': 0, 'response': 'ok'})\n", "for pk in (self.case_1.pk, self.case_3.pk):\n", "self.assertEqual('P3', TestCase.objects.get(pk=pk).priority.value)\n", "\"\"\"Test case for info view method\"\"\"\n", "@classmethod...\n", "super(CLASS_7, VAR_0).setUpTestData()\n", "VAR_0.get_info_url = reverse('ajax-info')\n", "VAR_0.group_nitrate = EnvGroupFactory(name='nitrate')\n", "VAR_0.group_new = EnvGroupFactory(name='NewGroup')\n", "VAR_0.property_os = EnvPropertyFactory(name='os')\n", "VAR_0.property_python = EnvPropertyFactory(name='python')\n", "VAR_0.property_django = EnvPropertyFactory(name='django')\n", "EnvGroupPropertyMapFactory(VAR_8=cls.group_nitrate, property=cls.property_os)\n", "EnvGroupPropertyMapFactory(VAR_8=cls.group_nitrate, property=cls.\n property_python)\n", "EnvGroupPropertyMapFactory(VAR_8=cls.group_new, property=cls.property_django)\n", "def FUNC_14(self):...\n", "VAR_1 = self.client.get(self.get_info_url, {'info_type': 'env_properties'})\n", "VAR_7 = json.loads(serializers.serialize('json', EnvProperty.objects.all(),\n fields=('name', 'value')))\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n VAR_7)\n", "def FUNC_15(self):...\n", "VAR_1 = self.client.get(self.get_info_url, {'info_type': 'env_properties',\n 'env_group_id': self.group_new.pk})\n", "VAR_8 = EnvGroup.objects.get(pk=self.group_new.pk)\n", "VAR_7 = json.loads(serializers.serialize('json', VAR_8.property.all(),\n fields=('name', 'value')))\n", "self.assertJSONEqual(str(VAR_1.content, encoding=settings.DEFAULT_CHARSET),\n VAR_7)\n" ]
[ "import json\n", "from http import HTTPStatus\n", "from urllib.parse import urlencode\n", "from django import test\n", "from django.conf import settings\n", "from django.contrib.contenttypes.models import ContentType\n", "from django.core import serializers\n", "from django.urls import reverse\n", "from django_comments.models import Comment\n", "from tcms.management.models import Priority\n", "from tcms.management.models import EnvGroup\n", "from tcms.management.models import EnvProperty\n", "from tcms.testcases.forms import CaseAutomatedForm\n", "from tcms.testcases.forms import TestCase\n", "from tcms.testplans.models import TestPlan\n", "from tcms.testruns.models import TestCaseRun\n", "from tcms.testruns.models import TestCaseRunStatus\n", "from tcms.tests import BaseCaseRun\n", "from tcms.tests import BasePlanCase\n", "from tcms.tests import remove_perm_from_user\n", "from tcms.tests import user_should_have_perm\n", "from tcms.tests.factories import UserFactory\n", "from tcms.tests.factories import EnvGroupFactory\n", "from tcms.tests.factories import EnvGroupPropertyMapFactory\n", "from tcms.tests.factories import EnvPropertyFactory\n", "@classmethod...\n", "super(TestNavigation, cls).setUpTestData()\n", "cls.user = UserFactory(email='[email protected]')\n", "cls.user.set_password('testing')\n", "cls.user.save()\n", "def test_urls_for_emails_with_pluses(self):...\n", "self.client.login(username=self.user.username, password='testing')\n", "response = self.client.get(reverse('iframe-navigation'))\n", "self.assertContains(response, urlencode({'people': self.user.email}))\n", "self.assertContains(response, urlencode({'author__email__startswith': self.\n user.email}))\n", "def test_when_not_logged_in_index_page_redirects_to_login(self):...\n", "response = self.client.get(reverse('core-views-index'))\n", "self.assertRedirects(response, reverse('tcms-login'), target_status_code=\n HTTPStatus.OK)\n", "def test_when_logged_in_index_page_redirects_to_dashboard(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.get(reverse('core-views-index'))\n", "self.assertRedirects(response, reverse('tcms-recent', args=[self.tester.\n username]), target_status_code=HTTPStatus.OK)\n", "\"\"\"Test case for ajax.comment_case_runs\"\"\"\n", "@classmethod...\n", "super(TestCommentCaseRuns, cls).setUpTestData()\n", "cls.many_comments_url = reverse('ajax-comment_case_runs')\n", "def test_refuse_if_missing_comment(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.many_comments_url, {'run': [self.\n case_run_1.pk, self.case_run_2.pk]})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'Comments needed'})\n", "def test_refuse_if_missing_no_case_run_pk(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.many_comments_url, {'comment':\n 'new comment', 'run': []})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'No runs selected.'})\n", "response = self.client.post(self.many_comments_url, {'comment': 'new comment'})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'No runs selected.'})\n", "def test_refuse_if_passed_case_run_pks_not_exist(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.many_comments_url, {'comment':\n 'new comment', 'run': '99999998,1009900'})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'No caserun found.'})\n", "def test_add_comment_to_case_runs(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "new_comment = 'new comment'\n", "response = self.client.post(self.many_comments_url, {'comment': new_comment,\n 'run': ','.join([str(self.case_run_1.pk), str(self.case_run_2.pk)])})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 0, 'response': 'ok'})\n", "case_run_ct = ContentType.objects.get_for_model(TestCaseRun)\n", "for case_run_pk in (self.case_run_1.pk, self.case_run_2.pk):\n", "comments = Comment.objects.filter(object_pk=case_run_pk, content_type=\n case_run_ct)\n", "\"\"\"Test case for update\"\"\"\n", "self.assertEqual(new_comment, comments[0].comment)\n", "@classmethod...\n", "self.assertEqual(self.tester, comments[0].user)\n", "super(TestUpdateObject, cls).setUpTestData()\n", "cls.permission = 'testplans.change_testplan'\n", "cls.update_url = reverse('ajax-update')\n", "def setUp(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def test_refuse_if_missing_permission(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "remove_perm_from_user(self.tester, self.permission)\n", "post_data = {'content_type': 'testplans.testplan', 'object_pk': self.plan.\n pk, 'field': 'is_active', 'value': 'False', 'value_type': 'bool'}\n", "response = self.client.post(self.update_url, post_data)\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'Permission Dinied.'})\n", "def test_update_plan_is_active(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "post_data = {'content_type': 'testplans.testplan', 'object_pk': self.plan.\n pk, 'field': 'is_active', 'value': 'False', 'value_type': 'bool'}\n", "response = self.client.post(self.update_url, post_data)\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 0, 'response': 'ok'})\n", "plan = TestPlan.objects.get(pk=self.plan.pk)\n", "self.assertFalse(plan.is_active)\n", "\"\"\"Test case for update_case_run_status\"\"\"\n", "@classmethod...\n", "super(TestUpdateCaseRunStatus, cls).setUpTestData()\n", "cls.permission = 'testruns.change_testcaserun'\n", "cls.update_url = reverse('ajax-update_case_run_status')\n", "def setUp(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def test_refuse_if_missing_permission(self):...\n", "remove_perm_from_user(self.tester, self.permission)\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.update_url, {'content_type':\n 'testruns.testcaserun', 'object_pk': self.case_run_1.pk, 'field':\n 'case_run_status', 'value': str(TestCaseRunStatus.objects.get(name=\n 'PAUSED').pk), 'value_type': 'int'})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response': 'Permission Dinied.'})\n", "def test_change_case_run_status(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.update_url, {'content_type':\n 'testruns.testcaserun', 'object_pk': self.case_run_1.pk, 'field':\n 'case_run_status', 'value': str(TestCaseRunStatus.objects.get(name=\n 'PAUSED').pk), 'value_type': 'int'})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 0, 'response': 'ok'})\n", "self.assertEqual('PAUSED', TestCaseRun.objects.get(pk=self.case_run_1.pk).\n case_run_status.name)\n", "\"\"\"Test case for form\"\"\"\n", "def test_get_form(self):...\n", "response = self.client.get(reverse('ajax-form'), {'app_form':\n 'testcases.CaseAutomatedForm'})\n", "form = CaseAutomatedForm()\n", "self.assertHTMLEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), form.as_p())\n", "\"\"\"Test case for update_cases_default_tester\"\"\"\n", "@classmethod...\n", "super(TestUpdateCasePriority, cls).setUpTestData()\n", "cls.permission = 'testcases.change_testcase'\n", "cls.case_update_url = reverse('ajax-update_cases_default_tester')\n", "def setUp(self):...\n", "user_should_have_perm(self.tester, self.permission)\n", "def test_refuse_if_missing_permission(self):...\n", "remove_perm_from_user(self.tester, self.permission)\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.case_update_url, {'target_field':\n 'priority', 'from_plan': self.plan.pk, 'case': [self.case_1.pk, self.\n case_3.pk], 'new_value': Priority.objects.get(value='P3').pk})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 1, 'response':\n \"You don't have enough permission to update TestCases.\"})\n", "def test_update_case_priority(self):...\n", "self.client.login(username=self.tester.username, password='password')\n", "response = self.client.post(self.case_update_url, {'target_field':\n 'priority', 'from_plan': self.plan.pk, 'case': [self.case_1.pk, self.\n case_3.pk], 'new_value': Priority.objects.get(value='P3').pk})\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), {'rc': 0, 'response': 'ok'})\n", "for pk in (self.case_1.pk, self.case_3.pk):\n", "self.assertEqual('P3', TestCase.objects.get(pk=pk).priority.value)\n", "\"\"\"Test case for info view method\"\"\"\n", "@classmethod...\n", "super(TestGetObjectInfo, cls).setUpTestData()\n", "cls.get_info_url = reverse('ajax-info')\n", "cls.group_nitrate = EnvGroupFactory(name='nitrate')\n", "cls.group_new = EnvGroupFactory(name='NewGroup')\n", "cls.property_os = EnvPropertyFactory(name='os')\n", "cls.property_python = EnvPropertyFactory(name='python')\n", "cls.property_django = EnvPropertyFactory(name='django')\n", "EnvGroupPropertyMapFactory(group=cls.group_nitrate, property=cls.property_os)\n", "EnvGroupPropertyMapFactory(group=cls.group_nitrate, property=cls.\n property_python)\n", "EnvGroupPropertyMapFactory(group=cls.group_new, property=cls.property_django)\n", "def test_get_env_properties(self):...\n", "response = self.client.get(self.get_info_url, {'info_type': 'env_properties'})\n", "expected_json = json.loads(serializers.serialize('json', EnvProperty.\n objects.all(), fields=('name', 'value')))\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), expected_json)\n", "def test_get_env_properties_by_group(self):...\n", "response = self.client.get(self.get_info_url, {'info_type':\n 'env_properties', 'env_group_id': self.group_new.pk})\n", "group = EnvGroup.objects.get(pk=self.group_new.pk)\n", "expected_json = json.loads(serializers.serialize('json', group.property.all\n (), fields=('name', 'value')))\n", "self.assertJSONEqual(str(response.content, encoding=settings.\n DEFAULT_CHARSET), expected_json)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7, 0, 7, 7, 7, 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 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "For", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show')\n", "self.mox.ReplayAll()\n", "self.driver.ensure_export({}, VAR_1)\n" ]
[ "def test_ensure_export(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'show')\n", "self.mox.ReplayAll()\n", "self.driver.ensure_export({}, volume)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_9):...\n", "DummyRequest.__init__(self, VAR_9)\n", "self.content = None\n", "self.code = None\n" ]
[ "def __init__(self, path):...\n", "DummyRequest.__init__(self, path)\n", "self.content = None\n", "self.code = None\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_6(self, VAR_33):...\n", "return VAR_33 != 'off' and bool(VAR_33)\n" ]
[ "def run(self, val):...\n", "return val != 'off' and bool(val)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_2, **VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "init_DBSession(VAR_3)\n", "VAR_5 = pyramid.config.Configurator(VAR_3=settings, root_factory=\n TraversalGlobalRootFactory)\n", "def FUNC_3(VAR_6):...\n", "for settings_key in VAR_12:\n", "assert VAR_5.registry.settings.get(settings_key)\n", "VAR_5.include('pyramid_mako')\n", "for VAR_12 in VAR_5.registry.settings.keys():\n", "VAR_18 = os.getenv(VAR_12.replace('.', '_').upper(), ''\n ) or VAR_5.registry.settings[VAR_12]\n", "VAR_5.add_request_method(partial(session_identity, session_keys={'id',\n 'admin', 'faves', 'user'}), 'session_identity', reify=True)\n", "VAR_5.registry.settings[VAR_12] = convert_str_with_type(VAR_18)\n", "setup_pyramid_autoformater(VAR_5)\n", "VAR_5.add_translation_dirs(VAR_5.registry.settings['i18n.translation_dirs'])\n", "VAR_7 = extract_subkeys(VAR_5.registry.settings, 'session.')\n", "VAR_8 = SignedCookieSessionFactory(serializer=json_serializer, **\n session_settings)\n", "VAR_5.set_session_factory(VAR_8)\n", "if not VAR_5.registry.settings['server.etag.cache_buster']:\n", "from .model.actions import last_update\n", "import karakara.views.search\n", "VAR_5.registry.settings['server.etag.cache_buster'] = 'last_update:{0}'.format(\n str(last_update()))\n", "karakara.views.search.search_config = read_json(VAR_5.registry.settings[\n 'karakara.search.view.config'])\n", "assert karakara.views.search.search_config, 'search_config data required'\n", "def FUNC_7(self, *VAR_16, **VAR_17):...\n", "VAR_9 = CLASS_0()\n", "if VAR_5.registry.settings.get('karakara.websocket.port'):\n", "def FUNC_8(VAR_12):...\n", "VAR_5.registry['socket_manager'] = VAR_9\n", "\"\"\"docstring\"\"\"\n", "from .views.comunity_login import social_login\n", "VAR_14 = pyramid.request.Request({'HTTP_COOKIE': '{0}={1}'.format(VAR_5.\n registry.settings['session.cookie_name'], VAR_12)})\n", "social_login.user_store = ComunityUserStore()\n", "VAR_20 = VAR_8(VAR_14)\n", "VAR_10 = VAR_5.registry.settings.get('login.provider.enabled')\n", "return VAR_20 and VAR_20.get('admin')\n", "if 'facebook' in VAR_10:\n", "FUNC_3(('login.facebook.appid', 'login.facebook.secret'), message=\n 'To use facebook as a login provider appid and secret must be provided')\n", "if 'google' in VAR_10:\n", "social_login.add_login_provider(FacebookLogin(appid=config.registry.\n settings.get('login.facebook.appid'), secret=config.registry.settings.\n get('login.facebook.secret'), permissions=config.registry.settings.get(\n 'login.facebook.permissions')))\n", "social_login.add_login_provider(GoogleLogin(client_secret_file=config.\n registry.settings.get('login.google.client_secret_file')))\n", "if not VAR_10 and VAR_5.registry.settings.get('karakara.server.mode'\n", "social_login.add_login_provider(NullLoginProvider())\n", "VAR_11.javascript_inline['comunity'] = social_login.html_includes\n", "social_login.user_store = NullComunityUserStore()\n", "def FUNC_4(VAR_12):...\n", "VAR_19 = os.path.join(os.getcwd(), VAR_5.registry.settings[VAR_12])\n", "if not os.path.isdir(VAR_19):\n", "VAR_0.error(f'Unable to add_static_view {VAR_12}:{VAR_19}')\n", "return VAR_19\n" ]
[ "def main(global_config, **settings):...\n", "\"\"\"docstring\"\"\"\n", "init_DBSession(settings)\n", "config = pyramid.config.Configurator(settings=settings, root_factory=\n TraversalGlobalRootFactory)\n", "def assert_settings_keys(keys):...\n", "for settings_key in key:\n", "assert config.registry.settings.get(settings_key)\n", "config.include('pyramid_mako')\n", "for key in config.registry.settings.keys():\n", "value = os.getenv(key.replace('.', '_').upper(), ''\n ) or config.registry.settings[key]\n", "config.add_request_method(partial(session_identity, session_keys={'id',\n 'admin', 'faves', 'user'}), 'session_identity', reify=True)\n", "config.registry.settings[key] = convert_str_with_type(value)\n", "setup_pyramid_autoformater(config)\n", "config.add_translation_dirs(config.registry.settings['i18n.translation_dirs'])\n", "session_settings = extract_subkeys(config.registry.settings, 'session.')\n", "session_factory = SignedCookieSessionFactory(serializer=json_serializer, **\n session_settings)\n", "config.set_session_factory(session_factory)\n", "if not config.registry.settings['server.etag.cache_buster']:\n", "from .model.actions import last_update\n", "import karakara.views.search\n", "config.registry.settings['server.etag.cache_buster'\n ] = 'last_update:{0}'.format(str(last_update()))\n", "karakara.views.search.search_config = read_json(config.registry.settings[\n 'karakara.search.view.config'])\n", "assert karakara.views.search.search_config, 'search_config data required'\n", "def recv(self, *args, **kwargs):...\n", "socket_manager = NullAuthEchoServerManager()\n", "if config.registry.settings.get('karakara.websocket.port'):\n", "def authenticator(key):...\n", "config.registry['socket_manager'] = socket_manager\n", "\"\"\"docstring\"\"\"\n", "from .views.comunity_login import social_login\n", "request = pyramid.request.Request({'HTTP_COOKIE': '{0}={1}'.format(config.\n registry.settings['session.cookie_name'], key)})\n", "social_login.user_store = ComunityUserStore()\n", "session_data = session_factory(request)\n", "login_providers = config.registry.settings.get('login.provider.enabled')\n", "return session_data and session_data.get('admin')\n", "if 'facebook' in login_providers:\n", "assert_settings_keys(('login.facebook.appid', 'login.facebook.secret'),\n message=\n 'To use facebook as a login provider appid and secret must be provided')\n", "if 'google' in login_providers:\n", "social_login.add_login_provider(FacebookLogin(appid=config.registry.\n settings.get('login.facebook.appid'), secret=config.registry.settings.\n get('login.facebook.secret'), permissions=config.registry.settings.get(\n 'login.facebook.permissions')))\n", "social_login.add_login_provider(GoogleLogin(client_secret_file=config.\n registry.settings.get('login.google.client_secret_file')))\n", "if not login_providers and config.registry.settings.get('karakara.server.mode'\n", "social_login.add_login_provider(NullLoginProvider())\n", "template_helpers.javascript_inline['comunity'] = social_login.html_includes\n", "social_login.user_store = NullComunityUserStore()\n", "def settings_path(key):...\n", "path = os.path.join(os.getcwd(), config.registry.settings[key])\n", "if not os.path.isdir(path):\n", "log.error(f'Unable to add_static_view {key}:{path}')\n", "return path\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 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "FunctionDef'", "For", "Assert'", "Expr'", "For", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "ImportFrom'", "Import'", "Assign'", "Assign'", "Assert'", "FunctionDef'", "Assign'", "Condition", "FunctionDef'", "Assign'", "Docstring", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_1):...\n", "self.__init__()\n", "self.name = VAR_1.get('name')\n", "self.vars = VAR_1.get('vars', dict())\n", "self.depth = VAR_1.get('depth', 0)\n", "self.hosts = VAR_1.get('hosts', [])\n", "self._hosts = None\n", "VAR_7 = VAR_1.get('parent_groups', [])\n", "for parent_data in VAR_7:\n", "VAR_12 = CLASS_0()\n", "VAR_12.deserialize(parent_data)\n", "self.parent_groups.append(VAR_12)\n" ]
[ "def deserialize(self, data):...\n", "self.__init__()\n", "self.name = data.get('name')\n", "self.vars = data.get('vars', dict())\n", "self.depth = data.get('depth', 0)\n", "self.hosts = data.get('hosts', [])\n", "self._hosts = None\n", "parent_groups = data.get('parent_groups', [])\n", "for parent_data in parent_groups:\n", "g = Group()\n", "g.deserialize(parent_data)\n", "self.parent_groups.append(g)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_9, **VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_7():...\n", "\"\"\"docstring\"\"\"\n", "VAR_10['env'] = self.env\n", "VAR_10['config'] = self.env.config\n", "VAR_10['params'] = self.params\n", "return VAR_10\n" ]
[ "def render(self, template_name, **template_vars):...\n", "\"\"\"docstring\"\"\"\n", "def get_vars():...\n", "\"\"\"docstring\"\"\"\n", "template_vars['env'] = self.env\n", "template_vars['config'] = self.env.config\n", "template_vars['params'] = self.params\n", "return template_vars\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@app.route('/achievements')...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = request.args.get('language', 'en')\n", "VAR_6 = request.args.get('region', 'US')\n", "VAR_11 = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "VAR_11.execute(VAR_0 + ' ORDER BY `order` ASC', {'language': VAR_5,\n 'region': VAR_6})\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ "@app.route('/achievements')...\n", "\"\"\"docstring\"\"\"\n", "language = request.args.get('language', 'en')\n", "region = request.args.get('region', 'US')\n", "cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "cursor.execute(SELECT_ACHIEVEMENTS_QUERY + ' ORDER BY `order` ASC', {\n 'language': language, 'region': region})\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "for directory in os.getenv('PATH').split(':'):\n", "if os.path.exists(os.path.join(directory, VAR_7)):\n", "return False\n", "return True\n" ]
[ "def executable_exists(executable):...\n", "\"\"\"docstring\"\"\"\n", "for directory in os.getenv('PATH').split(':'):\n", "if os.path.exists(os.path.join(directory, executable)):\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Condition", "Return'", "Return'" ]
[ "def FUNC_23(self, VAR_14):...\n", "" ]
[ "def is_unique(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "cursor.execute(VAR_5)\n", "VAR_10 = cursor.fetchall()\n", "return VAR_10\n" ]
[ "def connect_sql(self, sql):...\n", "\"\"\"docstring\"\"\"\n", "cursor.execute(sql)\n", "result = cursor.fetchall()\n", "return result\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n", "self.write_data({'type': 'torrent_error', 'event': {'infohash': hexlify(\n VAR_4), 'error': VAR_5[0]}})\n" ]
[ "def on_torrent_error(self, subject, changetype, objectID, *args):...\n", "self.write_data({'type': 'torrent_error', 'event': {'infohash': hexlify(\n objectID), 'error': args[0]}})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, *VAR_3, **VAR_4):...\n", "super(CLASS_0, self).__init__(*VAR_3, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2():...\n", "super(CLASS_4, self).__init__(slideParser.parse(VAR_10, slideLexer), VAR_2='\\n'\n )\n" ]
[ "def innerFunc():...\n", "super(Column, self).__init__(slideParser.parse(txt, slideLexer), after='\\n')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_18, VAR_19):...\n", "self.fs = VAR_18\n", "self.cfg = VAR_19\n", "self.tempfiles = {}\n", "self.filenames = {}\n", "self.newcount = 0\n", "self.init_honeyfs(self.cfg.get('honeypot', 'contents_path'))\n" ]
[ "def __init__(self, fs, cfg):...\n", "self.fs = fs\n", "self.cfg = cfg\n", "self.tempfiles = {}\n", "self.filenames = {}\n", "self.newcount = 0\n", "self.init_honeyfs(self.cfg.get('honeypot', 'contents_path'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_19(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_58 = self.getfile(VAR_21)\n", "if VAR_58 != False:\n", "self.mkdir(VAR_21, 0, 0, 4096, 16877)\n" ]
[ "def mkdir2(self, path):...\n", "\"\"\"docstring\"\"\"\n", "dir = self.getfile(path)\n", "if dir != False:\n", "self.mkdir(path, 0, 0, 4096, 16877)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_43(self, VAR_41, VAR_43):...\n", "self[VAR_41:VAR_41 + 1] = VAR_43\n", "VAR_55 = len(VAR_43) - 1\n", "for VAR_40, (i, j) in self._names.items():\n", "if i > VAR_41:\n", "self._names[VAR_40] = i + VAR_55, j + VAR_55\n", "if i == VAR_41:\n", "self.set_name(VAR_40, i, VAR_42=i + len(items))\n" ]
[ "def insert_items(self, index, items):...\n", "self[index:index + 1] = items\n", "add = len(items) - 1\n", "for name, (i, j) in self._names.items():\n", "if i > index:\n", "self._names[name] = i + add, j + add\n", "if i == index:\n", "self.set_name(name, i, end=i + len(items))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_0(VAR_2):...\n", "VAR_6 = argparse.ArgumentParser(prog='md_browser')\n", "VAR_6.add_argument('-p', '--port', type=int, default=8080, help=\n 'port to run on (default = %(default)s)')\n", "VAR_6.add_argument('-d', '--directory', type=str, default=SRC_DIR)\n", "VAR_6.add_argument('-e', '--external', action='store_true', help=\n 'whether to bind to external port')\n", "VAR_6.add_argument('file', nargs='?', help='open file in browser')\n", "VAR_7 = VAR_6.parse_args(VAR_2)\n", "VAR_8 = os.path.realpath(VAR_7.directory)\n", "VAR_9 = '0.0.0.0' if VAR_7.external else 'localhost'\n", "VAR_10 = VAR_9, VAR_7.port\n", "VAR_11 = CLASS_0(VAR_10, VAR_8)\n", "VAR_12 = 'http://' + VAR_9\n", "if VAR_7.port != 80:\n", "VAR_12 += ':%s' % VAR_7.port\n", "print('Listening on %s/' % VAR_12)\n", "VAR_13 = None\n", "if VAR_7.file:\n", "VAR_15 = os.path.realpath(VAR_7.file)\n", "if os.path.isfile(os.path.join(VAR_8, 'docs', 'README.md')):\n", "if not VAR_15.startswith(VAR_8):\n", "print(' Try loading %s/docs/README.md' % VAR_12)\n", "if os.path.isfile(os.path.join(VAR_7.directory, 'README.md')):\n", "print('%s is not under %s' % (VAR_7.file, VAR_7.directory))\n", "VAR_25 = os.path.relpath(VAR_15, VAR_8)\n", "VAR_14 = 1\n", "print(' Try loading %s/README.md' % VAR_12)\n", "return 1\n", "VAR_3 = '%s/%s' % (VAR_12, VAR_25)\n", "VAR_11.serve_forever()\n", "VAR_14 = 130\n", "VAR_11.shutdown()\n", "print('Opening %s' % VAR_3)\n", "print('Exception raised: %s' % str(e))\n", "if VAR_13:\n", "VAR_13 = threading.Thread(target=_open_url, VAR_7=(url,))\n", "VAR_13.join()\n", "return VAR_14\n", "VAR_13.start()\n" ]
[ "def main(argv):...\n", "parser = argparse.ArgumentParser(prog='md_browser')\n", "parser.add_argument('-p', '--port', type=int, default=8080, help=\n 'port to run on (default = %(default)s)')\n", "parser.add_argument('-d', '--directory', type=str, default=SRC_DIR)\n", "parser.add_argument('-e', '--external', action='store_true', help=\n 'whether to bind to external port')\n", "parser.add_argument('file', nargs='?', help='open file in browser')\n", "args = parser.parse_args(argv)\n", "top_level = os.path.realpath(args.directory)\n", "hostname = '0.0.0.0' if args.external else 'localhost'\n", "server_address = hostname, args.port\n", "s = Server(server_address, top_level)\n", "origin = 'http://' + hostname\n", "if args.port != 80:\n", "origin += ':%s' % args.port\n", "print('Listening on %s/' % origin)\n", "thread = None\n", "if args.file:\n", "path = os.path.realpath(args.file)\n", "if os.path.isfile(os.path.join(top_level, 'docs', 'README.md')):\n", "if not path.startswith(top_level):\n", "print(' Try loading %s/docs/README.md' % origin)\n", "if os.path.isfile(os.path.join(args.directory, 'README.md')):\n", "print('%s is not under %s' % (args.file, args.directory))\n", "rpath = os.path.relpath(path, top_level)\n", "retcode = 1\n", "print(' Try loading %s/README.md' % origin)\n", "return 1\n", "url = '%s/%s' % (origin, rpath)\n", "s.serve_forever()\n", "retcode = 130\n", "s.shutdown()\n", "print('Opening %s' % url)\n", "print('Exception raised: %s' % str(e))\n", "if thread:\n", "thread = threading.Thread(target=_open_url, args=(url,))\n", "thread.join()\n", "return retcode\n", "thread.start()\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 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Return'", "Expr'" ]
[ "@auth.require(acl.is_bot)...\n", "if VAR_9:\n", "VAR_51 = bot_code.get_bot_version(self.request.host_url)\n", "self.response.headers['Cache-Control'] = 'no-cache, no-store'\n", "if VAR_9 != VAR_51:\n", "self.response.headers['Content-Type'] = 'application/octet-stream'\n", "logging.error('Requested Swarming bot %s, have %s', VAR_9, VAR_51)\n", "self.response.headers['Cache-Control'] = 'public, max-age=3600'\n", "self.response.headers['Content-Disposition'\n ] = 'attachment; filename=\"swarming_bot.zip\"'\n", "self.abort(404)\n", "self.response.out.write(bot_code.get_swarming_bot_zip(self.request.host_url))\n" ]
[ "@auth.require(acl.is_bot)...\n", "if version:\n", "expected = bot_code.get_bot_version(self.request.host_url)\n", "self.response.headers['Cache-Control'] = 'no-cache, no-store'\n", "if version != expected:\n", "self.response.headers['Content-Type'] = 'application/octet-stream'\n", "logging.error('Requested Swarming bot %s, have %s', version, expected)\n", "self.response.headers['Cache-Control'] = 'public, max-age=3600'\n", "self.response.headers['Content-Disposition'\n ] = 'attachment; filename=\"swarming_bot.zip\"'\n", "self.abort(404)\n", "self.response.out.write(bot_code.get_swarming_bot_zip(self.request.host_url))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@VAR_19.route('/test3')...\n", "return 'OK'\n" ]
[ "@test_views.route('/test3')...\n", "return 'OK'\n" ]
[ 0, 0 ]
[ "Condition", "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(FloatField, self).__init__(*args, **kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_4(VAR_9):...\n", "if VAR_9['exception']['TYPE'] == UnknownExtraConf.__name__:\n" ]
[ "def _RaiseExceptionForData(data):...\n", "if data['exception']['TYPE'] == UnknownExtraConf.__name__:\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_18(VAR_37):...\n", "VAR_37 = VAR_37.replace('[', '')\n", "VAR_37 = VAR_37.replace(']', '')\n", "VAR_45, VAR_46 = VAR_37.split(',')\n", "VAR_37 = '{} - {}'.format(VAR_46, VAR_45)\n", "return VAR_37\n" ]
[ "def reformat(score):...\n", "score = score.replace('[', '')\n", "score = score.replace(']', '')\n", "win, loss = score.split(',')\n", "score = '{} - {}'.format(loss, win)\n", "return score\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(VAR_25, VAR_20, VAR_21, VAR_5=False, VAR_22=None, VAR_23=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_52 = [\n \"\"\"<collection><record>\n<controlfield tag=\"001\">%s</controlfield>\"\"\" %\n VAR_25]\n", "VAR_20 = VAR_20.items()\n", "VAR_21 = VAR_21.items()\n", "VAR_52.append(FUNC_9(VAR_20, VAR_21, VAR_22, VAR_23))\n", "VAR_52.append('</record></collection>')\n", "return '\\n'.join(VAR_52)\n" ]
[ "def build_marc(recid, single_keywords, composite_keywords, spires=False,...\n", "\"\"\"docstring\"\"\"\n", "output = [\n \"\"\"<collection><record>\n<controlfield tag=\"001\">%s</controlfield>\"\"\" %\n recid]\n", "single_keywords = single_keywords.items()\n", "composite_keywords = composite_keywords.items()\n", "output.append(_output_marc(single_keywords, composite_keywords,\n author_keywords, acronyms))\n", "output.append('</record></collection>')\n", "return '\\n'.join(output)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_1(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if os.path.exists(VAR_1):\n", "return FUNC_0(VAR_1)[1]\n", "return {}\n" ]
[ "def load_yml_filedir(root_dir):...\n", "\"\"\"docstring\"\"\"\n", "if os.path.exists(root_dir):\n", "return _load_yml_filedir(root_dir)[1]\n", "return {}\n" ]
[ 0, 0, 1, 1, 1 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Return'" ]
[ "def FUNC_27(self, VAR_15):...\n", "" ]
[ "def add(self, item):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self):...\n", "VAR_5 = Mock()\n", "VAR_5.sendmail.side_effect = lambda VAR_68: succeed(VAR_68)\n", "return VAR_5\n" ]
[ "def _create_mail_sender(self):...\n", "mail_sender = Mock()\n", "mail_sender.sendmail.side_effect = lambda mail: succeed(mail)\n", "return mail_sender\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_3, VAR_4, VAR_15=None, VAR_16=None):...\n", "CLASS_0.__init__(self, VAR_3, VAR_4)\n", "self.num_channels_label = VAR_15\n", "self.filter_input = VAR_16\n", "if self.filter_input:\n", "self.filter_input.textChanged.connect(self._on_filter_input_change)\n" ]
[ "def __init__(self, model, table_view, num_channels_label=None, filter_input...\n", "TriblerTableViewController.__init__(self, model, table_view)\n", "self.num_channels_label = num_channels_label\n", "self.filter_input = filter_input\n", "if self.filter_input:\n", "self.filter_input.textChanged.connect(self._on_filter_input_change)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "return os.stat(VAR_0, follow_symlinks=os.stat not in os.\n supports_follow_symlinks)\n" ]
[ "def lstat(f):...\n", "return os.stat(f, follow_symlinks=os.stat not in os.supports_follow_symlinks)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_15(self, VAR_21):...\n", "self.command('select ' + str(VAR_21), ['Target CPU', 'Core state',\n 'Debug entry cause'], 'Error selecting core')\n" ]
[ "def select_core(self, core):...\n", "self.command('select ' + str(core), ['Target CPU', 'Core state',\n 'Debug entry cause'], 'Error selecting core')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(VAR_3):...\n", "for dm in VAR_3:\n", "VAR_6 = getAlcoholByName(dm.text)\n", "if len(VAR_6) > 10:\n", "VAR_10 = (\n 'Sorry but I know a lot of alcohol with that in the name, could you be more specific?'\n )\n", "if VAR_6 == []:\n", "VAR_1.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n", "VAR_10 = (\n 'Unfortunately I cannot find the name of the alcohol you specified in my database, apologies.'\n )\n", "for VAR_2 in VAR_6:\n", "print(dm.sender_screen_name + ' sent ' + dm.text)\n", "VAR_1.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n", "VAR_10 = FUNC_0(VAR_2)\n", "setLastReplied('DM', dm.id_str)\n", "VAR_1.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n" ]
[ "def replyToUnansweredDMs(dms):...\n", "for dm in dms:\n", "results = getAlcoholByName(dm.text)\n", "if len(results) > 10:\n", "replyToDm = (\n 'Sorry but I know a lot of alcohol with that in the name, could you be more specific?'\n )\n", "if results == []:\n", "api.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n", "replyToDm = (\n 'Unfortunately I cannot find the name of the alcohol you specified in my database, apologies.'\n )\n", "for result in results:\n", "print(dm.sender_screen_name + ' sent ' + dm.text)\n", "api.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n", "replyToDm = formatReply(result)\n", "setLastReplied('DM', dm.id_str)\n", "api.send_direct_message(screen_name=dm.sender_screen_name, text=replyToDm)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "For", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3():...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = {}\n", "for arg in request.args:\n", "VAR_8 = re.findall('_oc_(.*)', arg)\n", "return VAR_7\n", "if VAR_8:\n", "VAR_7[VAR_8[0]] = request.args.get(arg), request.args.get('_od_' + VAR_8[0])\n" ]
[ "def get_order_args():...\n", "\"\"\"docstring\"\"\"\n", "orders = {}\n", "for arg in request.args:\n", "re_match = re.findall('_oc_(.*)', arg)\n", "return orders\n", "if re_match:\n", "orders[re_match[0]] = request.args.get(arg), request.args.get('_od_' +\n re_match[0])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Return'", "Condition", "Assign'" ]
[ "def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_18, errors.WRONG_PASSWORD, *VAR_15, **kw)\n" ]
[ "def __init__(self, item, *a, **kw):...\n", "VRequired.__init__(self, item, errors.WRONG_PASSWORD, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_17(VAR_5):...\n", "VAR_11 = VAR_5['children']\n", "if VAR_11:\n", "return itertools.chain.from_iterable([FUNC_17(child) for child in VAR_11])\n", "return VAR_5['id'],\n" ]
[ "def get_descendant_ids(node):...\n", "children = node['children']\n", "if children:\n", "return itertools.chain.from_iterable([get_descendant_ids(child) for child in\n children])\n", "return node['id'],\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_10, VAR_11):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_volume_from_snapshot(self, volume, snapshot):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_2(self, VAR_8, VAR_9, VAR_10, VAR_5, VAR_11):...\n", "VAR_14 = 'string'.format(VAR_8, VAR_9, VAR_10, VAR_5, VAR_11)\n", "self.cur.execute(VAR_14)\n", "self.conn.commit()\n" ]
[ "def create_event(self, title, start_time, time_zone, server_id, description):...\n", "sql = (\n \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n \"\"\"\n .format(title, start_time, time_zone, server_id, description))\n", "self.cur.execute(sql)\n", "self.conn.commit()\n" ]
[ 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_16):...\n", "" ]
[ "def _get_context(self, name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_23(self):...\n", "if not self.final:\n", "VAR_76 = self.marks[0][1]\n", "return self.final\n", "VAR_77 = time.time() if len(self.marks) == 1 else self.marks[-1][1]\n", "VAR_78 = lambda VAR_76, VAR_77: int((VAR_77 - VAR_76) * 1000)\n", "VAR_79 = [(VAR_25, VAR_78(self.marks[i][1], ts)) for i, (VAR_25, ts) in\n enumerate(self.marks[1:])]\n", "self.final = {'timestamp': int(VAR_76), 'duration_ms': VAR_78(VAR_76,\n VAR_77), 'marks_ms': {key: sum(VAR_82[1] for VAR_82 in group) for key,\n group in groupby(sorted(VAR_79), key=lambda x: x[0])}}\n" ]
[ "def finish(self):...\n", "if not self.final:\n", "start = self.marks[0][1]\n", "return self.final\n", "end = time.time() if len(self.marks) == 1 else self.marks[-1][1]\n", "diff_ms = lambda start, end: int((end - start) * 1000)\n", "durations = [(name, diff_ms(self.marks[i][1], ts)) for i, (name, ts) in\n enumerate(self.marks[1:])]\n", "self.final = {'timestamp': int(start), 'duration_ms': diff_ms(start, end),\n 'marks_ms': {key: sum(d[1] for d in group) for key, group in groupby(\n sorted(durations), key=lambda x: x[0])}}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "import copy\n", "import logging\n", "import os\n", "import sflock\n", "from cuckoo.common.config import emit_options\n", "from cuckoo.common.exceptions import CuckooOperationalError\n", "from cuckoo.common.files import Folders, Files, Storage\n", "from cuckoo.common.utils import validate_url, validate_hash\n", "from cuckoo.common.virustotal import VirusTotalAPI\n", "from cuckoo.core.database import Database\n", "VAR_0 = logging.getLogger(__name__)\n", "VAR_1 = Database()\n", "def FUNC_0(self, VAR_2, VAR_3, VAR_4):...\n", "if not VAR_4:\n", "return\n", "if validate_hash(VAR_4):\n", "if validate_url(VAR_4):\n", "VAR_21 = VirusTotalAPI().hash_fetch(VAR_4)\n", "VAR_2['errors'].append('Error retrieving file hash: %s' % e)\n", "VAR_18 = Files.create(VAR_3, VAR_4, VAR_21)\n", "VAR_2['data'].append({'type': 'url', 'data': VAR_4})\n", "VAR_2['errors'].append(\"'%s' was neither a valid hash or url\" % VAR_4)\n", "return\n", "VAR_2['data'].append({'type': 'file', 'data': VAR_18})\n", "return\n", "def FUNC_1(self, VAR_5, VAR_6):...\n", "return\n", "\"\"\"docstring\"\"\"\n", "if VAR_5 not in ('strings', 'files'):\n", "VAR_0.error(\"Bad parameter '%s' for submit_type\", VAR_5)\n", "VAR_13 = Folders.create_temp()\n", "return False\n", "VAR_14 = {'data': [], 'errors': []}\n", "if VAR_5 == 'strings':\n", "for VAR_4 in VAR_6:\n", "if VAR_5 == 'files':\n", "self._handle_string(VAR_14, VAR_13, VAR_4)\n", "for entry in VAR_6:\n", "return Database().add_submit(VAR_13, VAR_5, VAR_14)\n", "VAR_22 = Storage.get_filename_from_path(entry['name'])\n", "VAR_18 = Files.create(VAR_13, VAR_22, entry['data'])\n", "VAR_14['data'].append({'type': 'file', 'data': VAR_18})\n" ]
[ "import copy\n", "import logging\n", "import os\n", "import sflock\n", "from cuckoo.common.config import emit_options\n", "from cuckoo.common.exceptions import CuckooOperationalError\n", "from cuckoo.common.files import Folders, Files, Storage\n", "from cuckoo.common.utils import validate_url, validate_hash\n", "from cuckoo.common.virustotal import VirusTotalAPI\n", "from cuckoo.core.database import Database\n", "log = logging.getLogger(__name__)\n", "db = Database()\n", "def _handle_string(self, submit, tmppath, line):...\n", "if not line:\n", "return\n", "if validate_hash(line):\n", "if validate_url(line):\n", "filedata = VirusTotalAPI().hash_fetch(line)\n", "submit['errors'].append('Error retrieving file hash: %s' % e)\n", "filepath = Files.create(tmppath, line, filedata)\n", "submit['data'].append({'type': 'url', 'data': line})\n", "submit['errors'].append(\"'%s' was neither a valid hash or url\" % line)\n", "return\n", "submit['data'].append({'type': 'file', 'data': filepath})\n", "return\n", "def pre(self, submit_type, data):...\n", "return\n", "\"\"\"docstring\"\"\"\n", "if submit_type not in ('strings', 'files'):\n", "log.error(\"Bad parameter '%s' for submit_type\", submit_type)\n", "path_tmp = Folders.create_temp()\n", "return False\n", "submit_data = {'data': [], 'errors': []}\n", "if submit_type == 'strings':\n", "for line in data:\n", "if submit_type == 'files':\n", "self._handle_string(submit_data, path_tmp, line)\n", "for entry in data:\n", "return Database().add_submit(path_tmp, submit_type, submit_data)\n", "filename = Storage.get_filename_from_path(entry['name'])\n", "filepath = Files.create(path_tmp, filename, entry['data'])\n", "submit_data['data'].append({'type': 'file', 'data': filepath})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Condition", "Return'", "Condition", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'", "Expr'", "Return'", "FunctionDef'", "Return'", "Docstring", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "For", "Condition", "Expr'", "For", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_12(self, VAR_9, VAR_14):...\n", "super().validate(VAR_9, VAR_14)\n", "for VAR_18, part in enumerate(VAR_9):\n", "if isinstance(self.base_field, CLASS_0):\n", "self.base_field.validate(part, VAR_14)\n", "if len({len(i) for i in VAR_9}) > 1:\n" ]
[ "def validate(self, value, model_instance):...\n", "super().validate(value, model_instance)\n", "for index, part in enumerate(value):\n", "if isinstance(self.base_field, ArrayField):\n", "self.base_field.validate(part, model_instance)\n", "if len({len(i) for i in value}) > 1:\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "For", "Condition", "Expr'", "For" ]
[ "@api_post...\n", "VAR_7 = VAR_3.get('submit_id', 0)\n", "VAR_8 = VAR_3.get('password', None)\n", "VAR_9 = VAR_3.get('astree', True)\n", "VAR_6 = VAR_0.get_files(VAR_7=submit_id, VAR_8=password, VAR_9=astree)\n", "return JsonResponse({'status': True, 'data': VAR_6, 'defaults': FUNC_0()},\n encoder=JsonSerialize)\n" ]
[ "@api_post...\n", "submit_id = body.get('submit_id', 0)\n", "password = body.get('password', None)\n", "astree = body.get('astree', True)\n", "data = submit_manager.get_files(submit_id=submit_id, password=password,\n astree=astree)\n", "return JsonResponse({'status': True, 'data': data, 'defaults': defaults()},\n encoder=JsonSerialize)\n" ]
[ 0, 0, 0, 0, 1, 1 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_17(VAR_22, VAR_5=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_59 = {}\n", "if VAR_22:\n", "for VAR_96, VAR_63 in VAR_22.items():\n", "return VAR_59\n", "VAR_32 = VAR_63[0]\n", "VAR_33 = VAR_63[1]\n", "VAR_92 = []\n", "for VAR_94, spans in VAR_33.items():\n", "VAR_92.append(VAR_94.output(VAR_5))\n", "for VAR_93, spans in VAR_32.items():\n", "VAR_92.append(VAR_93.output(VAR_5))\n", "if VAR_92:\n", "VAR_59[VAR_96] = VAR_92\n", "VAR_59[VAR_96] = 0\n" ]
[ "def _get_author_keywords(author_keywords, spires=False):...\n", "\"\"\"docstring\"\"\"\n", "out = {}\n", "if author_keywords:\n", "for keyword, matches in author_keywords.items():\n", "return out\n", "skw_matches = matches[0]\n", "ckw_matches = matches[1]\n", "matches_str = []\n", "for ckw, spans in ckw_matches.items():\n", "matches_str.append(ckw.output(spires))\n", "for skw, spans in skw_matches.items():\n", "matches_str.append(skw.output(spires))\n", "if matches_str:\n", "out[keyword] = matches_str\n", "out[keyword] = 0\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Return'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "For", "Expr'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "VAR_1 = VAR_0.copy()\n", "VAR_2 = self._get(VAR_1)\n", "self.assertEqual(VAR_2.status_code, 302)\n", "self.assertEqual(User.objects.count(), 2)\n", "VAR_3 = User.objects.get(username='[email protected]')\n", "self.assertEqual(VAR_3.email, '{:d}@localhost'.format(VAR_3.id))\n", "self.assertEqual(VAR_3.first_name, '')\n", "self.assertEqual(VAR_3.last_name, 'Teekkari')\n", "self.assertEqual(VAR_3.userprofile.student_id, '123453')\n" ]
[ "def test_without_email(self):...\n", "meta = DEF_SHIBD_META.copy()\n", "response = self._get(meta)\n", "self.assertEqual(response.status_code, 302)\n", "self.assertEqual(User.objects.count(), 2)\n", "user = User.objects.get(username='[email protected]')\n", "self.assertEqual(user.email, '{:d}@localhost'.format(user.id))\n", "self.assertEqual(user.first_name, '')\n", "self.assertEqual(user.last_name, 'Teekkari')\n", "self.assertEqual(user.userprofile.student_id, '123453')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_15(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = block.sys_block_path(VAR_1)\n", "VAR_27 = os.listdir(os.path.join(VAR_14, 'holders'))\n", "LOG.debug(\"devname '%s' had holders: %s\", VAR_1, VAR_27)\n", "return VAR_27\n" ]
[ "def get_holders(device):...\n", "\"\"\"docstring\"\"\"\n", "sysfs_path = block.sys_block_path(device)\n", "holders = os.listdir(os.path.join(sysfs_path, 'holders'))\n", "LOG.debug(\"devname '%s' had holders: %s\", device, holders)\n", "return holders\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_1, VAR_2, VAR_5, VAR_6, VAR_4={}):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = self.pool.get('stock.location')\n", "VAR_23 = self.pool.get('account.move')\n", "VAR_24 = self.pool.get('account.move.line')\n", "VAR_25 = VAR_6.get('new_price', 0.0)\n", "VAR_19 = VAR_6.get('stock_output_account', False)\n", "VAR_18 = VAR_6.get('stock_input_account', False)\n", "VAR_20 = VAR_6.get('stock_journal', False)\n", "VAR_17 = self.browse(VAR_1, VAR_2, VAR_5)[0]\n", "VAR_21 = VAR_17.categ_id.property_stock_variation\n", "VAR_26 = VAR_21 and VAR_21.id or False\n", "if not VAR_26:\n", "VAR_27 = []\n", "VAR_28 = VAR_22.search(VAR_1, VAR_2, [('usage', '=', 'internal')])\n", "for rec_id in VAR_5:\n", "for location in VAR_22.browse(VAR_1, VAR_2, VAR_28):\n", "return VAR_27\n", "VAR_49 = VAR_4.copy()\n", "self.write(VAR_1, VAR_2, rec_id, {'standard_price': VAR_25})\n", "VAR_49.update({'location': location.id, 'compute_child': False})\n", "VAR_45 = self.browse(VAR_1, VAR_2, rec_id, VAR_4=c)\n", "VAR_53 = VAR_45.qty_available\n", "VAR_54 = VAR_45.standard_price - VAR_25\n", "if not VAR_54:\n", "if VAR_53:\n", "VAR_56 = location.company_id and location.company_id.id or False\n", "if not VAR_56:\n", "if not VAR_20:\n", "VAR_20 = (VAR_45.categ_id.property_stock_journal and VAR_45.categ_id.\n property_stock_journal.id or False)\n", "if not VAR_20:\n", "VAR_57 = VAR_23.create(VAR_1, VAR_2, {'journal_id': VAR_20, 'company_id':\n VAR_56})\n", "VAR_27.append(VAR_57)\n", "if VAR_54 > 0:\n", "if not VAR_18:\n", "if VAR_54 < 0:\n", "VAR_18 = VAR_45.product_tmpl_id.property_stock_account_input.id\n", "if not VAR_18:\n", "if not VAR_19:\n", "VAR_18 = VAR_45.categ_id.property_stock_account_input_categ.id\n", "if not VAR_18:\n", "VAR_19 = VAR_45.product_tmpl_id.property_stock_account_output.id\n", "if not VAR_19:\n", "VAR_58 = VAR_53 * VAR_54\n", "VAR_19 = VAR_45.categ_id.property_stock_account_output_categ.id\n", "if not VAR_19:\n", "VAR_24.create(VAR_1, VAR_2, {'name': VAR_45.name, 'account_id': VAR_18,\n 'debit': VAR_58, 'move_id': VAR_57})\n", "VAR_58 = VAR_53 * -VAR_54\n", "VAR_24.create(VAR_1, VAR_2, {'name': VAR_45.categ_id.name, 'account_id':\n VAR_26, 'credit': VAR_58, 'move_id': VAR_57})\n", "VAR_24.create(VAR_1, VAR_2, {'name': VAR_45.name, 'account_id': VAR_19,\n 'credit': VAR_58, 'move_id': VAR_57})\n", "VAR_24.create(VAR_1, VAR_2, {'name': VAR_45.categ_id.name, 'account_id':\n VAR_26, 'debit': VAR_58, 'move_id': VAR_57})\n" ]
[ "def do_change_standard_price(self, cr, uid, ids, datas, context={}):...\n", "\"\"\"docstring\"\"\"\n", "location_obj = self.pool.get('stock.location')\n", "move_obj = self.pool.get('account.move')\n", "move_line_obj = self.pool.get('account.move.line')\n", "new_price = datas.get('new_price', 0.0)\n", "stock_output_acc = datas.get('stock_output_account', False)\n", "stock_input_acc = datas.get('stock_input_account', False)\n", "journal_id = datas.get('stock_journal', False)\n", "product_obj = self.browse(cr, uid, ids)[0]\n", "account_variation = product_obj.categ_id.property_stock_variation\n", "account_variation_id = account_variation and account_variation.id or False\n", "if not account_variation_id:\n", "move_ids = []\n", "loc_ids = location_obj.search(cr, uid, [('usage', '=', 'internal')])\n", "for rec_id in ids:\n", "for location in location_obj.browse(cr, uid, loc_ids):\n", "return move_ids\n", "c = context.copy()\n", "self.write(cr, uid, rec_id, {'standard_price': new_price})\n", "c.update({'location': location.id, 'compute_child': False})\n", "product = self.browse(cr, uid, rec_id, context=c)\n", "qty = product.qty_available\n", "diff = product.standard_price - new_price\n", "if not diff:\n", "if qty:\n", "company_id = location.company_id and location.company_id.id or False\n", "if not company_id:\n", "if not journal_id:\n", "journal_id = (product.categ_id.property_stock_journal and product.categ_id.\n property_stock_journal.id or False)\n", "if not journal_id:\n", "move_id = move_obj.create(cr, uid, {'journal_id': journal_id, 'company_id':\n company_id})\n", "move_ids.append(move_id)\n", "if diff > 0:\n", "if not stock_input_acc:\n", "if diff < 0:\n", "stock_input_acc = product.product_tmpl_id.property_stock_account_input.id\n", "if not stock_input_acc:\n", "if not stock_output_acc:\n", "stock_input_acc = product.categ_id.property_stock_account_input_categ.id\n", "if not stock_input_acc:\n", "stock_output_acc = product.product_tmpl_id.property_stock_account_output.id\n", "if not stock_output_acc:\n", "amount_diff = qty * diff\n", "stock_output_acc = product.categ_id.property_stock_account_output_categ.id\n", "if not stock_output_acc:\n", "move_line_obj.create(cr, uid, {'name': product.name, 'account_id':\n stock_input_acc, 'debit': amount_diff, 'move_id': move_id})\n", "amount_diff = qty * -diff\n", "move_line_obj.create(cr, uid, {'name': product.categ_id.name, 'account_id':\n account_variation_id, 'credit': amount_diff, 'move_id': move_id})\n", "move_line_obj.create(cr, uid, {'name': product.name, 'account_id':\n stock_output_acc, 'credit': amount_diff, 'move_id': move_id})\n", "move_line_obj.create(cr, uid, {'name': product.categ_id.name, 'account_id':\n account_variation_id, 'debit': amount_diff, 'move_id': move_id})\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 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "For", "For", "Return'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = VAR_6()\n", "if VAR_5.categories:\n", "VAR_8['categories'] = []\n", "if VAR_5.actions:\n", "VAR_8['actions'] = []\n", "if VAR_5.links:\n", "VAR_8['links'] = []\n", "if VAR_5.attributes:\n", "VAR_8['attributes'] = VAR_6()\n", "if VAR_5.location:\n", "VAR_8['location'] = VAR_5.location\n", "for category in VAR_5.categories:\n", "VAR_10 = VAR_6()\n", "for link in VAR_5.links:\n", "VAR_10['term'] = category.term\n", "VAR_10 = VAR_6()\n", "for action in VAR_5.actions:\n", "VAR_10['scheme'] = category.scheme\n", "if link.target_title:\n", "VAR_10 = VAR_6()\n", "for VAR_12, value in VAR_5.attributes:\n", "VAR_11 = category.__class__.__name__.lower()\n", "VAR_10['title'] = link.target_title\n", "VAR_10['target_uri'] = link.target_location\n", "if action.target_title:\n", "VAR_8['attributes'][VAR_12] = value\n", "return VAR_8\n", "VAR_10['class'] = VAR_11\n", "VAR_10['target_type'] = [str(cat) for cat in link.target_categories]\n", "VAR_10['title'] = action.target_title\n", "VAR_10['uri'] = action.target_location\n", "VAR_10['title'] = category.title\n", "if link.link_location:\n", "assert len(action.target_categories) == 1\n", "if category.related:\n", "VAR_10['link_uri'] = link.link_location\n", "if link.link_categories:\n", "VAR_10['type'] = str(action.target_categories[0])\n", "VAR_10['related'] = str(category.related)\n", "if category.attributes:\n", "VAR_10['link_type'] = [str(cat) for cat in link.link_categories]\n", "if link.link_attributes:\n", "VAR_8['actions'].append(VAR_10)\n", "VAR_13 = VAR_6()\n", "if hasattr(category, 'actions') and category.actions:\n", "VAR_14 = VAR_6()\n", "VAR_8['links'].append(VAR_10)\n", "for VAR_16 in category.unique_attributes:\n", "VAR_10['actions'] = [str(cat) for cat in category.actions]\n", "if hasattr(category, 'location') and category.location:\n", "for VAR_12, value in link.link_attributes:\n", "VAR_15 = VAR_6()\n", "VAR_10['attributes'] = VAR_13\n", "VAR_10['location'] = VAR_5.translator.url_build(category.location,\n path_only=True)\n", "VAR_8['categories'].append(VAR_10)\n", "VAR_14[VAR_12] = value\n", "VAR_10['attributes'] = VAR_14\n", "VAR_15['mutable'] = VAR_16.mutable\n", "VAR_15['required'] = VAR_16.required\n", "VAR_15['type'] = VAR_16.type_name\n", "VAR_13[VAR_16.name] = VAR_15\n" ]
[ "def _json_obj(self, obj):...\n", "\"\"\"docstring\"\"\"\n", "json_obj = OrderedDict()\n", "if obj.categories:\n", "json_obj['categories'] = []\n", "if obj.actions:\n", "json_obj['actions'] = []\n", "if obj.links:\n", "json_obj['links'] = []\n", "if obj.attributes:\n", "json_obj['attributes'] = OrderedDict()\n", "if obj.location:\n", "json_obj['location'] = obj.location\n", "for category in obj.categories:\n", "d = OrderedDict()\n", "for link in obj.links:\n", "d['term'] = category.term\n", "d = OrderedDict()\n", "for action in obj.actions:\n", "d['scheme'] = category.scheme\n", "if link.target_title:\n", "d = OrderedDict()\n", "for name, value in obj.attributes:\n", "cat_class = category.__class__.__name__.lower()\n", "d['title'] = link.target_title\n", "d['target_uri'] = link.target_location\n", "if action.target_title:\n", "json_obj['attributes'][name] = value\n", "return json_obj\n", "d['class'] = cat_class\n", "d['target_type'] = [str(cat) for cat in link.target_categories]\n", "d['title'] = action.target_title\n", "d['uri'] = action.target_location\n", "d['title'] = category.title\n", "if link.link_location:\n", "assert len(action.target_categories) == 1\n", "if category.related:\n", "d['link_uri'] = link.link_location\n", "if link.link_categories:\n", "d['type'] = str(action.target_categories[0])\n", "d['related'] = str(category.related)\n", "if category.attributes:\n", "d['link_type'] = [str(cat) for cat in link.link_categories]\n", "if link.link_attributes:\n", "json_obj['actions'].append(d)\n", "attr_defs = OrderedDict()\n", "if hasattr(category, 'actions') and category.actions:\n", "attrs = OrderedDict()\n", "json_obj['links'].append(d)\n", "for attr in category.unique_attributes:\n", "d['actions'] = [str(cat) for cat in category.actions]\n", "if hasattr(category, 'location') and category.location:\n", "for name, value in link.link_attributes:\n", "attr_props = OrderedDict()\n", "d['attributes'] = attr_defs\n", "d['location'] = obj.translator.url_build(category.location, path_only=True)\n", "json_obj['categories'].append(d)\n", "attrs[name] = value\n", "d['attributes'] = attrs\n", "attr_props['mutable'] = attr.mutable\n", "attr_props['required'] = attr.required\n", "attr_props['type'] = attr.type_name\n", "attr_defs[attr.name] = attr_props\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "For", "Assign'", "For", "Assign'", "Assign'", "For", "Assign'", "Condition", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assert'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "For", "Assign'", "Condition", "For", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self):...\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=-1), None)\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenInvalidTryCount(self):...\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=-1), None)\n", "self._mox.VerifyAll()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'" ]
[ "def __call__(self):...\n", "return self\n" ]
[ "def __call__(self):...\n", "return self\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_5(VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = subprocess.Popen(['nmcli', 'connection', 'delete', 'id', VAR_6],\n stdout=subprocess.PIPE)\n", "print(VAR_8)\n" ]
[ "def delete_WifiConn(wifiap):...\n", "\"\"\"docstring\"\"\"\n", "ps = subprocess.Popen(['nmcli', 'connection', 'delete', 'id', wifiap],\n stdout=subprocess.PIPE)\n", "print(ps)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "@click.command(help='Add a new monitor')...\n", "if VAR_6:\n", "VAR_7 = True\n", "VAR_23, VAR_30, VAR_12 = newrelic.create_monitor(VAR_0.obj['ACCOUNT'],\n VAR_1, VAR_2, VAR_4, VAR_3, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10)\n", "if VAR_11:\n", "print(json.dumps(VAR_12))\n", "if VAR_23 == 0:\n", "return\n", "print(click.style(u'OK', fg='green', bold=True))\n", "print(click.style(u'Error', fg='red', bold=True))\n", "print('Monitor: ' + VAR_30)\n" ]
[ "@click.command(help='Add a new monitor')...\n", "if validation_string:\n", "bypass_head_request = True\n", "status, message, monitor = newrelic.create_monitor(ctx.obj['ACCOUNT'], name,\n uri, frequency, location, email, validation_string, bypass_head_request,\n verify_ssl, redirect_is_failure, sla_threshold)\n", "if raw:\n", "print(json.dumps(monitor))\n", "if status == 0:\n", "return\n", "print(click.style(u'OK', fg='green', bold=True))\n", "print(click.style(u'Error', fg='red', bold=True))\n", "print('Monitor: ' + message)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_23):...\n", "if VAR_23 and self.r_css_name.match(VAR_23):\n", "return VAR_23\n" ]
[ "def run(self, name):...\n", "if name and self.r_css_name.match(name):\n", "return name\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "@mock.patch('requests.post', FUNC_0)...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = self.test_release()\n", "VAR_15 = Release.objects.get(uuid=release3['uuid'])\n", "self.assertIn('autotest deployed ', VAR_15.summary)\n" ]
[ "@mock.patch('requests.post', mock_import_repository_task)...\n", "\"\"\"docstring\"\"\"\n", "release3 = self.test_release()\n", "release = Release.objects.get(uuid=release3['uuid'])\n", "self.assertIn('autotest deployed ', release.summary)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_18(VAR_26):...\n", "VAR_56 = VAR_2.match(VAR_26)\n", "if not VAR_56:\n", "VAR_57, VAR_58 = VAR_56.groups()\n", "VAR_59 = datetime.strptime(VAR_57, '%Y-%m-%d')\n", "return VAR_59, int(VAR_58)\n" ]
[ "def decode_part_str(part_str):...\n", "match = PART_RE.match(part_str)\n", "if not match:\n", "date_str, retention_days = match.groups()\n", "date = datetime.strptime(date_str, '%Y-%m-%d')\n", "return date, int(retention_days)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_3=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_3 is None:\n", "VAR_3 = sys.argv\n", "VAR_4 = VAR_3[0]\n", "VAR_4 = VAR_3[0]\n", "VAR_3 = VAR_3[1:]\n", "if VAR_4 == __file__:\n", "VAR_11, VAR_12, VAR_13 = FUNC_1(VAR_3)\n", "VAR_4 = '{} -m ptvsd'.format(os.path.basename(sys.executable))\n", "VAR_14 = FUNC_2(VAR_4, VAR_11)\n", "VAR_8 = VAR_12 + ['--']\n", "if VAR_13:\n", "VAR_8 += VAR_13\n", "return VAR_14, VAR_8\n" ]
[ "def parse_args(argv=None):...\n", "\"\"\"docstring\"\"\"\n", "if argv is None:\n", "argv = sys.argv\n", "prog = argv[0]\n", "prog = argv[0]\n", "argv = argv[1:]\n", "if prog == __file__:\n", "supported, pydevd, script = _group_args(argv)\n", "prog = '{} -m ptvsd'.format(os.path.basename(sys.executable))\n", "args = _parse_args(prog, supported)\n", "extra = pydevd + ['--']\n", "if script:\n", "extra += script\n", "return args, extra\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Return'" ]