lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_6(VAR_7, VAR_8='Argument', VAR_6=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_26 = ' ' * VAR_6\n",
"def FUNC_31(VAR_31):...\n",
"VAR_63 = \"'\" * isinstance(VAR_31, str)\n",
"return VAR_63 + str(VAR_31) + VAR_63\n"
] | [
"def _print_args(arguments, argument_type='Argument', indent=0):...\n",
"\"\"\"docstring\"\"\"\n",
"indent_str = ' ' * indent\n",
"def _maybe_add_quotes(value):...\n",
"is_quotes = \"'\" * isinstance(value, str)\n",
"return is_quotes + str(value) + is_quotes\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(VAR_40):...\n",
"return VAR_39[VAR_40]\n"
] | [
"def models_dir_get(x):...\n",
"return module_paths[x]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_19(VAR_2, *VAR_23, **VAR_24):...\n",
"VAR_3 = VAR_2.GET.get('url')\n",
"if VAR_3 is None or len(VAR_3) == 0:\n",
"VAR_3 = VAR_2.get_full_path()\n",
"VAR_9 = False\n",
"VAR_14 = VAR_24.get('conn', None)\n",
"VAR_16 = None\n",
"VAR_19 = VAR_24.get('server_id', None)\n",
"if VAR_14 is None:\n... | [
"def wrapped(request, *args, **kwargs):...\n",
"url = request.GET.get('url')\n",
"if url is None or len(url) == 0:\n",
"url = request.get_full_path()\n",
"doConnectionCleanup = False\n",
"conn = kwargs.get('conn', None)\n",
"error = None\n",
"server_id = kwargs.get('server_id', None)\n",
"if conn is... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Expr'",
... |
[
"def FUNC_151(VAR_199):...\n",
"if [VAR_14 for VAR_14 in VAR_199 if 32 > ord(VAR_14) or ord(VAR_14) > 127]:\n",
"return Header(VAR_199.encode('utf-8'), 'utf-8')\n",
"return VAR_199\n"
] | [
"def encode_header(key):...\n",
"if [c for c in key if 32 > ord(c) or ord(c) > 127]:\n",
"return Header(key.encode('utf-8'), 'utf-8')\n",
"return key\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Return'",
"Return'"
] |
[
"def FUNC_24(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_51 = 'string'\n",
"VAR_52 = VAR_23.add_parser('show', description=show_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_52.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to inspect'... | [
"def add_show_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"show_msg = \"\"\"Usage examples:\nTo show all tag-sets in a SavedModel:\n$saved_model_cli show --dir /tmp/saved_model\n\nTo show all available SignatureDef keys in a MetaGraphDef specified by its tag-set:\n$saved_model_cli show --dir /tmp/s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_34(VAR_94=None, VAR_93='read', VAR_10=None, VAR_95=False, VAR_62=None...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_10:\n",
"VAR_10 = VAR_18.user\n",
"if VAR_94:\n",
"if isinstance(VAR_94, string_types):\n",
"VAR_184 = (FUNC_66('has_website_permission') or {}).get(VAR_62, [])\n",
"VAR_94 = F... | [
"def has_website_permission(doc=None, ptype='read', user=None, verbose=False,...\n",
"\"\"\"docstring\"\"\"\n",
"if not user:\n",
"user = session.user\n",
"if doc:\n",
"if isinstance(doc, string_types):\n",
"hooks = (get_hooks('has_website_permission') or {}).get(doctype, [])\n",
"doc = get_doc(doctyp... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"For",
"Return'",
"Return'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_4, VAR_55, *VAR_6, **VAR_7):...\n",
"VAR_58 = VAR_7.pop('project')\n",
"VAR_7['auto_id'] = 'id_bulk_%s'\n",
"super().__init__(*VAR_6, **kwargs)\n",
"VAR_129 = VAR_58.label_set.all()\n",
"if VAR_129:\n",
"self.fields['remove_labels'].queryset = VAR_129\n",
"VAR_130 = {STATE_EMPT... | [
"def __init__(self, user, obj, *args, **kwargs):...\n",
"project = kwargs.pop('project')\n",
"kwargs['auto_id'] = 'id_bulk_%s'\n",
"super().__init__(*args, **kwargs)\n",
"labels = project.label_set.all()\n",
"if labels:\n",
"self.fields['remove_labels'].queryset = labels\n",
"excluded = {STATE_EMPTY, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_18, VAR_13, VAR_14, VAR_19=None):...\n",
"self.is_hidden = VAR_18.is_hidden\n",
"self.needs_multipart_form = VAR_18.needs_multipart_form\n",
"self.attrs = VAR_18.attrs\n",
"self.choices = VAR_18.choices\n",
"self.widget = VAR_18\n",
"self.rel = VAR_13\n",
"if VAR_19 is None:\n"... | [
"def __init__(self, widget, rel, admin_site, can_add_related=None):...\n",
"self.is_hidden = widget.is_hidden\n",
"self.needs_multipart_form = widget.needs_multipart_form\n",
"self.attrs = widget.attrs\n",
"self.choices = widget.choices\n",
"self.widget = widget\n",
"self.rel = rel\n",
"if can_add_rel... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(self):...\n",
"if 'project' not in self.cleaned_data:\n",
"return\n",
"VAR_58 = self.cleaned_data['project']\n",
"VAR_20 = self.cleaned_data.get('name')\n",
"if VAR_20 and VAR_58.component_set.filter(name__iexact=name).exists():\n",
"VAR_69 = self.cleaned_data.get('slug')\n",
"if VAR_69 an... | [
"def clean(self):...\n",
"if 'project' not in self.cleaned_data:\n",
"return\n",
"project = self.cleaned_data['project']\n",
"name = self.cleaned_data.get('name')\n",
"if name and project.component_set.filter(name__iexact=name).exists():\n",
"slug = self.cleaned_data.get('slug')\n",
"if slug and proje... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition"
] |
[
"def FUNC_86(VAR_123, VAR_86, VAR_124):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_185 = HttpResponse(content_type='text/csv')\n",
"VAR_185['Content-Disposition'] = 'attachment; filename={0}'.format(unicode(\n VAR_123).encode('utf-8'))\n",
"VAR_186 = VAR_26.writer(VAR_185, dialect='excel', quotechar='\"', qu... | [
"def csv_response(filename, header, rows):...\n",
"\"\"\"docstring\"\"\"\n",
"response = HttpResponse(content_type='text/csv')\n",
"response['Content-Disposition'] = 'attachment; filename={0}'.format(unicode\n (filename).encode('utf-8'))\n",
"writer = csv.writer(response, dialect='excel', quotechar='\"',... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_1, VAR_2):...\n",
"VAR_3 = self.setup_test_homeserver('server', http_client=None)\n",
"self.store = VAR_3.get_datastore()\n",
"return VAR_3\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"hs = self.setup_test_homeserver('server', http_client=None)\n",
"self.store = hs.get_datastore()\n",
"return hs\n"
] | [
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_60(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.login()\n",
"VAR_3 = self.client.get('/logout/next_page/named/')\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/password_reset/')\n",
"self.confirm_logged_out()\n"
] | [
"def test_logout_with_named_redirect(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.login()\n",
"response = self.client.get('/logout/next_page/named/')\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/password_reset/')\n",
"self.confirm_logged_out()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/admin/resetpassword/<int:user_id>')...\n",
"if VAR_62 is not None and VAR_62.is_authenticated:\n",
"VAR_59, VAR_71 = reset_password(VAR_9)\n",
"return redirect(url_for('admin.admin'))\n",
"if VAR_59 == 1:\n",
"VAR_0.debug(u'Password for user %s reset', VAR_71)\n",
"if VAR_59 == 0:\n",
... | [
"@admi.route('/admin/resetpassword/<int:user_id>')...\n",
"if current_user is not None and current_user.is_authenticated:\n",
"ret, message = reset_password(user_id)\n",
"return redirect(url_for('admin.admin'))\n",
"if ret == 1:\n",
"log.debug(u'Password for user %s reset', message)\n",
"if ret == 0:\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def __call__(self):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_222 = self.settings\n",
"VAR_222.controller = VAR_222.controller or VAR_56.controller\n",
"VAR_222.function = VAR_222.function or VAR_56.function\n",
"self.automenu()\n",
"VAR_299 = VAR_56.args(0) or 'index'\n",
"if VAR_299 and VAR_299.isd... | [
"def __call__(self):...\n",
"request = current.request\n",
"settings = self.settings\n",
"settings.controller = settings.controller or request.controller\n",
"settings.function = settings.function or request.function\n",
"self.automenu()\n",
"zero = request.args(0) or 'index'\n",
"if zero and zero.isd... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
... |
[
"from setuptools import setup\n",
"setup(name='security_monkey', version='0.8.0', long_description=__doc__,\n packages=['security_monkey'], include_package_data=True, zip_safe=False,\n install_requires=['APScheduler==2.1.2', 'Flask==0.10.1',\n 'Flask-Login==0.2.10', 'Flask-Mail==0.9.0', 'Flask-Migrate==1... | [
"from setuptools import setup\n",
"setup(name='security_monkey', version='0.8.0', long_description=__doc__,\n packages=['security_monkey'], include_package_data=True, zip_safe=False,\n install_requires=['APScheduler==2.1.2', 'Flask==0.10.1',\n 'Flask-Login==0.2.10', 'Flask-Mail==0.9.0', 'Flask-Migrate==1... | [
0,
4
] | [
"ImportFrom'",
"Expr'"
] |
[
"@app.route('/tags/<tag_name>')...\n",
"if not app.config['SEARCH_CONF']['enabled'] and not which('rg'):\n",
"flash(\n 'Search (for example ripgrep) must be installed to view pages about embedded tags.'\n , 'error')\n",
"VAR_11 = search(f'#{VAR_0}#', strict=True)\n",
"return redirect('/')\n",
"retur... | [
"@app.route('/tags/<tag_name>')...\n",
"if not app.config['SEARCH_CONF']['enabled'] and not which('rg'):\n",
"flash(\n 'Search (for example ripgrep) must be installed to view pages about embedded tags.'\n , 'error')\n",
"search_results = search(f'#{tag_name}#', strict=True)\n",
"return redirect('/')\n... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_115(self):...\n",
""
] | [
"def error(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@staticmethod...\n",
"tar.extractall(VAR_4)\n"
] | [
"@staticmethod...\n",
"tar.extractall(target_path)\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_14(VAR_21, VAR_22, VAR_23=None, VAR_24=None, VAR_25=None, VAR_26=None...\n",
"if VAR_26 is None:\n",
"VAR_26 = os.path.join(VAR_8.cwd, VAR_8.interface.flagging_dir)\n",
"VAR_60 = '{}/log.csv'.format(VAR_26)\n",
"VAR_61 = VAR_8.interface.encryption_key if VAR_8.interface.encrypt else None\n",
"VA... | [
"def flag_data(input_data, output_data, flag_option=None, flag_index=None,...\n",
"if flag_path is None:\n",
"flag_path = os.path.join(app.cwd, app.interface.flagging_dir)\n",
"log_fp = '{}/log.csv'.format(flag_path)\n",
"encryption_key = (app.interface.encryption_key if app.interface.encrypt else\n None... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"FunctionDef'",
"For",
"Assign'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assi... |
[
"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_8(self):...\n",
"self.folder.laf.write(util.read_input('TeeShopLAF.html'))\n",
"self.assert_expected(self.folder.t, 'TeeShop2.html', getProducts=self.\n getProducts)\n"
] | [
"def test_2(self):...\n",
"self.folder.laf.write(util.read_input('TeeShopLAF.html'))\n",
"self.assert_expected(self.folder.t, 'TeeShop2.html', getProducts=self.\n getProducts)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_29():...\n",
"return self.build_perspectives_response(VAR_34, VAR_36, VAR_39)\n"
] | [
"def build_response():...\n",
"return self.build_perspectives_response(SERVER_NAME, testkey, VALID_UNTIL_TS)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"self.assert_expected(self.folder.t, 'Loop2.html')\n"
] | [
"def testFancyLoop(self):...\n",
"self.assert_expected(self.folder.t, 'Loop2.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return FederationRateLimiter(self.get_clock(), VAR_8=self.config.rc_federation)\n"
] | [
"@cache_in_self...\n",
"return FederationRateLimiter(self.get_clock(), config=self.config.rc_federation\n )\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = ['item1', 'item2', 'item3']\n",
"self.assertEqual(format_value(VAR_8), \"\"\"\n item1, item2, item3\n\"\"\")\n",
"self.assertEqual(format_value([]), '\\n\\n')\n"
] | [
"def test_format_value_list(self):...\n",
"\"\"\"docstring\"\"\"\n",
"list_items = ['item1', 'item2', 'item3']\n",
"self.assertEqual(format_value(list_items), \"\"\"\n item1, item2, item3\n\"\"\")\n",
"self.assertEqual(format_value([]), '\\n\\n')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_25(self, VAR_13, VAR_14):...\n",
"VAR_30 = []\n",
"for fieldname, VAR_4 in VAR_13:\n",
"VAR_5 = frappe.get_meta(VAR_4)\n",
"return VAR_30\n",
"if VAR_5.get_field(fieldname):\n",
"VAR_41 = VAR_5.get_field(fieldname)\n",
"if fieldname == '_aggregate_column':\n",
"VAR_30.append(VAR_41)\n",
... | [
"def build_standard_report_columns(self, columns, group_by_args):...\n",
"_columns = []\n",
"for fieldname, doctype in columns:\n",
"meta = frappe.get_meta(doctype)\n",
"return _columns\n",
"if meta.get_field(fieldname):\n",
"field = meta.get_field(fieldname)\n",
"if fieldname == '_aggregate_column':\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"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 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._return_value.update(new_return_value)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_25(self):...\n",
"VAR_5 = {'not_senders': ['@misspiggy:muppets'], 'senders': [\n '@kermit:muppets'], 'rooms': ['!stage:unknown'], 'not_rooms': [\n '!piggyshouse:muppets'], 'types': ['m.room.message', 'muppets.kermit.*'\n ], 'not_types': ['muppets.misspiggy.*']}\n",
"VAR_6 = FUNC_0(sender='@ke... | [
"def test_definition_combined_event_bad_type(self):...\n",
"definition = {'not_senders': ['@misspiggy:muppets'], 'senders': [\n '@kermit:muppets'], 'rooms': ['!stage:unknown'], 'not_rooms': [\n '!piggyshouse:muppets'], 'types': ['m.room.message', 'muppets.kermit.*'\n ], 'not_types': ['muppets.misspiggy.*... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_2):...\n",
"return render_to_string('tags/tag_widget.html', {'tag': VAR_2})\n"
] | [
"def widget_single_tag(tag):...\n",
"return render_to_string('tags/tag_widget.html', {'tag': tag})\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(VAR_3, **VAR_4):...\n",
""
] | [
"def _callback(request, **kwargs):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_106(self, VAR_11=None):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"VAR_244.headers['Content-Type'] = 'text/x-csv'\n",
"if not VAR_11:\n",
"VAR_11 = VAR_56.args\n",
"def FUNC_164(VAR_179):...\n",
"if isinstance(VAR_179, unicodeT):\n",
"return VAR_179.encode('utf8'... | [
"def serve_csv(self, args=None):...\n",
"request = current.request\n",
"response = current.response\n",
"response.headers['Content-Type'] = 'text/x-csv'\n",
"if not args:\n",
"args = request.args\n",
"def none_exception(value):...\n",
"if isinstance(value, unicodeT):\n",
"return value.encode('utf8')... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"FunctionDef'",
"Condition",
"Return'",
"For",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(VAR_5):...\n",
"return json.load(f)\n"
] | [
"def load_metadata(metadata_file):...\n",
"return json.load(f)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_68(VAR_12, VAR_28):...\n",
"VAR_94 = re.search(VAR_28 + '=([\\\\.\\\\d\\\\s\\\\w-]+)', VAR_12, re.IGNORECASE |\n re.UNICODE)\n",
"if VAR_94:\n",
"return VAR_94.group(1)\n"
] | [
"def extract_user_data_from_field(user, field):...\n",
"match = re.search(field + '=([\\\\.\\\\d\\\\s\\\\w-]+)', user, re.IGNORECASE | re.\n UNICODE)\n",
"if match:\n",
"return match.group(1)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_58(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.login()\n",
"VAR_3 = self.client.get('/logout/?next=/login/')\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/login/')\n",
"self.confirm_logged_out()\n"
] | [
"def test_logout_with_redirect_argument(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.login()\n",
"response = self.client.get('/logout/?next=/login/')\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/login/')\n",
"self.confirm_logged_out()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_35(VAR_62):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def is_table(doctype):...\n",
"\"\"\"docstring\"\"\"\n",
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"@login_required()...\n",
"VAR_142 = VAR_5.getObject('Image', VAR_26)\n",
"if VAR_142 is None:\n",
"VAR_53 = {'template': 'webclient/annotations/original_metadata.html',\n 'imageId': VAR_142.getId()}\n",
"VAR_181 = VAR_142.loadOriginalMetadata()\n",
"return HttpResponse(VAR_286='LockTimeout', VAR_313=4... | [
"@login_required()...\n",
"image = conn.getObject('Image', imageId)\n",
"if image is None:\n",
"context = {'template': 'webclient/annotations/original_metadata.html',\n 'imageId': image.getId()}\n",
"om = image.loadOriginalMetadata()\n",
"return HttpResponse(content='LockTimeout', status=408)\n",
"re... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(VAR_12):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_12 is None:\n",
"return None\n",
"VAR_12 = re.sub('\\\\s+', ' ', VAR_12)\n",
"return [value.strip() for value in re.split(',(?![^()]*\\\\))', VAR_12) if\n value.strip()]\n"
] | [
"def splitForValues(forValues):...\n",
"\"\"\"docstring\"\"\"\n",
"if forValues is None:\n",
"return None\n",
"forValues = re.sub('\\\\s+', ' ', forValues)\n",
"return [value.strip() for value in re.split(',(?![^()]*\\\\))', forValues) if\n value.strip()]\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_63(self):...\n",
"VAR_3 = self.client.get('/admin/auth/user/?password__startswith=sha1$')\n",
"self.assertEqual(VAR_3.status_code, 400)\n",
"self.assertEqual(len(logger_calls), 1)\n"
] | [
"def test_changelist_disallows_password_lookups(self):...\n",
"response = self.client.get('/admin/auth/user/?password__startswith=sha1$')\n",
"self.assertEqual(response.status_code, 400)\n",
"self.assertEqual(len(logger_calls), 1)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9():...\n",
"while True:\n",
"VAR_24 = VAR_17.stdout.read(4096)\n",
"if not VAR_24:\n",
"yield VAR_24\n"
] | [
"def generate():...\n",
"while True:\n",
"data = proc.stdout.read(4096)\n",
"if not data:\n",
"yield data\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_7 = {'room': {'state': {'types': ['m.*']}}}\n",
"VAR_8 = yield defer.ensureDeferred(self.datastore.add_user_filter(VAR_0=\n user_localpart, VAR_10=user_filter_json))\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='m.room.topic', room_id='!foo:bar')\n",
"VAR_9 = [VAR_6]\n"... | [
"@defer.inlineCallbacks...\n",
"user_filter_json = {'room': {'state': {'types': ['m.*']}}}\n",
"filter_id = yield defer.ensureDeferred(self.datastore.add_user_filter(\n user_localpart=user_localpart, user_filter=user_filter_json))\n",
"event = MockEvent(sender='@foo:bar', type='m.room.topic', room_id='!foo... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(VAR_9: Union[int, str]) ->Union[int, str]:...\n",
"\"\"\"docstring\"\"\"\n",
"return int(VAR_9)\n",
"return VAR_9\n"
] | [
"def _precision_allowed_type(x: Union[int, str]) ->Union[int, str]:...\n",
"\"\"\"docstring\"\"\"\n",
"return int(x)\n",
"return x\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'",
"Return'"
] |
[
"def FUNC_15(VAR_40: Fingerprint, VAR_35: Fingerprint, VAR_41: bool=False,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_62 = [VAR_6]\n",
"if VAR_41:\n",
"VAR_62.append(VAR_7)\n",
"if VAR_42:\n",
"VAR_62.append(VAR_12)\n",
"VAR_63 = FUNC_12(VAR_40, VAR_35, CLASS_0(name='finetune', relevant_keys=\n section... | [
"def can_finetune(last_fingerprint: Fingerprint, new_fingerprint:...\n",
"\"\"\"docstring\"\"\"\n",
"section_keys = [FINGERPRINT_CONFIG_WITHOUT_EPOCHS_KEY]\n",
"if core:\n",
"section_keys.append(FINGERPRINT_DOMAIN_WITHOUT_NLG_KEY)\n",
"if nlu:\n",
"section_keys.append(FINGERPRINT_NLU_LABELS_KEY)\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_15(VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_39 = FUNC_14(VAR_18)\n",
"for VAR_68, example_list in VAR_39.items():\n",
"if not isinstance(example_list, list):\n",
"return VAR_39\n",
"VAR_39[VAR_68] = [FUNC_16(VAR_41) for VAR_41 in example_list]\n"
] | [
"def preprocess_input_examples_arg_string(input_examples_str):...\n",
"\"\"\"docstring\"\"\"\n",
"input_dict = preprocess_input_exprs_arg_string(input_examples_str)\n",
"for input_key, example_list in input_dict.items():\n",
"if not isinstance(example_list, list):\n",
"return input_dict\n",
"input_dict[... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_20(VAR_9, VAR_12, VAR_10):...\n",
"VAR_63, VAR_64, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, db.\n Books.authors.any(db.Authors.id == VAR_12), [VAR_10[0], db.Series.name,\n db.Books.series_index], db.books_series_link, db.Books.id == db.\n books_series_link.c.book, db.Series)\n",
... | [
"def render_author_books(page, author_id, order):...\n",
"entries, __, pagination = calibre_db.fill_indexpage(page, 0, db.Books, db.\n Books.authors.any(db.Authors.id == author_id), [order[0], db.Series.\n name, db.Books.series_index], db.books_series_link, db.Books.id == db.\n books_series_link.c.book, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_118(*VAR_9, **VAR_13):...\n",
"VAR_431, VAR_432, VAR_141 = self.basic()\n",
"VAR_141 = VAR_141 or self.user\n",
"VAR_433 = VAR_145\n",
"if callable(VAR_433):\n",
"VAR_433 = VAR_433()\n",
"if VAR_433:\n",
"if not VAR_141:\n",
"if callable(VAR_144):\n",
"if VAR_263.request.ajax:\n",
"VAR... | [
"def f(*a, **b):...\n",
"basic_allowed, basic_accepted, user = self.basic()\n",
"user = user or self.user\n",
"login_required = requires_login\n",
"if callable(login_required):\n",
"login_required = login_required()\n",
"if login_required:\n",
"if not user:\n",
"if callable(condition):\n",
"if cur... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Return'",
"Assign'"... |
[
"def FUNC_2(self, VAR_10):...\n",
"VAR_21 = self.appbuilder.sm.get_user_by_id(g.user.id)\n",
"for key, value in VAR_10.data.items():\n",
"if key == 'csrf_token':\n",
"VAR_48 = getattr(VAR_10, key)\n",
"VAR_48.data = getattr(VAR_21, key)\n"
] | [
"def form_get(self, form):...\n",
"item = self.appbuilder.sm.get_user_by_id(g.user.id)\n",
"for key, value in form.data.items():\n",
"if key == 'csrf_token':\n",
"form_field = getattr(form, key)\n",
"form_field.data = getattr(item, key)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_18(self):...\n",
"VAR_22, VAR_23 = self.make_request('POST', '/createRoom',\n b'{\"visibility\":\"private\",\"custom\":\"things\"}')\n",
"self.assertEquals(200, VAR_23.code)\n",
"self.assertTrue('room_id' in VAR_23.json_body)\n"
] | [
"def test_post_room_known_and_unknown_keys(self):...\n",
"request, channel = self.make_request('POST', '/createRoom',\n b'{\"visibility\":\"private\",\"custom\":\"things\"}')\n",
"self.assertEquals(200, channel.code)\n",
"self.assertTrue('room_id' in channel.json_body)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import get_object_or_404\n",
"from django.shortcuts import redirect\n",
"from django.views.decorators.http import require_POST\n",
"from django.contrib import messages\n",
"from .models import TopicFavorite\n",
"from .... | [
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import get_object_or_404\n",
"from django.shortcuts import redirect\n",
"from django.views.decorators.http import require_POST\n",
"from django.contrib import messages\n",
"from .models import TopicFavorite\n",
"from .... | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_15(self, VAR_6):...\n",
"VAR_19 = 30\n",
"VAR_20 = []\n",
"VAR_21 = datetime.datetime.now()\n",
"if self.is_standard == 'Yes':\n",
"VAR_20 = self.execute_module(VAR_6)\n",
"VAR_20 = self.execute_script(VAR_6)\n",
"VAR_22 = (datetime.datetime.now() - VAR_21).total_seconds()\n",
"if VAR_22 >... | [
"def execute_script_report(self, filters):...\n",
"threshold = 30\n",
"res = []\n",
"start_time = datetime.datetime.now()\n",
"if self.is_standard == 'Yes':\n",
"res = self.execute_module(filters)\n",
"res = self.execute_script(filters)\n",
"execution_time = (datetime.datetime.now() - start_time).tota... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"if not VAR_69:\n",
"return False\n",
"return ask('Save credentials to keyring [y/N]: ', ['y', 'n']) == 'y'\n"
] | [
"def _should_save_password_to_keyring(self):...\n",
"if not keyring:\n",
"return False\n",
"return ask('Save credentials to keyring [y/N]: ', ['y', 'n']) == 'y'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_1: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return sha256(encode(VAR_1, encoding='utf-8')).hexdigest()\n"
] | [
"def sha256_str(val: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return sha256(encode(val, encoding='utf-8')).hexdigest()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"from mock import Mock\n",
"from twisted.internet import defer\n",
"from synapse.rest.client.v1 import presence\n",
"from synapse.types import UserID\n",
"from tests import unittest\n",
"\"\"\" Tests presence REST API. \"\"\"\n",
"VAR_0 = '@sid:red'\n",
"VAR_1 = UserID.from_string(VAR_0)\n",
"VAR_2 ... | [
"from mock import Mock\n",
"from twisted.internet import defer\n",
"from synapse.rest.client.v1 import presence\n",
"from synapse.types import UserID\n",
"from tests import unittest\n",
"\"\"\" Tests presence REST API. \"\"\"\n",
"user_id = '@sid:red'\n",
"user = UserID.from_string(user_id)\n",
"ser... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_47(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from selenium.webdriver.common.keys import Keys\n",
"self.school.students = [self.lisa, self.peter]\n",
"self.school.alumni = [self.lisa, self.peter]\n",
"self.school.save()\n",
"self.admin_login(username='super', password='secret', login_url='/')\n... | [
"def test_filter(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from selenium.webdriver.common.keys import Keys\n",
"self.school.students = [self.lisa, self.peter]\n",
"self.school.alumni = [self.lisa, self.peter]\n",
"self.school.save()\n",
"self.admin_login(username='super', password='secret', login_url='/... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"def FUNC_103(VAR_46):...\n",
"if VAR_46 not in VAR_1.system_settings:\n",
"VAR_1.system_settings.update({VAR_46: VAR_12.get_single_value(\n 'System Settings', VAR_46)})\n",
"return VAR_1.system_settings.get(VAR_46)\n"
] | [
"def get_system_settings(key):...\n",
"if key not in local.system_settings:\n",
"local.system_settings.update({key: db.get_single_value('System Settings', key)}\n )\n",
"return local.system_settings.get(key)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"\"\"\"Reading/writing Beancount files.\"\"\"\n",
"from __future__ import annotations\n",
"import datetime\n",
"import re\n",
"import threading\n",
"from codecs import decode\n",
"from codecs import encode\n",
"from hashlib import sha256\n",
"from operator import attrgetter\n",
"from typing import... | [
"\"\"\"Reading/writing Beancount files.\"\"\"\n",
"from __future__ import annotations\n",
"import datetime\n",
"import re\n",
"import threading\n",
"from codecs import decode\n",
"from codecs import encode\n",
"from hashlib import sha256\n",
"from operator import attrgetter\n",
"from typing import... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom... |
[
"def FUNC_84(VAR_206):...\n",
"VAR_317 = []\n",
"for VAR_3, VAR_375 in VAR_206.items():\n",
"if isinstance(VAR_375, dict):\n",
"VAR_317.sort(VAR_310=lambda x: x['name'].lower())\n",
"VAR_317.append({'name': VAR_3, 'ul': FUNC_84(VAR_375)})\n",
"VAR_317.append({'name': VAR_3, 'id': VAR_375})\n",
"return... | [
"def ul_to_list(ul):...\n",
"dir_list = []\n",
"for name, value in ul.items():\n",
"if isinstance(value, dict):\n",
"dir_list.sort(key=lambda x: x['name'].lower())\n",
"dir_list.append({'name': name, 'ul': ul_to_list(value)})\n",
"dir_list.append({'name': name, 'id': value})\n",
"return dir_list\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_73(self):...\n",
"return self.renderer.newline()\n"
] | [
"def output_newline(self):...\n",
"return self.renderer.newline()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(self, VAR_13):...\n",
"VAR_28 = self._floatToString(VAR_13.real)\n",
"VAR_29 = self._floatToString(VAR_13.imag)\n",
"if VAR_29 == '0':\n",
"return VAR_28\n",
"if VAR_29 == '1':\n",
"VAR_29 = '+i'\n",
"if VAR_29 == '-1':\n",
"if VAR_28 == '0' and VAR_29 == '0':\n",
"VAR_29 = '-i'\n",
... | [
"def _complexToString(self, x):...\n",
"realS = self._floatToString(x.real)\n",
"imagS = self._floatToString(x.imag)\n",
"if imagS == '0':\n",
"return realS\n",
"if imagS == '1':\n",
"imagS = '+i'\n",
"if imagS == '-1':\n",
"if realS == '0' and imagS == '0':\n",
"imagS = '-i'\n",
"if x.imag < 0:... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_6, VAR_7='utf-8'):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_6, text_type):\n",
"return VAR_6\n",
"if VAR_6 == None:\n",
"return ''\n",
"if isinstance(VAR_6, binary_type):\n",
"return text_type(VAR_6, VAR_7)\n",
"return text_type(VAR_6)\n"
] | [
"def as_unicode(text, encoding='utf-8'):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(text, text_type):\n",
"return text\n",
"if text == None:\n",
"return ''\n",
"if isinstance(text, binary_type):\n",
"return text_type(text, encoding)\n",
"return text_type(text)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"@login_required()...\n",
""
] | [
"@login_required()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_65 = get_course_with_access(VAR_9.user, 'staff', VAR_10, depth=None)\n",
"VAR_127 = strip_if_string(VAR_9.GET.get('problem_to_reset'))\n",
"VAR_128 = VAR_9.GET.get(... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"course = get_course_with_access(request.user, 'staff', course_id, depth=None)\n",
"problem_to_reset = strip_if_string(request.GET.get('problem_to_reset'))\n",
"st... | [
0,
0,
0,
0,
3,
3,
0,
0,
0,
3,
3,
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'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"... |
[
"def FUNC_1(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = FUNC_10(VAR_2, VAR_3)\n",
"print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n",
"for VAR_5 in sorted(VAR_23.keys()):\n",
"print('SignatureDef key: \"%s\"' % VAR_5)\n"
] | [
"def _show_signature_def_map_keys(saved_model_dir, tag_set):...\n",
"\"\"\"docstring\"\"\"\n",
"signature_def_map = get_signature_def_map(saved_model_dir, tag_set)\n",
"print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n",
"for signature_def_key in sorted... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"For",
"Expr'"
] |
[
"@parameterized.named_parameters(('non_tfrt', False))...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_10 = test.test_src_dir_path(VAR_0)\n",
"VAR_11 = self.parser.parse_args(['run', '--dir', VAR_10, '--tag_set',\n 'serve', '--signature_def', 'serving_default'] + (['--use_tfrt'] if\n VAR_5... | [
"@parameterized.named_parameters(('non_tfrt', False))...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"args = self.parser.parse_args(['run', '--dir', base_path, '--tag_set',\n 'serve', '--signature_def', 'serving_default'] + (['--use_tfrt'... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(VAR_1):...\n",
"return FUNC_1(VAR_1, VAR_3=User.objects.all(), VAR_4=\n 'spirit/user/admin/index.html')\n"
] | [
"def index(request):...\n",
"return _index(request, queryset=User.objects.all(), template=\n 'spirit/user/admin/index.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self):...\n",
"VAR_32 = {'a': 5, 'b': np.array(range(4))}\n",
"VAR_33 = np.array([1])\n",
"VAR_34 = np.array([[1], [3]])\n",
"VAR_35 = os.path.join(test.get_temp_dir(), 'pickle0.pkl')\n",
"VAR_36 = os.path.join(test.get_temp_dir(), 'pickle1.pkl')\n",
"VAR_37 = os.path.join(test.get_temp_dir... | [
"def testInputParserPickle(self):...\n",
"pkl0 = {'a': 5, 'b': np.array(range(4))}\n",
"pkl1 = np.array([1])\n",
"pkl2 = np.array([[1], [3]])\n",
"input_path0 = os.path.join(test.get_temp_dir(), 'pickle0.pkl')\n",
"input_path1 = os.path.join(test.get_temp_dir(), 'pickle1.pkl')\n",
"input_path2 = os.path... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"AugAssign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_16, VAR_17=VAR_12, VAR_18=VAR_13, VAR_19=VAR_14, VAR_20=VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_16.tag in VAR_18:\n",
"return\n",
"VAR_63 = VAR_16.get('class')\n",
"if VAR_63:\n",
"VAR_63 = VAR_63.split()\n",
"for child in list(VAR_16):\n",
"for match_class in VAR_20:\n",
... | [
"def autolink(el, link_regexes=_link_regexes, avoid_elements=_avoid_elements,...\n",
"\"\"\"docstring\"\"\"\n",
"if el.tag in avoid_elements:\n",
"return\n",
"class_name = el.get('class')\n",
"if class_name:\n",
"class_name = class_name.split()\n",
"for child in list(el):\n",
"for match_class in avo... | [
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'",
"Assign'",
"Condition",
"Assign'",
"For",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_15(VAR_13):...\n",
"VAR_1.query(CLASS_14).filter(VAR_13 == CLASS_14.book_id).delete()\n",
"VAR_1.commit()\n",
"VAR_1.rollback()\n"
] | [
"def delete_download(book_id):...\n",
"session.query(Downloads).filter(book_id == Downloads.book_id).delete()\n",
"session.commit()\n",
"session.rollback()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(self):...\n",
"VAR_33 = {'a': 5, 'b': np.array(range(4))}\n",
"VAR_34 = np.array([1])\n",
"VAR_35 = np.array([[1], [3]])\n",
"VAR_36 = os.path.join(test.get_temp_dir(), 'pickle0.pkl')\n",
"VAR_37 = os.path.join(test.get_temp_dir(), 'pickle1.pkl')\n",
"VAR_38 = os.path.join(test.get_temp_dir... | [
"def testInputParserPickle(self):...\n",
"pkl0 = {'a': 5, 'b': np.array(range(4))}\n",
"pkl1 = np.array([1])\n",
"pkl2 = np.array([[1], [3]])\n",
"input_path0 = os.path.join(test.get_temp_dir(), 'pickle0.pkl')\n",
"input_path1 = os.path.join(test.get_temp_dir(), 'pickle1.pkl')\n",
"input_path2 = os.path... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"AugAssign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import render, redirect, get_object_or_404\n",
"from django.views.decorators.http import require_POST\n",
"from django.contrib import messages\n",
"from django.contrib.auth.views import redirect_to_login\n",
"from django... | [
"from django.contrib.auth.decorators import login_required\n",
"from django.shortcuts import render, redirect, get_object_or_404\n",
"from django.views.decorators.http import require_POST\n",
"from django.contrib import messages\n",
"from django.contrib.auth.views import redirect_to_login\n",
"from django... | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_7(VAR_24=None, VAR_28=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_177 = {}\n",
"VAR_24 = VAR_24 or getattr(VAR_1, 'sites_path', None)\n",
"VAR_28 = VAR_28 or getattr(VAR_1, 'site_path', None)\n",
"if VAR_24:\n",
"VAR_207 = os.path.join(VAR_24, 'common_site_config.json')\n",
"if VAR_28:\n",... | [
"def get_site_config(sites_path=None, site_path=None):...\n",
"\"\"\"docstring\"\"\"\n",
"config = {}\n",
"sites_path = sites_path or getattr(local, 'sites_path', None)\n",
"site_path = site_path or getattr(local, 'site_path', None)\n",
"if sites_path:\n",
"common_site_config = os.path.join(sites_path, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self, VAR_14='', **VAR_4):...\n",
"if self.current_cell:\n",
"if not VAR_14:\n",
"VAR_14 = None\n",
"self.current_cell.plugin_identifier = VAR_14\n",
"self.save_layout()\n"
] | [
"def dispatch_change_plugin(self, plugin='', **kwargs):...\n",
"if self.current_cell:\n",
"if not plugin:\n",
"plugin = None\n",
"self.current_cell.plugin_identifier = plugin\n",
"self.save_layout()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.form.load import get_attachments\n",
"for attach_item in get_attachments(self.doctype, self.amended_from):\n",
"VAR_82 = frappe.get_doc({'doctype': 'File', 'file_url': attach_item.\n file_url, 'file_name': attach_item.file_name, 'att... | [
"def copy_attachments_from_amended_from(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.form.load import get_attachments\n",
"for attach_item in get_attachments(self.doctype, self.amended_from):\n",
"_file = frappe.get_doc({'doctype': 'File', 'file_url': attach_item.file_url,\n 'file_name': at... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"For",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_15(VAR_3, **VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"self.fail(\"shouldn't ever get here\")\n",
"VAR_5 = JsonResource(self.homeserver)\n",
"VAR_5.register_paths('GET', [re.compile('^/_matrix/foo$')], FUNC_15,\n 'test_servlet')\n",
"VA... | [
"def test_no_handler(self):...\n",
"\"\"\"docstring\"\"\"\n",
"def _callback(request, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"self.fail(\"shouldn't ever get here\")\n",
"res = JsonResource(self.homeserver)\n",
"res.register_paths('GET', [re.compile('^/_matrix/foo$')], _callback,\n 'test_servlet... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_4, VAR_5, *VAR_6, **VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_4.has_perm('upload.authorship', VAR_5):\n",
"VAR_114 = CLASS_18\n",
"if VAR_4.has_perm('upload.overwrite', VAR_5):\n",
"VAR_7['initial'] = {'author_name': VAR_4.full_name, 'author_email': VAR_4.email\n }\n",
"VAR_11... | [
"def get_upload_form(user, translation, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if user.has_perm('upload.authorship', translation):\n",
"form = ExtraUploadForm\n",
"if user.has_perm('upload.overwrite', translation):\n",
"kwargs['initial'] = {'author_name': user.full_name, 'author_email': user... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Return'"
] |
[
"@FUNC_27(VAR_87=True)...\n",
"return 'pong'\n"
] | [
"@whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_9, VAR_15 = self.make_request('PUT', '/profile/%s/displayname' % (self.\n owner,), content=json.dumps({'displayname': 'test'}), VAR_7=self.owner_tok)\n",
"self.assertEqual(VAR_15.code, 200, VAR_15.result)\n",
"VAR_16 = self.get_displayname()\n",
"self.assertEqual(VAR_16, '... | [
"def test_set_displayname(self):...\n",
"request, channel = self.make_request('PUT', '/profile/%s/displayname' % (\n self.owner,), content=json.dumps({'displayname': 'test'}), access_token\n =self.owner_tok)\n",
"self.assertEqual(channel.code, 200, channel.result)\n",
"res = self.get_displayname()\n",
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = CLASS_1()\n",
"VAR_1.visit(ast.parse(VAR_0))\n",
"VAR_8 = CLASS_0(VAR_8)\n",
"return VAR_1.mongo_query\n",
"VAR_8.__traceback__ = sys.exc_info()[2]\n"
] | [
"def parse(expression):...\n",
"\"\"\"docstring\"\"\"\n",
"v = MongoVisitor()\n",
"v.visit(ast.parse(expression))\n",
"e = ParseError(e)\n",
"return v.mongo_query\n",
"e.__traceback__ = sys.exc_info()[2]\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'"
] |
[
"@pytest.mark.django_db...\n",
"VAR_0.DEBUG = True\n",
"VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' parent=view model=model\"\n )\n",
"VAR_7 = unicorn(None, VAR_6)\n",
"VAR_10 = CLASS_0(component_name='test', component_id='asdf')\n",
"VAR_11... | [
"@pytest.mark.django_db...\n",
"settings.DEBUG = True\n",
"token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' parent=view model=model\"\n )\n",
"unicorn_node = unicorn(None, token)\n",
"view = FakeComponentParent(component_name='test', component_id='... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"def FUNC_97(VAR_62):...\n",
"def FUNC_120():...\n",
"VAR_214 = VAR_1.db.get_value('DocType', VAR_62, 'module')\n",
"return VAR_1.module_app[FUNC_56(VAR_214)]\n"
] | [
"def get_doctype_app(doctype):...\n",
"def _get_doctype_app():...\n",
"doctype_module = local.db.get_value('DocType', doctype, 'module')\n",
"return local.module_app[scrub(doctype_module)]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"VAR_3 = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/password_reset/done/')\n"
] | [
"def test_reset_redirect_default(self):...\n",
"response = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, '/password_reset/done/')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/local/%s/users/%s/remove', VAR_30, VAR_16)\n",
"return self.client.post_json(VAR_5=destination, VAR_2=path, VAR_39=content,\n VAR_15=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/groups/local/%s/users/%s/remove', group_id, user_id)\n",
"return self.client.post_json(destination=destination, path=path, data=\n content, ignore_backoff=True)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_9(VAR_20):...\n",
"return VAR_20.replace(VAR_4 + '/', '')\n"
] | [
"def _get_obj_path(obj_path):...\n",
"return obj_path.replace(DATAROOT + '/', '')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_64(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=VAR_3):...\n",
"if self.settings.reset_password_requires_verification:\n",
"return self.request_reset_password(VAR_112, VAR_134, VAR_135, VAR_136)\n",
"return self.reset_password_deprecated(VAR_112, VAR_134, VAR_135, VAR_136)\n"
] | [
"def retrieve_password(self, next=DEFAULT, onvalidation=DEFAULT, onaccept=...\n",
"if self.settings.reset_password_requires_verification:\n",
"return self.request_reset_password(next, onvalidation, onaccept, log)\n",
"return self.reset_password_deprecated(next, onvalidation, onaccept, log)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"from flask_login import current_user, logout_user\n",
"from flask_restful import Resource\n",
"from security_monkey import rbac\n",
"VAR_0 = [rbac.exempt]\n",
"def FUNC_0(self):...\n",
"if not current_user.is_authenticated():\n",
"return 'Must be logged in to log out', 200\n",
"logout_user()\n",
"r... | [
"from flask_login import current_user, logout_user\n",
"from flask_restful import Resource\n",
"from security_monkey import rbac\n",
"decorators = [rbac.exempt]\n",
"def get(self):...\n",
"if not current_user.is_authenticated():\n",
"return 'Must be logged in to log out', 200\n",
"logout_user()\n",
... | [
0,
0,
0,
0,
0,
4,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"@VAR_12.route('/scope/<dataset>')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = 'SELECT sequence_no, rel_path, download_link FROM ' + VAR_13\n",
"VAR_21 = []\n",
"VAR_22 = []\n",
"if VAR_14:\n",
"VAR_21.append('MATCH (title, keywords, description) AGAINST(%s)')\n",
"if VAR_15:\n",
"VAR_22.append(VAR_... | [
"@scope_blueprint.route('/scope/<dataset>')...\n",
"\"\"\"docstring\"\"\"\n",
"query = 'SELECT sequence_no, rel_path, download_link FROM ' + dataset\n",
"conditions = []\n",
"substitutes = []\n",
"if keywords:\n",
"conditions.append('MATCH (title, keywords, description) AGAINST(%s)')\n",
"if divisor:\... | [
0,
0,
0,
0,
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'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"AugAssign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"For",
"Expr'",
"Expr'",... |
[
"def FUNC_104(self, VAR_148=None, VAR_188=None, VAR_11=None, VAR_189=None,...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_163(VAR_10):...\n",
"self.soap_procedures[VAR_148 or VAR_10.__name__\n ] = VAR_10, VAR_188, VAR_11, VAR_189, VAR_190\n",
"return VAR_10\n"
] | [
"def soap(self, name=None, returns=None, args=None, doc=None,...\n",
"\"\"\"docstring\"\"\"\n",
"def _soap(f):...\n",
"self.soap_procedures[name or f.__name__\n ] = f, returns, args, doc, response_element_name\n",
"return f\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"return '`tab{0}`.`{1}`'.format(*VAR_11)\n"
] | [
"@staticmethod...\n",
"return '`tab{0}`.`{1}`'.format(*parts)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = self._req(None)\n",
"VAR_33 = VAR_32.headers\n",
"self.assertEqual(VAR_33.getRawHeaders(b'Content-Type'), [self.test_image.\n content_type])\n",
"self.assertEqual(VAR_33.getRawHeaders(b'Content-Disposition'), None)\n"
] | [
"def test_disposition_none(self):...\n",
"\"\"\"docstring\"\"\"\n",
"channel = self._req(None)\n",
"headers = channel.headers\n",
"self.assertEqual(headers.getRawHeaders(b'Content-Type'), [self.test_image.\n content_type])\n",
"self.assertEqual(headers.getRawHeaders(b'Content-Disposition'), None)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_65 = get_course_with_access(VAR_9.user, 'staff', VAR_10, depth=None)\n",
"if not VAR_65.entrance_exam_id:\n",
"return HttpResponseBadRequest(_('Course has no entran... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"course = get_course_with_access(request.user, 'staff', course_id, depth=None)\n",
"if not course.entrance_exam_id:\n",
"return HttpResponseBadRequest(_('Course ha... | [
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
3,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Condition",
... |
[
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return VAR_44 + 2\n"
] | [
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return x + 2\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_82(VAR_67):...\n",
"if not VAR_67.name in self.flags.notifications_executed:\n",
"evaluate_alert(self, VAR_67.name, VAR_67.event)\n",
"self.flags.notifications_executed.append(VAR_67.name)\n"
] | [
"def _evaluate_alert(alert):...\n",
"if not alert.name in self.flags.notifications_executed:\n",
"evaluate_alert(self, alert.name, alert.event)\n",
"self.flags.notifications_executed.append(alert.name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@CLASS_4('settings')...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_3.path() == '/set':\n",
"return FUNC_14(VAR_3)\n",
"VAR_20 = jinja.render('settings.html', title='settings', configdata=\n configdata, confget=config.instance.get_str)\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('settings')...\n",
"\"\"\"docstring\"\"\"\n",
"if url.path() == '/set':\n",
"return _qute_settings_set(url)\n",
"html = jinja.render('settings.html', title='settings', configdata=\n configdata, confget=config.instance.get_str)\n",
"return 'text/html', html\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_25(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.sites.models import Site\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.urls import reverse\n",
"VAR_162 = Site.objects.get_current()\n",
"VAR_162 = Site(domain='configure-django-sites.com')\n",
"... | [
"def _get_staff_url(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.sites.models import Site\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.urls import reverse\n",
"site = Site.objects.get_current()\n",
"site = Site(domain='configure-django-sites.com')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_6: str) ->jinja2.Markup:...\n",
"return jinja2.Markup(bleach.linkify(bleach.clean(VAR_6, tags=ALLOWED_TAGS,\n attributes=ALLOWED_ATTRS, strip=True)))\n"
] | [
"def safe_markup(raw_html: str) ->jinja2.Markup:...\n",
"return jinja2.Markup(bleach.linkify(bleach.clean(raw_html, tags=\n ALLOWED_TAGS, attributes=ALLOWED_ATTRS, strip=True)))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"self.assert_expected(self.folder.t, 'CheckWithXMLHeader.html')\n"
] | [
"def testWithXMLHeader(self):...\n",
"self.assert_expected(self.folder.t, 'CheckWithXMLHeader.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_12(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_1(VAR_3)\n",
"if not VAR_16 or not 'cmd' in VAR_1.form_dict or VAR_13.developer_mode:\n",
"print(VAR_3)\n",
"VAR_20.append({'exc': VAR_3})\n"
] | [
"def errprint(msg):...\n",
"\"\"\"docstring\"\"\"\n",
"msg = as_unicode(msg)\n",
"if not request or not 'cmd' in local.form_dict or conf.developer_mode:\n",
"print(msg)\n",
"error_log.append({'exc': msg})\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'"
] |
[
"async def FUNC_8(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_16 = ((VAR_2, VAR_43) for VAR_2, VAR_47 in VAR_16.items() for VAR_43 in\n VAR_47.keys())\n",
"VAR_30 = await self.store.get_server_verify_keys(VAR_16)\n",
"VAR_31 = {}\n",
"for (VAR_2, VAR_43), VAR_49 in VAR_30.items():\n",
"VAR_... | [
"async def get_keys(self, keys_to_fetch):...\n",
"\"\"\"docstring\"\"\"\n",
"keys_to_fetch = ((server_name, key_id) for server_name, keys_for_server in\n keys_to_fetch.items() for key_id in keys_for_server.keys())\n",
"res = await self.store.get_server_verify_keys(keys_to_fetch)\n",
"keys = {}\n",
"for... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"if not VAR_2.config.can_load_media_repo:\n",
"super().__init__()\n",
"VAR_41 = VAR_2.get_media_repository()\n",
"self.putChild(b'upload', UploadResource(VAR_2, VAR_41))\n",
"self.putChild(b'download', DownloadResource(VAR_2, VAR_41))\n",
"self.putChild(b'thumbnail', T... | [
"def __init__(self, hs):...\n",
"if not hs.config.can_load_media_repo:\n",
"super().__init__()\n",
"media_repo = hs.get_media_repository()\n",
"self.putChild(b'upload', UploadResource(hs, media_repo))\n",
"self.putChild(b'download', DownloadResource(hs, media_repo))\n",
"self.putChild(b'thumbnail', Thum... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@login_required(setGroupContext=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_54 = 'webclient/history/calendar.html'\n",
"VAR_192 = VAR_2.session.get('user_id')\n",
"if VAR_35 is not None and VAR_36 is not None:\n",
"VAR_193 = BaseCalendar(VAR_5=conn, VAR_35=year, VAR_36=month, eid=\n filter_user_id)\n... | [
"@login_required(setGroupContext=True)...\n",
"\"\"\"docstring\"\"\"\n",
"template = 'webclient/history/calendar.html'\n",
"filter_user_id = request.session.get('user_id')\n",
"if year is not None and month is not None:\n",
"controller = BaseCalendar(conn=conn, year=year, month=month, eid=filter_user_id\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import asyncio\n",
"import enum\n",
"import inspect\n",
"import json\n",
"from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Set, Type, Union\n",
"from fastapi import params\n",
"from fastapi.datastructures import Default, DefaultPlaceholder\n",
"from fastapi.dependencies.mo... | [
"import asyncio\n",
"import enum\n",
"import inspect\n",
"import json\n",
"from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Set, Type, Union\n",
"from fastapi import params\n",
"from fastapi.datastructures import Default, DefaultPlaceholder\n",
"from fastapi.dependencies.mo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.