lines
sequencelengths 1
444
| raw_lines
sequencelengths 1
444
| label
sequencelengths 1
444
| type
sequencelengths 1
444
|
---|---|---|---|
[
"def FUNC_6(VAR_3):...\n",
"VAR_8 = get_activation_link(VAR_3)\n",
"VAR_9 = {'activation_link': VAR_8, 'user': VAR_3}\n",
"VAR_10 = email.EmailHolder(subject='Verify your {} account'.format(app.\n config['GLOBAL_SITE_NAME']), recipient=user, text=flask.render_template\n ('email/verify.txt', **tmpl_context), html=flask.render_template(\n 'email/verify.html', **tmpl_context))\n",
"email.send_email(VAR_10)\n"
] | [
"def send_verification_email(user):...\n",
"activation_link = get_activation_link(user)\n",
"tmpl_context = {'activation_link': activation_link, 'user': user}\n",
"email_msg = email.EmailHolder(subject='Verify your {} account'.format(app.\n config['GLOBAL_SITE_NAME']), recipient=user, text=flask.render_template\n ('email/verify.txt', **tmpl_context), html=flask.render_template(\n 'email/verify.html', **tmpl_context))\n",
"email.send_email(email_msg)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_30(self, VAR_78):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.version = VAR_78\n",
"return VAR_101\n"
] | [
"def version(self, version):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.version = version\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self, VAR_3):...\n",
"return VAR_3 in self.__slug_map\n"
] | [
"def has_slug(self, entity_slug):...\n",
"return entity_slug in self.__slug_map\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self, VAR_5):...\n",
"return 'LIMIT {}'.format(VAR_5)\n"
] | [
"def create_limit(self, limit):...\n",
"return 'LIMIT {}'.format(limit)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (select name from tabUser), count(name))'],\n limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, (select count(*) from tabSessions)'],\n limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n \"issingle, SELECT LOCATE('', `tabUser`.`user`) AS user;\"], limit_start=\n 0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (SELECT name from tabUser), count(*))'],\n limit_start=0, limit_page_length=1)\n",
"VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'count(name)'], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('count(name)' in VAR_3[0])\n",
"VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n \"locate('', name) as _relevance\"], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('_relevance' in VAR_3[0])\n",
"VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'date(creation) as creation'], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('creation' in VAR_3[0])\n",
"VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'datediff(modified, creation) as date_diff'], limit_start=0,\n limit_page_length=1)\n",
"self.assertTrue('date_diff' in VAR_3[0])\n"
] | [
"def test_query_fields_sanitizer(self):...\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (select name from tabUser), count(name))'],\n limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, (select count(*) from tabSessions)'],\n limit_start=0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n \"issingle, SELECT LOCATE('', `tabUser`.`user`) AS user;\"], limit_start=\n 0, limit_page_length=1)\n",
"self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (SELECT name from tabUser), count(*))'],\n limit_start=0, limit_page_length=1)\n",
"data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'count(name)'], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('count(name)' in data[0])\n",
"data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n \"locate('', name) as _relevance\"], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('_relevance' in data[0])\n",
"data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'date(creation) as creation'], limit_start=0, limit_page_length=1)\n",
"self.assertTrue('creation' in data[0])\n",
"data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'datediff(modified, creation) as date_diff'], limit_start=0,\n limit_page_length=1)\n",
"self.assertTrue('date_diff' in data[0])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
"def RestartServer(self):...\n",
"vimsupport.PostVimMessage('Restarting ycmd server...')\n",
"self._user_notified_about_crash = False\n",
"self._ServerCleanup()\n",
"self._SetupServer()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"import re\n",
"from django import forms\n",
"from django.contrib.contenttypes.models import ContentType\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from wiki.models import Article\n",
"from wiki.models import ChangeSet\n",
"from wiki.templatetags.wiki_extras import WIKI_WORD_RE\n",
"VAR_0 = re.compile('^' + WIKI_WORD_RE + '$')\n",
"VAR_1 = forms.CharField(widget=forms.Textarea)\n",
"VAR_2 = forms.CharField(required=False)\n",
"VAR_3 = forms.CharField(widget=forms.HiddenInput)\n",
"VAR_4 = forms.ModelChoiceField(queryset=ContentType.objects.all(), required\n =False, widget=forms.HiddenInput)\n",
"VAR_5 = forms.IntegerField(required=False, widget=forms.HiddenInput)\n",
"VAR_6 = forms.CharField(widget=forms.HiddenInput)\n",
"VAR_9 = Article\n",
"VAR_10 = 'creator', 'creator_ip', 'group', 'created_at', 'last_update'\n",
"def FUNC_0(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = self.cleaned_data['title']\n",
"if not VAR_0.match(VAR_11):\n",
"VAR_12 = ChangeSet.objects.filter(old_title=title).count()\n",
"if VAR_12 > 0:\n",
"return VAR_11\n"
] | [
"import re\n",
"from django import forms\n",
"from django.contrib.contenttypes.models import ContentType\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from wiki.models import Article\n",
"from wiki.models import ChangeSet\n",
"from wiki.templatetags.wiki_extras import WIKI_WORD_RE\n",
"wikiword_pattern = re.compile('^' + WIKI_WORD_RE + '$')\n",
"summary = forms.CharField(widget=forms.Textarea)\n",
"comment = forms.CharField(required=False)\n",
"user_ip = forms.CharField(widget=forms.HiddenInput)\n",
"content_type = forms.ModelChoiceField(queryset=ContentType.objects.all(),\n required=False, widget=forms.HiddenInput)\n",
"object_id = forms.IntegerField(required=False, widget=forms.HiddenInput)\n",
"action = forms.CharField(widget=forms.HiddenInput)\n",
"model = Article\n",
"exclude = 'creator', 'creator_ip', 'group', 'created_at', 'last_update'\n",
"def clean_title(self):...\n",
"\"\"\"docstring\"\"\"\n",
"title = self.cleaned_data['title']\n",
"if not wikiword_pattern.match(title):\n",
"cs = ChangeSet.objects.filter(old_title=title).count()\n",
"if cs > 0:\n",
"return title\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
6,
6,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"self.cursor.close()\n",
"self.mydb.close()\n"
] | [
"def close(self):...\n",
"self.cursor.close()\n",
"self.mydb.close()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_10, VAR_8):...\n",
"VAR_29, VAR_28 = VAR_10.compile(self.lhs)\n",
"return '%s[%s]' % (VAR_29, self.index), VAR_28\n"
] | [
"def as_sql(self, compiler, connection):...\n",
"lhs, params = compiler.compile(self.lhs)\n",
"return '%s[%s]' % (lhs, self.index), params\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.config.getint(self.section, 'listen_port')\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.config.getint(self.section, 'listen_port')\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"return self.title\n"
] | [
"def get_feed(self):...\n",
"return self.title\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import collections\n",
"import os\n",
"import pymongo\n",
"from django.http import Http404\n",
"from cuckoo.core.database import Database, TASK_PENDING\n",
"from cuckoo.common.mongo import mongo\n",
"VAR_0 = Database()\n",
"@staticmethod...\n",
"if not isinstance(VAR_1, int):\n",
"VAR_9 = {}\n",
"VAR_10 = VAR_0.view_task(VAR_1, details=True)\n",
"if VAR_10:\n",
"VAR_19 = VAR_10.to_dict()\n",
"return Exception('Task not found')\n",
"VAR_19['guest'] = {}\n",
"if VAR_10.guest:\n",
"VAR_19['guest'] = VAR_10.guest.to_dict()\n",
"VAR_19['errors'] = []\n",
"for error in VAR_10.errors:\n",
"VAR_19['errors'].append(error.message)\n",
"VAR_19['sample'] = {}\n",
"if VAR_10.sample_id:\n",
"VAR_26 = VAR_0.view_sample(VAR_10.sample_id)\n",
"VAR_9['task'] = VAR_19\n",
"VAR_19['sample'] = VAR_26.to_dict()\n",
"return VAR_9\n"
] | [
"import collections\n",
"import os\n",
"import pymongo\n",
"from django.http import Http404\n",
"from cuckoo.core.database import Database, TASK_PENDING\n",
"from cuckoo.common.mongo import mongo\n",
"db = Database()\n",
"@staticmethod...\n",
"if not isinstance(task_id, int):\n",
"data = {}\n",
"task = db.view_task(task_id, details=True)\n",
"if task:\n",
"entry = task.to_dict()\n",
"return Exception('Task not found')\n",
"entry['guest'] = {}\n",
"if task.guest:\n",
"entry['guest'] = task.guest.to_dict()\n",
"entry['errors'] = []\n",
"for error in task.errors:\n",
"entry['errors'].append(error.message)\n",
"entry['sample'] = {}\n",
"if task.sample_id:\n",
"sample = db.view_sample(task.sample_id)\n",
"data['task'] = entry\n",
"entry['sample'] = sample.to_dict()\n",
"return data\n"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"from django.http import HttpResponse\n",
"from django.shortcuts import render\n",
"from django.core.urlresolvers import reverse\n",
"def FUNC_0(VAR_0):...\n",
"if VAR_0.method == 'POST':\n",
"VAR_2 = VAR_0.POST.get('answer', '').lower()\n",
"return render(VAR_0, 'exercises/first_exercise.html')\n",
"VAR_3 = 0\n",
"if 'hello' in VAR_2:\n",
"VAR_3 += 1\n",
"if 'a+' in VAR_2:\n",
"VAR_3 += 1\n",
"return render(VAR_0, 'exercises/first_result.html', {'points': VAR_3,\n 'max_points': 2})\n"
] | [
"from django.http import HttpResponse\n",
"from django.shortcuts import render\n",
"from django.core.urlresolvers import reverse\n",
"def first(request):...\n",
"if request.method == 'POST':\n",
"submission = request.POST.get('answer', '').lower()\n",
"return render(request, 'exercises/first_exercise.html')\n",
"points = 0\n",
"if 'hello' in submission:\n",
"points += 1\n",
"if 'a+' in submission:\n",
"points += 1\n",
"return render(request, 'exercises/first_result.html', {'points': points,\n 'max_points': 2})\n"
] | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_41):...\n",
"VAR_79 = CLASS_24.run(self, VAR_41)\n",
"if VAR_79:\n",
"if not VAR_79._loaded:\n",
"return self.error(errors.NOT_AUTHOR)\n",
"VAR_79._load()\n",
"if VAR_101.user_is_loggedin and VAR_79.author_id == VAR_101.user._id:\n",
"return VAR_79\n"
] | [
"def run(self, fullname):...\n",
"thing = VByName.run(self, fullname)\n",
"if thing:\n",
"if not thing._loaded:\n",
"return self.error(errors.NOT_AUTHOR)\n",
"thing._load()\n",
"if c.user_is_loggedin and thing.author_id == c.user._id:\n",
"return thing\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_7.environ.pop('SWARMING_BOT_ID', None)\n",
"VAR_7.chdir(self.old_cwd)\n",
"file_path.rmtree(self.root_dir)\n",
"super(CLASS_0, self).tearDown()\n"
] | [
"def tearDown(self):...\n",
"os.environ.pop('SWARMING_BOT_ID', None)\n",
"os.chdir(self.old_cwd)\n",
"file_path.rmtree(self.root_dir)\n",
"super(TestBotMain, self).tearDown()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_1.route('/logout')...\n",
"logout_user()\n",
"return redirect(url_for('view_home'))\n"
] | [
"@app.route('/logout')...\n",
"logout_user()\n",
"return redirect(url_for('view_home'))\n"
] | [
0,
0,
0
] | [
"Condition",
"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_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_21(self, VAR_14):...\n",
""
] | [
"def is_relation_one_to_many(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_8(self, VAR_1):...\n",
"return self.data['groups'].get(VAR_1.id, ([], None))\n"
] | [
"def groups(self, instance):...\n",
"return self.data['groups'].get(instance.id, ([], None))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"clear_cache('writers')\n"
] | [
"def on_update(self):...\n",
"clear_cache('writers')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"VAR_0 = 'user_id'\n",
"VAR_1 = 'view_introduction'\n",
"VAR_2 = 'instructor_intro'\n",
"VAR_3 = 'create_course'\n",
"VAR_4 = 'create_courselet'\n",
"VAR_5 = 'create_thread'\n",
"VAR_6 = 'preview_courselet'\n",
"VAR_7 = 'next_steps'\n",
"VAR_8 = 'invite_somebody'\n",
"VAR_9 = 'introduction_course_id'\n",
"VAR_10 = VAR_1\n",
"VAR_11 = VAR_2\n",
"VAR_12 = VAR_3\n",
"VAR_13 = VAR_4\n",
"VAR_14 = VAR_5\n",
"VAR_15 = VAR_6\n",
"VAR_16 = VAR_7\n",
"VAR_17 = VAR_8\n"
] | [
"USER_ID = 'user_id'\n",
"STEP_1 = 'view_introduction'\n",
"STEP_2 = 'instructor_intro'\n",
"STEP_3 = 'create_course'\n",
"STEP_4 = 'create_courselet'\n",
"STEP_5 = 'create_thread'\n",
"STEP_6 = 'preview_courselet'\n",
"STEP_7 = 'next_steps'\n",
"STEP_8 = 'invite_somebody'\n",
"INTRODUCTION_COURSE_ID = 'introduction_course_id'\n",
"VIEW_INTRODUCTION = STEP_1\n",
"INTRODUCTION_INTRO = STEP_2\n",
"CREATE_COURSE = STEP_3\n",
"CREATE_COURSELET = STEP_4\n",
"CREATE_THREAD = STEP_5\n",
"PREVIEW_COURSELET = STEP_6\n",
"NEXT_STEPS = STEP_7\n",
"INVITE_SOMEBODY = STEP_8\n"
] | [
0,
0,
6,
0,
0,
0,
0,
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
6
] | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_19(self):...\n",
"self.compilation_ok('string')\n"
] | [
"def test_vacationext_basic(self):...\n",
"self.compilation_ok(\n \"\"\"\nrequire \"vacation\";\nif header :contains \"subject\" \"cyrus\" {\n vacation \"I'm out -- send mail to cyrus-bugs\";\n} else {\n vacation \"I'm out -- call me at +1 304 555 0123\";\n}\n\"\"\"\n )\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/losses')...\n",
"if VAR_0 == None:\n",
"FUNC_16()\n",
"VAR_26 = request.args.get('tag', default='christmasmike')\n",
"VAR_8 = \"SELECT * FROM matches WHERE (player1 = '\" + str(VAR_26\n ) + \"' OR \" + \"player2 = '\" + str(VAR_26) + \"') AND winner != '\" + str(\n VAR_26) + \"' ORDER BY date DESC;\"\n",
"VAR_27 = VAR_0.exec(VAR_8)\n",
"VAR_27 = [str(x) for x in VAR_27]\n",
"return json.dumps('\\n'.join(VAR_27))\n"
] | [
"@endpoints.route('/losses')...\n",
"if db == None:\n",
"init()\n",
"player = request.args.get('tag', default='christmasmike')\n",
"sql = \"SELECT * FROM matches WHERE (player1 = '\" + str(player\n ) + \"' OR \" + \"player2 = '\" + str(player) + \"') AND winner != '\" + str(\n player) + \"' ORDER BY date DESC;\"\n",
"result = db.exec(sql)\n",
"result = [str(x) for x in result]\n",
"return json.dumps('\\n'.join(result))\n"
] | [
0,
0,
0,
0,
4,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import copy\n",
"import unittest\n",
"import mock\n",
"from oslo_serialization import jsonutils\n",
"from oslo_utils import uuidutils\n",
"from requests import exceptions as requests_exceptions\n",
"from vmware_nsxlib import v3\n",
"from vmware_nsxlib.v3 import client as nsx_client\n",
"from vmware_nsxlib.v3 import client_cert\n",
"from vmware_nsxlib.v3 import cluster as nsx_cluster\n",
"from vmware_nsxlib.v3 import config\n",
"VAR_0 = 'admin'\n",
"VAR_1 = 'default'\n",
"VAR_2 = '1.2.3.4'\n",
"VAR_3 = False\n",
"VAR_4 = '/opt/stack/certs/nsx.pem'\n",
"VAR_5 = '/opt/stack/certs/client.pem'\n",
"VAR_6 = 10\n",
"VAR_7 = 10\n",
"VAR_8 = 180\n",
"VAR_9 = 10\n",
"VAR_10 = 10\n",
"VAR_11 = 10\n",
"VAR_12 = 'plugin scope'\n",
"VAR_13 = 'plugin tag'\n",
"VAR_14 = 'plugin ver'\n",
"VAR_15 = ['1.1.1.1']\n",
"VAR_16 = 'openstacklocal'\n",
"def FUNC_0():...\n",
"def FUNC_3(*VAR_17, **VAR_18):...\n",
"return {'id': uuidutils.generate_uuid()}\n"
] | [
"import copy\n",
"import unittest\n",
"import mock\n",
"from oslo_serialization import jsonutils\n",
"from oslo_utils import uuidutils\n",
"from requests import exceptions as requests_exceptions\n",
"from vmware_nsxlib import v3\n",
"from vmware_nsxlib.v3 import client as nsx_client\n",
"from vmware_nsxlib.v3 import client_cert\n",
"from vmware_nsxlib.v3 import cluster as nsx_cluster\n",
"from vmware_nsxlib.v3 import config\n",
"NSX_USER = 'admin'\n",
"NSX_PASSWORD = 'default'\n",
"NSX_MANAGER = '1.2.3.4'\n",
"NSX_INSECURE = False\n",
"NSX_CERT = '/opt/stack/certs/nsx.pem'\n",
"CLIENT_CERT = '/opt/stack/certs/client.pem'\n",
"NSX_HTTP_RETRIES = 10\n",
"NSX_HTTP_TIMEOUT = 10\n",
"NSX_HTTP_READ_TIMEOUT = 180\n",
"NSX_CONCURENT_CONN = 10\n",
"NSX_CONN_IDLE_TIME = 10\n",
"NSX_MAX_ATTEMPTS = 10\n",
"PLUGIN_SCOPE = 'plugin scope'\n",
"PLUGIN_TAG = 'plugin tag'\n",
"PLUGIN_VER = 'plugin ver'\n",
"DNS_NAMESERVERS = ['1.1.1.1']\n",
"DNS_DOMAIN = 'openstacklocal'\n",
"def _mock_nsxlib():...\n",
"def _return_id_key(*args, **kwargs):...\n",
"return {'id': uuidutils.generate_uuid()}\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
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_53(self):...\n",
"VAR_2 = {'nosec': 2, 'loc': 7, 'issues': {'CONFIDENCE': {'HIGH': 5},\n 'SEVERITY': {'LOW': 5}}}\n",
"self.check_metrics('skip.py', VAR_2)\n",
"VAR_2 = {'nosec': 0, 'loc': 4, 'issues': {'CONFIDENCE': {'HIGH': 2},\n 'SEVERITY': {'LOW': 2}}}\n",
"self.check_metrics('imports.py', VAR_2)\n"
] | [
"def test_metric_gathering(self):...\n",
"expect = {'nosec': 2, 'loc': 7, 'issues': {'CONFIDENCE': {'HIGH': 5},\n 'SEVERITY': {'LOW': 5}}}\n",
"self.check_metrics('skip.py', expect)\n",
"expect = {'nosec': 0, 'loc': 4, 'issues': {'CONFIDENCE': {'HIGH': 2},\n 'SEVERITY': {'LOW': 2}}}\n",
"self.check_metrics('imports.py', expect)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6():...\n",
"if not request.method in VAR_0:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"VAR_7 = urlparse(request.environ.get('HTTP_REFERER'))\n",
"if request.method == 'GET' and FUNC_4():\n",
"VAR_8 = VAR_7.hostname\n",
"return True\n",
"return False\n",
"if VAR_7.port:\n",
"VAR_8 += ':' + str(VAR_7.port)\n",
"if VAR_8.endswith(request.environ['adhocracy.domain']):\n",
"if request.method != 'GET':\n",
"return True\n"
] | [
"def check():...\n",
"if not request.method in methods:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"ref_url = urlparse(request.environ.get('HTTP_REFERER'))\n",
"if request.method == 'GET' and has_token():\n",
"ref_host = ref_url.hostname\n",
"return True\n",
"return False\n",
"if ref_url.port:\n",
"ref_host += ':' + str(ref_url.port)\n",
"if ref_host.endswith(request.environ['adhocracy.domain']):\n",
"if request.method != 'GET':\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"Return'"
] |
[
"def FUNC_10(VAR_20, VAR_21):...\n",
"return VAR_21[len(VAR_20):] if VAR_21.startswith(VAR_20) else VAR_21\n"
] | [
"def strip_prefix(prefix, s):...\n",
"return s[len(prefix):] if s.startswith(prefix) else s\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
""
] | [
"def write(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(self):...\n",
"return shellutil.run('service sshd restart', VAR_10=False)\n"
] | [
"def restart_ssh_service(self):...\n",
"return shellutil.run('service sshd restart', chk_err=False)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self):...\n",
"return self._email\n"
] | [
"def email(self):...\n",
"return self._email\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"VAR_0 = 'pos.open.statement'\n",
"VAR_1 = 'Open Statements'\n",
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = []\n",
"VAR_7 = self.pool.get('ir.model.data')\n",
"VAR_8 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n",
"VAR_9 = self.pool.get('account.bank.statement')\n",
"VAR_10 = self.pool.get('ir.sequence')\n",
"VAR_11 = self.pool.get('account.journal')\n",
"VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n",
"VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_12)))\n",
"VAR_13 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"for journal in VAR_11.browse(VAR_2, VAR_3, VAR_13):\n",
"VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n",
"VAR_14 = self.pool.get('ir.model.data')\n",
"if len(VAR_4):\n",
"VAR_15 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n",
"VAR_17 = ''\n",
"VAR_16 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n",
"if journal.sequence_id:\n",
"if VAR_15:\n",
"VAR_17 = VAR_10.get_id(VAR_2, VAR_3, journal.sequence_id.id)\n",
"VAR_17 = VAR_10.get(VAR_2, VAR_3, 'account.bank.statement')\n",
"VAR_15 = VAR_14.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n",
"if VAR_16:\n",
"VAR_18 = VAR_9.create(VAR_2, VAR_3, {'journal_id': journal.id, 'company_id':\n VAR_8, 'user_id': VAR_3, 'state': 'open', 'name': VAR_17,\n 'starting_details_ids': VAR_9._get_cash_close_box_lines(VAR_2, VAR_3, [])})\n",
"VAR_16 = VAR_14.browse(VAR_2, VAR_3, VAR_16, VAR_5=context).res_id\n",
"return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(VAR_15, 'tree'), (VAR_16, 'form')],\n 'type': 'ir.actions.act_window'}\n",
"VAR_9.button_open(VAR_2, VAR_3, [VAR_18], VAR_5)\n"
] | [
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"_name = 'pos.open.statement'\n",
"_description = 'Open Statements'\n",
"def open_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\n",
"company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n",
"statement_obj = self.pool.get('account.bank.statement')\n",
"sequence_obj = self.pool.get('ir.sequence')\n",
"journal_obj = self.pool.get('account.journal')\n",
"cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n",
"j_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n",
"journal_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"for journal in journal_obj.browse(cr, uid, journal_ids):\n",
"ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n",
"data_obj = self.pool.get('ir.model.data')\n",
"if len(ids):\n",
"id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n",
"number = ''\n",
"id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n",
"if journal.sequence_id:\n",
"if id2:\n",
"number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)\n",
"number = sequence_obj.get(cr, uid, 'account.bank.statement')\n",
"id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n",
"if id3:\n",
"statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id,\n 'company_id': company_id, 'user_id': uid, 'state': 'open', 'name':\n number, 'starting_details_ids': statement_obj._get_cash_close_box_lines\n (cr, uid, [])})\n",
"id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n",
"return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(id2, 'tree'), (id3, 'form')],\n 'type': 'ir.actions.act_window'}\n",
"statement_obj.button_open(cr, uid, [statement_id], context)\n"
] | [
0,
0,
0,
0,
0,
0,
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,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_45(self):...\n",
"return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n"
] | [
"def get_image_column_list(self):...\n",
"return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_18(self, VAR_11):...\n",
"assert json.loads(self.response.content) == json.loads(VAR_11)\n",
"return self\n"
] | [
"def then_response_should_be_json(self, json_string):...\n",
"assert json.loads(self.response.content) == json.loads(json_string)\n",
"return self\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Return'"
] |
[
"def FUNC_9(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"logging.error('Error: %s\\n%s', self._attributes, VAR_8)\n",
"self.post_event('bot_error', VAR_8)\n",
"logging.exception('post_error(%s) failed.', VAR_8)\n"
] | [
"def post_error(self, message):...\n",
"\"\"\"docstring\"\"\"\n",
"logging.error('Error: %s\\n%s', self._attributes, message)\n",
"self.post_event('bot_error', message)\n",
"logging.exception('post_error(%s) failed.', message)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"VAR_5 = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'enableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'user': 'integration-tests'}]\n",
"VAR_6 = gcp.GceContractBuilder(self.gce_observer)\n",
"VAR_6.new_clause_builder('Server Group Enabled', retryable_for_secs=90\n ).list_resources('managed-instance-groups').contains_pred_list([jc.\n PathContainsPredicate('baseInstanceName', self.__server_group_name), jc\n .PathContainsPredicate('targetPools', 'https')])\n",
"VAR_7 = self.agent.make_json_payload_from_kwargs(VAR_5=job, description=\n 'Server Group Test - enable server group', application=self.TEST_APP)\n",
"return st.OperationContract(self.new_post_operation(title=\n 'enable_server_group', data=payload, path=self.__path), contract=\n builder.build())\n"
] | [
"def enable_server_group(self):...\n",
"job = [{'cloudProvider': 'gce', 'asgName': self.__server_group_name,\n 'serverGroupName': self.__server_group_name, 'region': self.TEST_REGION,\n 'zone': self.TEST_ZONE, 'type': 'enableServerGroup', 'regions': [self.\n TEST_REGION], 'zones': [self.TEST_ZONE], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'user': 'integration-tests'}]\n",
"builder = gcp.GceContractBuilder(self.gce_observer)\n",
"builder.new_clause_builder('Server Group Enabled', retryable_for_secs=90\n ).list_resources('managed-instance-groups').contains_pred_list([jc.\n PathContainsPredicate('baseInstanceName', self.__server_group_name), jc\n .PathContainsPredicate('targetPools', 'https')])\n",
"payload = self.agent.make_json_payload_from_kwargs(job=job, description=\n 'Server Group Test - enable server group', application=self.TEST_APP)\n",
"return st.OperationContract(self.new_post_operation(title=\n 'enable_server_group', data=payload, path=self.__path), contract=\n builder.build())\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_31(self):...\n",
""
] | [
"def touch_or_create(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(VAR_6):...\n",
"VAR_18 = VAR_6.result()\n",
"if VAR_18.status_code == requests.codes.server_error:\n",
"FUNC_4(VAR_18.json())\n",
"VAR_18.raise_for_status()\n",
"if VAR_18.text:\n",
"return VAR_18.json()\n",
"return None\n"
] | [
"def JsonFromFuture(future):...\n",
"response = future.result()\n",
"if response.status_code == requests.codes.server_error:\n",
"_RaiseExceptionForData(response.json())\n",
"response.raise_for_status()\n",
"if response.text:\n",
"return response.json()\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self, VAR_14, VAR_12=None, VAR_13=False):...\n",
"return self.url_get(VAR_14, VAR_12=headers, VAR_13=silent)\n"
] | [
"def get(self, uuid, headers=None, silent=False):...\n",
"return self.url_get(uuid, headers=headers, silent=silent)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_7=None, VAR_8=''):...\n",
"if not VAR_4:\n",
"FUNC_0(VAR_51.settings['Output_dir'])\n",
"if VAR_7:\n",
"VAR_28 = random.choice(VAR_7)\n",
"VAR_28 = random.choice(VAR_4)\n",
"print('\\tgetRandomImage(): Chose random image {} (filter {})'.format(VAR_28,\n VAR_8))\n",
"VAR_13 = FUNC_1(VAR_28)\n",
"return VAR_28, VAR_13\n"
] | [
"def getRandomImage(filteredImagesCache=None, randomImageFilter=''):...\n",
"if not savedImagesCache:\n",
"generateSavedImagesCache(settings.settings['Output_dir'])\n",
"if filteredImagesCache:\n",
"randomImage = random.choice(filteredImagesCache)\n",
"randomImage = random.choice(savedImagesCache)\n",
"print('\\tgetRandomImage(): Chose random image {} (filter {})'.format(\n randomImage, randomImageFilter))\n",
"serverPath = outputPathToServerPath(randomImage)\n",
"return randomImage, serverPath\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'DELETE FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"VAR_2.commit()\n"
] | [
"def clear_all(self):...\n",
"connection = self.connect()\n",
"query = 'DELETE FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"connection.commit()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@validate(VAR_0=VMeetup('id'), VAR_15=VMenu('controller', CommentSortMenu),...\n",
"VAR_18 = Link._byID(VAR_0.assoc_link)\n",
"VAR_20 = c.user.pref_num_comments or g.num_comments\n",
"VAR_21 = g.max_comments if VAR_16 == 'true' else VAR_20\n",
"VAR_22 = CommentBuilder(VAR_18, CommentSortMenu.operator(VAR_15), None, None)\n",
"VAR_23 = NestedListing(VAR_22, VAR_21=num, parent_name=article._fullname)\n",
"VAR_24 = PaneStack()\n",
"if c.user_is_loggedin:\n",
"VAR_24.append(CommentReplyBox())\n",
"VAR_24.append(VAR_23.listing())\n",
"VAR_24.append(CommentReplyBox(link_name=article._fullname))\n",
"VAR_25 = CommentSortMenu(default=sort, type='dropdown2')\n",
"VAR_26 = [VAR_25, NumCommentsMenu(VAR_18.num_comments, default=num_comments)]\n",
"VAR_27 = CommentListing(VAR_27=displayPane, VAR_16=article.num_comments,\n VAR_26=nav_menus)\n",
"VAR_28 = None\n",
"if c.user_is_loggedin:\n",
"VAR_29 = VAR_18._getLastClickTime(c.user)\n",
"VAR_2 = ShowMeetup(VAR_0=meetup, VAR_27=content, fullname=article._fullname,\n VAR_28=lastViewed)\n",
"VAR_28 = VAR_29._date if VAR_29 else None\n",
"return BoringPage(pagename=meetup.title, VAR_27=res, body_class='meetup'\n ).render()\n",
"VAR_18._click(c.user)\n"
] | [
"@validate(meetup=VMeetup('id'), sort=VMenu('controller', CommentSortMenu),...\n",
"article = Link._byID(meetup.assoc_link)\n",
"user_num = c.user.pref_num_comments or g.num_comments\n",
"num = g.max_comments if num_comments == 'true' else user_num\n",
"builder = CommentBuilder(article, CommentSortMenu.operator(sort), None, None)\n",
"listing = NestedListing(builder, num=num, parent_name=article._fullname)\n",
"displayPane = PaneStack()\n",
"if c.user_is_loggedin:\n",
"displayPane.append(CommentReplyBox())\n",
"displayPane.append(listing.listing())\n",
"displayPane.append(CommentReplyBox(link_name=article._fullname))\n",
"sort_menu = CommentSortMenu(default=sort, type='dropdown2')\n",
"nav_menus = [sort_menu, NumCommentsMenu(article.num_comments, default=\n num_comments)]\n",
"content = CommentListing(content=displayPane, num_comments=article.\n num_comments, nav_menus=nav_menus)\n",
"lastViewed = None\n",
"if c.user_is_loggedin:\n",
"clicked = article._getLastClickTime(c.user)\n",
"res = ShowMeetup(meetup=meetup, content=content, fullname=article._fullname,\n lastViewed=lastViewed)\n",
"lastViewed = clicked._date if clicked else None\n",
"return BoringPage(pagename=meetup.title, content=res, body_class='meetup'\n ).render()\n",
"article._click(c.user)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_26(self, VAR_14, VAR_30):...\n",
"VAR_12 = \"%s '%s' '%s'\" % (VAR_5, VAR_30, VAR_14)\n",
"FUNC_7(self.session, VAR_12)\n"
] | [
"def start_clone_session(self, comp_name, session_name):...\n",
"cmd = \"%s '%s' '%s'\" % (SCRIPT_CLONE_PATH, session_name, comp_name)\n",
"send_main_session_command(self.session, cmd)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_8, VAR_10, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.fileExists(VAR_8):\n",
"VAR_7 = (\n \"INSERT INTO {0} (type, path, meta, mod_time) VALUES (1, '{1}', '{2}', '{3}');\"\n .format(VAR_2, VAR_8, utils.SQLiteUtils.escapeText(VAR_10), VAR_9))\n",
"print('addMetafile: Meta File already exists!')\n",
"self._run_command(VAR_7)\n"
] | [
"def addMetafile(self, pth, metadata, mod_time):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.fileExists(pth):\n",
"command = (\n \"INSERT INTO {0} (type, path, meta, mod_time) VALUES (1, '{1}', '{2}', '{3}');\"\n .format(TABLE_NAME, pth, utils.SQLiteUtils.escapeText(metadata), mod_time))\n",
"print('addMetafile: Meta File already exists!')\n",
"self._run_command(command)\n"
] | [
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"VAR_1 = resolve(f'/link_habitandpractice_to_puc/{self.objects.ehp.pk}/')\n",
"self.assertEqual(VAR_1.func, views.link_habitsandpractices)\n"
] | [
"def test_link_habitandpractice_to_puc(self):...\n",
"found = resolve(f'/link_habitandpractice_to_puc/{self.objects.ehp.pk}/')\n",
"self.assertEqual(found.func, views.link_habitsandpractices)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_21 = [VAR_28 for VAR_28 in self.expanded_output if VAR_28.exists]\n",
"if VAR_21:\n",
"logger.info(\n \"\"\"Removing output files of failed job {} since they might be corrupted:\n{}\"\"\"\n .format(self, ', '.join(VAR_21)))\n",
"for VAR_28 in VAR_21:\n",
"VAR_28.remove()\n"
] | [
"def cleanup(self):...\n",
"\"\"\"docstring\"\"\"\n",
"to_remove = [f for f in self.expanded_output if f.exists]\n",
"if to_remove:\n",
"logger.info(\n \"\"\"Removing output files of failed job {} since they might be corrupted:\n{}\"\"\"\n .format(self, ', '.join(to_remove)))\n",
"for f in to_remove:\n",
"f.remove()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_15(self, VAR_15, VAR_8):...\n",
"VAR_27, VAR_28 = super().as_sql(VAR_15, VAR_8)\n",
"VAR_27 = '%s::%s' % (VAR_27, self.lhs.output_field.db_type(VAR_8))\n",
"return VAR_27, VAR_28\n"
] | [
"def as_sql(self, qn, connection):...\n",
"sql, params = super().as_sql(qn, connection)\n",
"sql = '%s::%s' % (sql, self.lhs.output_field.db_type(connection))\n",
"return sql, params\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2():...\n",
"for blog in frappe.db.sql_list(\n",
"clear_cache(blog)\n",
"clear_cache('writers')\n"
] | [
"def clear_blog_cache():...\n",
"for blog in frappe.db.sql_list(\n",
"clear_cache(blog)\n",
"clear_cache('writers')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"Expr'"
] |
[
"def __call__(self):...\n",
"return self\n"
] | [
"def __call__(self):...\n",
"return self\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(VAR_8):...\n",
"return urllib.parse.quote_plus(VAR_8)\n"
] | [
"def url_escape(url):...\n",
"return urllib.parse.quote_plus(url)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_24(self, *VAR_71, **VAR_72):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.params = VAR_71, VAR_72\n",
"return VAR_101\n"
] | [
"def params(self, *params, **kwparams):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.params = params, kwparams\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = ('ga.js', 'analytics.js', 'quant.js', 'chartbeat.js',\n 'chartbeat_mab.js', 'beacon.js', 'krxd.net')\n",
"VAR_19 = str(VAR_6.content)\n",
"for script in VAR_18:\n",
"if script in VAR_19:\n",
"return True\n",
"return False\n"
] | [
"def validate_not_using_analytics(page):...\n",
"\"\"\"docstring\"\"\"\n",
"analytics_scripts = ('ga.js', 'analytics.js', 'quant.js', 'chartbeat.js',\n 'chartbeat_mab.js', 'beacon.js', 'krxd.net')\n",
"page_str = str(page.content)\n",
"for script in analytics_scripts:\n",
"if script in page_str:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_7, **VAR_8):...\n",
"VAR_8['backend'] = 'Simulator'\n",
"super().__init__(VAR_7, **kwargs)\n"
] | [
"def __init__(self, wires, **kwargs):...\n",
"kwargs['backend'] = 'Simulator'\n",
"super().__init__(wires, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.RESTART, *VAR_13, **kwargs)\n"
] | [
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.RESTART, *args, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_8(VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9['name']\n",
"if len(VAR_9['key']) > VAR_5:\n",
"VAR_9['key']\n"
] | [
"def validateNewKeyData(data):...\n",
"\"\"\"docstring\"\"\"\n",
"data['name']\n",
"if len(data['key']) > KEY_SIZE_LIMIT:\n",
"data['key']\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"VAR_15 = self.mock_nsx_clustered_api(http_read_timeout=37, http_timeout=7)\n",
"VAR_15.get('logical-ports')\n",
"VAR_16 = VAR_15.recorded_calls.method_calls[0]\n",
"VAR_17, VAR_0, VAR_1 = VAR_16\n",
"self.assertEqual(VAR_1['timeout'], (7, 37))\n"
] | [
"def test_timeouts(self):...\n",
"api = self.mock_nsx_clustered_api(http_read_timeout=37, http_timeout=7)\n",
"api.get('logical-ports')\n",
"mock_call = api.recorded_calls.method_calls[0]\n",
"name, args, kwargs = mock_call\n",
"self.assertEqual(kwargs['timeout'], (7, 37))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_26(VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_68 = len(VAR_17)\n",
"VAR_69 = lambda x: int(float(x) / 100 * VAR_68)\n",
"VAR_70 = [VAR_17[VAR_69(start):VAR_69(end)] for start, end in bconfig.\n CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(VAR_70)\n"
] | [
"def _get_partial_text(fulltext):...\n",
"\"\"\"docstring\"\"\"\n",
"length = len(fulltext)\n",
"get_index = lambda x: int(float(x) / 100 * length)\n",
"partial_text = [fulltext[get_index(start):get_index(end)] for start, end in\n bconfig.CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(partial_text)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"if self._services is None:\n",
"VAR_79 = mock(Services)\n",
"return self._services\n",
"VAR_79.keymanager = self.keymanager\n",
"VAR_79.mail_service = self.mail_service\n",
"VAR_79.draft_service = self.draft_service\n",
"VAR_79.search_engine = self.search_engine\n",
"VAR_79.feedback_service = self.feedback_service\n",
"VAR_79._leap_session = self.leap_session\n",
"self._services = VAR_79\n",
"self.leap_session.close = lambda : 'mocked'\n"
] | [
"@property...\n",
"if self._services is None:\n",
"services = mock(Services)\n",
"return self._services\n",
"services.keymanager = self.keymanager\n",
"services.mail_service = self.mail_service\n",
"services.draft_service = self.draft_service\n",
"services.search_engine = self.search_engine\n",
"services.feedback_service = self.feedback_service\n",
"services._leap_session = self.leap_session\n",
"self._services = services\n",
"self.leap_session.close = lambda : 'mocked'\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(self, VAR_2: str):...\n",
"\"\"\"docstring\"\"\"\n",
"self.username = VAR_2\n",
"db.session.commit()\n"
] | [
"def update_username(self, username: str):...\n",
"\"\"\"docstring\"\"\"\n",
"self.username = username\n",
"db.session.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(VAR_35, VAR_27):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_52 = ''\n",
"for result in VAR_35:\n",
"VAR_80 = VAR_35[result]\n",
"VAR_52 += '\\n--\\n{0}'.format(FUNC_21())\n",
"if VAR_80:\n",
"return VAR_52\n",
"VAR_89 = sorted(VAR_80, key=lambda x: list_result[x], reverse=True)\n",
"VAR_52 += '\\n\\n{0}:\\n'.format(result)\n",
"for element in VAR_89:\n",
"VAR_52 += '\\n{0} {1}'.format(VAR_80[element], element)\n"
] | [
"def _output_text(complete_output, categories):...\n",
"\"\"\"docstring\"\"\"\n",
"output = ''\n",
"for result in complete_output:\n",
"list_result = complete_output[result]\n",
"output += '\\n--\\n{0}'.format(_signature())\n",
"if list_result:\n",
"return output\n",
"list_result_sorted = sorted(list_result, key=lambda x: list_result[x],\n reverse=True)\n",
"output += '\\n\\n{0}:\\n'.format(result)\n",
"for element in list_result_sorted:\n",
"output += '\\n{0} {1}'.format(list_result[element], element)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"AugAssign'",
"Condition",
"Return'",
"Assign'",
"AugAssign'",
"For",
"AugAssign'"
] |
[
"def FUNC_0(self):...\n",
"self.reg = self.eng.allocate_qureg(self.wires)\n"
] | [
"def reset(self):...\n",
"self.reg = self.eng.allocate_qureg(self.wires)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __init__(self, VAR_11, VAR_24, VAR_25, VAR_6, VAR_26=None, VAR_27=...\n",
"self.url = VAR_11\n",
"self.output = VAR_24\n",
"self.command = VAR_25\n",
"self.logger = VAR_6.bind(context=type(self).__name__, seedurl=url)\n",
"self.policy = VAR_27\n",
"self.tempdir = VAR_26\n",
"self.copyLock = None if FUNC_0(VAR_24) else asyncio.Lock()\n",
"if self.copyLock and os.path.exists(self.output):\n",
"self.running = set()\n",
"self.concurrency = VAR_28\n",
"self.stats = {'requests': 0, 'finished': 0, 'failed': 0, 'bytesRcv': 0,\n 'crashed': 0, 'ignored': 0}\n"
] | [
"def __init__(self, url, output, command, logger, tempdir=None, policy=...\n",
"self.url = url\n",
"self.output = output\n",
"self.command = command\n",
"self.logger = logger.bind(context=type(self).__name__, seedurl=url)\n",
"self.policy = policy\n",
"self.tempdir = tempdir\n",
"self.copyLock = None if hasTemplate(output) else asyncio.Lock()\n",
"if self.copyLock and os.path.exists(self.output):\n",
"self.running = set()\n",
"self.concurrency = concurrency\n",
"self.stats = {'requests': 0, 'finished': 0, 'failed': 0, 'bytesRcv': 0,\n 'crashed': 0, 'ignored': 0}\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"VAR_19 = self.common.get_volume_stats(VAR_5)\n",
"VAR_19['storage_protocol'] = 'iSCSI'\n",
"VAR_20 = self.configuration.safe_get('volume_backend_name')\n",
"VAR_19['volume_backend_name'] = VAR_20 or self.__class__.__name__\n",
"self.common.client_logout()\n",
"return VAR_19\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"stats = self.common.get_volume_stats(refresh)\n",
"stats['storage_protocol'] = 'iSCSI'\n",
"backend_name = self.configuration.safe_get('volume_backend_name')\n",
"stats['volume_backend_name'] = backend_name or self.__class__.__name__\n",
"self.common.client_logout()\n",
"return stats\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
"def _init_common(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, **VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in VAR_0:\n",
"setattr(self, field_name, VAR_0[field_name])\n",
"VAR_1.pop(-1)\n",
"VAR_2 = self._meta.get_field(field_name)\n",
"VAR_1.extend(['WHERE', 'id', '=', str(self.id)])\n",
"VAR_3 = VAR_2.get_db_prep_save(VAR_0[field_name])\n",
"VAR_1 = ' '.join(VAR_1)\n",
"if isinstance(VAR_3, basestring):\n",
"connection.cursor().execute(VAR_1)\n",
"VAR_3 = \"'%s'\" % VAR_3.encode('utf-8').replace('\\\\', '\\\\\\\\')\n",
"if isinstance(VAR_3, models.Model):\n",
"transaction.commit_unless_managed()\n",
"VAR_1.extend((connection.ops.quote_name(VAR_2.column), '=', VAR_3, ','))\n",
"VAR_3 = str(VAR_3.id)\n",
"if VAR_3 is None:\n",
"VAR_3 = 'NULL'\n",
"VAR_3 = str(VAR_3)\n"
] | [
"def update_fields(self, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"sql = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\n",
"for field_name in kwargs:\n",
"setattr(self, field_name, kwargs[field_name])\n",
"sql.pop(-1)\n",
"field = self._meta.get_field(field_name)\n",
"sql.extend(['WHERE', 'id', '=', str(self.id)])\n",
"value = field.get_db_prep_save(kwargs[field_name])\n",
"sql = ' '.join(sql)\n",
"if isinstance(value, basestring):\n",
"connection.cursor().execute(sql)\n",
"value = \"'%s'\" % value.encode('utf-8').replace('\\\\', '\\\\\\\\')\n",
"if isinstance(value, models.Model):\n",
"transaction.commit_unless_managed()\n",
"sql.extend((connection.ops.quote_name(field.column), '=', value, ','))\n",
"value = str(value.id)\n",
"if value is None:\n",
"value = 'NULL'\n",
"value = str(value)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
4,
4,
4,
0,
4,
4,
4,
4,
4
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"@FUNC_0...\n",
"VAR_11 = '\\n'.join(('<a href=\"/mapmaker\">/mapmaker</a><br/>',\n '<a href=\"/map\">/map</a><br/>', '<a href=\"/login\">/login</a><br/>',\n '<a href=\"/settings\">/settings</a><br/>',\n '<a href=\"/mazetest\">/mazetest</a><br/>',\n '<a href=\"http://disco.fleo.se/TEAM%2010%20FTW!!!\">Team 10 FTW</a>'))\n",
"return VAR_4.format(VAR_11=text)\n"
] | [
"@handle_html...\n",
"text = '\\n'.join(('<a href=\"/mapmaker\">/mapmaker</a><br/>',\n '<a href=\"/map\">/map</a><br/>', '<a href=\"/login\">/login</a><br/>',\n '<a href=\"/settings\">/settings</a><br/>',\n '<a href=\"/mazetest\">/mazetest</a><br/>',\n '<a href=\"http://disco.fleo.se/TEAM%2010%20FTW!!!\">Team 10 FTW</a>'))\n",
"return base.format(text=text)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_38(VAR_0)\n",
"VAR_6 = VAR_6[VAR_6.find(\"'\") + 1:VAR_6.rfind(\"'\")]\n",
"VAR_6 = ':'.join(VAR_6.rsplit('.', 1))\n",
"return VAR_6\n"
] | [
"def class2str(value):...\n",
"\"\"\"docstring\"\"\"\n",
"s = str(value)\n",
"s = s[s.find(\"'\") + 1:s.rfind(\"'\")]\n",
"s = ':'.join(s.rsplit('.', 1))\n",
"return s\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(VAR_36):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = {}\n",
"for VAR_76, v in VAR_36:\n",
"VAR_66[VAR_76] = v\n",
"return VAR_66\n"
] | [
"def _kw(keywords):...\n",
"\"\"\"docstring\"\"\"\n",
"r = {}\n",
"for k, v in keywords:\n",
"r[k] = v\n",
"return r\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"import sqlite3 as sqlite\n",
"from SQLObjectStore import SQLObjectStore\n",
"\"\"\"string\"\"\"\n",
"def FUNC_0(self, VAR_0, VAR_1=False):...\n",
"if not VAR_0.get('database'):\n",
"VAR_0['database'] = '%s.db' % self._model.sqlDatabaseName()\n",
"def FUNC_1(self):...\n",
"VAR_5 = self._dbArgs.copy()\n",
"self.augmentDatabaseArgs(VAR_5)\n",
"return self.dbapiModule().connect(**kwargs)\n"
] | [
"import sqlite3 as sqlite\n",
"from SQLObjectStore import SQLObjectStore\n",
"\"\"\"SQLiteObjectStore implements an object store backed by a SQLite database.\n\n See the SQLite docs or the DB API 2.0 docs for more information:\n https://docs.python.org/2/library/sqlite3.html\n https://www.python.org/dev/peps/pep-0249/\n \"\"\"\n",
"def augmentDatabaseArgs(self, args, pool=False):...\n",
"if not args.get('database'):\n",
"args['database'] = '%s.db' % self._model.sqlDatabaseName()\n",
"def newConnection(self):...\n",
"kwargs = self._dbArgs.copy()\n",
"self.augmentDatabaseArgs(kwargs)\n",
"return self.dbapiModule().connect(**kwargs)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Condition",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(), max_retries=5)\n"
] | [
"def test_z_delete_load_balancer(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(), max_retries=5)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_0(self, VAR_1: int, VAR_2: str):...\n",
"VAR_4 = f'SELECT {VAR_2} FROM user_info WHERE member_id = {VAR_1};'\n",
"return await self.db_conn.fetchval(VAR_4)\n"
] | [
"async def fetch_user_info(self, member_id: int, column: str):...\n",
"query = f'SELECT {column} FROM user_info WHERE member_id = {member_id};'\n",
"return await self.db_conn.fetchval(query)\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None, VAR_17='', VAR_18='',...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11)\n",
"VAR_29 = VAR_28.get_tile_path(VAR_17, VAR_18, VAR_19)\n",
"if os.path.isfile(VAR_29):\n",
"VAR_32 = open(VAR_29, 'rb')\n",
"return HttpResponse(FileWrapper(VAR_32), content_type='image/png')\n"
] | [
"def get(self, request, pk=None, project_pk=None, z='', x='', y=''):...\n",
"\"\"\"docstring\"\"\"\n",
"task = self.get_and_check_task(request, pk, project_pk)\n",
"tile_path = task.get_tile_path(z, x, y)\n",
"if os.path.isfile(tile_path):\n",
"tile = open(tile_path, 'rb')\n",
"return HttpResponse(FileWrapper(tile), content_type='image/png')\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"VAR_15, self._timers = self._timers, []\n",
"for t in VAR_15:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer thread did not terminate fast enough: %s', t)\n"
] | [
"def cancel_all_timers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"timers = None\n",
"self._timers_dying = True\n",
"for t in self._timers:\n",
"t.cancel()\n",
"timers, self._timers = self._timers, []\n",
"for t in timers:\n",
"t.join(timeout=5)\n",
"if t.isAlive():\n",
"logging.error('Timer thread did not terminate fast enough: %s', t)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'"
] |
[
"@app.route('/api/indi_profiles', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_profiles]\n"
] | [
"@app.route('/api/indi_profiles', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_profiles]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_8 = dbaseConn()\n",
"VAR_9 = 'DELETE FROM `User` WHERE `uid`=%s'\n",
"cursor.execute(VAR_9, (VAR_4,))\n",
"VAR_8.db_conn_close()\n",
"VAR_8.db_conn_close()\n",
"VAR_8.db.commit()\n",
"return False\n",
"return True\n"
] | [
"@staticmethod...\n",
"dbcon = dbaseConn()\n",
"sql = 'DELETE FROM `User` WHERE `uid`=%s'\n",
"cursor.execute(sql, (user_id,))\n",
"dbcon.db_conn_close()\n",
"dbcon.db_conn_close()\n",
"dbcon.db.commit()\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.ime_properties.get('start_chars')\n",
"return ''\n"
] | [
"def get_start_chars(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.ime_properties.get('start_chars')\n",
"return ''\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'",
"Return'"
] |
[
"def FUNC_19(self, VAR_6, VAR_14):...\n",
"self.common.extend_volume(VAR_6, VAR_14)\n"
] | [
"def extend_volume(self, volume, new_size):...\n",
"self.common.extend_volume(volume, new_size)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@route('GET', '/-test/jquery-cookie.js', VAR_1=website)...\n",
"get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n",
"return (as_path(__file__).dirname() / 'jquery-cookie.js').text()\n"
] | [
"@route('GET', '/-test/jquery-cookie.js', website=website)...\n",
"get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n",
"return (as_path(__file__).dirname() / 'jquery-cookie.js').text()\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = psycopg2.connect(database=DBNAME)\n",
"VAR_3 = VAR_2.cursor()\n",
"VAR_3.execute(\"insert into posts values('%s')\" % VAR_1)\n",
"VAR_2.commit()\n",
"VAR_2.close()\n"
] | [
"def add_post(content):...\n",
"\"\"\"docstring\"\"\"\n",
"db = psycopg2.connect(database=DBNAME)\n",
"c = db.cursor()\n",
"c.execute(\"insert into posts values('%s')\" % content)\n",
"db.commit()\n",
"db.close()\n"
] | [
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_1: 'projects.Project', VAR_2: 'projects.ProjectStep') ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = VAR_2.definition.name.rsplit('.', 1)[0]\n",
"VAR_8 = types.ModuleType(VAR_7)\n",
"VAR_17 = f.read()\n",
"VAR_3 = InspectLoader.source_to_code(VAR_17, VAR_2.source_path)\n",
"return FUNC_2(VAR_1, VAR_17, VAR_4)\n",
"setattr(VAR_8, '__file__', VAR_2.source_path)\n",
"setattr(VAR_8, '__package__', '.'.join([VAR_1.id.replace('.', '-')] + VAR_2\n .filename.rsplit('.', 1)[0].split(os.sep)))\n",
"def FUNC_6():...\n",
"VAR_2.test_locals = dict()\n",
"VAR_2.test_locals.update(VAR_8.__dict__)\n",
"exec(VAR_3, VAR_2.test_locals)\n",
"FUNC_0(True)\n",
"VAR_18 = {'success': False}\n",
"FUNC_0(False)\n",
"threads.abort_thread()\n",
"VAR_18 = None\n",
"return {'success': True} if VAR_18 is None else VAR_18\n",
"if environ.modes.has(environ.modes.TESTING):\n",
"VAR_18 = FUNC_5(VAR_1, VAR_4)\n",
"FUNC_6()\n",
"exec(VAR_3, VAR_8.__dict__)\n",
"VAR_18 = None\n"
] | [
"def run(project: 'projects.Project', step: 'projects.ProjectStep') ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"module_name = step.definition.name.rsplit('.', 1)[0]\n",
"module = types.ModuleType(module_name)\n",
"source_code = f.read()\n",
"code = InspectLoader.source_to_code(source_code, step.source_path)\n",
"return render_syntax_error(project, source_code, error)\n",
"setattr(module, '__file__', step.source_path)\n",
"setattr(module, '__package__', '.'.join([project.id.replace('.', '-')] +\n step.filename.rsplit('.', 1)[0].split(os.sep)))\n",
"def exec_test():...\n",
"step.test_locals = dict()\n",
"step.test_locals.update(module.__dict__)\n",
"exec(code, step.test_locals)\n",
"set_executing(True)\n",
"out = {'success': False}\n",
"set_executing(False)\n",
"threads.abort_thread()\n",
"out = None\n",
"return {'success': True} if out is None else out\n",
"if environ.modes.has(environ.modes.TESTING):\n",
"out = render_error(project, error)\n",
"exec_test()\n",
"exec(code, module.__dict__)\n",
"out = None\n"
] | [
0,
0,
0,
0,
6,
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'",
"Return'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_31(self):...\n",
"if 'saml_data' in VAR_15:\n",
"return VAR_15['saml_data']['session_index']\n"
] | [
"def _current_saml_session_id(self):...\n",
"if 'saml_data' in session:\n",
"return session['saml_data']['session_index']\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_0():...\n",
""
] | [
"def create_connection():...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(VAR_4, VAR_5=None, VAR_6=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = VAR_4\n",
"VAR_2 = VAR_6\n",
"if VAR_5 is not None:\n",
"assert all(issubclass(VAR_12, CLASS_6) for VAR_12 in VAR_5)\n",
"template.bootstrap({'auth': VAR_0})\n",
"VAR_3 = tuple(VAR_5)\n"
] | [
"def configure_ui(app_name, ui_tabs=None, ui_data_callback=None):...\n",
"\"\"\"docstring\"\"\"\n",
"_ui_app_name = app_name\n",
"_ui_data_callback = ui_data_callback\n",
"if ui_tabs is not None:\n",
"assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)\n",
"template.bootstrap({'auth': TEMPLATES_DIR})\n",
"_ui_navbar_tabs = tuple(ui_tabs)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assert'",
"Expr'",
"Assign'"
] |
[
"def FUNC_3(self, VAR_5):...\n",
"self.common = self._init_common()\n",
"self._check_flags()\n",
"self.common.do_setup(VAR_5)\n"
] | [
"def do_setup(self, context):...\n",
"self.common = self._init_common()\n",
"self._check_flags()\n",
"self.common.do_setup(context)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_7, VAR_20=True, *VAR_15, **VAR_16):...\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n",
"self.redirect = VAR_20\n"
] | [
"def __init__(self, param, redirect=True, *a, **kw):...\n",
"Validator.__init__(self, param, *a, **kw)\n",
"self.redirect = redirect\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_14(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
"def NativeFiletypeCompletionUsable(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"return ungettext_lazy(u'Deleted Mapping', u'Deleted Mappings', VAR_7)\n"
] | [
"@staticmethod...\n",
"return ungettext_lazy(u'Deleted Mapping', u'Deleted Mappings', count)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return VAR_6\n",
"for perm in VAR_2:\n",
"if not VAR_0.user.has_perm(perm, VAR_6):\n"
] | [
"def get_and_check_project(request, project_pk, perms=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"project = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return project\n",
"for perm in perms:\n",
"if not request.user.has_perm(perm, project):\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"For",
"Condition"
] |
[
"def FUNC_1(self, VAR_0, VAR_1, *VAR_2, **VAR_3):...\n",
"VAR_12 = JustURL.objects.get(VAR_1=pk)\n",
"VAR_11 = CounterCountingForm()\n",
"return render(VAR_0, 'success-url-view.html', {'object': VAR_12, 'form':\n VAR_11})\n"
] | [
"def get(self, request, pk, *args, **kwargs):...\n",
"object = JustURL.objects.get(pk=pk)\n",
"form = CounterCountingForm()\n",
"return render(request, 'success-url-view.html', {'object': object, 'form':\n form})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_13):...\n",
"self.filters = VAR_13\n"
] | [
"def __init__(self, filters):...\n",
"self.filters = filters\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"return {'id': self.id, 'name': self.name, 'category': self.category,\n 'program': self.program, 'arguments': self.arguments, 'readonly': self.\n readonly, 'ui_properties': self.ui_properties}\n"
] | [
"def to_map(self):...\n",
"return {'id': self.id, 'name': self.name, 'category': self.category,\n 'program': self.program, 'arguments': self.arguments, 'readonly': self.\n readonly, 'ui_properties': self.ui_properties}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, VAR_3):...\n",
"VAR_20 = VAR_3.value.upper()\n",
"if VAR_3.type == 'ID':\n",
"if not VAR_20 in self.spdx.licenses:\n",
"if VAR_3.type == 'EXC':\n",
"self.lastid = VAR_20\n",
"if VAR_20 not in self.spdx.exceptions:\n",
"if VAR_3.type != 'WITH':\n",
"if self.lastid not in self.spdx.exceptions[VAR_20]:\n",
"self.lastid = None\n",
"self.lastid = None\n"
] | [
"def validate(self, tok):...\n",
"id = tok.value.upper()\n",
"if tok.type == 'ID':\n",
"if not id in self.spdx.licenses:\n",
"if tok.type == 'EXC':\n",
"self.lastid = id\n",
"if id not in self.spdx.exceptions:\n",
"if tok.type != 'WITH':\n",
"if self.lastid not in self.spdx.exceptions[id]:\n",
"self.lastid = None\n",
"self.lastid = None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_2=None, VAR_3=None, VAR_4=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = VAR_2\n",
"self.address = VAR_2\n",
"if VAR_3:\n",
"self.set_variable('ansible_port', int(VAR_3))\n",
"if VAR_4:\n",
"self._uuid = get_unique_id()\n",
"self.implicit = False\n"
] | [
"def __init__(self, name=None, port=None, gen_uuid=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = name\n",
"self.address = name\n",
"if port:\n",
"self.set_variable('ansible_port', int(port))\n",
"if gen_uuid:\n",
"self._uuid = get_unique_id()\n",
"self.implicit = False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_8, VAR_9 = 'eviluser', 'password'\n",
"VAR_10, VAR_11 = 'Evil', 'User'\n",
"VAR_12 = '[email protected]'\n",
"VAR_13 = {'username': VAR_8, 'password': VAR_9, 'first_name': VAR_10,\n 'last_name': VAR_11, 'email': VAR_12}\n",
"VAR_4 = '/api/auth/register'\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_13), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_7 = {'sha': 'df1e628f2244b73f9cdf944f880a2b3470a122f4', 'fingerprint':\n '88:25:ed:67:56:91:3d:c6:1b:7f:42:c6:9b:41:24:99', 'receive_user':\n 'eviluser', 'receive_repo': '{app_id}'.format(**locals()),\n 'ssh_connection': '10.0.1.10 50337 172.17.0.143 22',\n 'ssh_original_command': \"git-receive-pack '{app_id}.git'\".format(**\n locals())}\n",
"VAR_4 = '/api/hooks/push'.format(**locals())\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json', HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)\n",
"self.assertEqual(VAR_5.status_code, 403)\n"
] | [
"def test_push_abuse(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"username, password = 'eviluser', 'password'\n",
"first_name, last_name = 'Evil', 'User'\n",
"email = '[email protected]'\n",
"submit = {'username': username, 'password': password, 'first_name':\n first_name, 'last_name': last_name, 'email': email}\n",
"url = '/api/auth/register'\n",
"response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"body = {'sha': 'df1e628f2244b73f9cdf944f880a2b3470a122f4', 'fingerprint':\n '88:25:ed:67:56:91:3d:c6:1b:7f:42:c6:9b:41:24:99', 'receive_user':\n 'eviluser', 'receive_repo': '{app_id}'.format(**locals()),\n 'ssh_connection': '10.0.1.10 50337 172.17.0.143 22',\n 'ssh_original_command': \"git-receive-pack '{app_id}.git'\".format(**\n locals())}\n",
"url = '/api/hooks/push'.format(**locals())\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json', HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)\n",
"self.assertEqual(response.status_code, 403)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(VAR_7, VAR_10['host'], VAR_10['initiator'])\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(volume, connector['host'], connector[\n 'initiator'])\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"return 'check the main page'\n"
] | [
"def describe(self):...\n",
"return 'check the main page'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(VAR_5, VAR_32=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = VAR_5['device']\n",
"if VAR_1 in VAR_31:\n",
"VAR_32 = max(VAR_31[VAR_1]['level'], VAR_32)\n",
"VAR_31[VAR_1] = {'level': VAR_32, 'device': VAR_1, 'dev_type': VAR_5[\n 'dev_type']}\n",
"for holder in VAR_5['holders']:\n",
"FUNC_23(holder, VAR_32=level + 1)\n"
] | [
"def flatten_holders_tree(tree, level=0):...\n",
"\"\"\"docstring\"\"\"\n",
"device = tree['device']\n",
"if device in reg:\n",
"level = max(reg[device]['level'], level)\n",
"reg[device] = {'level': level, 'device': device, 'dev_type': tree['dev_type']}\n",
"for holder in tree['holders']:\n",
"flatten_holders_tree(holder, level=level + 1)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"super().continue_dut('go 0 1')\n"
] | [
"def continue_dut(self):...\n",
"super().continue_dut('go 0 1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.