lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_27(self):...\n",
"VAR_9 = self._makeEngine()\n",
"VAR_5 = self._makeContext()\n",
"VAR_11 = VAR_9.compile('string:$eightbit')\n",
"self.assertRaises(UnicodeDecodeError, VAR_5.evaluate, VAR_11)\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Product... | [
"def test_mixed(self):...\n",
"eng = self._makeEngine()\n",
"ec = self._makeContext()\n",
"expr = eng.compile('string:$eightbit')\n",
"self.assertRaises(UnicodeDecodeError, ec.evaluate, expr)\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTempl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Expr'"
] |
[
"def FUNC_5(self, VAR_2, VAR_14, VAR_15):...\n",
""
] | [
"def get_share_connection(self, request, conn, share_id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"async def FUNC_48(VAR_12: str):...\n",
""
] | [
"async def get_event(event_id: str):...\n",
""
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Condition"
] |
[
"def FUNC_95(self, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"self.run_procedures[VAR_10.__name__] = VAR_10\n",
"return VAR_10\n"
] | [
"def run(self, f):...\n",
"\"\"\"docstring\"\"\"\n",
"self.run_procedures[f.__name__] = f\n",
"return f\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_14 = self.mock_handler.set_displayname\n",
"VAR_14.side_effect = SynapseError(400, 'message')\n",
"VAR_12, VAR_13 = yield self.mock_resource.trigger('PUT', \n '/profile/%s/displayname' % '@opaque:elsewhere', b'{\"displayname\":\"bob\"}')\n",
"self.assertTrue(400 <= VAR... | [
"@defer.inlineCallbacks...\n",
"mocked_set = self.mock_handler.set_displayname\n",
"mocked_set.side_effect = SynapseError(400, 'message')\n",
"code, response = yield self.mock_resource.trigger('PUT', \n '/profile/%s/displayname' % '@opaque:elsewhere', b'{\"displayname\":\"bob\"}')\n",
"self.assertTrue(40... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return PusherPool(self)\n"
] | [
"@cache_in_self...\n",
"return PusherPool(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"if apply_markdown is None:\n",
"return VAR_7\n",
"return mark_safe(apply_markdown(VAR_7))\n"
] | [
"@register.simple_tag...\n",
"if apply_markdown is None:\n",
"return markdown_text\n",
"return mark_safe(apply_markdown(markdown_text))\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def __new__(VAR_0, VAR_1: str):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_0 != CLASS_1:\n",
"return super().__new__(VAR_0)\n",
"if VAR_1 == '-':\n",
"return CLASS_2(VAR_1)\n",
"if VAR_1.startswith('https:'):\n",
"return CLASS_3(VAR_1)\n",
"return CLASS_4(VAR_1)\n"
] | [
"def __new__(cls, sourceName: str):...\n",
"\"\"\"docstring\"\"\"\n",
"if cls != InputSource:\n",
"return super().__new__(cls)\n",
"if sourceName == '-':\n",
"return StdinInputSource(sourceName)\n",
"if sourceName.startswith('https:'):\n",
"return UrlInputSource(sourceName)\n",
"return FileInputSour... | [
0,
0,
0,
0,
0,
1,
0,
1,
1
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_10 = self.parser.parse_args(['show', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.show(VAR_10)\n",
"VAR_11 = out.getvalue()... | [
"def testShowCommandInputsOutputs(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 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.show... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_23):...\n",
""
] | [
"def compile(self, expression):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def __init__(self, VAR_63, VAR_64, VAR_65='HS256', VAR_66=True, VAR_67=30,...\n",
"self.secret_key = VAR_64\n",
"self.auth = VAR_63\n",
"self.algorithm = VAR_65\n",
"if self.algorithm not in ('HS256', 'HS384', 'HS512'):\n",
"self.verify_expiration = VAR_66\n",
"self.leeway = VAR_67\n",
"self.expirati... | [
"def __init__(self, auth, secret_key, algorithm='HS256', verify_expiration=...\n",
"self.secret_key = secret_key\n",
"self.auth = auth\n",
"self.algorithm = algorithm\n",
"if self.algorithm not in ('HS256', 'HS384', 'HS512'):\n",
"self.verify_expiration = verify_expiration\n",
"self.leeway = leeway\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
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Ass... |
[
"def FUNC_30(VAR_63):...\n",
"VAR_63 = io.StringIO(VAR_63)\n",
"VAR_82 = list(csv.reader(VAR_63))\n",
"VAR_83 = VAR_82[0]\n",
"VAR_84 = VAR_83.index('flag')\n",
"VAR_82[VAR_24][VAR_84] = VAR_23\n",
"VAR_47 = io.StringIO()\n",
"VAR_85 = csv.writer(VAR_47)\n",
"VAR_85.writerows(VAR_82)\n",
"return V... | [
"def replace_flag_at_index(file_content):...\n",
"file_content = io.StringIO(file_content)\n",
"content = list(csv.reader(file_content))\n",
"header = content[0]\n",
"flag_col_index = header.index('flag')\n",
"content[flag_index][flag_col_index] = flag_option\n",
"output = io.StringIO()\n",
"writer = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.unauthorized_handler...\n",
"if VAR_8.is_xhr or '/api/' in VAR_8.path:\n",
"VAR_30 = jsonify({'message':\n \"Couldn't find resource. Please login and try again.\"})\n",
"VAR_23 = FUNC_0(VAR_3=request.url, VAR_2=False)\n",
"VAR_30.status_code = 404\n",
"return redirect(VAR_23)\n",
"return VAR_... | [
"@login_manager.unauthorized_handler...\n",
"if request.is_xhr or '/api/' in request.path:\n",
"response = jsonify({'message':\n \"Couldn't find resource. Please login and try again.\"})\n",
"login_url = get_login_url(next=request.url, external=False)\n",
"response.status_code = 404\n",
"return redirec... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_84(VAR_14):...\n",
"for VAR_13 in VAR_43:\n",
"VAR_104 = getattr(self.rules, VAR_13)\n",
"return False\n",
"VAR_44 = VAR_104.match(VAR_14)\n",
"if not VAR_44:\n",
"getattr(self, 'parse_%s' % VAR_13)(VAR_44)\n",
"return VAR_44\n"
] | [
"def manipulate(text):...\n",
"for key in rules:\n",
"rule = getattr(self.rules, key)\n",
"return False\n",
"m = rule.match(text)\n",
"if not m:\n",
"getattr(self, 'parse_%s' % key)(m)\n",
"return m\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self, VAR_12, VAR_13, VAR_3=True):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_12(VAR_4):...\n",
"VAR_21 = [m.upper() for m in VAR_13]\n",
"for r, m, v in itertools.product(VAR_12, VAR_21, [VAR_4.__name__]):\n",
"self.before_acl.append((r, m, v, VAR_3))\n",
"return VAR_4\n"
] | [
"def allow(self, roles, methods, with_children=True):...\n",
"\"\"\"docstring\"\"\"\n",
"def decorator(view_func):...\n",
"_methods = [m.upper() for m in methods]\n",
"for r, m, v in itertools.product(roles, _methods, [view_func.__name__]):\n",
"self.before_acl.append((r, m, v, with_children))\n",
"retu... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"\"\"\"docstring\"\"\"\n",
"async def FUNC_18(VAR_3, **VAR_4):...\n",
"VAR_5 = CLASS_2.TestResource()\n",
"VAR_5.callback = VAR_10\n",
"VAR_7, VAR_6 = make_request(self.reactor, FakeSite(VAR_5), b'GET', b'/path')\n",
"self.assertEqual(VAR_6.result['code'], b'301')\n",
"VAR_1... | [
"def test_redirect_exception(self):...\n",
"\"\"\"docstring\"\"\"\n",
"async def callback(request, **kwargs):...\n",
"res = WrapHtmlRequestHandlerTests.TestResource()\n",
"res.callback = callback\n",
"_, channel = make_request(self.reactor, FakeSite(res), b'GET', b'/path')\n",
"self.assertEqual(channel.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_24(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_room(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_8(self, VAR_23):...\n",
""
] | [
"def compile(self, expression):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = {'a': 'b'}\n",
"VAR_10 = 'string'\n",
"self.assertEqual(FUNC_0(format_value(VAR_9)), FUNC_0(VAR_10))\n"
] | [
"def test_format_value_dict(self):...\n",
"\"\"\"docstring\"\"\"\n",
"test_dict = {'a': 'b'}\n",
"expected_dict_format = \"\"\"\n <table class=\"table table-striped\">\n <tbody>\n <tr>\n <th>a</th>\n <td>b</td>\n </tr>\n ... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"async def FUNC_47(VAR_82):...\n",
"for VAR_196 in VAR_82:\n",
"return False\n",
"await self.backfill(VAR_196, VAR_11, VAR_17=100, VAR_18=extremities)\n",
"VAR_0.info('Failed to backfill from %s because %s', VAR_196, VAR_170)\n",
"return True\n",
"if 400 <= VAR_170.code < 500:\n",
"VAR_0.info('Failed ... | [
"async def try_backfill(domains):...\n",
"for dom in domains:\n",
"return False\n",
"await self.backfill(dom, room_id, limit=100, extremities=extremities)\n",
"logger.info('Failed to backfill from %s because %s', dom, e)\n",
"return True\n",
"if 400 <= e.code < 500:\n",
"logger.info('Failed to backfil... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"For",
"Return'",
"Expr'",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"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.http import Http404\n",
"from djconfig import config\n",
"... | [
"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.http import Http404\n",
"from djconfig import config\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,
4,
0,
0,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"... |
[
"def FUNC_34(self):...\n",
"self.login()\n",
"VAR_3 = self.client.post('/password_change/', {'old_password': 'password',\n 'new_password1': 'password1', 'new_password2': 'password1'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, '/password_change/done/')\n"
] | [
"def test_password_change_redirect_default(self):...\n",
"self.login()\n",
"response = self.client.post('/password_change/', {'old_password':\n 'password', 'new_password1': 'password1', 'new_password2': 'password1'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, ... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_16, VAR_17, VAR_10, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(VAR_10, VAR_16) or inspect.isclass(VAR_10) and\n",
"return\n",
"VAR_27 = {'detail': ('%s.detail' % VAR_17, '%s.edit' % VAR_17)}\n",
"VAR_28 = [{}]\n",
"if getattr(VAR_10, 'pk', None):\n",
"VAR_28.append(... | [
"def derive_model_url(model_class, urlname_prefix, object, kind):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(object, model_class) or inspect.isclass(object) and\n",
"return\n",
"kind_to_urlnames = {'detail': ('%s.detail' % urlname_prefix, '%s.edit' %\n urlname_prefix)}\n",
"kwarg_sets = [{}]... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"For",
"For",
"Return'",
"Return'"
] |
[
"def FUNC_2(VAR_8, VAR_9=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.translate import get_dict\n",
"return get_dict(VAR_8, VAR_9)\n"
] | [
"def get_lang_dict(fortype, name=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.translate import get_dict\n",
"return get_dict(fortype, name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Return'"
] |
[
"@VAR_2.route('/<data>/<sort_param>', defaults={'page': 1, 'book_id': 1})...\n",
"return FUNC_15(VAR_8, VAR_20, VAR_5, VAR_9)\n"
] | [
"@web.route('/<data>/<sort_param>', defaults={'page': 1, 'book_id': 1})...\n",
"return render_books_list(data, sort_param, book_id, page)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_7(VAR_11, VAR_6='root', VAR_12=False):...\n",
"\"\"\"docstring\"\"\"\n",
"for tpath in FUNC_6(VAR_11):\n",
"if not VAR_54.access(tpath, VAR_54.R_OK):\n",
"VAR_32 = 'Could not access {0}.'.format(tpath)\n",
"if not VAR_54.path.exists(tpath):\n",
"VAR_32 += ' Path does not exist.'\n",
"VAR_34 ... | [
"def check_path_traversal(path, user='root', skip_perm_errors=False):...\n",
"\"\"\"docstring\"\"\"\n",
"for tpath in list_path_traversal(path):\n",
"if not os.access(tpath, os.R_OK):\n",
"msg = 'Could not access {0}.'.format(tpath)\n",
"if not os.path.exists(tpath):\n",
"msg += ' Path does not exist.'\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Condition",
"Condition",
"Return'",
"AugAssign'",
"AugAssign'"
] |
[
"@VAR_0.route('/config_edit', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = VAR_0.config['GANGA_RC']\n",
"VAR_86 = VAR_14.read()\n",
"if request.method == 'POST':\n",
"VAR_87 = request.form['config-data']\n",
"return render_template('config_edit.html', title='Edit gangarc', VAR_86... | [
"@gui.route('/config_edit', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"gui_rc = gui.config['GANGA_RC']\n",
"ganga_config = f.read()\n",
"if request.method == 'POST':\n",
"config_ganga = request.form['config-data']\n",
"return render_template('config_edit.html', title='Edit gangarc',\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_68 = ['user_email', 'exam_name', 'attempt_code',\n 'allowed_time_limit_mins', 'is_sample_attempt', 'started_at',\n 'completed_at', 'status']\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"instructor_task.api.submit_proctored_ex... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"query_features = ['user_email', 'exam_name', 'attempt_code',\n 'allowed_time_limit_mins', 'is_sample_attempt', 'started_at',\n 'completed_at', 'status']\n",
"course_key = CourseKey.from_string(course_id)\n",
"instructor_task.api.subm... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_7(self):...\n",
"FUNC_3(self.package_data)\n",
"VAR_10.run(self)\n"
] | [
"def run(self):...\n",
"check_package_data(self.package_data)\n",
"command.run(self)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_11):...\n",
"if not VAR_53.session['admin']:\n",
"VAR_62 = self.useroptions.forUser(self.getUserId())\n",
"for f in VAR_11:\n",
"if not VAR_62.getOptionValue('media.may_download'):\n",
"if '/../' in f:\n",
"VAR_59 = cherry.config['media.maximum_download_size']\n",
"return 'not_p... | [
"def download_check_files(self, filelist):...\n",
"if not cherrypy.session['admin']:\n",
"uo = self.useroptions.forUser(self.getUserId())\n",
"for f in filelist:\n",
"if not uo.getOptionValue('media.may_download'):\n",
"if '/../' in f:\n",
"size_limit = cherry.config['media.maximum_download_size']\n",
... | [
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"if self.cleaned_data.get('offset') is None:\n",
"self.cleaned_data['offset'] = 1\n",
"return self.cleaned_data['offset']\n"
] | [
"def clean_offset(self):...\n",
"if self.cleaned_data.get('offset') is None:\n",
"self.cleaned_data['offset'] = 1\n",
"return self.cleaned_data['offset']\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self, VAR_19: Entries) ->Generator[str, None, None]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = self.ledger.fava_options.indent\n",
"for VAR_2 in VAR_19:\n",
"if isinstance(VAR_2, (Balance, Transaction)):\n",
"if isinstance(VAR_2, Transaction) and VAR_2.flag in VAR_0:\n",
"yield FUNC_4(VAR_... | [
"def render_entries(self, entries: Entries) ->Generator[str, None, None]:...\n",
"\"\"\"docstring\"\"\"\n",
"indent = self.ledger.fava_options.indent\n",
"for entry in entries:\n",
"if isinstance(entry, (Balance, Transaction)):\n",
"if isinstance(entry, Transaction) and entry.flag in EXCL_FLAGS:\n",
"yi... | [
0,
0,
0,
0,
0,
0,
2,
2
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"super().save()\n",
"VAR_35 = tempfile.mkdtemp(dir=self.temp_dir())\n",
"VAR_0.info(f'Extracting: {self.file_path} to {VAR_35}')\n",
"shutil.unpack_archive(self.file_path, VAR_35, 'zip')\n",
"self.file_path = VAR_35\n"
] | [
"def save(self):...\n",
"super().save()\n",
"zip_extract_dir = tempfile.mkdtemp(dir=self.temp_dir())\n",
"logger.info(f'Extracting: {self.file_path} to {zip_extract_dir}')\n",
"shutil.unpack_archive(self.file_path, zip_extract_dir, 'zip')\n",
"self.file_path = zip_extract_dir\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_44(self, VAR_25):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_import and frappe.flags.mute_emails or frappe.flags.in_patch or frappe.flags.in_install:\n",
"return\n",
"if self.flags.notifications_executed == None:\n",
"self.flags.notifications_executed = []\n",
"from frappe.email.doc... | [
"def run_notifications(self, method):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_import and frappe.flags.mute_emails or frappe.flags.in_patch or frappe.flags.in_install:\n",
"return\n",
"if self.flags.notifications_executed == None:\n",
"self.flags.notifications_executed = []\n",
"from frappe... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"For",... |
[
"def FUNC_7(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('d/b'), 'b')\n"
] | [
"def test_evaluate_simple_path_dict_key_string_value(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('d/b'), 'b')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
"self.force = bool(self.force)\n"
] | [
"def finalize_options(self):...\n",
"self.force = bool(self.force)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_19(self, VAR_3):...\n",
"return VAR_3.path\n"
] | [
"def render(self, request):...\n",
"return request.path\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self):...\n",
"VAR_5 = self.get_counts('json', period='year')\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertJSONEqual(VAR_5.content.decode(), [])\n"
] | [
"def test_counts_view_year(self):...\n",
"response = self.get_counts('json', period='year')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertJSONEqual(response.content.decode(), [])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(self, VAR_5, VAR_12):...\n",
"VAR_9 = self.service.show_by_name(VAR_5, VAR_12)\n",
"return self._translate_uuid_to_id(VAR_5, VAR_9)\n"
] | [
"def show_by_name(self, context, name):...\n",
"image = self.service.show_by_name(context, name)\n",
"return self._translate_uuid_to_id(context, image)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@pytest.mark.parametrize('create_file, create_dir, filterfunc, expected', [...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = VAR_0 / 'foo'\n",
"if VAR_1 or VAR_2:\n",
"VAR_5.ensure(dir=create_dir)\n",
"VAR_6 = os.listdir(str(VAR_0))\n",
"VAR_7 = filescheme.get_file_list(str(VAR_0), VAR_6, VAR_3)\n",
"VAR_8... | [
"@pytest.mark.parametrize('create_file, create_dir, filterfunc, expected', [...\n",
"\"\"\"docstring\"\"\"\n",
"path = tmpdir / 'foo'\n",
"if create_file or create_dir:\n",
"path.ensure(dir=create_dir)\n",
"all_files = os.listdir(str(tmpdir))\n",
"result = filescheme.get_file_list(str(tmpdir), all_files... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_9(self):...\n",
"VAR_25 = messageCounts['fatal']\n",
"VAR_26 = messageCounts['linkerror']\n",
"VAR_27 = messageCounts['warning']\n",
"if self.lineNumbers:\n",
"warn('Because --line-numbers was used, no output was saved.')\n",
"if VAR_25:\n",
"success('Successfully generated, but fatal errors... | [
"def printResultMessage(self):...\n",
"fatals = messageCounts['fatal']\n",
"links = messageCounts['linkerror']\n",
"warnings = messageCounts['warning']\n",
"if self.lineNumbers:\n",
"warn('Because --line-numbers was used, no output was saved.')\n",
"if fatals:\n",
"success('Successfully generated, but... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_35(VAR_50):...\n",
""
] | [
"def resp_read(chunk_size):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_2(self, VAR_2, VAR_4):...\n",
"if (VAR_2, VAR_4) in self.cookies:\n"
] | [
"def expireCookie(self, cookie_name, path):...\n",
"if (cookie_name, path) in self.cookies:\n"
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.module:\n",
"self.module = frappe.db.get_value('DocType', self.ref_doctype, 'module')\n",
"if not self.is_standard:\n",
"self.is_standard = 'No'\n",
"if self.is_standard == 'No':\n",
"if frappe.session.user == 'Administrator' and getatt... | [
"def validate(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.module:\n",
"self.module = frappe.db.get_value('DocType', self.ref_doctype, 'module')\n",
"if not self.is_standard:\n",
"self.is_standard = 'No'\n",
"if self.is_standard == 'No':\n",
"if frappe.session.user == 'Administrator' and geta... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(VAR_2):...\n",
"if not VAR_2 or not FUNC_0(VAR_2):\n",
"return\n",
"VAR_3 = VAR_2.id\n",
"ub.session.delete(VAR_2)\n",
"ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == VAR_3).delete()\n",
"ub.session.add(ub.ShelfArchive(uuid=cur_shelf.uuid, user_id=cur_shelf.user_id))\n",
"ub.s... | [
"def delete_shelf_helper(cur_shelf):...\n",
"if not cur_shelf or not check_shelf_edit_permissions(cur_shelf):\n",
"return\n",
"shelf_id = cur_shelf.id\n",
"ub.session.delete(cur_shelf)\n",
"ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id).delete()\n",
"ub.session.add(ub.ShelfArchive... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_2, VAR_3):...\n",
"self.fetches = []\n",
"async def FUNC_14(VAR_14, VAR_15, VAR_16, VAR_17=None, VAR_18=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_15(VAR_37):...\n",
"VAR_39, VAR_23 = VAR_37\n",
"VAR_16.write(VAR_39)\n",
"return VAR_23\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"self.fetches = []\n",
"async 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'",
"AsyncFunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"if self.is_standard == 'Yes' and not cint(getattr(frappe.local.conf,\n",
"frappe.throw(_('You are not allowed to delete Standard Report'))\n",
"delete_custom_role('report', self.name)\n"
] | [
"def on_trash(self):...\n",
"if self.is_standard == 'Yes' and not cint(getattr(frappe.local.conf,\n",
"frappe.throw(_('You are not allowed to delete Standard Report'))\n",
"delete_custom_role('report', self.name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_41(self, VAR_28, VAR_35):...\n",
"VAR_15 = self.getUserId()\n",
"VAR_80 = self.playlistdb.createM3U(VAR_28=plid, VAR_15=userid, addrstr=hostaddr\n )\n",
"VAR_81 = self.playlistdb.getName(VAR_28, VAR_15)\n",
"if VAR_80 and VAR_81:\n",
"return self.serve_string_as_file(VAR_80, VAR_81 + '.m3u')\... | [
"def api_downloadm3u(self, plid, hostaddr):...\n",
"userid = self.getUserId()\n",
"pls = self.playlistdb.createM3U(plid=plid, userid=userid, addrstr=hostaddr)\n",
"name = self.playlistdb.getName(plid, userid)\n",
"if pls and name:\n",
"return self.serve_string_as_file(pls, name + '.m3u')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_30(VAR_27):...\n",
"print(VAR_26 + VAR_27)\n"
] | [
"def in_print(s):...\n",
"print(indent_str + s)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = VAR_2.session['connector'].server_id\n",
"VAR_139 = False\n",
"VAR_144 = VAR_2.GET.get('fromid', None)\n",
"VAR_140 = VAR_2.POST.getlist('toids')\n",
"VAR_141 = str(VAR_2.POST.get('to_type', 'image'))\n",
"VAR_145 = None\n",
"if VAR_141 ... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"server_id = request.session['connector'].server_id\n",
"json_data = False\n",
"fromid = request.GET.get('fromid', None)\n",
"toids = request.POST.getlist('toids')\n",
"to_type = str(request.POST.get('to_type', 'image'))\n",
"rdef = None\n",
"if t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"FunctionDef'",
"Conditio... |
[
"@defer.inlineCallbacks...\n",
"VAR_14 = self.mock_handler.set_avatar_url\n",
"VAR_14.return_value = defer.succeed(())\n",
"VAR_12, VAR_13 = yield self.mock_resource.trigger('PUT', \n '/profile/%s/avatar_url' % VAR_0,\n b'{\"avatar_url\": \"http://my.server/pic.gif\"}')\n",
"self.assertEquals(200, VAR... | [
"@defer.inlineCallbacks...\n",
"mocked_set = self.mock_handler.set_avatar_url\n",
"mocked_set.return_value = defer.succeed(())\n",
"code, response = yield self.mock_resource.trigger('PUT', \n '/profile/%s/avatar_url' % myid,\n b'{\"avatar_url\": \"http://my.server/pic.gif\"}')\n",
"self.assertEquals(2... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>/pin', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_72 = current_user\n",
"VAR_40 = json.loads(VAR_72.pinned_jobs\n ) if VAR_72.pinned_jobs is not None else []\n",
"if VAR_9 not in VAR_40:\n",
"VAR_40.append(VAR_9)\n",
"VAR_72.pinned_jobs = json.dumps(V... | [
"@gui.route('/api/jobs/<int:job_id>/pin', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"u = current_user\n",
"pinned_jobs = json.loads(u.pinned_jobs) if u.pinned_jobs is not None else []\n",
"if job_id not in pinned_jobs:\n",
"pinned_jobs.append(job_id)\n",
"u.pinned_jobs = json.dumps(pinned_jobs)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_67(self):...\n",
"VAR_135 = self.settings.login_onaccept\n",
"if VAR_135:\n",
"VAR_7 = Storage(dict(VAR_96=self.user))\n",
"if not isinstance(VAR_135, (list, tuple)):\n",
"VAR_135 = [VAR_135]\n",
"for VAR_26 in VAR_135:\n",
"VAR_26(VAR_7)\n"
] | [
"def run_login_onaccept(self):...\n",
"onaccept = self.settings.login_onaccept\n",
"if onaccept:\n",
"form = Storage(dict(vars=self.user))\n",
"if not isinstance(onaccept, (list, tuple)):\n",
"onaccept = [onaccept]\n",
"for callback in onaccept:\n",
"callback(form)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"For",
"Expr'"
] |
[
"@VAR_2.route('/book/<int:book_id>')...\n",
"VAR_63 = calibre_db.get_filtered_book(VAR_5, allow_show_archived=True)\n",
"if VAR_63:\n",
"for FUNC_31 in range(0, len(VAR_63.languages)):\n",
"VAR_3.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n",
"... | [
"@web.route('/book/<int:book_id>')...\n",
"entries = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n",
"if entries:\n",
"for index in range(0, len(entries.languages)):\n",
"log.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n",
"e... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"For",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"For",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"async def FUNC_38(self, VAR_45: JsonDict) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"assert_params_in_dict(VAR_45, ['room_id'])\n",
"VAR_28 = await self.store.get_room_version_id(VAR_45['room_id'])\n",
"VAR_93 = self.event_builder_factory.new(VAR_28, VAR_45)\n",
"VAR_1, VAR_32 = await self.event_creation... | [
"async def on_exchange_third_party_invite_request(self, event_dict: JsonDict...\n",
"\"\"\"docstring\"\"\"\n",
"assert_params_in_dict(event_dict, ['room_id'])\n",
"room_version = await self.store.get_room_version_id(event_dict['room_id'])\n",
"builder = self.event_builder_factory.new(room_version, event_dic... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_1):...\n",
"VAR_17 = VAR_1.MagicMock(class_name='MyRefClass', module_name='my_test_enum')\n",
"VAR_9 = VAR_1.MagicMock()\n",
"from openapi_python_client.parser.properties import RefProperty\n",
"VAR_4 = VAR_28(VAR_5='test', VAR_26=True, default=None, reference=\n fake_reference)\n",... | [
"def test_get_imports(self, mocker):...\n",
"fake_reference = mocker.MagicMock(class_name='MyRefClass', module_name=\n 'my_test_enum')\n",
"prefix = mocker.MagicMock()\n",
"from openapi_python_client.parser.properties import RefProperty\n",
"p = RefProperty(name='test', required=True, default=None, refer... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"def FUNC_3(VAR_0, VAR_1):...\n",
"return FUNC_0(VAR_0=request, VAR_1=pk, VAR_2='is_closed', VAR_3=True, VAR_4\n =Comment.CLOSED, VAR_5=_('The topic has been locked'))\n"
] | [
"def lock(request, pk):...\n",
"return _moderate(request=request, pk=pk, field_name='is_closed', to_value=\n True, action=Comment.CLOSED, message=_('The topic has been locked'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0():...\n",
"VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' test_kwarg='tested!'\"\n )\n",
"VAR_7 = unicorn(None, VAR_6)\n",
"VAR_8 = {}\n",
"VAR_9 = VAR_7.render(VAR_8)\n",
"assert '->tested!<-' in VAR_9\n"
] | [
"def test_unicorn_render_kwarg():...\n",
"token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' test_kwarg='tested!'\"\n )\n",
"unicorn_node = unicorn(None, token)\n",
"context = {}\n",
"actual = unicorn_node.render(context)\n",
"assert '->tested!<-' ... | [
0,
0,
0,
0,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"Model with a callable concrete function.\"\"\"\n",
"def __init__(self):...\n",
"VAR_57 = def_function.function(self.multiply, input_signature=[tensor_spec.\n TensorSpec(shape=(), dtype=dtypes.float32), tensor_spec.TensorSpec(\n shape=(), dtype=dtypes.float32)])\n",
"se... | [
"def testShowAllWithPureConcreteFunction(self):...\n",
"\"\"\"Model with a callable concrete function.\"\"\"\n",
"def __init__(self):...\n",
"function = def_function.function(self.multiply, input_signature=[\n tensor_spec.TensorSpec(shape=(), dtype=dtypes.float32), tensor_spec.\n TensorSpec(shape=(), dt... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_35(self, VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.docstatus:\n",
"self.docstatus = 0\n",
"if VAR_23 == 0:\n",
"if self.docstatus == 0:\n",
"if VAR_23 == 1:\n",
"self._action = 'save'\n",
"if self.docstatus == 1:\n",
"if self.docstatus == 1:\n",
"if VAR_23 == 2:\n",
"se... | [
"def check_docstatus_transition(self, docstatus):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.docstatus:\n",
"self.docstatus = 0\n",
"if docstatus == 0:\n",
"if self.docstatus == 0:\n",
"if docstatus == 1:\n",
"self._action = 'save'\n",
"if self.docstatus == 1:\n",
"if self.docstatus == 1:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_19(self):...\n",
"VAR_19 = self.helper.create_room_as(self.user_id)\n",
"VAR_20, VAR_21 = self.make_request('PUT',\n b'directory/room/%23unofficial_test%3Atest', ('{\"room_id\":\"%s\"}' % (\n VAR_19,)).encode('ascii'))\n",
"self.assertEquals(200, VAR_21.code, VAR_21.result)\n"
] | [
"def test_allowed(self):...\n",
"room_id = self.helper.create_room_as(self.user_id)\n",
"request, channel = self.make_request('PUT',\n b'directory/room/%23unofficial_test%3Atest', ('{\"room_id\":\"%s\"}' % (\n room_id,)).encode('ascii'))\n",
"self.assertEquals(200, channel.code, channel.result)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"\"\"\"Test starting qutebrowser with special arguments/environments.\"\"\"\n",
"import subprocess\n",
"import socket\n",
"import sys\n",
"import logging\n",
"import re\n",
"import pytest\n",
"from PyQt5.QtCore import QProcess, qVersion\n",
"from helpers import utils\n",
"VAR_0 = pytest.mark.skipi... | [
"\"\"\"Test starting qutebrowser with special arguments/environments.\"\"\"\n",
"import subprocess\n",
"import socket\n",
"import sys\n",
"import logging\n",
"import re\n",
"import pytest\n",
"from PyQt5.QtCore import QProcess, qVersion\n",
"from helpers import utils\n",
"ascii_locale = pytest.mar... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"AugAssign'",
"AugAssign'",
"Condition",
"AugAssign'",
"Expr'",
"Return'"
] |
[
"@administrator_required...\n",
"VAR_3 = {'version': spirit.__version__, 'django_version': django.\n get_version(), 'category_count': Category.objects.all().count() - 1,\n 'topics_count': Topic.objects.all().count(), 'comments_count': Comment.\n objects.all().count(), 'users_count': VAR_0.objects.all().c... | [
"@administrator_required...\n",
"context = {'version': spirit.__version__, 'django_version': django.\n get_version(), 'category_count': Category.objects.all().count() - 1,\n 'topics_count': Topic.objects.all().count(), 'comments_count': Comment.\n objects.all().count(), 'users_count': User.objects.all().... | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_43(VAR_110, VAR_111):...\n",
"if 'firstrunstart' in VAR_111:\n",
"VAR_111.remove('firstrunstart')\n",
"if 'firstrunend' in VAR_111:\n",
"VAR_111.remove('firstrunend')\n",
"return ['firstrunstart'] + VAR_110 + VAR_111 + ['firstrunend']\n"
] | [
"def custom_insert_order(existing, missing):...\n",
"if 'firstrunstart' in missing:\n",
"missing.remove('firstrunstart')\n",
"if 'firstrunend' in missing:\n",
"missing.remove('firstrunend')\n",
"return ['firstrunstart'] + existing + missing + ['firstrunend']\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"import itertools\n",
"from flask import request, abort, _app_ctx_stack, redirect\n",
"from flask_security.core import AnonymousUser\n",
"from security_monkey.datastore import User\n",
"from flask.ext.login import current_user\n",
"VAR_15 = None\n",
"from .models import RBACRole, RBACUserMixin\n",
"fr... | [
"import itertools\n",
"from flask import request, abort, _app_ctx_stack, redirect\n",
"from flask_security.core import AnonymousUser\n",
"from security_monkey.datastore import User\n",
"from flask.ext.login import current_user\n",
"current_user = None\n",
"from .models import RBACRole, RBACUserMixin\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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Condition",
"For",
"Assign'",
"Assign'",
"Condit... |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = list(VAR_12)\n",
"VAR_12.reverse()\n",
"while VAR_12:\n",
"VAR_30 = VAR_12.pop()\n",
"return VAR_10\n",
"if ITraversable.providedBy(VAR_10):\n",
"VAR_10 = getattr(VAR_10, VAR_9.traverseMethod)(VAR_30)\n",
"VAR_10 = traversePathElement(VAR_1... | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"path_items = list(path_items)\n",
"path_items.reverse()\n",
"while path_items:\n",
"name = path_items.pop()\n",
"return base\n",
"if ITraversable.providedBy(base):\n",
"base = getattr(base, cls.traverseMethod)(name)\n",
"base = traversePathElement(b... | [
0,
0,
0,
0,
1,
0,
0,
0,
1,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'"
] |
[
"\"\"\"Tests REST events for /profile paths.\"\"\"\n",
"import json\n",
"from mock import Mock\n",
"from twisted.internet import defer\n",
"import synapse.types\n",
"from synapse.api.errors import AuthError, SynapseError\n",
"from synapse.rest import admin\n",
"from synapse.rest.client.v1 import login... | [
"\"\"\"Tests REST events for /profile paths.\"\"\"\n",
"import json\n",
"from mock import Mock\n",
"from twisted.internet import defer\n",
"import synapse.types\n",
"from synapse.api.errors import AuthError, SynapseError\n",
"from synapse.rest import admin\n",
"from synapse.rest.client.v1 import login... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Asy... |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = socket.AF_INET\n",
"VAR_35 = socket.getaddrinfo(VAR_1 or None, None, socket.AF_UNSPEC, socket.\n SOCK_STREAM)\n",
"return VAR_23\n",
"if not VAR_35:\n",
"return VAR_23\n",
"VAR_36 = VAR_35[0]\n",
"return VAR_36[0]\n"
] | [
"def lookup_family(hostname):...\n",
"\"\"\"docstring\"\"\"\n",
"fallback = socket.AF_INET\n",
"hostnames = socket.getaddrinfo(hostname or None, None, socket.AF_UNSPEC,\n socket.SOCK_STREAM)\n",
"return fallback\n",
"if not hostnames:\n",
"return fallback\n",
"h = hostnames[0]\n",
"return h[0]\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def __call__(self, VAR_17=None, VAR_18={}, VAR_19=None, **VAR_20):...\n",
"return 'dummy'\n"
] | [
"def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):...\n",
"return 'dummy'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_2.method == 'POST':\n",
"return JsonResponse({'Error': 'Need to POST to chgrp'}, VAR_313=405)\n",
"VAR_20 = getIntOrDefault(VAR_2, 'group_id', None)\n",
"if VAR_20 is None:\n",
"return JsonResponse({'Error': 'chgrp: No group_id specified'}... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.method == 'POST':\n",
"return JsonResponse({'Error': 'Need to POST to chgrp'}, status=405)\n",
"group_id = getIntOrDefault(request, 'group_id', None)\n",
"if group_id is None:\n",
"return JsonResponse({'Error': 'chgrp: No group_id spec... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"FunctionDef'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",... |
[
"def FUNC_0(VAR_5, VAR_6):...\n",
"FUNC_1()\n"
] | [
"def signal_store_user_session(object, user):...\n",
"store_user_session()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"VAR_5 = super().default_config()\n",
"VAR_5['worker_app'] = 'yes'\n",
"return VAR_5\n"
] | [
"def default_config(self):...\n",
"conf = super().default_config()\n",
"conf['worker_app'] = 'yes'\n",
"return conf\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_168(*VAR_9, **VAR_13):...\n",
"VAR_27 = None\n",
"VAR_27 = VAR_10(*VAR_9, **b)\n",
"thread.start_new_thread(VAR_26, (VAR_27,))\n",
"return VAR_27\n"
] | [
"def __completion(*a, **b):...\n",
"d = None\n",
"d = f(*a, **b)\n",
"thread.start_new_thread(callback, (d,))\n",
"return d\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_10(self, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16):...\n",
"VAR_32 = VAR_12.width\n",
"VAR_33 = VAR_12.height\n",
"if VAR_32 * VAR_33 >= self.max_image_pixels:\n",
"VAR_0.info('Image too large to thumbnail %r x %r > %r', VAR_32, VAR_33,\n self.max_image_pixels)\n",
"if VAR_12.transpose_method i... | [
"def _generate_thumbnail(self, thumbnailer, t_width, t_height, t_method, t_type...\n",
"m_width = thumbnailer.width\n",
"m_height = thumbnailer.height\n",
"if m_width * m_height >= self.max_image_pixels:\n",
"logger.info('Image too large to thumbnail %r x %r > %r', m_width, m_height,\n self.max_image_pix... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_17(VAR_10, VAR_11, VAR_20=None, VAR_21=False, VAR_6=None, VAR_17=...\n",
"\"\"\"docstring\"\"\"\n",
"if FUNC_9(VAR_10):\n",
"FUNC_7(VAR_10, VAR_11)\n",
"if FUNC_10(VAR_10):\n",
"if VAR_21:\n",
"FUNC_16(VAR_10, VAR_11, VAR_20, VAR_17=hashes)\n",
"if VAR_6 is None:\n",
"write_delete_marker_f... | [
"def unpack_url(link, location, download_dir=None, only_download=False,...\n",
"\"\"\"docstring\"\"\"\n",
"if is_vcs_url(link):\n",
"unpack_vcs_link(link, location)\n",
"if is_file_url(link):\n",
"if only_download:\n",
"unpack_file_url(link, location, download_dir, hashes=hashes)\n",
"if session is No... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.required:\n",
"return f'List[{self.inner_property.get_type_string()}]'\n",
"return f'Optional[List[{self.inner_property.get_type_string()}]]'\n"
] | [
"def get_type_string(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.required:\n",
"return f'List[{self.inner_property.get_type_string()}]'\n",
"return f'Optional[List[{self.inner_property.get_type_string()}]]'\n"
] | [
0,
0,
5,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_6 = self.get_success(self.handler.check_device_registered(VAR_5=\n '@theresa:foo', VAR_6=None, initial_device_display_name='display'))\n",
"VAR_11 = self.get_success(self.handler.store.get_device('@theresa:foo', VAR_6))\n",
"self.assertEqual(VAR_11['display_name'], 'display')... | [
"def test_device_id_is_made_up_if_unspecified(self):...\n",
"device_id = self.get_success(self.handler.check_device_registered(user_id=\n '@theresa:foo', device_id=None, initial_device_display_name='display'))\n",
"dev = self.get_success(self.handler.store.get_device('@theresa:foo', device_id)\n )\n",
"... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_6.route('/obj/<path:obj_path>')...\n",
"VAR_13 = FUNC_6(VAR_10)\n",
"VAR_12 = Headers()\n",
"VAR_15 = send_file(VAR_13, cache_timeout=datetime.timedelta(days=365).\n total_seconds(), add_etags=True, conditional=True)\n",
"VAR_15.headers.extend(VAR_12)\n",
"return VAR_15\n"
] | [
"@scope_blueprint.route('/obj/<path:obj_path>')...\n",
"path = _get_obj_absolute_path(obj_path)\n",
"headers = Headers()\n",
"response = send_file(path, cache_timeout=datetime.timedelta(days=365).\n total_seconds(), add_etags=True, conditional=True)\n",
"response.headers.extend(headers)\n",
"return res... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_18(VAR_10, VAR_6, VAR_22, VAR_17, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_64 = VAR_10.url.split('#', 1)[0]\n",
"VAR_15 = VAR_6.get(VAR_64, VAR_102={'Accept-Encoding': 'identity'}, VAR_34=True\n )\n",
"VAR_1.critical('HTTP error %s while getting %s', exc.response.status_code,\n VAR_10... | [
"def _download_http_url(link, session, temp_dir, hashes, progress_bar):...\n",
"\"\"\"docstring\"\"\"\n",
"target_url = link.url.split('#', 1)[0]\n",
"resp = session.get(target_url, headers={'Accept-Encoding': 'identity'},\n stream=True)\n",
"logger.critical('HTTP error %s while getting %s', exc.response... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"Condition",
"Expr'",
"AugAssign'",
... |
[
"def FUNC_3(VAR_2: 'RequestToCommandArgs'):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = [fi for fi in VAR_2.field_infos if fi.generate_download_link and\n fi.link_name]\n",
"VAR_12 = []\n",
"VAR_12.append('<!-- CLICK_WEB START FOOTER -->')\n",
"if VAR_11:\n",
"VAR_12.append('<b>Result files:</b><br>'... | [
"def _create_result_footer(req_to_args: 'RequestToCommandArgs'):...\n",
"\"\"\"docstring\"\"\"\n",
"to_download = [fi for fi in req_to_args.field_infos if fi.\n generate_download_link and fi.link_name]\n",
"lines = []\n",
"lines.append('<!-- CLICK_WEB START FOOTER -->')\n",
"if to_download:\n",
"line... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_0):...\n",
"storage.save('tmp/s3file/s3_file.txt', ContentFile(b's3file'))\n",
"storage.save('tmp/s3file/s3_other_file.txt', ContentFile(b'other s3file'))\n",
"VAR_8 = VAR_0.post('/', data={'file': [\n 'custom/location/tmp/s3file/s3_file.txt',\n 'custom/location/tmp/s3file/s3_other... | [
"def test_process_request__multiple_files(self, rf):...\n",
"storage.save('tmp/s3file/s3_file.txt', ContentFile(b's3file'))\n",
"storage.save('tmp/s3file/s3_other_file.txt', ContentFile(b'other s3file'))\n",
"request = rf.post('/', data={'file': [\n 'custom/location/tmp/s3file/s3_file.txt',\n 'custom/lo... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_2(self, VAR_5, VAR_6, VAR_3=None, VAR_4=()):...\n",
"if VAR_3 is None:\n",
"VAR_3 = {}\n",
"VAR_3['class'] = 'selectfilter'\n",
"if self.is_stacked:\n",
"VAR_3['class'] += 'stacked'\n",
"VAR_27 = [super(CLASS_0, self).render(VAR_5, VAR_6, VAR_3, VAR_4)]\n",
"VAR_27.append(\n '<script type... | [
"def render(self, name, value, attrs=None, choices=()):...\n",
"if attrs is None:\n",
"attrs = {}\n",
"attrs['class'] = 'selectfilter'\n",
"if self.is_stacked:\n",
"attrs['class'] += 'stacked'\n",
"output = [super(FilteredSelectMultiple, self).render(name, value, attrs,\n choices)]\n",
"output.appe... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_1.route('/jump')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_33 = werkzeug.urls.url_parse(request.referrer)\n",
"VAR_34 = VAR_33.decode_query()\n",
"for VAR_28, VAR_9 in request.args.lists():\n",
"if VAR_9 == ['']:\n",
"VAR_35 = VAR_33.replace(query=werkzeug.urls.url_encode(qs_dict, sort=True))\n",
"... | [
"@app.route('/jump')...\n",
"\"\"\"docstring\"\"\"\n",
"url = werkzeug.urls.url_parse(request.referrer)\n",
"qs_dict = url.decode_query()\n",
"for key, values in request.args.lists():\n",
"if values == ['']:\n",
"redirect_url = url.replace(query=werkzeug.urls.url_encode(qs_dict, sort=True))\n",
"qs_di... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"@unittest.override_config({'enable_metrics': True, 'metrics_flags': {...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertEqual(self.store._known_servers_count, 1)\n",
"self.pump()\n",
"self.assertEqual(self.store._known_servers_count, 1)\n",
"self.room = self.helper.create_room_as(self.u_alice, tok=self.t_ali... | [
"@unittest.override_config({'enable_metrics': True, 'metrics_flags': {...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertEqual(self.store._known_servers_count, 1)\n",
"self.pump()\n",
"self.assertEqual(self.store._known_servers_count, 1)\n",
"self.room = self.helper.create_room_as(self.u_alice, tok=self.t_ali... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@handle_dashboard_error...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_40 = require_student_from_identifier(VAR_9.GET.get('student'))\n",
"VAR_65 = get_course_by_id(SlashSeparatedCourseKey.from_deprecated_string(\n VAR_10))\n",
"return JsonResponse(dump_student_extensions(VAR_65, VAR_40))\n"
] | [
"@handle_dashboard_error...\n",
"\"\"\"docstring\"\"\"\n",
"student = require_student_from_identifier(request.GET.get('student'))\n",
"course = get_course_by_id(SlashSeparatedCourseKey.from_deprecated_string(\n course_id))\n",
"return JsonResponse(dump_student_extensions(course, student))\n"
] | [
0,
0,
3,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_71(self, VAR_43, VAR_26):...\n",
"if not self.get('__onload'):\n",
"self.set('__onload', frappe._dict())\n",
"self.get('__onload')[VAR_43] = VAR_26\n"
] | [
"def set_onload(self, key, value):...\n",
"if not self.get('__onload'):\n",
"self.set('__onload', frappe._dict())\n",
"self.get('__onload')[key] = value\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_72(self, VAR_43=None):...\n",
"if not VAR_43:\n",
"return self.get('__onload', frappe._dict())\n",
"return self.get('__onload')[VAR_43]\n"
] | [
"def get_onload(self, key=None):...\n",
"if not key:\n",
"return self.get('__onload', frappe._dict())\n",
"return self.get('__onload')[key]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_66(VAR_124=None, VAR_47=None, VAR_120=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_118(VAR_120=None):...\n",
"VAR_184 = {}\n",
"for VAR_219 in ([VAR_120] if VAR_120 else FUNC_64(VAR_122=True)):\n",
"VAR_219 = 'frappe' if VAR_219 == 'webnotes' else VAR_219\n",
"return VAR_184\n",
"VAR_2... | [
"def get_hooks(hook=None, default=None, app_name=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def load_app_hooks(app_name=None):...\n",
"hooks = {}\n",
"for app in ([app_name] if app_name else get_installed_apps(sort=True)):\n",
"app = 'frappe' if app == 'webnotes' else app\n",
"return hooks\n",
"app_hoo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"For",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"VAR_28 = np.ones([2, 10])\n",
"VAR_39 = np.array([[1], [2], [3]])\n",
"VAR_40 = np.mgrid[0:5, 0:5]\n",
"VAR_41 = [[3], [4]]\n",
"VAR_22 = (\n 'x1=np.ones([2,10]);x2=np.array([[1],[2],[3]]);x3=np.mgrid[0:5,0:5];x4=[[3],[4]]'\n )\n",
"VAR_31 = saved_model_cli.load_inputs_... | [
"def testInputParserPythonExpression(self):...\n",
"x1 = np.ones([2, 10])\n",
"x2 = np.array([[1], [2], [3]])\n",
"x3 = np.mgrid[0:5, 0:5]\n",
"x4 = [[3], [4]]\n",
"input_expr_str = (\n 'x1=np.ones([2,10]);x2=np.array([[1],[2],[3]]);x3=np.mgrid[0:5,0:5];x4=[[3],[4]]'\n )\n",
"feed_dict = saved_mod... | [
0,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_33 = VAR_178(VAR_33 or 0)\n",
"VAR_33 = 0\n",
"VAR_120 = VAR_9.get('thumbprefix', 'webgateway_render_thumbnail')\n",
"VAR_122 = getIntOrDefault(VAR_2, 'size', None)\n",
"VAR_1.debug(VAR_122)\n",
"VAR_19 = VAR_9['server_id']\n",
"def FUNC_66(V... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"field = long(field or 0)\n",
"field = 0\n",
"prefix = kwargs.get('thumbprefix', 'webgateway_render_thumbnail')\n",
"thumbsize = getIntOrDefault(request, 'size', None)\n",
"logger.debug(thumbsize)\n",
"server_id = kwargs['server_id']\n",
"def get_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.store.set_profile_displayname(self.frank.\n localpart, 'Frank'))\n",
"VAR_3 = yield defer.ensureDeferred(self.handler.get_displayname(self.frank))\n",
"self.assertEquals('Frank', VAR_3)\n"
] | [
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.store.set_profile_displayname(self.frank.\n localpart, 'Frank'))\n",
"displayname = yield defer.ensureDeferred(self.handler.get_displayname(self.\n frank))\n",
"self.assertEquals('Frank', displayname)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"super().clean()\n",
"if 'revert' not in self.cleaned_data:\n",
"return None\n",
"self.cleaned_data['revert_change'] = Change.objects.get(pk=self.\n cleaned_data['revert'], VAR_17=self.unit)\n",
"return self.cleaned_data\n"
] | [
"def clean(self):...\n",
"super().clean()\n",
"if 'revert' not in self.cleaned_data:\n",
"return None\n",
"self.cleaned_data['revert_change'] = Change.objects.get(pk=self.\n cleaned_data['revert'], unit=self.unit)\n",
"return self.cleaned_data\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_58(self, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<del>%s</del>' % VAR_14\n"
] | [
"def strikethrough(self, text):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<del>%s</del>' % text\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_5(VAR_19=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27 = formatdate(VAR_19)\n",
"return '%s-%s-%s GMT' % (VAR_27[:7], VAR_27[8:11], VAR_27[12:25])\n"
] | [
"def cookie_date(epoch_seconds=None):...\n",
"\"\"\"docstring\"\"\"\n",
"rfcdate = formatdate(epoch_seconds)\n",
"return '%s-%s-%s GMT' % (rfcdate[:7], rfcdate[8:11], rfcdate[12:25])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@VAR_2.route('/admin/mailsettings')...\n",
"VAR_22 = config.get_mail_settings()\n",
"return render_title_template('email_edit.html', VAR_22=content, title=_(\n u'Edit E-mail Server Settings'), page='mailset', VAR_1=feature_support)\n"
] | [
"@admi.route('/admin/mailsettings')...\n",
"content = config.get_mail_settings()\n",
"return render_title_template('email_edit.html', content=content, title=_(\n u'Edit E-mail Server Settings'), page='mailset', feature_support=\n feature_support)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_7 = {'presence': {'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.profile')\n",
"VAR_9 = [VAR_6]\n",
"VAR_10 = yield defer.ensu... | [
"@defer.inlineCallbacks...\n",
"user_filter_json = {'presence': {'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.profile')\n",
"events = [event]... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(VAR_1):...\n",
"return FUNC_1(VAR_1, VAR_3=User.objects.filter(st__is_administrator=True),\n VAR_4='spirit/user/admin/admins.html')\n"
] | [
"def index_admins(request):...\n",
"return _index(request, queryset=User.objects.filter(st__is_administrator=\n True), template='spirit/user/admin/admins.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_25(self, VAR_89):...\n",
"\"\"\"docstring\"\"\"\n",
"self.auth.user = Storage(VAR_89['user'])\n",
"self.auth.user_groups = VAR_89['user_groups']\n",
"self.auth.hmac_key = VAR_89['hmac_key']\n"
] | [
"def inject_token(self, tokend):...\n",
"\"\"\"docstring\"\"\"\n",
"self.auth.user = Storage(tokend['user'])\n",
"self.auth.user_groups = tokend['user_groups']\n",
"self.auth.hmac_key = tokend['hmac_key']\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_31(self, *VAR_13, **VAR_14):...\n",
"if self.directory is None:\n",
"return\n",
"return super(CLASS_2, self).set(*VAR_13, **kwargs)\n"
] | [
"def set(self, *args, **kwargs):...\n",
"if self.directory is None:\n",
"return\n",
"return super(SafeFileCache, self).set(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, *, VAR_11, VAR_12, VAR_13, VAR_14=None):...\n",
"log.init.debug('Initializing NetworkManager')\n",
"super().__init__(VAR_14)\n",
"log.init.debug('NetworkManager init done')\n",
"self.adopted_downloads = 0\n",
"self._args = objreg.get('args')\n",
"self._win_id = VAR_11\n",
"self._ta... | [
"def __init__(self, *, win_id, tab_id, private, parent=None):...\n",
"log.init.debug('Initializing NetworkManager')\n",
"super().__init__(parent)\n",
"log.init.debug('NetworkManager init done')\n",
"self.adopted_downloads = 0\n",
"self._args = objreg.get('args')\n",
"self._win_id = win_id\n",
"self._t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.