lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_2(self, VAR_3, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = list(itertools.chain(*VAR_3.context['form'].errors.values()))\n",
"self.assertIn(force_text(VAR_4), VAR_10)\n"
] | [
"def assertFormError(self, response, error):...\n",
"\"\"\"docstring\"\"\"\n",
"form_errors = list(itertools.chain(*response.context['form'].errors.values()))\n",
"self.assertIn(force_text(error), form_errors)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"@VAR_2.user_loader...\n",
"return CLASS_0.query.get(int(VAR_4))\n"
] | [
"@login.user_loader...\n",
"return User.query.get(int(user_id))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_8(VAR_13):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = VAR_13.get('max_open_files', 100000)\n",
"if sys.platform.startswith('win'):\n",
"VAR_46 = VAR_47 = win32file._getmaxstdio()\n",
"VAR_46, VAR_47 = resource.getrlimit(resource.RLIMIT_NOFILE)\n",
"VAR_29 = VAR_54.path.join(VAR_13.get('pki_di... | [
"def check_max_open_files(opts):...\n",
"\"\"\"docstring\"\"\"\n",
"mof_c = opts.get('max_open_files', 100000)\n",
"if sys.platform.startswith('win'):\n",
"mof_s = mof_h = win32file._getmaxstdio()\n",
"mof_s, mof_h = resource.getrlimit(resource.RLIMIT_NOFILE)\n",
"accepted_keys_dir = os.path.join(opts.g... | [
0,
0,
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'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"AugAssign'",
... |
[
"def FUNC_13(self):...\n",
"self.assertFormfield(models.Band, 'members', forms.SelectMultiple)\n"
] | [
"def testManyToMany(self):...\n",
"self.assertFormfield(models.Band, 'members', forms.SelectMultiple)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_61(self):...\n",
"User.objects.filter(username='testclient').update(is_staff=True,\n is_superuser=True)\n",
"self.login()\n",
"self.admin = User.objects.get(pk=1)\n"
] | [
"def setUp(self):...\n",
"User.objects.filter(username='testclient').update(is_staff=True,\n is_superuser=True)\n",
"self.login()\n",
"self.admin = User.objects.get(pk=1)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def __call__(VAR_20, VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_20(VAR_2, *VAR_23, **VAR_24):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = VAR_21(VAR_2, *VAR_23, **kwargs)\n",
"if isinstance(VAR_22, HttpResponseBase):\n",
"return VAR_22\n",
"VAR_37 = 'template' in VAR_22 and VAR_22['template... | [
"def __call__(ctx, f):...\n",
"\"\"\"docstring\"\"\"\n",
"def wrapper(request, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"context = f(request, *args, **kwargs)\n",
"if isinstance(context, HttpResponseBase):\n",
"return context\n",
"template = 'template' in context and context['template'] or ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_13(self, VAR_8):...\n",
"VAR_14 = re.search('https?://[^/]*(/.*reset/\\\\S*)', VAR_8.body)\n",
"self.assertTrue(VAR_14 is not None, 'No URL found in sent email')\n",
"return VAR_14.group(), VAR_14.groups()[0]\n"
] | [
"def _read_signup_email(self, email):...\n",
"urlmatch = re.search('https?://[^/]*(/.*reset/\\\\S*)', email.body)\n",
"self.assertTrue(urlmatch is not None, 'No URL found in sent email')\n",
"return urlmatch.group(), urlmatch.groups()[0]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_44(self, **VAR_133):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_222 = self._get_login_settings()\n",
"if VAR_133.get(VAR_222.passfield):\n",
"VAR_133[VAR_222.passfield] = VAR_222.table_user[VAR_222.passfield].validate(\n VAR_133[VAR_222.passfield], None)[0]\n",
"if not VAR_133.get(VAR_222.userfie... | [
"def register_bare(self, **fields):...\n",
"\"\"\"docstring\"\"\"\n",
"settings = self._get_login_settings()\n",
"if fields.get(settings.passfield):\n",
"fields[settings.passfield] = settings.table_user[settings.passfield].validate(\n fields[settings.passfield], None)[0]\n",
"if not fields.get(settings... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"async def FUNC_8(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_26 = {}\n",
"async def FUNC_15(VAR_41):...\n",
"VAR_2, VAR_6 = VAR_41\n",
"VAR_31 = await self.get_server_verify_key_v2_direct(VAR_2, VAR_6)\n",
"VAR_0.warning('Error looking up keys %s from %s: %s', VAR_6, VAR_2, e)\n",
"await yi... | [
"async def get_keys(self, keys_to_fetch):...\n",
"\"\"\"docstring\"\"\"\n",
"results = {}\n",
"async def get_key(key_to_fetch_item):...\n",
"server_name, key_ids = key_to_fetch_item\n",
"keys = await self.get_server_verify_key_v2_direct(server_name, key_ids)\n",
"logger.warning('Error looking up keys %s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_12(VAR_30: Fingerprint, VAR_31: Fingerprint, VAR_32: Section) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"for k in VAR_32.relevant_keys:\n",
"if VAR_30.get(k) != VAR_31.get(k):\n",
"return False\n",
"VAR_0.info(f'Data ({k}) for {VAR_32.name} section changed.')\n",
"return True\n"
] | [
"def did_section_fingerprint_change(fingerprint1: Fingerprint, fingerprint2:...\n",
"\"\"\"docstring\"\"\"\n",
"for k in section.relevant_keys:\n",
"if fingerprint1.get(k) != fingerprint2.get(k):\n",
"return False\n",
"logger.info(f'Data ({k}) for {section.name} section changed.')\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_145(self):...\n",
"if not self.can_manage():\n",
"return self.not_authorized()\n",
"self.auth.db.wiki_page.slug.represent = lambda VAR_156, VAR_266: SPAN(\n '@////%s' % VAR_156)\n",
"self.auth.db.wiki_page.title.represent = lambda VAR_441, VAR_266: A(VAR_441,\n _href=URL(args=row.slug))\n",
... | [
"def pages(self):...\n",
"if not self.can_manage():\n",
"return self.not_authorized()\n",
"self.auth.db.wiki_page.slug.represent = lambda slug, row: SPAN('@////%s' % slug\n )\n",
"self.auth.db.wiki_page.title.represent = lambda title, row: A(title, _href=\n URL(args=row.slug))\n",
"wiki_table = self... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_9(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(VAR_21) > 13:\n",
"VAR_28 = int(VAR_21, 36)\n",
"if six.PY2 and VAR_28 > sys.maxint:\n",
"return VAR_28\n"
] | [
"def base36_to_int(s):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(s) > 13:\n",
"value = int(s, 36)\n",
"if six.PY2 and value > sys.maxint:\n",
"return value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_67(VAR_125, VAR_46, VAR_105):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_105, dict):\n",
"VAR_125.setdefault(VAR_46, {})\n",
"VAR_125.setdefault(VAR_46, [])\n",
"for inkey in VAR_105:\n",
"if not isinstance(VAR_105, list):\n",
"FUNC_67(VAR_125[VAR_46], inkey, VAR_105[inkey])\n",
... | [
"def append_hook(target, key, value):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(value, dict):\n",
"target.setdefault(key, {})\n",
"target.setdefault(key, [])\n",
"for inkey in value:\n",
"if not isinstance(value, list):\n",
"append_hook(target[key], inkey, value[inkey])\n",
"value = [value]\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"\"\"\"\nMirrorManager2 xmlrpc controller.\n\"\"\"\n",
"import base64\n",
"import pickle\n",
"import bz2\n",
"import flask\n",
"from flaskext.xmlrpc import XMLRPCHandler, Fault\n",
"from mirrormanager2.app import APP, ADMIN, SESSION\n",
"from mirrormanager2.lib import model\n",
"from mirrormanager2.... | [
"\"\"\"\nMirrorManager2 xmlrpc controller.\n\"\"\"\n",
"import base64\n",
"import pickle\n",
"import bz2\n",
"import flask\n",
"from flaskext.xmlrpc import XMLRPCHandler, Fault\n",
"from mirrormanager2.app import APP, ADMIN, SESSION\n",
"from mirrormanager2.lib import model\n",
"from mirrormanager2.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"async def FUNC_7(VAR_25: 'TrainingDataImporter') ->VAR_1:...\n",
"\"\"\"docstring\"\"\"\n",
"import time\n",
"VAR_26 = await VAR_25.get_config()\n",
"VAR_52 = await VAR_25.get_domain()\n",
"VAR_53 = await VAR_25.get_stories()\n",
"VAR_54 = await VAR_25.get_nlu_data()\n",
"VAR_55 = VAR_52.responses\n"... | [
"async def model_fingerprint(file_importer: 'TrainingDataImporter'...\n",
"\"\"\"docstring\"\"\"\n",
"import time\n",
"config = await file_importer.get_config()\n",
"domain = await file_importer.get_domain()\n",
"stories = await file_importer.get_stories()\n",
"nlu_data = await file_importer.get_nlu_dat... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4():...\n",
"assert utils.spinal_case('keep_alive') == 'keep-alive'\n"
] | [
"def test_spinal_case():...\n",
"assert utils.spinal_case('keep_alive') == 'keep-alive'\n"
] | [
0,
1
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_14(VAR_21: Text) ->bool:...\n",
"return VAR_21 is not None and VAR_21.strip() != ''\n"
] | [
"def is_valid(input: Text) ->bool:...\n",
"return input is not None and input.strip() != ''\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import sys\n",
"import os\n",
"from setuptools import setup, find_packages\n",
"from setuptools.command.test import test as TestCommand\n",
"def FUNC_0(VAR_0):...\n",
"VAR_1 = os.path.dirname(os.path.abspath(__file__))\n",
"return open(os.path.join(VAR_1, VAR_0)).read()\n"
] | [
"import sys\n",
"import os\n",
"from setuptools import setup, find_packages\n",
"from setuptools.command.test import test as TestCommand\n",
"def _read(fname):...\n",
"here = os.path.dirname(os.path.abspath(__file__))\n",
"return open(os.path.join(here, fname)).read()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_57 = VAR_9.POST.get('action')\n",
"VAR_58 = VAR_9.POST.get('identifiers')\n",
"VAR_59 = FUNC_64(VAR_58)\n",
"VAR_60 = VAR_9.POST.get('auto_enroll') in ['true', 'True', True]\n... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"action = request.POST.get('action')\n",
"identifiers_raw = request.POST.get('identifiers')\n",
"identifiers = _split_input_list(identifiers_raw)\n",
"auto_enroll = request.P... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = apps.get_model(app_label='acls', model_name='AccessControlList')\n",
"VAR_14 = ['<div class=\"tag-container\">']\n",
"VAR_15 = VAR_13.objects.filter_by_access(permission_tag_view, VAR_1,\n queryset=document.attached_tags().all())\n",
... | [
"def widget_document_tags(document, user):...\n",
"\"\"\"docstring\"\"\"\n",
"AccessControlList = apps.get_model(app_label='acls', model_name=\n 'AccessControlList')\n",
"result = ['<div class=\"tag-container\">']\n",
"tags = AccessControlList.objects.filter_by_access(permission_tag_view, user,\n quer... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_32(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import StrictUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provideUtility\n",
"pr... | [
"def testStrictResolver(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import StrictUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provideUtilit... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_38(self):...\n",
"if self.flags.ignore_validate_update_after_submit:\n",
"return\n",
"self._validate_update_after_submit()\n",
"for VAR_21 in self.get_all_children():\n",
"if VAR_21.is_new() and self.meta.get_field(VAR_21.parentfield).allow_on_submit:\n",
"VAR_21._validate_update_after_submit(... | [
"def validate_update_after_submit(self):...\n",
"if self.flags.ignore_validate_update_after_submit:\n",
"return\n",
"self._validate_update_after_submit()\n",
"for d in self.get_all_children():\n",
"if d.is_new() and self.meta.get_field(d.parentfield).allow_on_submit:\n",
"d._validate_update_after_submit... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"For",
"Condition",
"Expr'"
] |
[
"@FUNC_0...\n",
"return Ratelimiter(clock=self.get_clock(), rate_hz=self.config.\n rc_registration.per_second, burst_count=self.config.rc_registration.\n burst_count)\n"
] | [
"@cache_in_self...\n",
"return Ratelimiter(clock=self.get_clock(), rate_hz=self.config.\n rc_registration.per_second, burst_count=self.config.rc_registration.\n burst_count)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_10(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"if re.search('\\\\.\\\\.\\\\{sep}'.format(sep=os.sep), VAR_16):\n",
"return False\n",
"return True\n"
] | [
"def clean_id(id_):...\n",
"\"\"\"docstring\"\"\"\n",
"if re.search('\\\\.\\\\.\\\\{sep}'.format(sep=os.sep), id_):\n",
"return False\n",
"return True\n"
] | [
0,
0,
1,
1,
1
] | [
"FunctionDef'",
"Docstring",
"For",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_26='XXX ERROR MESSAGE NEEDED'):...\n",
"self.errors.append(VAR_26)\n",
"if self.strict:\n"
] | [
"def serializeError(self, data='XXX ERROR MESSAGE NEEDED'):...\n",
"self.errors.append(data)\n",
"if self.strict:\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition"
] |
[
"@expose('/login/', methods=['GET', 'POST'])...\n",
""
] | [
"@expose('/login/', methods=['GET', 'POST'])...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"@VAR_1.route('/<bfile>/holdings/by_<aggregation_key>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_18 in ['account', 'currency', 'cost_currency']:\n",
"return render_template('_layout.html', active_page='holdings', VAR_18=\n aggregation_key)\n",
"return abort(404)\n"
] | [
"@app.route('/<bfile>/holdings/by_<aggregation_key>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if aggregation_key in ['account', 'currency', 'cost_currency']:\n",
"return render_template('_layout.html', active_page='holdings',\n aggregation_key=aggregation_key)\n",
"return abort(404)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/query/<int:query_id>')...\n",
"VAR_14 = g.conn.session.query(Query).filter(Query.id == VAR_4).one()\n",
"VAR_17 = get_user() is not None and get_user().id == VAR_14.user_id\n",
"VAR_18 = False\n",
"if get_user():\n",
"VAR_18 = g.conn.session.query(func.count(Star.id)).filter(Star.user_id =... | [
"@app.route('/query/<int:query_id>')...\n",
"query = g.conn.session.query(Query).filter(Query.id == query_id).one()\n",
"can_edit = get_user() is not None and get_user().id == query.user_id\n",
"is_starred = False\n",
"if get_user():\n",
"is_starred = g.conn.session.query(func.count(Star.id)).filter(Star.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_85(VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"return {'username': VAR_19.username, 'email': VAR_19.email, 'first_name':\n VAR_19.first_name, 'last_name': VAR_19.last_name}\n"
] | [
"def extract_user_info(user):...\n",
"\"\"\"docstring\"\"\"\n",
"return {'username': user.username, 'email': user.email, 'first_name': user.\n first_name, 'last_name': user.last_name}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_112(self):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"VAR_313 = list(self.xmlrpc_procedures.values())\n",
"return VAR_244.xmlrpc(VAR_56, VAR_313)\n"
] | [
"def serve_xmlrpc(self):...\n",
"request = current.request\n",
"response = current.response\n",
"services = list(self.xmlrpc_procedures.values())\n",
"return response.xmlrpc(request, services)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_44(self, VAR_25):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_import and frappe.flags.mute_emails or frappe.flags.in_patch or frappe.flags.in_install:\n",
"return\n",
"if self.flags.notifications_executed == None:\n",
"self.flags.notifications_executed = []\n",
"from frappe.email.doc... | [
"def run_notifications(self, method):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_import and frappe.flags.mute_emails or frappe.flags.in_patch or frappe.flags.in_install:\n",
"return\n",
"if self.flags.notifications_executed == None:\n",
"self.flags.notifications_executed = []\n",
"from frappe... | [
0,
0,
0,
0,
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",
"Condition",
"Return'",
"Condition",
"Assign'",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"For",... |
[
"def FUNC_3(VAR_3):...\n",
"if VAR_25.session['user'] == 'Guest':\n",
"if VAR_3 not in VAR_25.guest_methods:\n",
"if not VAR_3 in VAR_25.whitelisted:\n",
"VAR_25.throw(_('Not permitted'), VAR_25.PermissionError)\n",
"if VAR_3 not in VAR_25.xss_safe_methods:\n",
"VAR_25.throw(_('Not permitted'), VAR_25.P... | [
"def is_whitelisted(method):...\n",
"if frappe.session['user'] == 'Guest':\n",
"if method not in frappe.guest_methods:\n",
"if not method in frappe.whitelisted:\n",
"frappe.throw(_('Not permitted'), frappe.PermissionError)\n",
"if method not in frappe.xss_safe_methods:\n",
"frappe.throw(_('Not permitted... | [
0,
2,
2,
2,
2,
2,
2,
2,
2,
2
] | [
"FunctionDef'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Condition",
"Expr'",
"For",
"Condition",
"Assign'"
] |
[
"@property...\n",
"VAR_26 = ['core.js', 'SelectBox.js', 'SelectFilter2.js']\n",
"return forms.Media(VAR_26=[static('admin/js/%s' % path) for path in js])\n"
] | [
"@property...\n",
"js = ['core.js', 'SelectBox.js', 'SelectFilter2.js']\n",
"return forms.Media(js=[static('admin/js/%s' % path) for path in js])\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"import json\n",
"from django.http.response import HttpResponse, HttpResponseRedirect\n",
"from django.middleware.csrf import get_token\n",
"from django.utils.http import urlencode\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from django.views.generic import TemplateView\n",
"from s... | [
"import json\n",
"from django.http.response import HttpResponse, HttpResponseRedirect\n",
"from django.middleware.csrf import get_token\n",
"from django.utils.http import urlencode\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from django.views.generic import TemplateView\n",
"from s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'",
... |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_83(self, VAR_71):...\n",
"if isinstance(VAR_71, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = VAR_71 or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._return_value.update(VAR_71)\n",
"def FUNC_84(... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"def add_to_return_value(self, new_return_value):...\n",
"if isinstance(new_return_value, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = new_return_value or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._retur... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"import time\n",
"from mock import Mock\n",
"import canonicaljson\n",
"import signedjson.key\n",
"import signedjson.sign\n",
"from nacl.signing import SigningKey\n",
"from signedjson.key import encode_verify_key_base64, get_verify_key\n",
"from twisted.internet import defer\n",
"from twisted.interne... | [
"import time\n",
"from mock import Mock\n",
"import canonicaljson\n",
"import signedjson.key\n",
"import signedjson.sign\n",
"from nacl.signing import SigningKey\n",
"from signedjson.key import encode_verify_key_base64, get_verify_key\n",
"from twisted.internet import defer\n",
"from twisted.interne... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
... |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3):...\n",
"VAR_4 = VAR_0.rsplit(VAR_1, VAR_3)\n",
"return VAR_2.join(VAR_4)\n"
] | [
"def rreplace(s, old, new, occurrence):...\n",
"li = s.rsplit(old, occurrence)\n",
"return new.join(li)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"@abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"Condition",
"Docstring"
] |
[
"@VAR_6.route('/meta/<path:object_path>')...\n",
"VAR_13 = FUNC_6(VAR_9)\n",
"VAR_14 = dict()\n",
"for VAR_18, value in attributes:\n",
"return jsonify(VAR_14)\n",
"VAR_14[VAR_18] = value\n"
] | [
"@scope_blueprint.route('/meta/<path:object_path>')...\n",
"path = _get_obj_absolute_path(object_path)\n",
"attrs = dict()\n",
"for key, value in attributes:\n",
"return jsonify(attrs)\n",
"attrs[key] = value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"For",
"Return'",
"Assign'"
] |
[
"def FUNC_52(VAR_62, VAR_109=False, VAR_115=False):...\n",
"\"\"\"docstring\"\"\"\n",
"FUNC_53(FUNC_56(VAR_12.get_value('DocType', VAR_62, 'module')), 'doctype',\n FUNC_56(VAR_62), VAR_109=force, VAR_115=reset_permissions)\n"
] | [
"def reload_doctype(doctype, force=False, reset_permissions=False):...\n",
"\"\"\"docstring\"\"\"\n",
"reload_doc(scrub(db.get_value('DocType', doctype, 'module')), 'doctype',\n scrub(doctype), force=force, reset_permissions=reset_permissions)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_29(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_41 = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'regress_x_to_y', '--inpu... | [
"def testRunCommandInputExamplesFeatureValueNotListError(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"output_dir = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"args = self.parser.parse_args(['run', '--dir', base_path, '--tag... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(VAR_6, VAR_7):...\n",
"VAR_25 = Deferred()\n",
"self.push_attempts.append((VAR_25, VAR_6, VAR_7))\n",
"return make_deferred_yieldable(VAR_25)\n"
] | [
"def post_json_get_json(url, body):...\n",
"d = Deferred()\n",
"self.push_attempts.append((d, url, body))\n",
"return make_deferred_yieldable(d)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_12=True, **VAR_7):...\n",
"VAR_21 = {'type': 'date'}\n",
"if VAR_12:\n",
"VAR_21['data-provide'] = 'datepicker'\n",
"super().__init__(VAR_21=attrs, VAR_36='%Y-%m-%d', **kwargs)\n",
"VAR_21['data-date-format'] = 'yyyy-mm-dd'\n"
] | [
"def __init__(self, datepicker=True, **kwargs):...\n",
"attrs = {'type': 'date'}\n",
"if datepicker:\n",
"attrs['data-provide'] = 'datepicker'\n",
"super().__init__(attrs=attrs, format='%Y-%m-%d', **kwargs)\n",
"attrs['data-date-format'] = 'yyyy-mm-dd'\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_72(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_263.request.ajax:\n",
"return self.messages.access_denied\n"
] | [
"def not_authorized(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if current.request.ajax:\n",
"return self.messages.access_denied\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'"
] |
[
"def FUNC_9(VAR_14, VAR_11, VAR_15=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_54.path.isabs(VAR_14):\n",
"return ''\n",
"if not VAR_54.path.isabs(VAR_11):\n",
"VAR_11 = VAR_54.path.join(VAR_14, VAR_11)\n",
"VAR_11 = VAR_54.path.normpath(VAR_11)\n",
"if VAR_15:\n",
"if VAR_11.startswith(VA... | [
"def clean_path(root, path, subdir=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if not os.path.isabs(root):\n",
"return ''\n",
"if not os.path.isabs(path):\n",
"path = os.path.join(root, path)\n",
"path = os.path.normpath(path)\n",
"if subdir:\n",
"if path.startswith(root):\n",
"if os.path.dirname(p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"self.mock_federation_resource = MockHttpResource()\n",
"self.mock_http_client = Mock(spec=[])\n",
"self.mock_http_client.put_json = DeferredMockCallable()\n",
"VAR_2 = yield setup_test_homeserver(self.addCleanup, http_client=self.\n mock_http_client, keyring=Mock())\n",
... | [
"@defer.inlineCallbacks...\n",
"self.mock_federation_resource = MockHttpResource()\n",
"self.mock_http_client = Mock(spec=[])\n",
"self.mock_http_client.put_json = DeferredMockCallable()\n",
"hs = yield setup_test_homeserver(self.addCleanup, http_client=self.\n mock_http_client, keyring=Mock())\n",
"se... | [
0,
0,
0,
0,
4,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_56(VAR_35, VAR_36, VAR_37, VAR_38, VAR_39, VAR_40, VAR_41, VAR_24,...\n",
"VAR_35.extend((VAR_36.replace('|', ','), VAR_37, VAR_38))\n",
"if VAR_39:\n",
"if VAR_40:\n",
"VAR_35.extend([_(u'Published after ') + format_date(datetime.strptime(\n VAR_39, '%Y-%m-%d'), format='medium', locale=get_loc... | [
"def extend_search_term(searchterm, author_name, book_title, publisher,...\n",
"searchterm.extend((author_name.replace('|', ','), book_title, publisher))\n",
"if pub_start:\n",
"if pub_end:\n",
"searchterm.extend([_(u'Published after ') + format_date(datetime.strptime(\n pub_start, '%Y-%m-%d'), format='m... | [
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",... |
[
"def FUNC_113(self):...\n",
"return CLASS_0(dict(self).copy())\n"
] | [
"def copy(self):...\n",
"return _dict(dict(self).copy())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self, VAR_0, VAR_1, VAR_2):...\n",
"self.store = VAR_2.get_datastore()\n",
"self.storage = VAR_2.get_storage()\n",
"self.event_builder_factory = VAR_2.get_event_builder_factory()\n",
"self.event_creation_handler = VAR_2.get_event_creation_handler()\n",
"self.u_alice = UserID.from_string('@alic... | [
"def prepare(self, reactor, clock, hs):...\n",
"self.store = hs.get_datastore()\n",
"self.storage = hs.get_storage()\n",
"self.event_builder_factory = hs.get_event_builder_factory()\n",
"self.event_creation_handler = hs.get_event_creation_handler()\n",
"self.u_alice = UserID.from_string('@alice:test')\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_2(self):...\n",
"VAR_4 = generate_credits(None, timezone.now() - timedelta(days=1), timezone\n .now() + timedelta(days=1), translation__component=self.component)\n",
"self.assertEqual(VAR_4, [])\n"
] | [
"def test_credits_empty(self):...\n",
"data = generate_credits(None, timezone.now() - timedelta(days=1), timezone.\n now() + timedelta(days=1), translation__component=self.component)\n",
"self.assertEqual(data, [])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_107(VAR_169, VAR_7='utf-8'):...\n",
""
] | [
"def safe_encode(param, encoding='utf-8'):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_154(*VAR_9, **VAR_13):...\n",
"VAR_13['_rel'] = 'nofollow'\n",
"return A(*VAR_9, **b)\n"
] | [
"def Anr(*a, **b):...\n",
"b['_rel'] = 'nofollow'\n",
"return A(*a, **b)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_36(self, VAR_1=None, VAR_2=None):...\n",
"if VAR_1 is None:\n",
"VAR_1 = self._makeEngine()\n",
"if VAR_2 is None:\n",
"VAR_2 = {}\n",
"return self._getTargetClass()(VAR_1, VAR_2)\n"
] | [
"def _makeOne(self, engine=None, contexts=None):...\n",
"if engine is None:\n",
"engine = self._makeEngine()\n",
"if contexts is None:\n",
"contexts = {}\n",
"return self._getTargetClass()(engine, contexts)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"\"\"\"Contains handlers for federation events.\"\"\"\n",
"import itertools\n",
"import logging\n",
"from collections.abc import Container\n",
"from http import HTTPStatus\n",
"from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union\n",
"import attr\n",
"from signedjso... | [
"\"\"\"Contains handlers for federation events.\"\"\"\n",
"import itertools\n",
"import logging\n",
"from collections.abc import Container\n",
"from http import HTTPStatus\n",
"from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union\n",
"import attr\n",
"from signedjso... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0... | [
"Expr'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom... |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2.method != 'POST':\n",
"VAR_154 = FUNC_42(VAR_2, VAR_5)\n",
"VAR_114 = FUNC_43(VAR_2)\n",
"VAR_115 = {'selected': VAR_114, 'images': VAR_154['image'], 'datasets':\n VAR_154['dataset'], 'projects': VAR_154['project'], 'screens': VAR_154[\n ... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method != 'POST':\n",
"oids = getObjects(request, conn)\n",
"selected = getIds(request)\n",
"initial = {'selected': selected, 'images': oids['image'], 'datasets': oids[\n 'dataset'], 'projects': oids['project'], 'screens': oids['screen'],... | [
0,
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",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return... |
[
"def FUNC_30(self, VAR_8):...\n",
""
] | [
"def get(self, id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_50(VAR_62=None, VAR_9=None, VAR_109=0, VAR_110=None, VAR_111=False,...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.delete_doc\n",
"frappe.model.delete_doc.delete_doc(VAR_62, VAR_9, VAR_109, VAR_110, VAR_111,\n VAR_92, VAR_19, VAR_112, VAR_113, VAR_114)\n"
] | [
"def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None,...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.delete_doc\n",
"frappe.model.delete_doc.delete_doc(doctype, name, force, ignore_doctypes,\n for_reload, ignore_permissions, flags, ignore_on_trash, ignore_missing,\n delete_perm... | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Import'",
"Expr'"
] |
[
"def FUNC_11(VAR_11):...\n",
"return os.path.join(VAR_3, VAR_11)\n"
] | [
"def _get_index_absolute_path(index):...\n",
"return os.path.join(INDEXDIR, index)\n"
] | [
0,
1
] | [
"FunctionDef'",
"Return'"
] |
[
"@login_required...\n",
"VAR_7 = Topic.objects.for_update_or_404(VAR_2, VAR_0.user)\n",
"VAR_1 = VAR_7.category_id\n",
"VAR_5 = TopicForm(VAR_4=request.user, data=post_data(request), instance=topic)\n",
"if is_post(VAR_0) and VAR_5.is_valid():\n",
"VAR_7 = VAR_5.save()\n",
"return render(VAR_0=request, ... | [
"@login_required...\n",
"topic = Topic.objects.for_update_or_404(pk, request.user)\n",
"category_id = topic.category_id\n",
"form = TopicForm(user=request.user, data=post_data(request), instance=topic)\n",
"if is_post(request) and form.is_valid():\n",
"topic = form.save()\n",
"return render(request=requ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_23(self, VAR_17):...\n",
""
] | [
"def api_listdir(self, directory):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_41(self, VAR_24=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_65 = []\n",
"for VAR_19 in self.meta.get('fields', {'fieldtype': ['in', VAR_81]}):\n",
"if VAR_24:\n",
"return VAR_65\n",
"if VAR_19.options == VAR_24:\n",
"VAR_26 = self.get(VAR_19.fieldname)\n",
"return self.get(VAR_19.fieldna... | [
"def get_all_children(self, parenttype=None):...\n",
"\"\"\"docstring\"\"\"\n",
"ret = []\n",
"for df in self.meta.get('fields', {'fieldtype': ['in', table_fields]}):\n",
"if parenttype:\n",
"return ret\n",
"if df.options == parenttype:\n",
"value = self.get(df.fieldname)\n",
"return self.get(df.fie... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_25(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_44 = np.array([[1], [2]])\n",
"VAR_45 = np.zeros((6, 3))\n",
"VAR_31 = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutOverwrite_inputs.npz')\n",
"np.savez(VAR_31, VAR_2... | [
"def testRunCommandOutOverwrite(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"x = np.array([[1], [2]])\n",
"x_notused = np.zeros((6, 3))\n",
"input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutOverwrite_inputs... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"import logging\n",
"from django.template.response import TemplateResponse\n",
"from django.utils.safestring import mark_safe\n",
"import orjson\n",
"from bs4 import BeautifulSoup\n",
"from bs4.element import Tag\n",
"from bs4.formatter import HTMLFormatter\n",
"from django_unicorn.utils import saniti... | [
"import logging\n",
"from django.template.response import TemplateResponse\n",
"from django.utils.safestring import mark_safe\n",
"import orjson\n",
"from bs4 import BeautifulSoup\n",
"from bs4.element import Tag\n",
"from bs4.formatter import HTMLFormatter\n",
"from django_unicorn.utils import saniti... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"FunctionDef'",
"For",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",... |
[
"def FUNC_15():...\n",
"random.seed(VAR_24)\n",
"return list(map(lambda x: x + VAR_5 * VAR_45, sorted(random.sample(list(\n range(VAR_5)), VAR_44))))\n"
] | [
"def generate_mix_indices():...\n",
"random.seed(seed)\n",
"return list(map(lambda x: x + ITEMS_PER_ITERATION * iteration_count, sorted\n (random.sample(list(range(ITEMS_PER_ITERATION)), mix_per_iteration))))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"@login_required()...\n",
""
] | [
"@login_required()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_17(VAR_9, VAR_5):...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_RANDOM):\n",
"VAR_63, VAR_64, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, True,\n [func.randomblob(2)])\n",
"abort(404)\n",
"VAR_65 = Pagination(1, config.config_books_per_page, config.\n config_books_per_page)... | [
"def render_discover_books(page, book_id):...\n",
"if current_user.check_visibility(constants.SIDEBAR_RANDOM):\n",
"entries, __, pagination = calibre_db.fill_indexpage(page, 0, db.Books, True,\n [func.randomblob(2)])\n",
"abort(404)\n",
"pagination = Pagination(1, config.config_books_per_page, config.\n ... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"@VAR_4.route('/result', methods=['GET', 'POST'])...\n",
"VAR_23 = VAR_17['result']\n",
"VAR_16 = {'is_success': VAR_23, 'solved_count': VAR_17['quiz_count'],\n 'correct': VAR_17['correct'], 'current_munhak': VAR_17['current_munhak']}\n",
"VAR_17['quiz_count'] = 0\n",
"VAR_17['solved_quiz'] = []\n",
"V... | [
"@app.route('/result', methods=['GET', 'POST'])...\n",
"is_success = session['result']\n",
"data = {'is_success': is_success, 'solved_count': session['quiz_count'],\n 'correct': session['correct'], 'current_munhak': session['current_munhak']}\n",
"session['quiz_count'] = 0\n",
"session['solved_quiz'] = [... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/admin/logdownload/<int:logtype>')...\n",
"if VAR_26 == 0:\n",
"VAR_113 = logger.get_logfile(config.config_logfile)\n",
"if VAR_26 == 1:\n",
"if logger.is_valid_logfile(VAR_113):\n",
"VAR_113 = logger.get_accesslogfile(config.config_access_logfile)\n",
"abort(404)\n",
"return debug_info... | [
"@admi.route('/admin/logdownload/<int:logtype>')...\n",
"if logtype == 0:\n",
"file_name = logger.get_logfile(config.config_logfile)\n",
"if logtype == 1:\n",
"if logger.is_valid_logfile(file_name):\n",
"file_name = logger.get_accesslogfile(config.config_access_logfile)\n",
"abort(404)\n",
"return deb... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Expr'"
] |
[
"def FUNC_24(self):...\n",
"VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'users':\n {'create': coreapi.Link(url='/users/', action='post', fields=[]),\n 'list': coreapi.Link(url='/users/', action='get', fields=[]), 'read':\n coreapi.Link(url='/users/{id}/', action='get', fields=[corea... | [
"def test_default_actions_and_single_custom_action(self):...\n",
"schema = coreapi.Document(url='', title='Example API', content={'users': {\n 'create': coreapi.Link(url='/users/', action='post', fields=[]), 'list':\n coreapi.Link(url='/users/', action='get', fields=[]), 'read': coreapi.\n Link(url='/use... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_9(self, VAR_12, VAR_1, VAR_2):...\n",
"VAR_2 = VAR_2.__name__\n",
"if self.acl.is_exempt(VAR_2):\n",
"return True\n",
"if not self.acl.seted:\n",
"self._setup_acl()\n",
"VAR_20 = set()\n",
"VAR_21 = {'*', VAR_1}\n",
"VAR_22 = {None, VAR_2}\n",
"VAR_20.add(anonymous)\n",
"VAR_20.update(... | [
"def _check_permission(self, roles, method, resource):...\n",
"resource = resource.__name__\n",
"if self.acl.is_exempt(resource):\n",
"return True\n",
"if not self.acl.seted:\n",
"self._setup_acl()\n",
"_roles = set()\n",
"_methods = {'*', method}\n",
"_resources = {None, resource}\n",
"_roles.add... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_28(VAR_17, VAR_34, VAR_35=True):...\n",
"VAR_62 = VAR_34.split('&')\n",
"VAR_62 = list(map(lambda it: it.strip().replace(',', '|'), VAR_62))\n",
"VAR_62 = helper.uniq(VAR_62)\n",
"if VAR_62 == ['']:\n",
"VAR_62 = [_(u'Unknown')]\n",
"VAR_63 = FUNC_7(VAR_62, VAR_17.authors, db.Authors, calibre_... | [
"def handle_author_on_edit(book, author_name, update_stored=True):...\n",
"input_authors = author_name.split('&')\n",
"input_authors = list(map(lambda it: it.strip().replace(',', '|'),\n input_authors))\n",
"input_authors = helper.uniq(input_authors)\n",
"if input_authors == ['']:\n",
"input_authors = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_6(self):...\n",
"VAR_5 = {'types': ['m.*', 'org.matrix.foo.bar']}\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='m.room.message', room_id='!foo:bar')\n",
"self.assertTrue(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_types_works_with_wildcards(self):...\n",
"definition = {'types': ['m.*', 'org.matrix.foo.bar']}\n",
"event = MockEvent(sender='@foo:bar', type='m.room.message', room_id='!foo:bar')\n",
"self.assertTrue(Filter(definition).check(event))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = VAR_3.adjusted(QUrl.NormalizePathSegments | QUrl.StripTrailingSlash)\n",
"if VAR_14 != VAR_3:\n",
"VAR_15 = VAR_3.path()\n",
"VAR_16 = VAR_3.host()\n",
"VAR_17 = urlutils.query_string(VAR_3)\n",
"log.misc.debug('url: {}, path: {}, host {}... | [
"def data_for_url(url):...\n",
"\"\"\"docstring\"\"\"\n",
"norm_url = url.adjusted(QUrl.NormalizePathSegments | QUrl.StripTrailingSlash)\n",
"if norm_url != url:\n",
"path = url.path()\n",
"host = url.host()\n",
"query = urlutils.query_string(url)\n",
"log.misc.debug('url: {}, path: {}, host {}'.forma... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition"
... |
[
"def FUNC_8(VAR_26: Optional[Dict[Text, Any]], VAR_27: Optional[List[Text]]=...\n",
"if not VAR_26:\n",
"return ''\n",
"VAR_56 = VAR_27 or list(filter(lambda k: k not in VAR_28, VAR_26.keys()))\n",
"VAR_57 = {k: VAR_26[k] for k in VAR_56 if k in VAR_26}\n",
"return rasa.shared.utils.io.deep_container_fing... | [
"def _get_fingerprint_of_config(config: Optional[Dict[Text, Any]],...\n",
"if not config:\n",
"return ''\n",
"keys = include_keys or list(filter(lambda k: k not in exclude_keys, config.\n keys()))\n",
"sub_config = {k: config[k] for k in keys if k in config}\n",
"return rasa.shared.utils.io.deep_contai... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_56(self):...\n",
"self.login()\n",
"VAR_3 = self.client.get('/logout/next_page/')\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/somewhere/')\n",
"VAR_3 = self.client.get('/logout/next_page/?next=/login/')\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
... | [
"def test_logout_with_overridden_redirect_url(self):...\n",
"self.login()\n",
"response = self.client.get('/logout/next_page/')\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/somewhere/')\n",
"response = self.client.get('/logout/next_page/?next=/login/')\n",
"s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(self, VAR_39):...\n",
"return self.doc_links[VAR_39.name]\n"
] | [
"def get_field_doc(self, field):...\n",
"return self.doc_links[field.name]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_31(VAR_20, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = 'identifier-type-'\n",
"VAR_67 = 'identifier-val-'\n",
"VAR_68 = []\n",
"for type_key, type_value in VAR_20.items():\n",
"if not type_key.startswith(VAR_66):\n",
"return VAR_68\n",
"VAR_94 = VAR_67 + type_key[len(VAR_66):]\n",... | [
"def identifier_list(to_save, book):...\n",
"\"\"\"docstring\"\"\"\n",
"id_type_prefix = 'identifier-type-'\n",
"id_val_prefix = 'identifier-val-'\n",
"result = []\n",
"for type_key, type_value in to_save.items():\n",
"if not type_key.startswith(id_type_prefix):\n",
"return result\n",
"val_key = id_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_17(VAR_5):...\n",
"VAR_19 = filescheme.dirbrowser_html(VAR_5).decode('utf-8')\n",
"VAR_20 = bs4.BeautifulSoup(VAR_19, 'html.parser')\n",
"print(VAR_20.prettify())\n",
"VAR_21 = VAR_20('div', id='dirbrowserContainer')[0]\n",
"VAR_42 = VAR_21('ul', class_='parent')\n",
"if not VAR_42:\n",
"VAR... | [
"def parse(path):...\n",
"html = filescheme.dirbrowser_html(path).decode('utf-8')\n",
"soup = bs4.BeautifulSoup(html, 'html.parser')\n",
"print(soup.prettify())\n",
"container = soup('div', id='dirbrowserContainer')[0]\n",
"parent_elem = container('ul', class_='parent')\n",
"if not parent_elem:\n",
"p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Expr'",
"Assign'",
"Return'",
"Expr'"
] |
[
"@VAR_0.route('/ajax/editbooks/<param>', methods=['POST'])...\n",
"VAR_81 = VAR_33.form.to_dict()\n",
"VAR_16 = calibre_db.get_book(VAR_81['pk'])\n",
"VAR_80 = ''\n",
"if VAR_44 == 'series_index':\n",
"FUNC_18(VAR_81['value'], VAR_16)\n",
"if VAR_44 == 'tags':\n",
"VAR_80 = Response(json.dumps({'succe... | [
"@editbook.route('/ajax/editbooks/<param>', methods=['POST'])...\n",
"vals = request.form.to_dict()\n",
"book = calibre_db.get_book(vals['pk'])\n",
"ret = ''\n",
"if param == 'series_index':\n",
"edit_book_series_index(vals['value'], book)\n",
"if param == 'tags':\n",
"ret = Response(json.dumps({'succ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Con... |
[
"def FUNC_39(VAR_15, VAR_16, VAR_17={}, VAR_3=None):...\n",
"VAR_98 = (VAR_15, VAR_16) if 'app' in VAR_17 else (VAR_3, VAR_15, VAR_16)\n",
"VAR_99 = URL('edit', VAR_98=args, VAR_17=vars)\n",
"return A(VAR_16, VAR_144='editor_filelink', _href=url, _style=\n 'word-wrap: nowrap;')\n"
] | [
"def editfile(path, file, vars={}, app=None):...\n",
"args = (path, file) if 'app' in vars else (app, path, file)\n",
"url = URL('edit', args=args, vars=vars)\n",
"return A(file, _class='editor_filelink', _href=url, _style='word-wrap: nowrap;'\n )\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_53(VAR_91, VAR_116=None, VAR_117=None, VAR_109=False, VAR_115=False):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.modules\n",
"return frappe.modules.reload_doc(VAR_91, VAR_116, VAR_117, VAR_109=force,\n VAR_115=reset_permissions)\n"
] | [
"def reload_doc(module, dt=None, dn=None, force=False, reset_permissions=False):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.modules\n",
"return frappe.modules.reload_doc(module, dt, dn, force=force,\n reset_permissions=reset_permissions)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"@parameterized.expand([(['federation'], 'auth_fail'), ([], 'no_resource'),...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = {'port': 8080, 'type': 'http', 'bind_addresses': ['0.0.0.0'],\n 'resources': [{'names': VAR_2}]}\n",
"self.hs._listen_http(parse_listener_def(VAR_6))\n",
"VAR_7 = self.reactor.tcpServers... | [
"@parameterized.expand([(['federation'], 'auth_fail'), ([], 'no_resource'),...\n",
"\"\"\"docstring\"\"\"\n",
"config = {'port': 8080, 'type': 'http', 'bind_addresses': ['0.0.0.0'],\n 'resources': [{'names': names}]}\n",
"self.hs._listen_http(parse_listener_def(config))\n",
"site = self.reactor.tcpServer... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"@VAR_2.route('/formats')...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_FORMAT):\n",
"if VAR_87.get_view_property('ratings', 'dir') == 'desc':\n",
"abort(404)\n",
"VAR_10 = db.Data.format.desc()\n",
"VAR_10 = db.Data.format.asc()\n",
"VAR_109 = 0\n",
"VAR_109 = 1\n",
"VAR_63 = calibre_db.sess... | [
"@web.route('/formats')...\n",
"if current_user.check_visibility(constants.SIDEBAR_FORMAT):\n",
"if current_user.get_view_property('ratings', 'dir') == 'desc':\n",
"abort(404)\n",
"order = db.Data.format.desc()\n",
"order = db.Data.format.asc()\n",
"order_no = 0\n",
"order_no = 1\n",
"entries = cali... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self, VAR_16, VAR_15, VAR_17, VAR_18, VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_105 = self.profile\n",
"VAR_101 = []\n",
"VAR_102 = [VAR_0.format('specialchar', VAR_20, 'data-value=\"{}\"'.format(\n VAR_13.encode('ascii', 'xmlcharrefreplace').decode('ascii')), char) for\n VAR_20, cha... | [
"def get_toolbar(self, language, fieldname, unit, idx, source):...\n",
"\"\"\"docstring\"\"\"\n",
"profile = self.profile\n",
"groups = []\n",
"chars = [BUTTON_TEMPLATE.format('specialchar', name, 'data-value=\"{}\"'.\n format(value.encode('ascii', 'xmlcharrefreplace').decode('ascii')),\n char) for na... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@pytest.mark.windows...\n",
"assert filescheme.is_root(VAR_9) == VAR_10\n"
] | [
"@pytest.mark.windows...\n",
"assert filescheme.is_root(directory) == is_root\n"
] | [
0,
0
] | [
"Condition",
"Assert'"
] |
[
"def FUNC_1(VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = getattr(VAR_5, 'request', None)\n",
"VAR_4 = list(VAR_4)\n",
"VAR_4.reverse()\n",
"while VAR_4:\n",
"VAR_19 = VAR_4.pop()\n",
"return VAR_3\n",
"if OFS.interfaces.ITraversable.providedBy(VAR_3):\n",
"VAR_3 = VAR_3.unrest... | [
"def trustedBoboAwareZopeTraverse(object, path_items, econtext):...\n",
"\"\"\"docstring\"\"\"\n",
"request = getattr(econtext, 'request', None)\n",
"path_items = list(path_items)\n",
"path_items.reverse()\n",
"while path_items:\n",
"name = path_items.pop()\n",
"return object\n",
"if OFS.interfaces.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_13(self):...\n",
"VAR_20 = as_string(None)\n",
"assert VAR_20 == ''\n"
] | [
"def test_as_string_with_none(self):...\n",
"result = as_string(None)\n",
"assert result == ''\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'"
] |
[
"def FUNC_22(VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_50 = VAR_22.checkpoint_path or os.path.join(VAR_22.dir,\n 'variables/variables')\n",
"if not VAR_22.variables_to_feed:\n",
"VAR_78 = []\n",
"if VAR_22.variables_to_feed.lower() == 'all':\n",
"saved_model_aot_compile.freeze_model(VAR_50=chec... | [
"def freeze_model(args):...\n",
"\"\"\"docstring\"\"\"\n",
"checkpoint_path = args.checkpoint_path or os.path.join(args.dir,\n 'variables/variables')\n",
"if not args.variables_to_feed:\n",
"variables_to_feed = []\n",
"if args.variables_to_feed.lower() == 'all':\n",
"saved_model_aot_compile.freeze_mo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_144(self, VAR_156):...\n",
"VAR_63 = self.auth\n",
"VAR_101 = VAR_63.db\n",
"VAR_212 = VAR_101.wiki_page(VAR_156=slug)\n",
"if not (VAR_212 and self.can_edit(VAR_212)):\n",
"return self.not_authorized(VAR_212)\n",
"self.auth.db.wiki_media.id.represent = (lambda VAR_215, VAR_266: VAR_215 if\n ... | [
"def editmedia(self, slug):...\n",
"auth = self.auth\n",
"db = auth.db\n",
"page = db.wiki_page(slug=slug)\n",
"if not (page and self.can_edit(page)):\n",
"return self.not_authorized(page)\n",
"self.auth.db.wiki_media.id.represent = (lambda id, row: id if not row.\n filename else SPAN('@////%i/%s.%s'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __init__(self):...\n",
"self.called = False\n"
] | [
"def __init__(self):...\n",
"self.called = False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_51(self):...\n",
"def FUNC_52():...\n",
"self.http_server.stop()\n",
"self.io_loop.stop()\n",
"self.io_loop.add_callback(FUNC_52)\n"
] | [
"def stop(self):...\n",
"def _stop():...\n",
"self.http_server.stop()\n",
"self.io_loop.stop()\n",
"self.io_loop.add_callback(_stop)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_0.route('/jobs/<int:job_id>/subjobs', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"VAR_84['subjobs_per_page'] = int(request.form.get('subjobs-per-page'))\n",
"VAR_51 = int(request.args.get('page')) if request.args.get('page'\n ) is not None else 0\n"... | [
"@gui.route('/jobs/<int:job_id>/subjobs', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"session['subjobs_per_page'] = int(request.form.get('subjobs-per-page'))\n",
"current_page = int(request.args.get('page')) if request.args.get('page'\n ) is not None else... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"async def FUNC_6(self, VAR_3: str, VAR_4: str) ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.federation_domain_whitelist is not None and VAR_3 not in self.federation_domain_whitelist:\n",
"VAR_31 = VAR_3, VAR_4\n",
"VAR_30, VAR_28 = await self._get_remote_media_impl(VAR_3, VAR_4)\n",
"if VAR_30:\n",... | [
"async def get_remote_media_info(self, server_name: str, media_id: str) ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.federation_domain_whitelist is not None and server_name not in self.federation_domain_whitelist:\n",
"key = server_name, media_id\n",
"responder, media_info = await self._get_remote_med... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_9(VAR_25):...\n",
"return VAR_25[:-1] if VAR_25.endswith('_') else VAR_25\n"
] | [
"def norm(k):...\n",
"return k[:-1] if k.endswith('_') else k\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_20(VAR_66: DecoratedCallable) ->DecoratedCallable:...\n",
"self.add_api_websocket_route(VAR_26, VAR_66, VAR_28=name)\n",
"return VAR_66\n"
] | [
"def decorator(func: DecoratedCallable) ->DecoratedCallable:...\n",
"self.add_api_websocket_route(path, func, name=name)\n",
"return func\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_43(VAR_62, VAR_9):...\n",
"FUNC_10().hdel('last_modified', VAR_62)\n",
"VAR_46 = FUNC_42(VAR_62, VAR_9)\n",
"if VAR_46 in VAR_1.document_cache:\n",
"FUNC_10().hdel('document_cache', VAR_46)\n"
] | [
"def clear_document_cache(doctype, name):...\n",
"cache().hdel('last_modified', doctype)\n",
"key = get_document_cache_key(doctype, name)\n",
"if key in local.document_cache:\n",
"cache().hdel('document_cache', key)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_164(VAR_179):...\n",
"if isinstance(VAR_179, unicodeT):\n",
"return VAR_179.encode('utf8')\n",
"if hasattr(VAR_179, 'isoformat'):\n",
"return VAR_179.isoformat()[:19].replace('T', ' ')\n",
"if VAR_179 is None:\n",
"return '<NULL>'\n",
"return VAR_179\n"
] | [
"def none_exception(value):...\n",
"if isinstance(value, unicodeT):\n",
"return value.encode('utf8')\n",
"if hasattr(value, 'isoformat'):\n",
"return value.isoformat()[:19].replace('T', ' ')\n",
"if value is None:\n",
"return '<NULL>'\n",
"return value\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"For",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_73(self, VAR_4, **VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils.background_jobs import enqueue\n",
"if hasattr(self, '_' + VAR_4):\n",
"VAR_4 = '_' + VAR_4\n",
"if file_lock.lock_exists(self.get_signature()):\n",
"frappe.throw(_(\n 'This document is currently queued for execu... | [
"def queue_action(self, action, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils.background_jobs import enqueue\n",
"if hasattr(self, '_' + action):\n",
"action = '_' + action\n",
"if file_lock.lock_exists(self.get_signature()):\n",
"frappe.throw(_(\n 'This document is currently queued... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_11(VAR_6, VAR_7, VAR_20):...\n",
"self.assertEqual(VAR_6, self.hs.hostname)\n",
"self.assertEqual(VAR_7, '/_matrix/key/v2/query')\n",
"VAR_10 = FakeChannel(self.site, self.reactor)\n",
"VAR_11 = SynapseRequest(VAR_10)\n",
"VAR_11.content = BytesIO(encode_canonical_json(VAR_20))\n",
"VAR_... | [
"async def post_json(destination, path, data):...\n",
"self.assertEqual(destination, self.hs.hostname)\n",
"self.assertEqual(path, '/_matrix/key/v2/query')\n",
"channel = FakeChannel(self.site, self.reactor)\n",
"req = SynapseRequest(channel)\n",
"req.content = BytesIO(encode_canonical_json(data))\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_172(VAR_354):...\n",
"return VAR_354 + ' ' + VAR_354.replace('icon', 'glyphicon')\n"
] | [
"def rename(icon):...\n",
"return icon + ' ' + icon.replace('icon', 'glyphicon')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.