lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"@require_POST...\n",
"return FUNC_72(VAR_2, VAR_27='chgrp', VAR_5=conn, **kwargs)\n"
] | [
"@require_POST...\n",
"return dryRun(request, action='chgrp', conn=conn, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_1(VAR_4: pathlib.Path):...\n",
"VAR_13 = pathlib.Path(str(VAR_4) + '.data')\n",
"VAR_5 = pathlib.Path(str(VAR_4) + '.meta')\n",
"return VAR_13, VAR_5\n"
] | [
"def get_paths(base_path: pathlib.Path):...\n",
"data_file = pathlib.Path(str(base_path) + '.data')\n",
"metadata_file = pathlib.Path(str(base_path) + '.meta')\n",
"return data_file, metadata_file\n"
] | [
0,
1,
1,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(self, VAR_22):...\n",
"if not VAR_22.strip():\n",
"VAR_102 = '[]'\n",
"VAR_114 = self.model.search(VAR_22.strip())\n",
"return VAR_102\n",
"VAR_102 = [entry.to_dict() for entry in VAR_114]\n"
] | [
"def api_search(self, searchstring):...\n",
"if not searchstring.strip():\n",
"jsonresults = '[]'\n",
"searchresults = self.model.search(searchstring.strip())\n",
"return jsonresults\n",
"jsonresults = [entry.to_dict() for entry in searchresults]\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_6(self) ->None:...\n",
"subprocess.run('isort .', cwd=self.project_dir, shell=True, stdout=\n subprocess.PIPE, stderr=subprocess.PIPE)\n",
"subprocess.run('black .', cwd=self.project_dir, shell=True, stdout=\n subprocess.PIPE, stderr=subprocess.PIPE)\n"
] | [
"def _reformat(self) ->None:...\n",
"subprocess.run('isort .', cwd=self.project_dir, shell=True, stdout=\n subprocess.PIPE, stderr=subprocess.PIPE)\n",
"subprocess.run('black .', cwd=self.project_dir, shell=True, stdout=\n subprocess.PIPE, stderr=subprocess.PIPE)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_5(VAR_22, *VAR_23, **VAR_24):...\n",
"VAR_65 = type(VAR_22)\n",
"VAR_55 = fromstring(VAR_22)\n",
"FUNC_4(VAR_55, *VAR_23, **kw)\n",
"return _transform_result(VAR_65, VAR_55)\n"
] | [
"def word_break_html(html, *args, **kw):...\n",
"result_type = type(html)\n",
"doc = fromstring(html)\n",
"word_break(doc, *args, **kw)\n",
"return _transform_result(result_type, doc)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/api/templates/<int:template_id>', methods=['DELETE'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_98 = FUNC_58(f'/internal/templates/{VAR_19}', 'delete')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_98)\n"
] | [
"@gui.route('/api/templates/<int:template_id>', methods=['DELETE'])...\n",
"\"\"\"docstring\"\"\"\n",
"response_info = query_internal_api(f'/internal/templates/{template_id}',\n 'delete')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(response_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_51(self):...\n",
"self.logout(VAR_112=None, VAR_140=None, VAR_136=None)\n"
] | [
"def logout_bare(self):...\n",
"self.logout(next=None, onlogout=None, log=None)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_23(self):...\n",
"self._validate_mandatory()\n",
"self._validate_data_fields()\n",
"self._validate_selects()\n",
"self._validate_non_negative()\n",
"self._validate_length()\n",
"self._extract_images_from_text_editor()\n",
"self._sanitize_content()\n",
"self._save_passwords()\n",
"self.va... | [
"def _validate(self):...\n",
"self._validate_mandatory()\n",
"self._validate_data_fields()\n",
"self._validate_selects()\n",
"self._validate_non_negative()\n",
"self._validate_length()\n",
"self._extract_images_from_text_editor()\n",
"self._sanitize_content()\n",
"self._save_passwords()\n",
"self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@csrf_exempt...\n",
"VAR_6 = {'config': {'enable_collect_everything': True}, 'editorParams': {},\n 'isAuthenticated': False, 'supportedCompression': ['gzip', 'gzip-js',\n 'lz64']}\n",
"if VAR_1.COOKIES.get(settings.TOOLBAR_COOKIE_NAME\n",
"VAR_6['isAuthenticated'] = True\n",
"if VAR_1.user.is_authent... | [
"@csrf_exempt...\n",
"response = {'config': {'enable_collect_everything': True}, 'editorParams':\n {}, 'isAuthenticated': False, 'supportedCompression': ['gzip',\n 'gzip-js', 'lz64']}\n",
"if request.COOKIES.get(settings.TOOLBAR_COOKIE_NAME\n",
"response['isAuthenticated'] = True\n",
"if request.user.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_25(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53 = 'string'\n",
"VAR_54 = VAR_23.add_parser('run', description=run_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_54.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to execute')\... | [
"def add_run_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"run_msg = \"\"\"Usage example:\nTo run input tensors from files through a MetaGraphDef and save the output tensors to files:\n$saved_model_cli show --dir /tmp/saved_model --tag_set serve \\\\\n --signature_def serving_default \\\\\n --in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53 = VAR_2.GET\n",
"VAR_54 = VAR_53.get('m', '_') + VAR_53.get('p', '_') + VAR_53.get('c', '_'\n ) + VAR_53.get('q', '_')\n",
"return VAR_54\n"
] | [
"def _get_signature_from_request(request):...\n",
"\"\"\"docstring\"\"\"\n",
"r = request.GET\n",
"rv = r.get('m', '_') + r.get('p', '_') + r.get('c', '_') + r.get('q', '_')\n",
"return rv\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_1, VAR_2):...\n",
"if VAR_1 is None:\n",
"return\n",
"super().__init__()\n",
"self.enabled = VAR_1.get('enabled', False)\n",
"self.renew_by_email_enabled = 'renew_at' in VAR_1\n",
"if self.enabled:\n",
"if 'period' in VAR_1:\n",
"VAR_7 = VAR_1.get('template_dir')\n",
"self.... | [
"def __init__(self, config, synapse_config):...\n",
"if config is None:\n",
"return\n",
"super().__init__()\n",
"self.enabled = config.get('enabled', False)\n",
"self.renew_by_email_enabled = 'renew_at' in config\n",
"if self.enabled:\n",
"if 'period' in config:\n",
"template_dir = config.get('templ... | [
0,
0,
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'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
... |
[
"def FUNC_13(self):...\n",
"VAR_21 = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"VAR_23 = saved_model_cli.preprocess_inputs_arg_string(VAR_21)\n",
"self.assertTrue(VAR_23['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'))\n",
"self.assertTrue(VAR_23['i... | [
"def testInputPreProcessFileNames(self):...\n",
"input_str = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"input_dict = saved_model_cli.preprocess_inputs_arg_string(input_str)\n",
"self.assertTrue(input_dict['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_27(VAR_87=False, VAR_88=False, VAR_89=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_89:\n",
"VAR_89 = ['GET', 'POST', 'PUT', 'DELETE']\n",
"def FUNC_115(VAR_129):...\n",
"VAR_83.append(VAR_129)\n",
"VAR_86[VAR_129] = VAR_89\n",
"if VAR_87:\n",
"VAR_84.append(VAR_129)\n",
"return V... | [
"def whitelist(allow_guest=False, xss_safe=False, methods=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not methods:\n",
"methods = ['GET', 'POST', 'PUT', 'DELETE']\n",
"def innerfn(fn):...\n",
"whitelisted.append(fn)\n",
"allowed_http_methods_for_whitelisted_func[fn] = methods\n",
"if allow_guest:\n",... | [
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_16(self):...\n",
"VAR_15 = self._makeOne()\n",
"VAR_16 = CLASS_1()\n",
"VAR_17 = CLASS_0(RESPONSE=response)\n",
"VAR_25 = b'cookie:from_other_plugin'\n",
"VAR_26 = encodebytes(VAR_25)\n",
"VAR_26 = VAR_26.rstrip()\n",
"if six.PY3:\n",
"VAR_26 = VAR_26.decode('utf8')\n",
"VAR_17.set(VAR_1... | [
"def test_extractCredentials_from_cookie_with_colon_that_is_not_ours(self):...\n",
"helper = self._makeOne()\n",
"response = FauxCookieResponse()\n",
"request = FauxSettableRequest(RESPONSE=response)\n",
"cookie_str = b'cookie:from_other_plugin'\n",
"cookie_val = encodebytes(cookie_str)\n",
"cookie_val ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@VAR_1.post('/json_body')...\n",
"\"\"\"docstring\"\"\"\n",
"return\n"
] | [
"@test_router.post('/json_body')...\n",
"\"\"\"docstring\"\"\"\n",
"return\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_16(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('x | string:x'), 'x')\n"
] | [
"def test_hybrid_with_string_expression(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('x | string:x'), 'x')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def __init__(self):...\n",
"self._context = SSL.Context(SSL.SSLv23_METHOD)\n",
"self._context.set_verify(VERIFY_NONE, lambda *_: None)\n"
] | [
"def __init__(self):...\n",
"self._context = SSL.Context(SSL.SSLv23_METHOD)\n",
"self._context.set_verify(VERIFY_NONE, lambda *_: None)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@app.route('/folders/rename', methods=['POST'])...\n",
"VAR_9 = forms.RenameDirectoryForm()\n",
"if VAR_9.validate_on_submit():\n",
"return redirect('/')\n",
"VAR_35 = data.rename_folder(VAR_9.current_path.data, VAR_9.new_name.data)\n",
"flash('Directory not found.', 'error')\n",
"if not VAR_35:\n",
... | [
"@app.route('/folders/rename', methods=['POST'])...\n",
"form = forms.RenameDirectoryForm()\n",
"if form.validate_on_submit():\n",
"return redirect('/')\n",
"new_path = data.rename_folder(form.current_path.data, form.new_name.data)\n",
"flash('Directory not found.', 'error')\n",
"if not new_path:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def __getattr__(self, VAR_14: str) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_14 in self._configs.keys():\n",
"return self._configs[VAR_14]\n",
"return self._get_unclassed_config(None, VAR_14)\n"
] | [
"def __getattr__(self, item: str) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"if item in self._configs.keys():\n",
"return self._configs[item]\n",
"return self._get_unclassed_config(None, item)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_4: EscapableEntity) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = type(VAR_4)\n",
"if VAR_4 is None:\n",
"return u''\n",
"if VAR_7 == int:\n",
"return str(VAR_4)\n",
"if isinstance(VAR_4, HTML):\n",
"return VAR_4.__html__()\n",
"if isinstance(VAR_7, str):\n",
"return html_esc... | [
"def escape_attribute(value: EscapableEntity) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"attr_type = type(value)\n",
"if value is None:\n",
"return u''\n",
"if attr_type == int:\n",
"return str(value)\n",
"if isinstance(value, HTML):\n",
"return value.__html__()\n",
"if isinstance(attr_type, str):\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_59():...\n",
"\"\"\"docstring\"\"\"\n",
"if 'templates_per_page' not in VAR_84:\n",
"VAR_84['templates_per_page'] = 10\n",
"if 'templates_filter' not in VAR_84:\n",
"VAR_84['templates_filter'] = {key: 'any' for key in ['application', 'backend']}\n",
"if 'jobs_per_page' not in VAR_84:\n",
"VA... | [
"def create_session_defaults():...\n",
"\"\"\"docstring\"\"\"\n",
"if 'templates_per_page' not in session:\n",
"session['templates_per_page'] = 10\n",
"if 'templates_filter' not in session:\n",
"session['templates_filter'] = {key: 'any' for key in ['application', 'backend']\n }\n",
"if 'jobs_per_page... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_27(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'INVALID_SIGNATURE', '--input_exprs',\n 'x2=np.ones((3,1))'])\n",
"saved_model_cl... | [
"def testRunCommandInvalidSignature(self):...\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', 'INVALID_SIGNATURE', '--input_exprs',\n 'x2... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_17(VAR_30, VAR_1):...\n",
"VAR_2 = VAR_1.server_name\n",
"VAR_54 = VAR_45[VAR_2]\n",
"VAR_54.remove(id(VAR_1))\n",
"if not VAR_54:\n",
"VAR_0.debug('Releasing key lookup lock on %s', VAR_2)\n",
"return VAR_30\n",
"FUNC_16(VAR_2)\n"
] | [
"def lookup_done(res, verify_request):...\n",
"server_name = verify_request.server_name\n",
"server_requests = server_to_request_ids[server_name]\n",
"server_requests.remove(id(verify_request))\n",
"if not server_requests:\n",
"logger.debug('Releasing key lookup lock on %s', server_name)\n",
"return res... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_7=None, VAR_8=[], VAR_9=None):...\n",
"for member in VAR_8:\n",
"VAR_32 = '/rooms/%s/state/m.room.member/%s' % (VAR_7, member)\n",
"VAR_22, VAR_23 = self.make_request('GET', VAR_32)\n",
"self.assertEquals(VAR_9, VAR_23.code)\n"
] | [
"def _test_get_membership(self, room=None, members=[], expect_code=None):...\n",
"for member in members:\n",
"path = '/rooms/%s/state/m.room.member/%s' % (room, member)\n",
"request, channel = self.make_request('GET', path)\n",
"self.assertEquals(expect_code, channel.code)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_1, VAR_2):...\n",
"self.fetches = []\n",
"def FUNC_10(VAR_23, VAR_24, VAR_25, VAR_26=None, VAR_27=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_11(VAR_37):...\n",
"VAR_4, VAR_39 = VAR_37\n",
"VAR_25.write(VAR_4)\n",
"return VAR_39\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"self.fetches = []\n",
"def get_file(destination, path, output_stream, args=None, max_size=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def write_to(r):...\n",
"data, response = r\n",
"output_stream.write(data)\n",
"return response\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"async def FUNC_18(VAR_3, **VAR_4):...\n",
""
] | [
"async def callback(request, **kwargs):...\n",
""
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Condition"
] |
[
"def FUNC_8(self, VAR_23=None, **VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"self.attrs = self.widget.build_attrs(VAR_23=None, **kwargs)\n",
"return self.attrs\n"
] | [
"def build_attrs(self, extra_attrs=None, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"self.attrs = self.widget.build_attrs(extra_attrs=None, **kwargs)\n",
"return self.attrs\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"async def FUNC_5(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"VAR_28 = f'https://api.github.com/gists/{self.gist_id}'\n",
"self.log.debug('Fetching %s', VAR_28)\n",
"VAR_41 = await self.github_api_request(VAR_28)\n",
"if VAR_41 is None:\n",
"return None\n",
"V... | [
"async def get_resolved_ref(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"api_url = f'https://api.github.com/gists/{self.gist_id}'\n",
"self.log.debug('Fetching %s', api_url)\n",
"resp = await self.github_api_request(api_url)\n",
"if resp is None:\n",
"return None... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'",
"Assign'"
] |
[
"@pytest.mark.options(EXTERNAL_SERVER_NAME='works.com')...\n",
"VAR_3.setattr('flask.request.host_url', 'http://example.com')\n",
"assert _validate_redirect_url('http://works.com') is True\n",
"VAR_3.undo()\n"
] | [
"@pytest.mark.options(EXTERNAL_SERVER_NAME='works.com')...\n",
"monkeypatch.setattr('flask.request.host_url', 'http://example.com')\n",
"assert _validate_redirect_url('http://works.com') is True\n",
"monkeypatch.undo()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assert'",
"Expr'"
] |
[
"def FUNC_58(VAR_44):...\n",
"return [VAR_221 for VAR_221 in VAR_44 if not (VAR_221[:1] in '#' or VAR_221\n .endswith('~') or VAR_221.endswith('.bak'))]\n"
] | [
"def ignore(fs):...\n",
"return [f for f in fs if not (f[:1] in '#' or f.endswith('~') or f.endswith\n ('.bak'))]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_38(self, VAR_33='created', VAR_34=''):...\n",
"VAR_77 = self.playlistdb.showPlaylists(self.getUserId(), VAR_34)\n",
"VAR_78 = int(time.time())\n",
"VAR_79 = False\n",
"for VAR_110 in VAR_77:\n",
"VAR_110['username'] = self.userdb.getNameById(VAR_110['userid'])\n",
"if VAR_33[0] == '-':\n",
"... | [
"def api_showplaylists(self, sortby='created', filterby=''):...\n",
"playlists = self.playlistdb.showPlaylists(self.getUserId(), filterby)\n",
"curr_time = int(time.time())\n",
"is_reverse = False\n",
"for pl in playlists:\n",
"pl['username'] = self.userdb.getNameById(pl['userid'])\n",
"if sortby[0] == ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@default('git_credentials')...\n",
"if self.access_token:\n",
"if self.client_id:\n",
"return ''\n",
"return 'username={client_id}\\\\npassword={token}'.format(VAR_26=self.\n client_id, token=self.access_token)\n",
"return 'username={token}\\\\npassword=x-oauth-basic'.format(token=self.\n access_to... | [
"@default('git_credentials')...\n",
"if self.access_token:\n",
"if self.client_id:\n",
"return ''\n",
"return 'username={client_id}\\\\npassword={token}'.format(client_id=self.\n client_id, token=self.access_token)\n",
"return 'username={token}\\\\npassword=x-oauth-basic'.format(token=self.\n access... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_26(self, VAR_14, VAR_43=None):...\n",
"VAR_14 = VAR_14.rstrip('\\n')\n",
"if not VAR_43:\n",
"VAR_43 = FUNC_48(self.default_rules)\n",
"if self._in_footnote and 'footnote' in VAR_43:\n",
"VAR_43.remove('footnote')\n",
"VAR_83 = self.renderer.placeholder()\n",
"def FUNC_84(VAR_14):...\n",
"... | [
"def output(self, text, rules=None):...\n",
"text = text.rstrip('\\n')\n",
"if not rules:\n",
"rules = list(self.default_rules)\n",
"if self._in_footnote and 'footnote' in rules:\n",
"rules.remove('footnote')\n",
"output = self.renderer.placeholder()\n",
"def manipulate(text):...\n",
"for key in rul... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"FunctionDef'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"@VAR_22.setter...\n",
"self._callback = VAR_26\n"
] | [
"@callback.setter...\n",
"self._callback = value\n"
] | [
0,
0
] | [
"Condition",
"Assign'"
] |
[
"def FUNC_2(VAR_5: Decimal, VAR_6: (str | None)=None, VAR_7: bool=False,...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_5 and not VAR_7:\n",
"return ''\n",
"if VAR_5 == ZERO:\n",
"return g.ledger.format_decimal(ZERO, VAR_6)\n",
"if VAR_8:\n",
"VAR_5 = -VAR_5\n",
"return g.ledger.format_decimal(VAR_5,... | [
"def format_currency(value: Decimal, currency: (str | None)=None,...\n",
"\"\"\"docstring\"\"\"\n",
"if not value and not show_if_zero:\n",
"return ''\n",
"if value == ZERO:\n",
"return g.ledger.format_decimal(ZERO, currency)\n",
"if invert:\n",
"value = -value\n",
"return g.ledger.format_decimal(va... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"if frappe.flags.in_import:\n",
"return\n",
"VAR_60 = frappe.new_doc(self.doctype, as_dict=True)\n",
"self.update_if_missing(VAR_60)\n",
"for VAR_19 in self.meta.get_table_fields():\n",
"VAR_60 = frappe.new_doc(VAR_19.options, as_dict=True)\n",
"VAR_26 = self.get(VAR_19.fiel... | [
"def _set_defaults(self):...\n",
"if frappe.flags.in_import:\n",
"return\n",
"new_doc = frappe.new_doc(self.doctype, as_dict=True)\n",
"self.update_if_missing(new_doc)\n",
"for df in self.meta.get_table_fields():\n",
"new_doc = frappe.new_doc(df.options, as_dict=True)\n",
"value = self.get(df.fieldnam... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Assign'",
"Condition",
"For",
"Expr'"
] |
[
"@unittest.override_config({'rc_joins': {'local': {'per_second': 0.5,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_34 = [self.helper.create_room_as(self.user_id), self.helper.\n create_room_as(self.user_id), self.helper.create_room_as(self.user_id)]\n",
"self.reactor.advance(2)\n",
"VAR_34.append(self.helper.c... | [
"@unittest.override_config({'rc_joins': {'local': {'per_second': 0.5,...\n",
"\"\"\"docstring\"\"\"\n",
"room_ids = [self.helper.create_room_as(self.user_id), self.helper.\n create_room_as(self.user_id), self.helper.create_room_as(self.user_id)]\n",
"self.reactor.advance(2)\n",
"room_ids.append(self.help... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_45(self, VAR_64):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('skip_style') and VAR_64.lower().startswith('<style'):\n",
"return ''\n",
"if self.options.get('escape'):\n",
"return VAR_19(VAR_64)\n",
"return VAR_64\n"
] | [
"def block_html(self, html):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('skip_style') and html.lower().startswith('<style'):\n",
"return ''\n",
"if self.options.get('escape'):\n",
"return escape(html)\n",
"return html\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_32():...\n",
"logging.set_verbosity(logging.INFO)\n",
"VAR_63 = FUNC_31()\n",
"VAR_22 = VAR_63.parse_args()\n",
"if not hasattr(VAR_22, 'func'):\n",
"VAR_63.error('too few arguments')\n",
"VAR_22.func(VAR_22)\n"
] | [
"def main():...\n",
"logging.set_verbosity(logging.INFO)\n",
"parser = create_parser()\n",
"args = parser.parse_args()\n",
"if not hasattr(args, 'func'):\n",
"parser.error('too few arguments')\n",
"args.func(args)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"async def FUNC_1(VAR_1, VAR_4):...\n",
"async def FUNC_6(VAR_6):...\n",
"VAR_7 = await VAR_4(VAR_6)\n",
"VAR_10 = 'public; max-age={}'.format(VAR_2)\n",
"if VAR_6.path in VAR_3 or VAR_2 <= 0:\n",
"VAR_10 = 'no-cache'\n",
"VAR_7.headers.setdefault('Cache-Control', VAR_10)\n",
"return VAR_7\n"
] | [
"async def cache_control_middleware(app, handler):...\n",
"async def middleware_handler(request):...\n",
"response = await handler(request)\n",
"cache_control_value = 'public; max-age={}'.format(CACHE_MAX_AGE)\n",
"if request.path in NO_CACHE_ENDPOINTS or CACHE_MAX_AGE <= 0:\n",
"cache_control_value = 'no... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_49():...\n",
"VAR_83 = False\n",
"VAR_16 = request.form.to_dict()\n",
"VAR_83 |= FUNC_38(VAR_16, 'config_port')\n",
"ub.session.rollback()\n",
"config.save()\n",
"VAR_83 |= FUNC_41(VAR_16, 'config_trustedhosts')\n",
"VAR_0.error('Settings DB is not Writeable')\n",
"if VAR_83:\n",
"VAR_83... | [
"def _configuration_update_helper():...\n",
"reboot_required = False\n",
"to_save = request.form.to_dict()\n",
"reboot_required |= _config_int(to_save, 'config_port')\n",
"ub.session.rollback()\n",
"config.save()\n",
"reboot_required |= _config_string(to_save, 'config_trustedhosts')\n",
"log.error('Se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"AugAssign'",
"Expr'",
"Expr'",
"AugAssign'",
"Expr'",
"Condition",
"AugAssign'",
"Expr'",
"Expr'",
"Return'",
"Condition",
"Return'",
"AugAssign'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"AugAssign'",
"Expr'",
"Expr'",
"AugAssig... |
[
"def FUNC_83(VAR_9, *VAR_2, **VAR_3):...\n",
"if GlobalStaff().has_user(VAR_9.user):\n",
"return VAR_1(VAR_9, *VAR_2, **kwargs)\n",
"return HttpResponseForbidden(\n u'Must be {platform_name} staff to perform this action.'.format(\n platform_name=settings.PLATFORM_NAME))\n"
] | [
"def wrapped(request, *args, **kwargs):...\n",
"if GlobalStaff().has_user(request.user):\n",
"return func(request, *args, **kwargs)\n",
"return HttpResponseForbidden(\n u'Must be {platform_name} staff to perform this action.'.format(\n platform_name=settings.PLATFORM_NAME))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._create_alias(self.admin_user)\n",
"self.get_failure(self.handler.delete_association(create_requester(self.\n test_user), self.room_alias), synapse.api.errors.AuthError)\n"
] | [
"def test_delete_alias_not_allowed(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._create_alias(self.admin_user)\n",
"self.get_failure(self.handler.delete_association(create_requester(self.\n test_user), self.room_alias), synapse.api.errors.AuthError)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def __enter__(self):...\n",
"FUNC_4(self.site)\n",
"return VAR_1\n"
] | [
"def __enter__(self):...\n",
"init(self.site)\n",
"return local\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_60(*VAR_119):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.join(VAR_1.site_path, *VAR_119)\n"
] | [
"def get_site_path(*joins):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.join(local.site_path, *joins)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_18(self, VAR_1):...\n",
"VAR_5 = VAR_1.MagicMock()\n",
"VAR_26 = VAR_1.MagicMock()\n",
"VAR_23 = oai.Schema.construct(type=mocker.MagicMock())\n",
"from openapi_python_client.parser.errors import PropertyError\n",
"from openapi_python_client.parser.properties import property_from_data\n",
"ass... | [
"def test_property_from_data_unsupported_type(self, mocker):...\n",
"name = mocker.MagicMock()\n",
"required = mocker.MagicMock()\n",
"data = oai.Schema.construct(type=mocker.MagicMock())\n",
"from openapi_python_client.parser.errors import PropertyError\n",
"from openapi_python_client.parser.properties i... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"Assert'"
] |
[
"def FUNC_61(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_254 = self.table_user()\n",
"VAR_56 = VAR_263.request\n",
"VAR_139 = VAR_263.session\n",
"if VAR_112 is VAR_3:\n",
"VAR_112 = self.get_vars_next() or self.settings.reset_password_next\n... | [
"def reset_password(self, next=DEFAULT, onvalidation=DEFAULT, onaccept=...\n",
"\"\"\"docstring\"\"\"\n",
"table_user = self.table_user()\n",
"request = current.request\n",
"session = current.session\n",
"if next is DEFAULT:\n",
"next = self.get_vars_next() or self.settings.reset_password_next\n",
"if... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"C... |
[
"def __getattr__(self, VAR_199):...\n",
"if VAR_199 not in self.__dict__:\n",
"self.__dict__[VAR_199] = Storage()\n",
"return self.__dict__[VAR_199]\n"
] | [
"def __getattr__(self, key):...\n",
"if key not in self.__dict__:\n",
"self.__dict__[key] = Storage()\n",
"return self.__dict__[key]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def __init__(self, *VAR_4, **VAR_5):...\n",
"self.queryset = VAR_5.pop('queryset')\n",
"return super(CLASS_0, self).__init__(*VAR_4, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"self.queryset = kwargs.pop('queryset')\n",
"return super(TagFormWidget, self).__init__(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"self.client.logout()\n"
] | [
"def tearDown(self):...\n",
"self.client.logout()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(VAR_18: Text=DEFAULT_MODELS_PATH) ->Text:...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_18:\n",
"if not os.path.exists(VAR_18):\n",
"if os.path.isdir(VAR_18):\n",
"VAR_18 = FUNC_2(VAR_18)\n",
"if not VAR_18.endswith('.tar.gz'):\n",
"if not VAR_18:\n",
"return VAR_18\n"
] | [
"def get_local_model(model_path: Text=DEFAULT_MODELS_PATH) ->Text:...\n",
"\"\"\"docstring\"\"\"\n",
"if not model_path:\n",
"if not os.path.exists(model_path):\n",
"if os.path.isdir(model_path):\n",
"model_path = get_latest_model(model_path)\n",
"if not model_path.endswith('.tar.gz'):\n",
"if not mod... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'"
] |
[
"def FUNC_45(self, VAR_54, VAR_55):...\n",
"return VAR_54 * VAR_55\n"
] | [
"def multiply(self, a, b):...\n",
"return a * b\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@csrf.exempt...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27 = request.form.get('html')\n",
"if not VAR_27:\n",
"return 'No HTML provided', 400\n",
"VAR_28 = DataObj(url=request.form.get('url'), type='bookmark')\n",
"VAR_28.process_bookmark_url(VAR_27)\n",
"if VAR_28.insert():\n",
"return redirect(f'/dat... | [
"@csrf.exempt...\n",
"\"\"\"docstring\"\"\"\n",
"html = request.form.get('html')\n",
"if not html:\n",
"return 'No HTML provided', 400\n",
"bookmark = DataObj(url=request.form.get('url'), type='bookmark')\n",
"bookmark.process_bookmark_url(html)\n",
"if bookmark.insert():\n",
"return redirect(f'/dat... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"self.assert_expected(self.folder.t, 'StringExpression.html')\n"
] | [
"def testStringExpressions(self):...\n",
"self.assert_expected(self.folder.t, 'StringExpression.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return CasHandler(self)\n"
] | [
"@cache_in_self...\n",
"return CasHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_14():...\n",
"VAR_23.component_instance.json_args = VAR_34\n",
"VAR_23.component_instance.special_args.extend(VAR_21)\n"
] | [
"def marshall_element_args():...\n",
"element.component_instance.json_args = serialized_json_args\n",
"element.component_instance.special_args.extend(special_args)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_45(*VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.document\n",
"VAR_94 = frappe.model.document.get_doc(*VAR_79, **kwargs)\n",
"if VAR_79 and len(VAR_79) > 1:\n",
"VAR_46 = FUNC_42(VAR_79[0], VAR_79[1])\n",
"return VAR_94\n",
"VAR_1.document_cache[VAR_46] = VAR_94\... | [
"def get_doc(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.document\n",
"doc = frappe.model.document.get_doc(*args, **kwargs)\n",
"if args and len(args) > 1:\n",
"key = get_document_cache_key(args[0], args[1])\n",
"return doc\n",
"local.document_cache[key] = doc\n",
"cache... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'"
] |
[
"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():...\n",
"doctype_module = local.db.get_value('DocType', doctype, 'module')\n",
"return local.module_app[scrub(doctype_module)]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_55(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_patch:\n",
"return\n",
"frappe.publish_realtime('doc_update', {'modified': self.modified, 'doctype':\n self.doctype, 'name': self.name}, VAR_2=self.doctype, docname=self.name,\n after_commit=True)\n",
"if not self.meta.get('re... | [
"def notify_update(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_patch:\n",
"return\n",
"frappe.publish_realtime('doc_update', {'modified': self.modified, 'doctype':\n self.doctype, 'name': self.name}, doctype=self.doctype, docname=self.\n name, after_commit=True)\n",
"if not self.met... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"VAR_10 = test.test_src_dir_path(VAR_0)\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_11 = self.parser.parse_args(['show', '--dir', VAR_10, '--tag_set',\n 'badtagset'])\n",
"saved_model_cli.show(VAR_11)\n"
] | [
"def testShowCommandErrorNoTagSet(self):...\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"self.parser = saved_model_cli.create_parser()\n",
"args = self.parser.parse_args(['show', '--dir', base_path, '--tag_set',\n 'badtagset'])\n",
"saved_model_cli.show(args)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_3, VAR_9, VAR_4, VAR_10):...\n",
"VAR_13 = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Redaction, 'sender': VAR_4.to_string(), 'state_key':\n VAR_4.to_string(), 'room_id': VAR_3.to_string(), 'content': {'reason':\n VAR_10}, 'redacts': VAR_9})\... | [
"def inject_redaction(self, room, event_id, user, reason):...\n",
"builder = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Redaction, 'sender': user.to_string(), 'state_key':\n user.to_string(), 'room_id': room.to_string(), 'content': {'reason':\n reason}, 'redacts':... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_25(self):...\n",
"VAR_71 = 'nbserver-%s.json' % os.getpid()\n",
"return os.path.join(self.runtime_dir, VAR_71)\n"
] | [
"def _info_file_default(self):...\n",
"info_file = 'nbserver-%s.json' % os.getpid()\n",
"return os.path.join(self.runtime_dir, info_file)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
"@wraps(VAR_0)...\n",
"VAR_4 = VAR_1.user\n",
"if not VAR_4.is_authenticated:\n",
"return redirect_to_login(next=request.get_full_path(), login_url=settings.\n LOGIN_URL)\n",
"if not VAR_4.st.is_moderator:\n",
"return VAR_0(VAR_1, *VAR_2, **kwargs)\n"
] | [
"def moderator_required(view_func):...\n",
"@wraps(view_func)...\n",
"user = request.user\n",
"if not user.is_authenticated:\n",
"return redirect_to_login(next=request.get_full_path(), login_url=settings.\n LOGIN_URL)\n",
"if not user.st.is_moderator:\n",
"return view_func(request, *args, **kwargs)\n... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_3(self, VAR_6):...\n",
"if VAR_6.enable_registration is not None:\n",
"self.enable_registration = bool(strtobool(str(VAR_6.enable_registration)))\n"
] | [
"def read_arguments(self, args):...\n",
"if args.enable_registration is not None:\n",
"self.enable_registration = bool(strtobool(str(args.enable_registration)))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'"
] |
[
"def FUNC_15(VAR_10, VAR_3, VAR_11, VAR_8):...\n",
"VAR_0 = ub.session.query(ub.Shelf).filter(ub.Shelf.id == VAR_3).first()\n",
"if VAR_0 and FUNC_1(VAR_0):\n",
"if VAR_10 == 1:\n",
"flash(_(u'Error opening shelf. Shelf does not exist or is not accessible'),\n category='error')\n",
"if VAR_8 == 'pubnew... | [
"def render_show_shelf(shelf_type, shelf_id, page_no, sort_param):...\n",
"shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()\n",
"if shelf and check_shelf_view_permissions(shelf):\n",
"if shelf_type == 1:\n",
"flash(_(u'Error opening shelf. Shelf does not exist or is not accessible'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"For",
"Expr'",
"Condition",
"Expr'",
"Return'",
"... |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"event_from_pdu_json({'type': EventTypes.Message, 'content': {'foo': [{'bar':\n 2 ** 56}]}, 'room_id': '!room:test', 'sender': '@user:test', 'depth': 1,\n 'prev_events': [], 'auth_events': [], 'origin_server_ts': 1234},\n RoomVersions.V6)\n"
] | [
"def test_invalid_nested(self):...\n",
"\"\"\"docstring\"\"\"\n",
"event_from_pdu_json({'type': EventTypes.Message, 'content': {'foo': [{'bar':\n 2 ** 56}]}, 'room_id': '!room:test', 'sender': '@user:test', 'depth': 1,\n 'prev_events': [], 'auth_events': [], 'origin_server_ts': 1234},\n RoomVersions.V6... | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_45(self):...\n",
"return json.dumps(audiotranscode.getDecoders())\n"
] | [
"def api_getdecoders(self):...\n",
"return json.dumps(audiotranscode.getDecoders())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23():...\n",
"from frappe.utils.user import UserPermissions\n",
"if not VAR_1.user_perms:\n",
"VAR_1.user_perms = UserPermissions(VAR_1.session.user)\n",
"return VAR_1.user_perms\n"
] | [
"def get_user():...\n",
"from frappe.utils.user import UserPermissions\n",
"if not local.user_perms:\n",
"local.user_perms = UserPermissions(local.session.user)\n",
"return local.user_perms\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Condition",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"return InitialSyncHandler(self)\n"
] | [
"@cache_in_self...\n",
"return InitialSyncHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/%s/users/%s/remove', VAR_30, VAR_16)\n",
"return self.client.post_json(VAR_5=destination, VAR_2=path, VAR_3={\n 'requester_user_id': requester_user_id}, VAR_39=content, VAR_15=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/groups/%s/users/%s/remove', group_id, user_id)\n",
"return self.client.post_json(destination=destination, path=path, args={\n 'requester_user_id': requester_user_id}, data=content, ignore_backoff=True)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"@VAR_2.route('/robots.txt')...\n",
"return send_from_directory(constants.STATIC_DIR, 'robots.txt')\n"
] | [
"@web.route('/robots.txt')...\n",
"return send_from_directory(constants.STATIC_DIR, 'robots.txt')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(VAR_10: Dependant, VAR_22: Optional[Any]=None) ->Callable[[...\n",
"async def FUNC_5(VAR_25: WebSocket) ->None:...\n",
"VAR_53 = await solve_dependencies(VAR_24=websocket, VAR_10=dependant,\n VAR_22=dependency_overrides_provider)\n",
"VAR_11, VAR_51, VAR_56, VAR_57, VAR_58 = VAR_53\n",
"if VA... | [
"def get_websocket_app(dependant: Dependant, dependency_overrides_provider:...\n",
"async def app(websocket: WebSocket) ->None:...\n",
"solved_result = await solve_dependencies(request=websocket, dependant=\n dependant, dependency_overrides_provider=dependency_overrides_provider)\n",
"values, errors, _, _2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assert'",
"Expr'",
"Return'"
] |
[
"def FUNC_15(VAR_35, VAR_36=''):...\n",
"return VAR_35\n"
] | [
"def deserialize_component(ui_value, widget_id=''):...\n",
"return ui_value\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@CLASS_4('spawn-output')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('pre.html', title='spawn output', content=spawn_output)\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('spawn-output')...\n",
"\"\"\"docstring\"\"\"\n",
"src = jinja.render('pre.html', title='spawn output', content=spawn_output)\n",
"return 'text/html', src\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"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 io\n",
"import os\n",
"from ..InputSource import InputSource\n",
"from ..messages import *\n",
"from .main import scriptPath\n",
"from .status import splitStatus\n",
"def __init__(self, VAR_6=None, VAR_7=None):...\n",
"self.type = VAR_6\n",
"if self.type not in ('readonly', 'latest'):\n",
... | [
"import io\n",
"import os\n",
"from ..InputSource import InputSource\n",
"from ..messages import *\n",
"from .main import scriptPath\n",
"from .status import splitStatus\n",
"def __init__(self, type=None, fallback=None):...\n",
"self.type = type\n",
"if self.type not in ('readonly', 'latest'):\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"FunctionDef'",
"Return'",
"Return'",
"Return'",
"Retur... |
[
"def __post_init__(self) ->None:...\n",
"super().__post_init__()\n",
"if self.default is not None:\n",
"self.default = f'\"{self.default}\"'\n"
] | [
"def __post_init__(self) ->None:...\n",
"super().__post_init__()\n",
"if self.default is not None:\n",
"self.default = f'\"{self.default}\"'\n"
] | [
0,
5,
5,
5
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'"
] |
[
"@CLASS_4('help')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = VAR_3.path()\n",
"if not VAR_23 or VAR_23 == '/':\n",
"VAR_23 = 'index.html'\n",
"VAR_23 = VAR_23.lstrip('/')\n",
"if not docutils.docs_up_to_date(VAR_23):\n",
"message.error(\n 'Your documentation is outdated! Please re-run scripts/asci... | [
"@add_handler('help')...\n",
"\"\"\"docstring\"\"\"\n",
"urlpath = url.path()\n",
"if not urlpath or urlpath == '/':\n",
"urlpath = 'index.html'\n",
"urlpath = urlpath.lstrip('/')\n",
"if not docutils.docs_up_to_date(urlpath):\n",
"message.error(\n 'Your documentation is outdated! Please re-run scr... | [
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'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assert'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Retu... |
[
"@VAR_0.route('/upload', methods=['GET', 'POST'])...\n",
"if not config.config_uploading:\n",
"abort(404)\n",
"if VAR_33.method == 'POST' and 'btn-upload' in VAR_33.files:\n",
"for VAR_41 in VAR_33.files.getlist('btn-upload'):\n",
"return Response(json.dumps({'location': url_for('web.index')}), mimetype=\... | [
"@editbook.route('/upload', methods=['GET', 'POST'])...\n",
"if not config.config_uploading:\n",
"abort(404)\n",
"if request.method == 'POST' and 'btn-upload' in request.files:\n",
"for requested_file in request.files.getlist('btn-upload'):\n",
"return Response(json.dumps({'location': url_for('web.index')... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"Condition",
"For",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
... |
[
"@VAR_0.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/<attribute>',...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_114 = FUNC_58(f'/internal/jobs/{VAR_9}/subjobs/{VAR_11}/{VAR_16}', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_114)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/<attribute>',...\n",
"\"\"\"docstring\"\"\"\n",
"subjob_attribute_info = query_internal_api(\n f'/internal/jobs/{job_id}/subjobs/{subjob_id}/{attribute}', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsoni... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"async def FUNC_13(self, VAR_33: str, VAR_34: BinaryIO, VAR_15: Optional[int...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = {b'User-Agent': [self.user_agent]}\n",
"if VAR_24:\n",
"VAR_46.update(VAR_24)\n",
"VAR_13 = await self.request('GET', VAR_33, VAR_24=Headers(actual_headers))\n",
"VAR_49 = dict(VAR_13... | [
"async def get_file(self, url: str, output_stream: BinaryIO, max_size:...\n",
"\"\"\"docstring\"\"\"\n",
"actual_headers = {b'User-Agent': [self.user_agent]}\n",
"if headers:\n",
"actual_headers.update(headers)\n",
"response = await self.request('GET', url, headers=Headers(actual_headers))\n",
"resp_hea... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Return'"
] |
[
"async def FUNC_8(self):...\n",
"if not hasattr(self, 'resolved_ref'):\n",
"self.resolved_ref = await self.get_resolved_ref()\n",
"return f'https://{self.hostname}/{self.user}/{self.repo}/tree/{self.resolved_ref}'\n"
] | [
"async def get_resolved_ref_url(self):...\n",
"if not hasattr(self, 'resolved_ref'):\n",
"self.resolved_ref = await self.get_resolved_ref()\n",
"return f'https://{self.hostname}/{self.user}/{self.repo}/tree/{self.resolved_ref}'\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_85(self, *VAR_0, **VAR_1):...\n",
"VAR_73 = []\n",
"VAR_25 = VAR_6.__name__\n",
"VAR_91 = frappe.get_doc_hooks()\n",
"for handler in (VAR_91.get(self.doctype, {}).get(VAR_25, []) + VAR_91.get(\n",
"VAR_73.append(frappe.get_attr(handler))\n",
"VAR_92 = FUNC_84(VAR_6, *VAR_73)\n",
"return VAR_... | [
"def composer(self, *args, **kwargs):...\n",
"hooks = []\n",
"method = f.__name__\n",
"doc_events = frappe.get_doc_hooks()\n",
"for handler in (doc_events.get(self.doctype, {}).get(method, []) +\n",
"hooks.append(frappe.get_attr(handler))\n",
"composed = compose(f, *hooks)\n",
"return composed(self, m... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_40(self):...\n",
"VAR_85 = self.denied_column_value or ''\n",
"return [t.strip() for t in VAR_85.split(',')]\n"
] | [
"def list_denied_column_values(self):...\n",
"mct = self.denied_column_value or ''\n",
"return [t.strip() for t in mct.split(',')]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(VAR_5, VAR_0):...\n",
"if VAR_0 == VAR_12:\n",
"self.resync_attempts += 1\n"
] | [
"def query_user_devices(destination, user_id):...\n",
"if user_id == remote_user_id:\n",
"self.resync_attempts += 1\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"AugAssign'"
] |
[
"@VAR_0.route('/ajax/sort_value/<field>/<int:bookid>')...\n",
"if VAR_45 in ['title', 'authors', 'sort', 'author_sort']:\n",
"VAR_16 = calibre_db.get_filtered_book(VAR_46)\n",
"return ''\n",
"if VAR_16:\n",
"if VAR_45 == 'title':\n",
"return json.dumps({'sort': VAR_16.sort})\n",
"if VAR_45 == 'authors... | [
"@editbook.route('/ajax/sort_value/<field>/<int:bookid>')...\n",
"if field in ['title', 'authors', 'sort', 'author_sort']:\n",
"book = calibre_db.get_filtered_book(bookid)\n",
"return ''\n",
"if book:\n",
"if field == 'title':\n",
"return json.dumps({'sort': book.sort})\n",
"if field == 'authors':\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_6):...\n",
"self.helper.auth_user_id = self.rmcreator_id\n",
"self.uncreated_rmid = '!aa:test'\n",
"self.created_rmid = self.helper.create_room_as(self.rmcreator_id, is_public\n =False)\n",
"self.created_public_rmid = self.helper.create_room_as(self.rmcreator_id,\n ... | [
"def prepare(self, reactor, clock, hs):...\n",
"self.helper.auth_user_id = self.rmcreator_id\n",
"self.uncreated_rmid = '!aa:test'\n",
"self.created_rmid = self.helper.create_room_as(self.rmcreator_id, is_public\n =False)\n",
"self.created_public_rmid = self.helper.create_room_as(self.rmcreator_id,\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_21():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_5()\n",
"VAR_5 = '/'.join(request.args)\n",
"VAR_49 = request.vars.sender\n",
"if isinstance(VAR_49, list):\n",
"VAR_49 = VAR_49[0]\n",
"VAR_46 = FORM.confirm(T('Delete'), {T('Cancel'): URL(VAR_49, VAR_157=\n request.vars.id)})\n",
"... | [
"def delete():...\n",
"\"\"\"docstring\"\"\"\n",
"app = get_app()\n",
"filename = '/'.join(request.args)\n",
"sender = request.vars.sender\n",
"if isinstance(sender, list):\n",
"sender = sender[0]\n",
"dialog = FORM.confirm(T('Delete'), {T('Cancel'): URL(sender, anchor=request\n .vars.id)})\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_22(VAR_15, VAR_17, VAR_29, VAR_20, VAR_30, VAR_31):...\n",
"VAR_48 = False\n",
"if VAR_20[VAR_31] == 'None':\n",
"VAR_20[VAR_31] = None\n",
"if VAR_29.datatype == 'bool':\n",
"if VAR_20[VAR_31] != VAR_30:\n",
"VAR_20[VAR_31] = 1 if VAR_20[VAR_31] == 'True' else 0\n",
"if VAR_29.datatype == '... | [
"def edit_cc_data_value(book_id, book, c, to_save, cc_db_value, cc_string):...\n",
"changed = False\n",
"if to_save[cc_string] == 'None':\n",
"to_save[cc_string] = None\n",
"if c.datatype == 'bool':\n",
"if to_save[cc_string] != cc_db_value:\n",
"to_save[cc_string] = 1 if to_save[cc_string] == 'True' el... | [
0,
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'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assig... |
[
"def FUNC_21(self, VAR_9, VAR_20):...\n",
"f.write(VAR_20)\n"
] | [
"def albumartcache_save(self, path, data):...\n",
"f.write(data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.normpath(os.path.join(VAR_3, os.pardir))\n"
] | [
"def parent_dir(directory):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.normpath(os.path.join(directory, os.pardir))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_7(VAR_1):...\n",
"VAR_20.throw(_('Invalid Search Field {0}').format(VAR_1), VAR_20.DataError)\n"
] | [
"def _raise_exception(searchfield):...\n",
"frappe.throw(_('Invalid Search Field {0}').format(searchfield), frappe.\n DataError)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_12(self, VAR_13):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_68 = self.fields['method'].choices\n",
"self.fields['method'].choices = [choice for choice in VAR_68 if choice[0] !=\n VAR_13]\n"
] | [
"def remove_translation_choice(self, value):...\n",
"\"\"\"docstring\"\"\"\n",
"choices = self.fields['method'].choices\n",
"self.fields['method'].choices = [choice for choice in choices if choice[0] !=\n value]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(VAR_3, VAR_6, VAR_7):...\n",
"VAR_50 = False\n",
"if len(VAR_7) > 0:\n",
"for del_element in VAR_7:\n",
"return VAR_50\n",
"VAR_3.remove(del_element)\n",
"VAR_50 = True\n",
"if len(del_element.books) == 0:\n",
"VAR_6.delete(del_element)\n"
] | [
"def remove_objects(db_book_object, db_session, del_elements):...\n",
"changed = False\n",
"if len(del_elements) > 0:\n",
"for del_element in del_elements:\n",
"return changed\n",
"db_book_object.remove(del_element)\n",
"changed = True\n",
"if len(del_element.books) == 0:\n",
"db_session.delete(del_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"For",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Expr'"
] |
[
"from django.shortcuts import render, redirect\n",
"from django.contrib import messages\n",
"from django.utils.translation import gettext as _\n",
"from django.contrib.auth import get_user_model\n",
"import spirit\n",
"import django\n",
"from spirit.category.models import Category\n",
"from spirit.com... | [
"from django.shortcuts import render, redirect\n",
"from django.contrib import messages\n",
"from django.utils.translation import gettext as _\n",
"from django.contrib.auth import get_user_model\n",
"import spirit\n",
"import django\n",
"from spirit.category.models import Category\n",
"from spirit.com... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Expr'... |
[
"def FUNC_19(self):...\n",
"from OFS.Folder import Folder\n",
"VAR_14 = self.folder\n",
"self.folder = CLASS_1()\n",
"self.folder.t, self.folder.laf = VAR_14.t, VAR_14.laf\n",
"self.folder.laf.write('ok')\n",
"self.assert_expected(self.folder.t, 'CheckPathTraverse.html')\n"
] | [
"def testPathTraverse(self):...\n",
"from OFS.Folder import Folder\n",
"f = self.folder\n",
"self.folder = Folder()\n",
"self.folder.t, self.folder.laf = f.t, f.laf\n",
"self.folder.laf.write('ok')\n",
"self.assert_expected(self.folder.t, 'CheckPathTraverse.html')\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(VAR_10, VAR_11, VAR_4):...\n",
"if VAR_4 == 'custom':\n",
"if VAR_10.value != VAR_11:\n",
"if VAR_4 == 'languages':\n",
"VAR_10.value = VAR_11\n",
"return VAR_10\n",
"if VAR_10.lang_code != VAR_11:\n",
"if VAR_4 == 'series':\n",
"VAR_10.lang_code = VAR_11\n",
"if VAR_10.name != VAR_11:... | [
"def create_objects_for_addition(db_element, add_element, db_type):...\n",
"if db_type == 'custom':\n",
"if db_element.value != add_element:\n",
"if db_type == 'languages':\n",
"db_element.value = add_element\n",
"return db_element\n",
"if db_element.lang_code != add_element:\n",
"if db_type == 'serie... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@expose('/login/', methods=['GET', 'POST'])...\n",
"@self.appbuilder.sm.oid.loginhandler...\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"VAR_10 = LoginForm_oid()\n",
"if VAR_10.validate_on_submit():\n",
"VAR_53['remember_me'] = VAR... | [
"@expose('/login/', methods=['GET', 'POST'])...\n",
"@self.appbuilder.sm.oid.loginhandler...\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"form = LoginForm_oid()\n",
"if form.validate_on_submit():\n",
"session['remember_me'] = form.r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_201 = VAR_5.getExperimenterPhoto(VAR_40)\n",
"return HttpResponse(VAR_201, content_type='image/jpeg')\n"
] | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"photo = conn.getExperimenterPhoto(oid)\n",
"return HttpResponse(photo, content_type='image/jpeg')\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.