lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_1(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'SELECT description FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"return cursor.fetchall()\n"
] | [
"def get_all_inputs(self):...\n",
"connection = self.connect()\n",
"query = 'SELECT description FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"return cursor.fetchall()\n"
] | [
0,
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"self._check_key(VAR_1)\n"
] | [
"def test_ecdsa_key(self):...\n",
"self._check_key(ECDSA_PUBKEY)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"VAR_13 = ['Line1 passed', 'Line1 failed']\n",
"VAR_14 = ['Line1', 'Line2']\n",
"VAR_15 = [' passed', None]\n",
"self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[0]), VAR_15[0])\n",
"self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[1]), VAR_15[1])\n... | [
"def test_get_prefixed_value(self):...\n",
"lines = ['Line1 passed', 'Line1 failed']\n",
"prefix = ['Line1', 'Line2']\n",
"expected_output = [' passed', None]\n",
"self.assertEqual(self.driver._get_prefixed_value(lines, prefix[0]),\n expected_output[0])\n",
"self.assertEqual(self.driver._get_prefixed_v... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"VAR_21 = self.get_client_session()\n",
"if VAR_21:\n",
"VAR_21['webclient_authenticated_uid'] = self.uid\n",
"VAR_21.save()\n"
] | [
"def at_login(self):...\n",
"csession = self.get_client_session()\n",
"if csession:\n",
"csession['webclient_authenticated_uid'] = self.uid\n",
"csession.save()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_65):...\n",
"if self.overwrite_workdir is None:\n",
"if not os.path.exists(VAR_65):\n",
"os.makedirs(VAR_65)\n",
"self._workdir = VAR_65\n",
"os.chdir(VAR_65)\n"
] | [
"def workdir(self, workdir):...\n",
"if self.overwrite_workdir is None:\n",
"if not os.path.exists(workdir):\n",
"os.makedirs(workdir)\n",
"self._workdir = workdir\n",
"os.chdir(workdir)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_32(self, VAR_32, VAR_29):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_24 = self.getfile(VAR_32)\n",
"if VAR_24 == False:\n",
"return\n",
"if VAR_24[VAR_2] != VAR_13:\n",
"return\n",
"VAR_24[VAR_5] = VAR_29\n"
] | [
"def update_size(self, filename, size):...\n",
"\"\"\"docstring\"\"\"\n",
"f = self.getfile(filename)\n",
"if f == False:\n",
"return\n",
"if f[A_TYPE] != T_FILE:\n",
"return\n",
"f[A_SIZE] = size\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_2(self):...\n",
"VAR_1 = DataDocument.objects.first()\n",
"VAR_2 = self.client.get(f'/datadocument/179486/')\n",
"self.assertIn('Download Script', VAR_2.content.decode('utf-8'))\n",
"self.assertIn('Extraction Script', VAR_2.content.decode('utf-8'))\n"
] | [
"def test_script_links(self):...\n",
"doc = DataDocument.objects.first()\n",
"response = self.client.get(f'/datadocument/179486/')\n",
"self.assertIn('Download Script', response.content.decode('utf-8'))\n",
"self.assertIn('Extraction Script', response.content.decode('utf-8'))\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@cached_property...\n",
"\"\"\"docstring\"\"\"\n",
"return [VAR_46 for VAR_46 in self.fields if VAR_46.is_attribute]\n"
] | [
"@cached_property...\n",
"\"\"\"docstring\"\"\"\n",
"return [f for f in self.fields if f.is_attribute]\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@app.route('/api/sequences/<sequence_id>/sequence_items/<sequence_item_id>',...\n",
"app.logger.debug('modifying sequence item {} from sequence'.format(VAR_9,\n VAR_8))\n",
"VAR_21 = SequenceItem(VAR_3)\n",
"VAR_19.sequence_items = [(VAR_21 if x.id == VAR_9 else x) for x in VAR_19.\n sequence_items]\n"... | [
"@app.route('/api/sequences/<sequence_id>/sequence_items/<sequence_item_id>',...\n",
"app.logger.debug('modifying sequence item {} from sequence'.format(\n sequence_item_id, sequence_id))\n",
"new_sequence_item = SequenceItem(json)\n",
"sequence.sequence_items = [(new_sequence_item if x.id == sequence_item... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return [('no', _('No receipt')), ('default', _('Default')), ('only_email',\n _('Only email')), ('paper', _('On paper'))]\n"
] | [
"def _get_receipt_types(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return [('no', _('No receipt')), ('default', _('Default')), ('only_email',\n _('Only email')), ('paper', _('On paper'))]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_5(VAR_3, VAR_10, VAR_2):...\n",
"if '%(key)s' in VAR_3:\n",
"VAR_3 = VAR_3.replace('%(key)s', VAR_10)\n",
"if '%s' in VAR_3:\n",
"VAR_3 = VAR_3.replace('%s', (VAR_2 or '') + '%')\n",
"return VAR_3\n"
] | [
"def scrub_custom_query(query, key, txt):...\n",
"if '%(key)s' in query:\n",
"query = query.replace('%(key)s', key)\n",
"if '%s' in query:\n",
"query = query.replace('%s', (txt or '') + '%')\n",
"return query\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_15():...\n",
"if VAR_14 not in self._timers:\n",
"return\n",
"self._timers.remove(VAR_14)\n",
"VAR_10()\n",
"logging.exception('Timer callback failed')\n"
] | [
"def call_wrapper():...\n",
"if timer not in self._timers:\n",
"return\n",
"self._timers.remove(timer)\n",
"callback()\n",
"logging.exception('Timer callback failed')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_44(self):...\n",
"from frappe.utils.file_manager import extract_images_from_doc\n",
"if self.doctype != 'DocType':\n",
"for VAR_25 in self.meta.get('fields', {'fieldtype': ('=', 'Text Editor')}):\n",
"extract_images_from_doc(self, VAR_25.fieldname)\n"
] | [
"def _extract_images_from_text_editor(self):...\n",
"from frappe.utils.file_manager import extract_images_from_doc\n",
"if self.doctype != 'DocType':\n",
"for df in self.meta.get('fields', {'fieldtype': ('=', 'Text Editor')}):\n",
"extract_images_from_doc(self, df.fieldname)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Condition",
"For",
"Expr'"
] |
[
"@api.route('/item/', methods=['GET'])...\n",
"VAR_5 = request.args.get('name')\n",
"VAR_1 = ('SELECT id, name_enus FROM `tblDBCItem` WHERE name_enus LIKE \"%{}%\" '\n .format(VAR_5))\n",
"VAR_2 = mysql.connection.cursor()\n",
"VAR_2.execute(VAR_1)\n",
"VAR_3 = VAR_2.fetchall()\n",
"if VAR_3:\n",
"... | [
"@api.route('/item/', methods=['GET'])...\n",
"item_name = request.args.get('name')\n",
"sql = ('SELECT id, name_enus FROM `tblDBCItem` WHERE name_enus LIKE \"%{}%\" '\n .format(item_name))\n",
"cursor = mysql.connection.cursor()\n",
"cursor.execute(sql)\n",
"data = cursor.fetchall()\n",
"if data:\n"... | [
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"For",
"Assign'",
"Return'",
"For",
"Assign'",
"Expr'"
] |
[
"@staticmethod...\n",
"return [(CLASS_1(*VAR_3) if not isinstance(VAR_3, CLASS_1) else VAR_3) for\n VAR_3 in VAR_16]\n"
] | [
"@staticmethod...\n",
"return [(Column(*col) if not isinstance(col, Column) else col) for col in\n columns]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@auth.route('/logout')...\n",
"logout_user()\n",
"flash('You have logged out.')\n",
"return redirect(url_for('main.index'))\n"
] | [
"@auth.route('/logout')...\n",
"logout_user()\n",
"flash('You have logged out.')\n",
"return redirect(url_for('main.index'))\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'ACME', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='EQUIOM', VAR_10=[{'name': '----EQUIOM'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'ACME', id='1')\n",
"verify_results(client, jwt, query='EQUIOM', expected=[{'name': '----EQUIOM'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"self.conditions = []\n",
"self.grouped_or_conditions = []\n",
"self.build_filter_conditions(self.filters, self.conditions)\n",
"self.build_filter_conditions(self.or_filters, self.grouped_or_conditions)\n",
"if not self.flags.ignore_permissions:\n",
"VAR_58 = self.build_match_... | [
"def build_conditions(self):...\n",
"self.conditions = []\n",
"self.grouped_or_conditions = []\n",
"self.build_filter_conditions(self.filters, self.conditions)\n",
"self.build_filter_conditions(self.or_filters, self.grouped_or_conditions)\n",
"if not self.flags.ignore_permissions:\n",
"match_conditions ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"@tornado.gen.coroutine...\n",
"VAR_17 = 'string'\n",
"VAR_19 = yield VAR_1.execute(query=sql)\n",
"VAR_24 = VAR_19.fetchall()\n",
"VAR_25 = []\n",
"for t in VAR_24:\n",
"VAR_25.append({'id': t[0], 'title': '%s - %s' % (t[2], t[1])})\n",
"return VAR_25\n"
] | [
"@tornado.gen.coroutine...\n",
"sql = (\n 'SELECT boiler_rooms.id, boiler_rooms.name, districts.name from boiler_rooms JOIN districts ON(districts.id = district_id)'\n )\n",
"cursor = yield tx.execute(query=sql)\n",
"tuples = cursor.fetchall()\n",
"res = []\n",
"for t in tuples:\n",
"res.append({'... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"import cgi\n",
"import mysql.connector\n",
"from html import beghtml, endhtml\n",
"VAR_0 = cgi.FieldStorage()\n",
"VAR_1 = VAR_0.getvalue('search_enzyme')\n",
"VAR_2 = VAR_0.getvalue('search_process1')\n",
"VAR_3 = VAR_0.getvalue('search_process2')\n",
"VAR_4 = VAR_0.getvalue('search_enzyme2')\n",
... | [
"import cgi\n",
"import mysql.connector\n",
"from html import beghtml, endhtml\n",
"form = cgi.FieldStorage()\n",
"search_enzyme = form.getvalue('search_enzyme')\n",
"search_process1 = form.getvalue('search_process1')\n",
"search_process2 = form.getvalue('search_process2')\n",
"search_enzyme2 = form.g... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0... | [
"Import'",
"Import'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"... |
[
"def FUNC_16(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = block.sys_block_path(VAR_1)\n",
"VAR_28 = block.path_to_kname(VAR_1)\n",
"VAR_29 = [block.sys_block_path(h) for h in FUNC_15(VAR_1)\n ] + block.get_sysfs_partitions(VAR_1)\n",
"VAR_30 = next((k for k, v in VAR_10.items() if v['ident'](VAR_... | [
"def gen_holders_tree(device):...\n",
"\"\"\"docstring\"\"\"\n",
"device = block.sys_block_path(device)\n",
"dev_name = block.path_to_kname(device)\n",
"holder_paths = [block.sys_block_path(h) for h in get_holders(device)\n ] + block.get_sysfs_partitions(device)\n",
"dev_type = next((k for k, v in DEV_... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(VAR_30, VAR_3):...\n",
"if not isinstance(VAR_30, _IOFile):\n",
"return IOFile(VAR_30, VAR_16=self)\n",
"return VAR_30.apply_wildcards(VAR_3, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n"
] | [
"def concretize_iofile(f, wildcards):...\n",
"if not isinstance(f, _IOFile):\n",
"return IOFile(f, rule=self)\n",
"return f.apply_wildcards(wildcards, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = getUtility(IRegistry)\n",
"return False\n",
"return VAR_0\n",
"VAR_0 = VAR_15['collective.solr.active']\n"
] | [
"def isActive():...\n",
"\"\"\"docstring\"\"\"\n",
"registry = getUtility(IRegistry)\n",
"return False\n",
"return active\n",
"active = registry['collective.solr.active']\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"Return'",
"Assign'"
] |
[
"@property...\n",
"return self._input\n"
] | [
"@property...\n",
"return self._input\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.norun = True\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.norun = True\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def __init__(self):...\n",
"self.license_files = 0\n",
"self.exception_files = 0\n",
"self.licenses = []\n",
"self.exceptions = {}\n"
] | [
"def __init__(self):...\n",
"self.license_files = 0\n",
"self.exception_files = 0\n",
"self.licenses = []\n",
"self.exceptions = {}\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __hash__(self):...\n",
"return hash(self.name)\n"
] | [
"def __hash__(self):...\n",
"return hash(self.name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"if self._hosts_cache is None:\n",
"self._hosts_cache = self._get_hosts()\n",
"return self._hosts_cache\n"
] | [
"def get_hosts(self):...\n",
"if self._hosts_cache is None:\n",
"self._hosts_cache = self._get_hosts()\n",
"return self._hosts_cache\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_49(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('create table t1(n int, s text)')\n",
"self.cursor.execute(\"insert into t1 values (1, 'abc')\")\n",
"self.cursor.execute('select * from t1')\n",
"VAR_31 = self.cursor.description[0]\n",
"self.assertEqual(VAR_31[0], 'n')\n",
"s... | [
"def test_description(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('create table t1(n int, s text)')\n",
"self.cursor.execute(\"insert into t1 values (1, 'abc')\")\n",
"self.cursor.execute('select * from t1')\n",
"t = self.cursor.description[0]\n",
"self.assertEqual(t[0], 'n')\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_34, VAR_29):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def read(self, fd, size):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"@pytest.fixture(scope='session')...\n",
"return FUNC_2(VAR_0, 'postgres')\n"
] | [
"@pytest.fixture(scope='session')...\n",
"return _get_engine(request, 'postgres')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_1.route('/models')...\n",
"VAR_16 = FUNC_7('models.json')\n",
"return render_template('models.html', VAR_16=models)\n"
] | [
"@app.route('/models')...\n",
"models = load_json('models.json')\n",
"return render_template('models.html', models=models)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_26(self):...\n",
"for VAR_25 in self.meta.get('fields'):\n",
"if VAR_25.fieldtype == 'Check':\n",
"if self.docstatus is not None:\n",
"self.set(VAR_25.fieldname, cint(self.get(VAR_25.fieldname)))\n",
"if self.get(VAR_25.fieldname) is not None:\n",
"self.docstatus = cint(self.docstatus)\n",
"... | [
"def _fix_numeric_types(self):...\n",
"for df in self.meta.get('fields'):\n",
"if df.fieldtype == 'Check':\n",
"if self.docstatus is not None:\n",
"self.set(df.fieldname, cint(self.get(df.fieldname)))\n",
"if self.get(df.fieldname) is not None:\n",
"self.docstatus = cint(self.docstatus)\n",
"if df.fie... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_17(self, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"if not path.exists(VAR_17):\n",
"return 0\n",
"VAR_50 = sqlite3.connect(VAR_17)\n",
"return 0\n",
"VAR_52 = VAR_50.execute(\"select sql from sqlite_master where name='phrases';\"\n ).fetchall()\n",
"VAR_53 = ' '.join(VAR_52[0][0].splitl... | [
"def get_number_of_columns_of_phrase_table(self, db_file):...\n",
"\"\"\"docstring\"\"\"\n",
"if not path.exists(db_file):\n",
"return 0\n",
"db = sqlite3.connect(db_file)\n",
"return 0\n",
"tp_res = db.execute(\"select sql from sqlite_master where name='phrases';\"\n ).fetchall()\n",
"str = ' '.jo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"@api.public...\n",
""
] | [
"@api.public...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_7(self):...\n",
"return {}\n"
] | [
"def Response(self):...\n",
"return {}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(VAR_7)\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(volume)\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_1(self, VAR_3: str) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = await as_future(session.query(database.Paste).filter(database.Paste\n .removal_id == VAR_3).first)\n",
"if not VAR_7:\n",
"VAR_0.info('RemovePaste.get: someone visited with invalid id')\n",
"session.delete(VAR_7)\n",... | [
"async def get(self, removal_id: str) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"paste = await as_future(session.query(database.Paste).filter(database.Paste\n .removal_id == removal_id).first)\n",
"if not paste:\n",
"log.info('RemovePaste.get: someone visited with invalid id')\n",
"session.delete(paste... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@commands.command(pass_context=True, name='sr', hidden=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = VAR_4.message.author\n",
"if self.bot.helpers_role not in VAR_8.roles and self.bot.staff_role not in VAR_8.roles and self.bot.verified_role not in VAR_8.roles and self.bot.trusted_role not in VAR_8.roles:\... | [
"@commands.command(pass_context=True, name='sr', hidden=True)...\n",
"\"\"\"docstring\"\"\"\n",
"author = ctx.message.author\n",
"if self.bot.helpers_role not in author.roles and self.bot.staff_role not in author.roles and self.bot.verified_role not in author.roles and self.bot.trusted_role not in author.role... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_7, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('update items set itemname = \"%s\" where itemid = \"%s\"' %\n (VAR_8, VAR_7))\n",
"self.connection.commit()\n"
] | [
"def update_item(self, itemid, itemname):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor.execute('update items set itemname = \"%s\" where itemid = \"%s\"' %\n (itemname, itemid))\n",
"self.connection.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_44=None):...\n",
"if not VAR_101.user_is_loggedin:\n",
"if VAR_44 is not None and not valid_password(VAR_101.user, VAR_44):\n",
"VAR_101.errors.add(errors.WRONG_PASSWORD)\n"
] | [
"def run(self, password=None):...\n",
"if not c.user_is_loggedin:\n",
"if password is not None and not valid_password(c.user, password):\n",
"c.errors.add(errors.WRONG_PASSWORD)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'"
] |
[
"def FUNC_1(self, VAR_3: str) ->Iterator[CLASS_2]:...\n",
"...\n"
] | [
"def query(self, query_string: str) ->Iterator[IRow]:...\n",
"...\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
""
] | [
"@utils.synchronized('3par', external=True)...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def __str__(self):...\n",
"return 'Could not post ad, this user is banned.\\n' + super().__str__()\n"
] | [
"def __str__(self):...\n",
"return 'Could not post ad, this user is banned.\\n' + super().__str__()\n"
] | [
0,
5
] | [
"FunctionDef'",
"Return'"
] |
[
"@route('POST', '/-test/stop', VAR_1=website)...\n",
"FUNC_7()\n"
] | [
"@route('POST', '/-test/stop', website=website)...\n",
"stop_browser()\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"\"\"\"string\"\"\"\n",
"import sys\n",
"import citest.aws_testing as aws\n",
"import citest.json_contract as jc\n",
"import citest.service_testing as st\n",
"import spinnaker_testing as sk\n",
"import spinnaker_testing.kato as kato\n",
"\"\"\"string\"\"\"\n",
"VAR_0 = ''\n",
"@classmethod...\n",
... | [
"\"\"\"\nTests to see if CloudDriver/Kato can interoperate with Amazon Web Services.\n\nSample Usage:\n Assuming you have created $PASSPHRASE_FILE (which you should chmod 400):\n and $CITEST_ROOT points to the root directory of this repository\n (which is . if you execute this from the root)\n and $AWS_... | [
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Expr'",
"Assign'",
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"self._omnicomp.OnFileReadyToParse(None)\n",
"if not self._IsServerAlive():\n",
"self._NotifyUserIfServerCrashed()\n",
"VAR_5 = {}\n",
"self._AddTagsFilesIfNeeded(VAR_5)\n",
"self._AddSyntaxDataIfNeeded(VAR_5)\n",
"self._AddExtraConfDataIfNeeded(VAR_5)\n",
"self._latest_fi... | [
"def OnFileReadyToParse(self):...\n",
"self._omnicomp.OnFileReadyToParse(None)\n",
"if not self._IsServerAlive():\n",
"self._NotifyUserIfServerCrashed()\n",
"extra_data = {}\n",
"self._AddTagsFilesIfNeeded(extra_data)\n",
"self._AddSyntaxDataIfNeeded(extra_data)\n",
"self._AddExtraConfDataIfNeeded(ext... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_25(self):...\n",
"os.environ.update({'USER_EMAIL': 'joe@example.com', 'USER_ID': '123',\n 'USER_IS_ADMIN': '0'})\n",
"self.assertEqual(model.Identity(model.IDENTITY_USER, 'joe@example.com'),\n handler.gae_cookie_authentication(webapp2.Request({})))\n"
] | [
"def test_applicable(self):...\n",
"os.environ.update({'USER_EMAIL': 'joe@example.com', 'USER_ID': '123',\n 'USER_IS_ADMIN': '0'})\n",
"self.assertEqual(model.Identity(model.IDENTITY_USER, 'joe@example.com'),\n handler.gae_cookie_authentication(webapp2.Request({})))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"@VAR_0.route('one_hot_encode_column', methods=['POST'])...\n",
"VAR_1 = get_dataset_with_id(request.args.get('dataset_id'))\n",
"VAR_2 = request.form['column']\n",
"one_hot_encode(VAR_1.working_copy, VAR_2)\n",
"flash('An unexpected error occured while one-hot-encoding the column', 'danger'\n )\n",
"f... | [
"@_transform.route('one_hot_encode_column', methods=['POST'])...\n",
"dataset = get_dataset_with_id(request.args.get('dataset_id'))\n",
"col = request.form['column']\n",
"one_hot_encode(dataset.working_copy, col)\n",
"flash('An unexpected error occured while one-hot-encoding the column', 'danger'\n )\n",... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"\"\"\"\nShared functions for plan/case/run.\n\nMost of these functions are use for Ajax.\n\"\"\"\n",
"import datetime\n",
"import sys\n",
"import json\n",
"from distutils.util import strtobool\n",
"from django import http\n",
"from django.db.models import Q, Count\n",
"from django.contrib.auth.models... | [
"\"\"\"\nShared functions for plan/case/run.\n\nMost of these functions are use for Ajax.\n\"\"\"\n",
"import datetime\n",
"import sys\n",
"import json\n",
"from distutils.util import strtobool\n",
"from django import http\n",
"from django.db.models import Q, Count\n",
"from django.contrib.auth.models... | [
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
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom... |
[
"def FUNC_0(self):...\n",
"VAR_3 = VAR_2.execute('SELECT * FROM USERS')\n",
"VAR_4 = 0\n",
"for row in VAR_3:\n",
"VAR_4 = VAR_4 + 1\n",
"return {'Number of users': VAR_4}\n"
] | [
"def get(self):...\n",
"query = conn.execute('SELECT * FROM USERS')\n",
"i = 0\n",
"for row in query:\n",
"i = i + 1\n",
"return {'Number of users': i}\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"@property...\n",
"return base64.b64encode((self.rule.name + ''.join(self.output)).encode('utf-8')\n ).decode('utf-8')\n"
] | [
"@property...\n",
"return base64.b64encode((self.rule.name + ''.join(self.output)).encode('utf-8')\n ).decode('utf-8')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_5(VAR_0, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = pd.read_sql_table(VAR_0, db.engine)\n",
"print('ONE-HOT ENCODING FAILED')\n",
"VAR_19 = pd.get_dummies(VAR_15[VAR_5])\n",
"print('OH', VAR_19)\n",
"VAR_15 = VAR_15.join(VAR_19)\n",
"print('DF', VAR_15)\n",
"db.engine.execute('DRO... | [
"def one_hot_encode(table_name, attr):...\n",
"\"\"\"docstring\"\"\"\n",
"dataframe = pd.read_sql_table(table_name, db.engine)\n",
"print('ONE-HOT ENCODING FAILED')\n",
"one_hot = pd.get_dummies(dataframe[attr])\n",
"print('OH', one_hot)\n",
"dataframe = dataframe.join(one_hot)\n",
"print('DF', datafr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_22(VAR_23):...\n",
"VAR_63, VAR_64, VAR_65 = VAR_23.split('-')\n",
"VAR_64 = '01' if VAR_64 == '12' else str(int(VAR_64) + 1).zfill(2)\n",
"VAR_63 = str(int(VAR_63) + 1).zfill(2) if VAR_64 == '01' else VAR_63\n",
"VAR_23 = '{}-{}-{}'.format(VAR_63, VAR_64, VAR_65)\n",
"return VAR_23\n"
] | [
"def get_next_month(date):...\n",
"y, m, d = date.split('-')\n",
"m = '01' if m == '12' else str(int(m) + 1).zfill(2)\n",
"y = str(int(y) + 1).zfill(2) if m == '01' else y\n",
"date = '{}-{}-{}'.format(y, m, d)\n",
"return date\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(VAR_20, **VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4[VAR_20] = VAR_19\n"
] | [
"def add_existing_task(task_id, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"created_tasks[task_id] = kwargs\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def __init__(self, VAR_0=None):...\n",
"self.depth = 0\n",
"self.name = VAR_0\n",
"self.hosts = []\n",
"self._hosts = None\n",
"self.vars = {}\n",
"self.child_groups = []\n",
"self.parent_groups = []\n",
"self._hosts_cache = None\n",
"self.priority = 1\n"
] | [
"def __init__(self, name=None):...\n",
"self.depth = 0\n",
"self.name = name\n",
"self.hosts = []\n",
"self._hosts = None\n",
"self.vars = {}\n",
"self.child_groups = []\n",
"self.parent_groups = []\n",
"self._hosts_cache = None\n",
"self.priority = 1\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_14(self):...\n",
"self.last = self.token\n",
"self.token = FUNC_14(self.tokens, None)\n",
"return self.token\n"
] | [
"def next(self):...\n",
"self.last = self.token\n",
"self.token = next(self.tokens, None)\n",
"return self.token\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, *VAR_11, **VAR_12):...\n",
"VAR_12['options'].update({'send_prompt': True})\n",
"self.send_text(*VAR_11, **kwargs)\n"
] | [
"def send_prompt(self, *args, **kwargs):...\n",
"kwargs['options'].update({'send_prompt': True})\n",
"self.send_text(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_3, VAR_4, VAR_5):...\n",
"return {'tilejson': '2.1.0', 'name': VAR_3, 'version': '1.0.0', 'scheme':\n 'tms', 'tiles': VAR_4, 'minzoom': 0, 'maxzoom': 22, 'bounds': VAR_5}\n"
] | [
"def get_tile_json(name, tiles, bounds):...\n",
"return {'tilejson': '2.1.0', 'name': name, 'version': '1.0.0', 'scheme':\n 'tms', 'tiles': tiles, 'minzoom': 0, 'maxzoom': 22, 'bounds': bounds}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, **VAR_3):...\n",
"VAR_14 = Article.objects.order_by('-time')\n",
"for i in VAR_14:\n",
"i.md = markdown(i.content, extensions=['markdown.extensions.extra',\n 'markdown.extensions.codehilite', 'markdown.extensions.toc'])\n",
"return VAR_14\n"
] | [
"def get_queryset(self, **kwargs):...\n",
"queryset = Article.objects.order_by('-time')\n",
"for i in queryset:\n",
"i.md = markdown(i.content, extensions=['markdown.extensions.extra',\n 'markdown.extensions.codehilite', 'markdown.extensions.toc'])\n",
"return queryset\n"
] | [
0,
0,
0,
3,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_32(self, VAR_81):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.shellcmd = VAR_81\n",
"return VAR_101\n"
] | [
"def shellcmd(self, cmd):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.shellcmd = cmd\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self, VAR_6: str, VAR_5, VAR_4=None, VAR_7=None) ->str:...\n",
"if not isinstance(VAR_5, list):\n",
"VAR_5 = self.decompress(VAR_5)\n",
"VAR_15 = []\n",
"VAR_16 = self.build_attrs(VAR_4 or dict())\n",
"if 'required' in VAR_16:\n",
"VAR_17 = VAR_16.get('id', None)\n",
"for VAR_34, VAR_1 in ... | [
"def render(self, name: str, value, attrs=None, renderer=None) ->str:...\n",
"if not isinstance(value, list):\n",
"value = self.decompress(value)\n",
"output = []\n",
"final_attrs = self.build_attrs(attrs or dict())\n",
"if 'required' in final_attrs:\n",
"id_ = final_attrs.get('id', None)\n",
"for i, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_47(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n",
"self.check_example('httpoxy_cgihandler.py', VAR_2)\n",
"self.check_example('httpoxy_twisted_script.py', VAR_2)\n",
"self.check_example('httpoxy_twisted_directory.py', VAR_2)\n"
] | [
"def test_httpoxy(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n",
"self.check_example('httpoxy_cgihandler.py', expect)\n",
"self.check_example('httpoxy_twisted_script.py', expect)\n",
"self.check_example('httpoxy_twisted_directory.py', expect)\n"... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_9, VAR_3):...\n",
"if isinstance(VAR_9, slice):\n",
"VAR_30 = (\n f\"[{VAR_9.start or ''}:{VAR_9.stop or ''}{VAR_9.step and ':' + VAR_9.step or ''}]\"\n )\n",
"VAR_30 = f'[{VAR_9!r}]'\n",
"self._r_steps_.append((VAR_30, VAR_3))\n"
] | [
"def log_getitem(self, key_name, roamer):...\n",
"if isinstance(key_name, slice):\n",
"item_desc = (\n f\"[{key_name.start or ''}:{key_name.stop or ''}{key_name.step and ':' + key_name.step or ''}]\"\n )\n",
"item_desc = f'[{key_name!r}]'\n",
"self._r_steps_.append((item_desc, roamer))\n"
] | [
0,
0,
0,
0,
1
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0():...\n",
"system('cls')\n"
] | [
"def clear():...\n",
"system('cls')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_14(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_13(VAR_16)\n"
] | [
"def temporary(value):...\n",
"\"\"\"docstring\"\"\"\n",
"return temp(value)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_42(self):...\n",
"VAR_32 = list()\n",
"for VAR_14 in self.get_columns_list():\n",
"if not self.is_relation(VAR_14):\n",
"return VAR_32\n",
"VAR_38 = self.get_property_first_col(VAR_14).name\n",
"VAR_32.append(VAR_14)\n",
"if not self.is_pk(VAR_38) and not self.is_fk(VAR_38) and not self.is_i... | [
"def get_search_columns_list(self):...\n",
"ret_lst = list()\n",
"for col_name in self.get_columns_list():\n",
"if not self.is_relation(col_name):\n",
"return ret_lst\n",
"tmp_prop = self.get_property_first_col(col_name).name\n",
"ret_lst.append(col_name)\n",
"if not self.is_pk(tmp_prop) and not self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"VAR_5 = {'id': 'myid'}\n",
"VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_3.status_code, 201)\n",
"VAR_5 = {'id': VAR_3.data['id']}\n",
"VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_t... | [
"def test_app_override_id(self):...\n",
"body = {'id': 'myid'}\n",
"response = self.client.post('/api/apps', json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"body = {'id': response.data['id']}\n",
"response = self.client.post('/api/apps', json.... | [
0,
0,
5,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(VAR_28.size for VAR_28 in self.input)\n",
"return self._inputsize\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(f.size for f in self.input)\n",
"return self._inputsize\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Return'"
] |
[
"\"\"\"SchoolCMS-schoolcms-init.\"\"\"\n",
"from __future__ import absolute_import\n",
"from __future__ import print_function\n",
"from __future__ import unicode_literals\n",
"VAR_0 = '0.0.3dev2'\n",
"VAR_1 = 0, 0, 3, 12\n"
] | [
"\"\"\"SchoolCMS-schoolcms-init.\"\"\"\n",
"from __future__ import absolute_import\n",
"from __future__ import print_function\n",
"from __future__ import unicode_literals\n",
"version = '0.0.3dev2'\n",
"version_info = 0, 0, 3, 12\n"
] | [
0,
0,
0,
0,
5,
5
] | [
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_27, VAR_19=None):...\n",
"self._event = VAR_19\n",
"self.name = VAR_27\n"
] | [
"def __init__(self, name, event=None):...\n",
"self._event = event\n",
"self.name = name\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_15(self, VAR_24='/tmp/app_test_client.log', VAR_22=4567, VAR_23=...\n",
"def FUNC_41():...\n",
"self.listenTCP(VAR_22, VAR_23)\n",
"reactor.run()\n",
"VAR_67 = multiprocessing.Process(target=_start)\n",
"VAR_67.start()\n",
"time.sleep(1)\n",
"return lambda : VAR_67.terminate()\n"
] | [
"def run_on_a_thread(self, logfile='/tmp/app_test_client.log', port=4567,...\n",
"def _start():...\n",
"self.listenTCP(port, host)\n",
"reactor.run()\n",
"process = multiprocessing.Process(target=_start)\n",
"process.start()\n",
"time.sleep(1)\n",
"return lambda : process.terminate()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_11(self, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_44 = 'confirmation', 'paging', 'events', 'formatoutput'\n",
"VAR_0.error(_('Failed to setup the Dell EqualLogic driver'))\n",
"for feature in VAR_44:\n",
"self._eql_execute('cli-settings', feature, 'off')\n",
"for line in self._eql_execu... | [
"def do_setup(self, context):...\n",
"\"\"\"docstring\"\"\"\n",
"disabled_cli_features = 'confirmation', 'paging', 'events', 'formatoutput'\n",
"LOG.error(_('Failed to setup the Dell EqualLogic driver'))\n",
"for feature in disabled_cli_features:\n",
"self._eql_execute('cli-settings', feature, 'off')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"For",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_7, VAR_8=True, VAR_9=False, VAR_10=None, VAR_11=None,...\n",
"self.files = VAR_7\n",
"if not self.files:\n",
"self.files = [VAR_2]\n",
"if VAR_16:\n",
"self.cache_headers = VAR_8\n",
"self.files = (VAR_2,) + self.files\n",
"self.cors = VAR_9\n",
"self._inspect = VAR_10\n",
... | [
"def __init__(self, files, cache_headers=True, cors=False, inspect_data=None,...\n",
"self.files = files\n",
"if not self.files:\n",
"self.files = [MEMORY]\n",
"if memory:\n",
"self.cache_headers = cache_headers\n",
"self.files = (MEMORY,) + self.files\n",
"self.cors = cors\n",
"self._inspect = insp... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
... |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = VAR_0[:]\n",
"VAR_11.append((Allow, Authenticated, 'view'))\n",
"return VAR_11\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"acl = DEFAULT_PERM[:]\n",
"acl.append((Allow, Authenticated, 'view'))\n",
"return acl\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_23 = self.command()\n",
"if self.accept(CLASS_1.COMMAND_END):\n",
"VAR_42 = self.commands()\n",
"return VAR_23\n",
"if VAR_23 and VAR_42:\n",
"return CLASS_6(VAR_23, VAR_42)\n",
"return VAR_42\n"
] | [
"def commands(self):...\n",
"base = self.command()\n",
"if self.accept(TokenType.COMMAND_END):\n",
"other = self.commands()\n",
"return base\n",
"if base and other:\n",
"return DoubleNode(base, other)\n",
"return other\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_20(self, VAR_16):...\n",
"return self.meta.get_field(VAR_16).options\n"
] | [
"def get_table_field_doctype(self, fieldname):...\n",
"return self.meta.get_field(fieldname).options\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n",
"VAR_7 = []\n",
"VAR_8 = self.pool.get('ir.model.data')\n",
"VAR_9 = self.pool.get('account.bank.statement')\n",
"VAR_10 = self.pool.get('acc... | [
"def close_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\n",
"statement_obj = self.pool.get('account.bank.statement')\n",
"journa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"... |
[
"def FUNC_20(self, VAR_19, VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"for clause in reversed(self.order):\n",
"VAR_40 = VAR_20.has_wildcards() - VAR_19.has_wildcards()\n",
"VAR_51 = clause.index(VAR_19.name)\n",
"if VAR_40 != 0:\n",
"VAR_52 = clause.index(VAR_20.name)\n",
"return VAR_40\n",
"return... | [
"def compare(self, rule1, rule2):...\n",
"\"\"\"docstring\"\"\"\n",
"for clause in reversed(self.order):\n",
"wildcard_cmp = rule2.has_wildcards() - rule1.has_wildcards()\n",
"i = clause.index(rule1.name)\n",
"if wildcard_cmp != 0:\n",
"j = clause.index(rule2.name)\n",
"return wildcard_cmp\n",
"retu... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'"
] |
[
"def __init__(self, VAR_0):...\n",
"self.bot = VAR_0\n",
"self.updating = False\n"
] | [
"def __init__(self, bot):...\n",
"self.bot = bot\n",
"self.updating = False\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_33(self):...\n",
""
] | [
"def some_other_method(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@app.route('/api/indi_service/start', methods=['POST'])...\n",
""
] | [
"@app.route('/api/indi_service/start', methods=['POST'])...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_19(self, *VAR_67):...\n",
"self._localrules.update(VAR_67)\n"
] | [
"def localrules(self, *rulenames):...\n",
"self._localrules.update(rulenames)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_15(VAR_11, VAR_1, VAR_18, VAR_3, VAR_19, VAR_4):...\n",
"VAR_12 = []\n",
"for VAR_15 in range(VAR_11[1]):\n",
"VAR_29 = VAR_1.pop()\n",
"if VAR_11[2] == 1:\n",
"if VAR_29 >= 0:\n",
"VAR_7 = SymbolicInput(VAR_4[0], 'id', None)\n",
"VAR_12.insert(0, int(VAR_29, 16))\n",
"VAR_12.insert(0, VAR... | [
"def handleEnvOps(item, stack, memory, symbols, userIn, symId):...\n",
"params = []\n",
"for i in range(item[1]):\n",
"p = stack.pop()\n",
"if item[2] == 1:\n",
"if p >= 0:\n",
"x = SymbolicInput(symId[0], 'id', None)\n",
"params.insert(0, int(p, 16))\n",
"params.insert(0, p)\n",
"symbols[symId[0]... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"AugAssign'"
] |
[
"def FUNC_13(self, VAR_9, VAR_7):...\n",
"if not self.doctype:\n",
"return VAR_9\n",
"if not isinstance(VAR_9, CLASS_0):\n",
"if 'doctype' not in VAR_9:\n",
"VAR_9.parent = self.name\n",
"VAR_9['doctype'] = self.get_table_field_doctype(VAR_7)\n",
"VAR_9 = FUNC_0(VAR_9['doctype'])(VAR_9)\n",
"VAR_9.p... | [
"def _init_child(self, value, key):...\n",
"if not self.doctype:\n",
"return value\n",
"if not isinstance(value, BaseDocument):\n",
"if 'doctype' not in value:\n",
"value.parent = self.name\n",
"value['doctype'] = self.get_table_field_doctype(key)\n",
"value = get_controller(value['doctype'])(value)\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_35 = VAR_14.search_keyword(VAR_22, VAR_16=1000) if VAR_22 else select(g for\n g in VAR_14)\n",
"if VAR_20:\n",
"if VAR_20 == 'HEALTH':\n",
"return VAR_35\n",
"VAR_35 = VAR_35.sort_by('(g.health.seeders, g.health.leechers)'\n ) if VAR_21 else VAR... | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"pony_query = cls.search_keyword(query_filter, lim=1000\n ) if query_filter else select(g for g in cls)\n",
"if sort_by:\n",
"if sort_by == 'HEALTH':\n",
"return pony_query\n",
"pony_query = pony_query.sort_by('(g.health.seeders, g.health.leechers)'\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(self, VAR_1, VAR_3):...\n",
"VAR_4 = (\n \"insert into post(userid,date,comment) values(%d,current_timestamp(0),'%s');\"\n % (VAR_1, VAR_3))\n",
"VAR_5 = sql.insertDB(self.conn, VAR_4)\n",
"return VAR_5\n"
] | [
"def insertData(self, userid, post):...\n",
"sqlText = (\n \"insert into post(userid,date,comment) values(%d,current_timestamp(0),'%s');\"\n % (userid, post))\n",
"result = sql.insertDB(self.conn, sqlText)\n",
"return result\n"
] | [
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self, VAR_15, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = VAR_15[0]\n",
"VAR_18 = VAR_0\n",
"VAR_6 = self.customer_id\n",
"self.cursor.execute('string', (VAR_7, VAR_18))\n",
"VAR_19 = self.cursor.fetchall()\n",
"if len(VAR_19) == 0:\n",
"self.cursor.execute('string', {'store_id'... | [
"def _purchase_by_product(self, product, quantity):...\n",
"\"\"\"docstring\"\"\"\n",
"product_id = product[0]\n",
"store_id = ONLINE_STORE_ID\n",
"customer_id = self.customer_id\n",
"self.cursor.execute(\n \"\"\"\n SELECT product_id\n FROM store_sells_product\n WHERE p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_1 = ['DTXSID9022528', 'DTXSID1020273', 'DTXSID6026296', 'DTXSID2021781']\n",
"VAR_2 = stats_by_dtxsids(VAR_1)\n",
"for e in VAR_2:\n",
"if e['sid'] == 'DTXSID9022528':\n",
"self.assertEqual(2, VAR_3['dds_n'],\n 'There should be 2 datadocuments associated with ethylaraben'... | [
"def test_dtxsid_dds_n(self):...\n",
"dtxs = ['DTXSID9022528', 'DTXSID1020273', 'DTXSID6026296', 'DTXSID2021781']\n",
"stats = stats_by_dtxsids(dtxs)\n",
"for e in stats:\n",
"if e['sid'] == 'DTXSID9022528':\n",
"self.assertEqual(2, ethylparaben_stats['dds_n'],\n 'There should be 2 datadocuments associ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_14(self, VAR_0, *VAR_1, **VAR_2):...\n",
"if not VAR_0.user.is_authenticated:\n",
"return invalid_permission_redirect(VAR_0)\n",
"VAR_34 = VAR_0.POST.get('print_transaction', None)\n",
"if VAR_34:\n",
"VAR_4 = get_object_or_404(Transaction, code=print_transaction)\n",
"VAR_0.method = 'GET'\n",... | [
"def post(self, request, *args, **kwargs):...\n",
"if not request.user.is_authenticated:\n",
"return invalid_permission_redirect(request)\n",
"print_transaction = request.POST.get('print_transaction', None)\n",
"if print_transaction:\n",
"transaction = get_object_or_404(Transaction, code=print_transaction... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_0.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if VAR_1 not in oauth.remote_apps:\n",
"VAR_4 = oauth.remote_app(VAR_1, **conf['params']... | [
"@blueprint.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if remote_app not in oauth.remote_apps:\n",
"remote = oauth.remote_app(remote_a... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Docstring",
"Expr'",
"Expr'",
"For",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@functools.lru_cache(None)...\n",
"\"\"\"docstring\"\"\"\n",
"return self._get_model_field(Win, VAR_7)\n"
] | [
"@functools.lru_cache(None)...\n",
"\"\"\"docstring\"\"\"\n",
"return self._get_model_field(Win, name)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, *VAR_5, **VAR_6):...\n",
"VAR_2 = db.get_dataset(VAR_2)\n",
"VAR_27 = db.User.select()\n",
"VAR_28 = db.DatasetAccessCurrent.select().where(db.DatasetAccessCurrent.\n dataset == VAR_2)\n",
"VAR_10 = peewee.prefetch(VAR_27, VAR_28)\n",
"self.finish({'data': self._build_json_resp... | [
"def get(self, dataset, *args, **kwargs):...\n",
"dataset = db.get_dataset(dataset)\n",
"users = db.User.select()\n",
"access = db.DatasetAccessCurrent.select().where(db.DatasetAccessCurrent.\n dataset == dataset)\n",
"query = peewee.prefetch(users, access)\n",
"self.finish({'data': self._build_json_re... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, *VAR_2, **VAR_3):...\n",
"super(CLASS_0, self).__init__(*VAR_2, **kwargs)\n",
"self.cluster_vip = None\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(HpSanISCSIDriver, self).__init__(*args, **kwargs)\n",
"self.cluster_vip = None\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_2(self):...\n",
"VAR_0 = True\n"
] | [
"def run(self):...\n",
"stop = True\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_19():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_45 = None\n",
"VAR_46 = '/sys/fs/cgroup/memory/memory.limit_in_bytes'\n",
"if VAR_40.path.exists(VAR_46):\n",
"VAR_45 = int(VAR_8.read())\n",
"VAR_47 = None\n",
"import psutil\n",
"if VAR_47 is not None:\n",
"VAR_47 = psutil.virtual_memory().t... | [
"def get_system_memory():...\n",
"\"\"\"docstring\"\"\"\n",
"docker_limit = None\n",
"memory_limit_filename = '/sys/fs/cgroup/memory/memory.limit_in_bytes'\n",
"if os.path.exists(memory_limit_filename):\n",
"docker_limit = int(f.read())\n",
"psutil_memory_in_bytes = None\n",
"import psutil\n",
"if p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Import'",
"Condition",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'",
"Assign'"
] |
[
"def FUNC_4(self, VAR_9=None):...\n",
"if VAR_9 is None:\n",
"VAR_9 = self\n",
"VAR_21 = VAR_20.path.join(self.parlai_home, 'data')\n",
"VAR_9.add_argument('-dp', '--datapath', default=default_data_path, help=\n 'path to datasets, defaults to {parlai_dir}/data')\n"
] | [
"def add_parlai_data_path(self, argument_group=None):...\n",
"if argument_group is None:\n",
"argument_group = self\n",
"default_data_path = os.path.join(self.parlai_home, 'data')\n",
"argument_group.add_argument('-dp', '--datapath', default=default_data_path,\n help='path to datasets, defaults to {parla... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_3(VAR_5, 'unfreeze')\n"
] | [
"def startProgramUnfreezing(program_entity):...\n",
"\"\"\"docstring\"\"\"\n",
"return _processProgramFreezing(program_entity, 'unfreeze')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def __enter__(self):...\n",
"os.dup2(self.newfd, self.fd)\n"
] | [
"def __enter__(self):...\n",
"os.dup2(self.newfd, self.fd)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_8(self):...\n",
"VAR_6 = self.logger\n",
"async def FUNC_10():...\n",
"await self.processItem(VAR_5)\n",
"VAR_31 = CLASS_5(asyncio.get_event_loop())\n",
"self.handler.append(VAR_31)\n",
"VAR_13 = CLASS_6(self)\n",
"self.handler.append(VAR_13)\n",
"VAR_40 = asyncio.ensure_future(FUNC_... | [
"async def run(self):...\n",
"logger = self.logger\n",
"async def processQueue():...\n",
"await self.processItem(item)\n",
"idle = IdleStateTracker(asyncio.get_event_loop())\n",
"self.handler.append(idle)\n",
"behavior = InjectBehaviorOnload(self)\n",
"self.handler.append(behavior)\n",
"handle = asy... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"AsyncFunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.