lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_12(self):...\n",
"VAR_3 = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertEqual(len(mail.outbox), 1)\n",
"return self._read_signup_email(mail.outbox[0])\n"
] | [
"def _test_confirm_start(self):...\n",
"response = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertEqual(len(mail.outbox), 1)\n",
"return self._read_signup_email(mail.outbox[0])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_10(self, VAR_2=None):...\n",
"VAR_6 = self.get_app()\n",
"if VAR_15.is_authenticated():\n",
"VAR_23 = 403\n",
"VAR_23 = 401\n",
"if VAR_6.config.get('FRONTED_BY_NGINX'):\n",
"VAR_24 = 'https://{}:{}{}'.format(VAR_6.config.get('FQDN'), VAR_6.config.\n get('NGINX_PORT'), '/login')\n",
"VAR_... | [
"def _deny_hook(self, resource=None):...\n",
"app = self.get_app()\n",
"if current_user.is_authenticated():\n",
"status = 403\n",
"status = 401\n",
"if app.config.get('FRONTED_BY_NGINX'):\n",
"url = 'https://{}:{}{}'.format(app.config.get('FQDN'), app.config.get(\n 'NGINX_PORT'), '/login')\n",
"url... | [
0,
0,
4,
0,
0,
0,
0,
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@abc.abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"@abc.abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"Condition",
"Docstring"
] |
[
"def FUNC_54(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(self.meta, 'track_seen', False):\n",
"frappe.db.set_value(self.doctype, self.name, '_seen', json.dumps([frappe.\n session.user]), VAR_27=False)\n"
] | [
"def reset_seen(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(self.meta, 'track_seen', False):\n",
"frappe.db.set_value(self.doctype, self.name, '_seen', json.dumps([frappe.\n session.user]), update_modified=False)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"@staticmethod...\n",
"if isinstance(VAR_5, int):\n",
"return VAR_5\n",
"VAR_51 = 1000\n",
"VAR_52 = 60 * VAR_51\n",
"VAR_53 = 60 * VAR_52\n",
"VAR_54 = 24 * VAR_53\n",
"VAR_55 = 7 * VAR_54\n",
"VAR_56 = 365 * VAR_54\n",
"VAR_48 = {'s': VAR_51, 'm': VAR_52, 'h': VAR_53, 'd': VAR_54, 'w': VAR_55,\n... | [
"@staticmethod...\n",
"if isinstance(value, int):\n",
"return value\n",
"second = 1000\n",
"minute = 60 * second\n",
"hour = 60 * minute\n",
"day = 24 * hour\n",
"week = 7 * day\n",
"year = 365 * day\n",
"sizes = {'s': second, 'm': minute, 'h': hour, 'd': day, 'w': week, 'y': year}\n",
"size = 1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"@VAR_2.route('/ajax/toggleread/<int:book_id>', methods=['POST'])...\n",
"if not config.config_read_column:\n",
"VAR_95 = ub.session.query(ub.ReadBook).filter(and_(ub.ReadBook.user_id ==\n int(VAR_87.id), ub.ReadBook.book_id == VAR_5)).first()\n",
"calibre_db.update_title_sort(config)\n",
"VAR_3.error(u'... | [
"@web.route('/ajax/toggleread/<int:book_id>', methods=['POST'])...\n",
"if not config.config_read_column:\n",
"book = ub.session.query(ub.ReadBook).filter(and_(ub.ReadBook.user_id == int\n (current_user.id), ub.ReadBook.book_id == book_id)).first()\n",
"calibre_db.update_title_sort(config)\n",
"log.error... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
... |
[
"@utils.prevent_exceptions(False)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_33 = objreg.get('proxy-factory', None)\n",
"if VAR_33 is not None:\n",
"VAR_46 = VAR_33.get_error()\n",
"VAR_34 = VAR_22.url().scheme()\n",
"if VAR_46 is not None:\n",
"if VAR_34 in self._scheme_handlers:\n",
"return networkrep... | [
"@utils.prevent_exceptions(False)...\n",
"\"\"\"docstring\"\"\"\n",
"proxy_factory = objreg.get('proxy-factory', None)\n",
"if proxy_factory is not None:\n",
"proxy_error = proxy_factory.get_error()\n",
"scheme = req.url().scheme()\n",
"if proxy_error is not None:\n",
"if scheme in self._scheme_handle... | [
0,
0,
0,
0,
0,
3,
0,
3,
0,
3,
0,
3,
0,
0,
3,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assert'",
"Condition",
"Assign'"... |
[
"def FUNC_5(VAR_10: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_24 = VAR_0 / VAR_10\n",
"VAR_39 = int(VAR_24.stat().st_mtime)\n",
"VAR_39 = 0\n",
"return FUNC_6('static', VAR_10=filename, VAR_39=mtime)\n"
] | [
"def static_url(filename: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"file_path = STATIC_FOLDER / filename\n",
"mtime = int(file_path.stat().st_mtime)\n",
"mtime = 0\n",
"return url_for('static', filename=filename, mtime=mtime)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_26(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', 'regress_x2_to_y3', '--input_exprs',\n 'x2=np.ones((3,1))'])\n",
"saved_model_cli... | [
"def testRunCommandInvalidInputKeyError(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', 'regress_x2_to_y3', '--input_exprs',\n ... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
"@frappe.whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __call__(self, VAR_5):...\n",
"VAR_45 = []\n",
"if isinstance(self._expr, str):\n",
"VAR_47 = VAR_5.evaluateText\n",
"VAR_47 = VAR_5.evaluate\n",
"for var in self._vars:\n",
"VAR_48 = VAR_47(var)\n",
"return self._expr % tuple(VAR_45)\n",
"VAR_45.append(VAR_48)\n"
] | [
"def __call__(self, econtext):...\n",
"vvals = []\n",
"if isinstance(self._expr, str):\n",
"evaluate = econtext.evaluateText\n",
"evaluate = econtext.evaluate\n",
"for var in self._vars:\n",
"v = evaluate(var)\n",
"return self._expr % tuple(vvals)\n",
"vvals.append(v)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"from synapse.app.generic_worker import GenericWorkerServer\n",
"from tests.server import make_request\n",
"from tests.unittest import HomeserverTestCase\n",
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"VAR_2 = self.setup_test_homeserver(http_client=None, homeserver_to_use=\n GenericWorkerServer)\n",
"retu... | [
"from synapse.app.generic_worker import GenericWorkerServer\n",
"from tests.server import make_request\n",
"from tests.unittest import HomeserverTestCase\n",
"def make_homeserver(self, reactor, clock):...\n",
"hs = self.setup_test_homeserver(http_client=None, homeserver_to_use=\n GenericWorkerServer)\n",... | [
0,
0,
0,
0,
4,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_35():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_87 = getattr(settings, 'REGISTRATION_CODE_LENGTH', 8)\n",
"return FUNC_8(VAR_87)\n"
] | [
"def random_code_generator():...\n",
"\"\"\"docstring\"\"\"\n",
"code_length = getattr(settings, 'REGISTRATION_CODE_LENGTH', 8)\n",
"return generate_random_string(code_length)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"import logging\n",
"import urllib\n",
"from typing import Any, Dict, Optional\n",
"from synapse.api.constants import Membership\n",
"from synapse.api.errors import Codes, HttpResponseException, SynapseError\n",
"from synapse.api.urls import FEDERATION_UNSTABLE_PREFIX, FEDERATION_V1_PREFIX, FEDERATION_V2_... | [
"import logging\n",
"import urllib\n",
"from typing import Any, Dict, Optional\n",
"from synapse.api.constants import Membership\n",
"from synapse.api.errors import Codes, HttpResponseException, SynapseError\n",
"from synapse.api.urls import FEDERATION_UNSTABLE_PREFIX, FEDERATION_V1_PREFIX, FEDERATION_V2_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Docstring",
"Expr'",
"Assign'",
"Return'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.debug('send_data dest=%s, txid=%s', VAR_11.destination, VAR_11.\n transaction_id)\n",
"if VAR_11.destination == self.server_name:\n",
"VAR_36 = VAR_11.get_dict()\n",
"VAR_2 = FUNC_1('/send/%s', VAR_11.transaction_id)\n",
"VAR_37 = await self.cli... | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"logger.debug('send_data dest=%s, txid=%s', transaction.destination,\n transaction.transaction_id)\n",
"if transaction.destination == self.server_name:\n",
"json_data = transaction.get_dict()\n",
"path = _create_v1_path('/send/%s', transaction.transactio... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_9(self, VAR_24):...\n",
"return self.widget.id_for_label(VAR_24)\n"
] | [
"def id_for_label(self, id_):...\n",
"return self.widget.id_for_label(id_)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.route('/api/credentials', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_108 = FUNC_58('/internal/credentials', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_108)\n"
] | [
"@gui.route('/api/credentials', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"credentials_info = query_internal_api('/internal/credentials', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(credentials_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = signedjson.key.generate_signing_key(1)\n",
"async def FUNC_24(VAR_23):...\n",
"self.assertEqual(VAR_23, {'server1': {FUNC_0(VAR_20): 1500}})\n",
"return {'server1': {FUNC_0(VAR_20): FetchKeyResult(get_verify_key(VAR_20), \n 1200)}}\n"
] | [
"def test_verify_json_dedupes_key_requests(self):...\n",
"\"\"\"docstring\"\"\"\n",
"key1 = signedjson.key.generate_signing_key(1)\n",
"async def get_keys(keys_to_fetch):...\n",
"self.assertEqual(keys_to_fetch, {'server1': {get_key_id(key1): 1500}})\n",
"return {'server1': {get_key_id(key1): FetchKeyResul... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AsyncFunctionDef'",
"Expr'",
"Return'"
] |
[
"async def FUNC_9(self, VAR_17: str, VAR_16: str, VAR_30: bool=False, VAR_29:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = CLASS_0(VAR_15='DELETE', VAR_17=destination, VAR_16=path, VAR_20=args)\n",
"VAR_12 = self.clock.time_msec()\n",
"VAR_11 = await self._send_request(VAR_10, VAR_30=long_retries, VAR_29=\n ... | [
"async def delete_json(self, destination: str, path: str, long_retries: bool...\n",
"\"\"\"docstring\"\"\"\n",
"request = MatrixFederationRequest(method='DELETE', destination=destination,\n path=path, query=args)\n",
"start_ms = self.clock.time_msec()\n",
"response = await self._send_request(request, lon... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_30(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_41 = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'regress_x_to_y', '--inpu... | [
"def testRunCommandInputExamplesFeatureBadType(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"output_dir = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"args = self.parser.parse_args(['run', '--dir', base_path, '--tag_set',\n ... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"async def FUNC_5(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"VAR_44 = urllib.parse.quote(self.namespace, safe='')\n",
"VAR_33 = AsyncHTTPClient()\n",
"VAR_28 = (\n 'https://{hostname}/api/v4/projects/{namespace}/repository/commits/{ref}'\n .format(VAR_19=self... | [
"async def get_resolved_ref(self):...\n",
"if hasattr(self, 'resolved_ref'):\n",
"return self.resolved_ref\n",
"namespace = urllib.parse.quote(self.namespace, safe='')\n",
"client = AsyncHTTPClient()\n",
"api_url = (\n 'https://{hostname}/api/v4/projects/{namespace}/repository/commits/{ref}'\n .form... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self, VAR_1):...\n",
"from openapi_python_client.parser.properties import UnionProperty\n",
"VAR_13 = VAR_1.MagicMock()\n",
"VAR_15 = VAR_1.MagicMock()\n",
"VAR_13.get_imports.return_value = {VAR_15}\n",
"VAR_14 = VAR_1.MagicMock()\n",
"VAR_16 = VAR_1.MagicMock()\n",
"VAR_14.get_imports.re... | [
"def test_get_type_imports(self, mocker):...\n",
"from openapi_python_client.parser.properties import UnionProperty\n",
"inner_property_1 = mocker.MagicMock()\n",
"inner_import_1 = mocker.MagicMock()\n",
"inner_property_1.get_imports.return_value = {inner_import_1}\n",
"inner_property_2 = mocker.MagicMock... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"@VAR_1.route('/upload', methods=['GET', 'POST'])...\n",
"if not config.config_uploading:\n",
"abort(404)\n",
"if VAR_32.method == 'POST' and 'btn-upload' in VAR_32.files:\n",
"for VAR_40 in VAR_32.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
] | [
"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_2.route('/ajax/pathchooser/')...\n",
"return FUNC_37()\n"
] | [
"@admi.route('/ajax/pathchooser/')...\n",
"return pathchooser()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@FUNC_0...\n",
"return EventHandler(self)\n"
] | [
"@cache_in_self...\n",
"return EventHandler(self)\n"
] | [
0,
0
] | [
"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'"
] |
[
"def FUNC_4(self):...\n",
"super().clean()\n",
"if 'merge' not in self.cleaned_data:\n",
"return None\n",
"VAR_17 = self.unit\n",
"return self.cleaned_data\n",
"VAR_5 = VAR_17.translation\n",
"VAR_58 = VAR_5.component.project\n",
"self.cleaned_data['merge_unit'] = VAR_135 = Unit.objects.get(pk=self.... | [
"def clean(self):...\n",
"super().clean()\n",
"if 'merge' not in self.cleaned_data:\n",
"return None\n",
"unit = self.unit\n",
"return self.cleaned_data\n",
"translation = unit.translation\n",
"project = translation.component.project\n",
"self.cleaned_data['merge_unit'] = merge_unit = Unit.objects.g... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition"
] |
[
"def FUNC_60(self):...\n",
"self.register_user('user', 'test')\n",
"VAR_65 = self.login('user', 'test')\n",
"VAR_61 = self._get_aliases(VAR_65, VAR_17=403)\n",
"self.assertEqual(VAR_61['errcode'], 'M_FORBIDDEN')\n"
] | [
"def test_not_in_room(self):...\n",
"self.register_user('user', 'test')\n",
"user_tok = self.login('user', 'test')\n",
"res = self._get_aliases(user_tok, expected_code=403)\n",
"self.assertEqual(res['errcode'], 'M_FORBIDDEN')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(VAR_8, VAR_7, VAR_5, VAR_9):...\n",
"VAR_10 = FUNC_14(VAR_7, VAR_8)\n",
"if VAR_8 == 'rated':\n",
"return FUNC_16(VAR_9, VAR_5, VAR_10=order)\n",
"if VAR_8 == 'discover':\n",
"return FUNC_17(VAR_9, VAR_5)\n",
"if VAR_8 == 'unread':\n",
"return FUNC_27(VAR_9, False, VAR_10=order)\n",
"if... | [
"def render_books_list(data, sort, book_id, page):...\n",
"order = get_sort_function(sort, data)\n",
"if data == 'rated':\n",
"return render_rated_books(page, book_id, order=order)\n",
"if data == 'discover':\n",
"return render_discover_books(page, book_id)\n",
"if data == 'unread':\n",
"return render... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"For"... |
[
"def FUNC_19(self):...\n",
"VAR_9 = self.cleaned_data['component']\n",
"self.fields['branch'].choices = [(x, x) for x in self.branch_data[VAR_9.pk]]\n",
"return VAR_9\n"
] | [
"def clean_component(self):...\n",
"component = self.cleaned_data['component']\n",
"self.fields['branch'].choices = [(x, x) for x in self.branch_data[component.pk]\n ]\n",
"return component\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"return self.repo\n"
] | [
"def get_build_slug(self):...\n",
"return self.repo\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/<org_slug>/oauth/google', endpoint='authorize_org')...\n",
"VAR_11['org_slug'] = current_org.slug\n",
"return redirect(url_for('.authorize', next=request.args.get('next', None)))\n"
] | [
"@blueprint.route('/<org_slug>/oauth/google', endpoint='authorize_org')...\n",
"session['org_slug'] = current_org.slug\n",
"return redirect(url_for('.authorize', next=request.args.get('next', None)))\n"
] | [
4,
4,
4
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_41(VAR_105):...\n",
"return VAR_50 or VAR_104 != VAR_105.get_etag()[0]\n"
] | [
"def validate_cache(cached):...\n",
"return force_refresh or current_etag != cached.get_etag()[0]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = FUNC_5(VAR_10.url_without_fragment)\n",
"return os.path.isdir(VAR_47)\n"
] | [
"def is_dir_url(link):...\n",
"\"\"\"docstring\"\"\"\n",
"link_path = url_to_path(link.url_without_fragment)\n",
"return os.path.isdir(link_path)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"VAR_27 = widgets.AdminSplitDateTime()\n",
"VAR_27.is_localized = True\n",
"self.assertHTMLEqual(conditional_escape(VAR_27.render('test', datetime(2007,\n 12, 1, 9, 30))), 'string')\n"
] | [
"def test_localization(self):...\n",
"w = widgets.AdminSplitDateTime()\n",
"w.is_localized = True\n",
"self.assertHTMLEqual(conditional_escape(w.render('test', datetime(2007, 12,\n 1, 9, 30))),\n '<p class=\"datetime\">Datum: <input value=\"01.12.2007\" type=\"text\" class=\"vDateField\" name=\"test_0\"... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __getattr__(VAR_59, VAR_60):...\n",
"if VAR_60 == 'nameResolver':\n",
"return VAR_55\n",
"return getattr(VAR_54, VAR_60)\n"
] | [
"def __getattr__(_self, attr):...\n",
"if attr == 'nameResolver':\n",
"return nameResolver\n",
"return getattr(real_reactor, attr)\n"
] | [
0,
4,
4,
4
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_2.route('/get_languages_json', methods=['GET'])...\n",
"VAR_56 = (request.args.get('q') or '').lower()\n",
"VAR_57 = isoLanguages.get_language_names(get_locale())\n",
"VAR_58 = [s for key, s in VAR_57.items() if s.lower().startswith(VAR_56.\n lower())]\n",
"if len(VAR_58) < 5:\n",
"VAR_63 = [s fo... | [
"@web.route('/get_languages_json', methods=['GET'])...\n",
"query = (request.args.get('q') or '').lower()\n",
"language_names = isoLanguages.get_language_names(get_locale())\n",
"entries_start = [s for key, s in language_names.items() if s.lower().\n startswith(query.lower())]\n",
"if len(entries_start) ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Assign'"
] |
[
"@app.context_processor...\n",
"VAR_3 = data.get_items(load_content=False)\n",
"VAR_4 = require('archivy')[0].version\n",
"VAR_5 = sep\n",
"if VAR_5 == '\\\\':\n",
"VAR_5 += '\\\\'\n",
"return dict(VAR_3=dataobjs, VAR_5=SEP, VAR_4=version)\n"
] | [
"@app.context_processor...\n",
"dataobjs = data.get_items(load_content=False)\n",
"version = require('archivy')[0].version\n",
"SEP = sep\n",
"if SEP == '\\\\':\n",
"SEP += '\\\\'\n",
"return dict(dataobjs=dataobjs, SEP=SEP, version=version)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_21(self, VAR_0):...\n",
"from openapi_python_client import Project\n",
"VAR_8 = Project(VAR_3=mocker.MagicMock(title='My Test API'))\n",
"VAR_8.project_dir = VAR_0.MagicMock()\n",
"VAR_21 = VAR_0.MagicMock(autospec=pathlib.Path)\n",
"VAR_22 = VAR_0.MagicMock(autospec=pathlib.Path)\n",
"VAR_23 ... | [
"def test__build_metadata(self, mocker):...\n",
"from openapi_python_client import Project\n",
"project = Project(openapi=mocker.MagicMock(title='My Test API'))\n",
"project.project_dir = mocker.MagicMock()\n",
"pyproject_path = mocker.MagicMock(autospec=pathlib.Path)\n",
"readme_path = mocker.MagicMock(a... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_3, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_3:\n",
"self.recently_accessed_remotes.add((VAR_3, VAR_4))\n",
"self.recently_accessed_locals.add(VAR_4)\n"
] | [
"def mark_recently_accessed(self, server_name, media_id):...\n",
"\"\"\"docstring\"\"\"\n",
"if server_name:\n",
"self.recently_accessed_remotes.add((server_name, media_id))\n",
"self.recently_accessed_locals.add(media_id)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_16(self):...\n",
"VAR_22, VAR_23 = self.make_request('POST', '/createRoom',\n b'{\"visibility\":\"private\"}')\n",
"self.assertEquals(200, VAR_23.code)\n",
"self.assertTrue('room_id' in VAR_23.json_body)\n"
] | [
"def test_post_room_visibility_key(self):...\n",
"request, channel = self.make_request('POST', '/createRoom',\n b'{\"visibility\":\"private\"}')\n",
"self.assertEquals(200, channel.code)\n",
"self.assertTrue('room_id' in channel.json_body)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_72(VAR_128):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_120 = VAR_128.split('.')[0]\n",
"if not VAR_1.flags.in_install and VAR_120 not in FUNC_64():\n",
"VAR_96(FUNC_0('App {0} is not installed').format(VAR_120), AppNotInstalledError\n )\n",
"VAR_118 = '.'.join(VAR_128.split('.')[:-1])\n",
"VAR... | [
"def get_attr(method_string):...\n",
"\"\"\"docstring\"\"\"\n",
"app_name = method_string.split('.')[0]\n",
"if not local.flags.in_install and app_name not in get_installed_apps():\n",
"throw(_('App {0} is not installed').format(app_name), AppNotInstalledError)\n",
"modulename = '.'.join(method_string.spl... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"return SearchHandler(self)\n"
] | [
"@cache_in_self...\n",
"return SearchHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_79(VAR_31, VAR_136, VAR_137=None, VAR_138=None, VAR_5=None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.message_title = VAR_31\n",
"VAR_1.message = VAR_136\n",
"VAR_1.response['type'] = 'page'\n",
"VAR_1.response['route'] = VAR_78\n",
"VAR_1.no_cache = 1\n",
"if VAR_138:\n",
"VAR_1.response['... | [
"def respond_as_web_page(title, html, success=None, http_status_code=None,...\n",
"\"\"\"docstring\"\"\"\n",
"local.message_title = title\n",
"local.message = html\n",
"local.response['type'] = 'page'\n",
"local.response['route'] = template\n",
"local.no_cache = 1\n",
"if http_status_code:\n",
"loca... | [
0,
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'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"... |
[
"import logging\n",
"from mock import Mock\n",
"from synapse.api.constants import EventTypes, Membership\n",
"from synapse.events.builder import EventBuilderFactory\n",
"from synapse.rest.admin import register_servlets_for_client_rest_resource\n",
"from synapse.rest.client.v1 import login, room\n",
"fro... | [
"import logging\n",
"from mock import Mock\n",
"from synapse.api.constants import EventTypes, Membership\n",
"from synapse.events.builder import EventBuilderFactory\n",
"from synapse.rest.admin import register_servlets_for_client_rest_resource\n",
"from synapse.rest.client.v1 import login, room\n",
"fro... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_2):...\n",
"return len([VAR_69 for VAR_69 in VAR_2.split('\\n') if VAR_69.strip() and \n not VAR_69.startswith('#')])\n"
] | [
"def count_lines(data):...\n",
"return len([line for line in data.split('\\n') if line.strip() and not line.\n startswith('#')])\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_14(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_17 = QUrlQuery(VAR_3)\n",
"VAR_24 = VAR_17.queryItemValue('option', QUrl.FullyDecoded)\n",
"VAR_25 = VAR_17.queryItemValue('value', QUrl.FullyDecoded)\n",
"if VAR_24 == 'content.javascript.enabled' and VAR_25 == 'false':\n",
"VAR_40 = (\n 'R... | [
"def _qute_settings_set(url):...\n",
"\"\"\"docstring\"\"\"\n",
"query = QUrlQuery(url)\n",
"option = query.queryItemValue('option', QUrl.FullyDecoded)\n",
"value = query.queryItemValue('value', QUrl.FullyDecoded)\n",
"if option == 'content.javascript.enabled' and value == 'false':\n",
"msg = (\n 'Re... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_32(VAR_87):...\n",
"VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n"
] | [
"def hash_update(value):...\n",
"hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self, VAR_0, VAR_1):...\n",
"VAR_2 = self.setup_test_homeserver('server', http_client=None,\n federation_sender=Mock())\n",
"return VAR_2\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"hs = self.setup_test_homeserver('server', http_client=None,\n federation_sender=Mock())\n",
"return hs\n"
] | [
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(VAR_21, VAR_28, VAR_29):...\n",
"VAR_67 = VAR_21.split()\n",
"for VAR_31 in VAR_67:\n",
"if len(VAR_31) > VAR_28:\n",
"return VAR_21\n",
"VAR_98 = FUNC_7(VAR_31, VAR_28, VAR_29)\n",
"VAR_21 = VAR_21.replace(VAR_31, VAR_98)\n"
] | [
"def _break_text(text, max_width, break_character):...\n",
"words = text.split()\n",
"for word in words:\n",
"if len(word) > max_width:\n",
"return text\n",
"replacement = _insert_break(word, max_width, break_character)\n",
"text = text.replace(word, replacement)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_3(self):...\n",
"import pytest\n",
"sys.exit(pytest.main(self.pytest_args))\n"
] | [
"def run_tests(self):...\n",
"import pytest\n",
"sys.exit(pytest.main(self.pytest_args))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Expr'"
] |
[
"@expose('/show/<pk>', methods=['GET'])...\n",
"VAR_44 = dict()\n",
"VAR_44['resetpasswords'] = self.actions.get('resetpasswords')\n",
"VAR_21 = self.datamodel.get(VAR_23, self._base_filters)\n",
"if not VAR_21:\n",
"abort(404)\n",
"VAR_43 = self._get_show_widget(VAR_23, VAR_21, VAR_44=actions)\n",
"s... | [
"@expose('/show/<pk>', methods=['GET'])...\n",
"actions = dict()\n",
"actions['resetpasswords'] = self.actions.get('resetpasswords')\n",
"item = self.datamodel.get(pk, self._base_filters)\n",
"if not item:\n",
"abort(404)\n",
"widgets = self._get_show_widget(pk, item, actions=actions)\n",
"self.update... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"return CLASS_7()\n"
] | [
"def _makeEngine(self):...\n",
"return DummyEngine()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self):...\n",
"assert join('/foo/bar/') == '/foo/bar'\n",
"assert join('/foo/bar/', None) == '/foo/bar'\n",
"assert join('/foo/bar/', '/') == '/foo/bar'\n",
"assert join('/foo', 'bar/') == '/foo/bar'\n"
] | [
"def test_it_strips_trailing_slash(self):...\n",
"assert join('/foo/bar/') == '/foo/bar'\n",
"assert join('/foo/bar/', None) == '/foo/bar'\n",
"assert join('/foo/bar/', '/') == '/foo/bar'\n",
"assert join('/foo', 'bar/') == '/foo/bar'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"\"\"\"string\"\"\"\n",
"import jwt\n",
"import base64\n",
"import requests\n",
"from flask import Blueprint, current_app, redirect, request\n",
"from flask.ext.restful import reqparse, Resource, Api\n",
"from flask.ext.principal import Identity, identity_changed\n",
"from flask_login import login_use... | [
"\"\"\"\n.. module: security_monkey.sso.views\n :platform: Unix\n :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more\n :license: Apache, see LICENSE for more details.\n.. moduleauthor:: Patrick Kelley <patrick@netflix.com>\n\"\"\"\n",
"import jwt\n",
"import base64\n",
"import requests\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
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"ImportFrom'",
"Expr'",
"Assign'",
"Fu... |
[
"def FUNC_1(*VAR_2, **VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = []\n",
"VAR_47 += [(arg, None) for arg in VAR_2]\n",
"VAR_47 += [(VAR_160, VAR_3[VAR_160]) for VAR_160 in VAR_3]\n",
"def FUNC_84(VAR_1):...\n",
"def FUNC_83(*VAR_2, **VAR_3):...\n",
"VAR_9 = VAR_2[0]\n",
"VAR_193 = {'error': ... | [
"def require_query_params(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"required_params = []\n",
"required_params += [(arg, None) for arg in args]\n",
"required_params += [(key, kwargs[key]) for key in kwargs]\n",
"def decorator(func):...\n",
"def wrapped(*args, **kwargs):...\n",
"request = arg... | [
0,
0,
3,
3,
3,
0,
0,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AugAssign'",
"AugAssign'",
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_83(VAR_9, VAR_10):...\n",
""
] | [
"def wrapped(request, course_id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@app.route('/dataobj/move/<int:dataobj_id>', methods=['POST'])...\n",
"VAR_9 = forms.MoveItemForm()\n",
"VAR_21 = VAR_9.path.data if VAR_9.path.data != '' else 'root directory'\n",
"if VAR_9.path.data == None:\n",
"flash('No path specified.')\n",
"if data.move_item(VAR_1, VAR_9.path.data):\n",
"flash('... | [
"@app.route('/dataobj/move/<int:dataobj_id>', methods=['POST'])...\n",
"form = forms.MoveItemForm()\n",
"out_dir = form.path.data if form.path.data != '' else 'root directory'\n",
"if form.path.data == None:\n",
"flash('No path specified.')\n",
"if data.move_item(dataobj_id, form.path.data):\n",
"flash(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_86 = socket.socket()\n",
"VAR_86.bind(('localhost', 0))\n",
"self.log.warn(\"\"\"Cannot bind to localhost, using 127.0.0.1 as default ip\n%s\"\"\",\n e)\n",
"VAR_86.close()\n",
"return '127.0.0.1'\n",
"return 'localhost'\n"
] | [
"def _ip_default(self):...\n",
"\"\"\"docstring\"\"\"\n",
"s = socket.socket()\n",
"s.bind(('localhost', 0))\n",
"self.log.warn(\"\"\"Cannot bind to localhost, using 127.0.0.1 as default ip\n%s\"\"\",\n e)\n",
"s.close()\n",
"return '127.0.0.1'\n",
"return 'localhost'\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_11(VAR_13, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"return bool(FUNC_9(VAR_13['pki_dir'], VAR_16)) and FUNC_10(VAR_16)\n",
"return False\n"
] | [
"def valid_id(opts, id_):...\n",
"\"\"\"docstring\"\"\"\n",
"return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n",
"return False\n"
] | [
0,
0,
1,
0
] | [
"FunctionDef'",
"Docstring",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_11):...\n",
"self.room_owner = self.register_user('room_owner', 'test')\n",
"self.room_owner_tok = self.login('room_owner', 'test')\n",
"self.room_id = self.helper.create_room_as(self.room_owner, VAR_52=self.\n room_owner_tok)\n"
] | [
"def prepare(self, reactor, clock, homeserver):...\n",
"self.room_owner = self.register_user('room_owner', 'test')\n",
"self.room_owner_tok = self.login('room_owner', 'test')\n",
"self.room_id = self.helper.create_room_as(self.room_owner, tok=self.\n room_owner_tok)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"from pathlib import Path\n",
"from os.path import sep\n",
"from pkg_resources import require\n",
"from shutil import which\n",
"import frontmatter\n",
"from flask import render_template, flash, redirect, request, url_for, send_file, send_from_directory\n",
"from flask_login import login_user, current_u... | [
"from pathlib import Path\n",
"from os.path import sep\n",
"from pkg_resources import require\n",
"from shutil import which\n",
"import frontmatter\n",
"from flask import render_template, flash, redirect, request, url_for, send_file, send_from_directory\n",
"from flask_login import login_user, current_u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_7(self, VAR_5: SynapseRequest, VAR_6: str):...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertRegex(VAR_5.path, \n b'^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$' % (VAR_6.\n encode('ascii'),))\n",
"self.assertEqual(VAR_5.method, b'GET')\n"
] | [
"def assert_request_is_get_repl_stream_updates(self, request: SynapseRequest,...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertRegex(request.path, \n b'^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$' % (\n stream_name.encode('ascii'),))\n",
"self.assertEqual(request.method, b'GET')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_8, VAR_9):...\n",
"self.hs = VAR_8\n",
"self.store = self.hs.get_datastore()\n",
"self.storage = self.hs.get_storage()\n",
"self.clock = self.hs.get_clock()\n",
"self.state_handler = self.hs.get_state_handler()\n",
"self.user_id = VAR_9['user_name']\n",
"self.app_id = VAR_9['ap... | [
"def __init__(self, hs, pusherdict):...\n",
"self.hs = hs\n",
"self.store = self.hs.get_datastore()\n",
"self.storage = self.hs.get_storage()\n",
"self.clock = self.hs.get_clock()\n",
"self.state_handler = self.hs.get_state_handler()\n",
"self.user_id = pusherdict['user_name']\n",
"self.app_id = pushe... | [
0,
0,
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
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition... |
[
"def FUNC_3(VAR_1: Any) ->List[Tuple[str, Tuple, Any]]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = inspect.signature(VAR_1).parameters\n",
"VAR_21 = []\n",
"for arg in VAR_20:\n",
"VAR_31 = VAR_20[arg].annotation\n",
"return VAR_21\n",
"VAR_32 = VAR_20[arg].default\n",
"VAR_36 = tuple(VAR_31.__args... | [
"def get_init_arguments_and_types(cls: Any) ->List[Tuple[str, Tuple, Any]]:...\n",
"\"\"\"docstring\"\"\"\n",
"cls_default_params = inspect.signature(cls).parameters\n",
"name_type_default = []\n",
"for arg in cls_default_params:\n",
"arg_type = cls_default_params[arg].annotation\n",
"return name_type_d... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_61(self, VAR_49, VAR_62, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = FUNC_3(VAR_49)\n",
"if not VAR_62:\n",
"return '<a href=\"%s\">%s</a>' % (VAR_49, VAR_14)\n",
"VAR_62 = VAR_19(VAR_62, VAR_15=True)\n",
"return '<a href=\"%s\" title=\"%s\">%s</a>' % (VAR_49, VAR_62, VAR_14)\n"
] | [
"def link(self, link, title, text):...\n",
"\"\"\"docstring\"\"\"\n",
"link = escape_link(link)\n",
"if not title:\n",
"return '<a href=\"%s\">%s</a>' % (link, text)\n",
"title = escape(title, quote=True)\n",
"return '<a href=\"%s\" title=\"%s\">%s</a>' % (link, title, text)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self, VAR_8, **VAR_4):...\n",
"VAR_8 = int(VAR_8)\n",
"if len(self.layout.rows[VAR_8].cells) >= VAR_0:\n",
"if not 0 <= VAR_8 < len(self.layout.rows):\n",
"return\n",
"self.layout.rows[VAR_8].add_cell()\n",
"self.save_layout()\n"
] | [
"def dispatch_add_cell(self, y, **kwargs):...\n",
"y = int(y)\n",
"if len(self.layout.rows[y].cells) >= ROW_CELL_LIMIT:\n",
"if not 0 <= y < len(self.layout.rows):\n",
"return\n",
"self.layout.rows[y].add_cell()\n",
"self.save_layout()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_94(VAR_153, VAR_46, VAR_154, VAR_155=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_153 not in VAR_1.cache:\n",
"VAR_1.cache[VAR_153] = {}\n",
"if VAR_46 not in VAR_1.cache[VAR_153]:\n",
"VAR_1.cache[VAR_153][VAR_46] = VAR_154()\n",
"if VAR_1.cache[VAR_153][VAR_46] == None and VAR_155:\n",
... | [
"def local_cache(namespace, key, generator, regenerate_if_none=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if namespace not in local.cache:\n",
"local.cache[namespace] = {}\n",
"if key not in local.cache[namespace]:\n",
"local.cache[namespace][key] = generator()\n",
"if local.cache[namespace][key] == Non... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'"
] |
[
"def __init__(self, **VAR_7):...\n",
"VAR_7['attrs'] = {'dir': 'auto', 'class':\n 'markdown-editor highlight-editor', 'data-mode': 'markdown'}\n",
"super().__init__(**kwargs)\n"
] | [
"def __init__(self, **kwargs):...\n",
"kwargs['attrs'] = {'dir': 'auto', 'class':\n 'markdown-editor highlight-editor', 'data-mode': 'markdown'}\n",
"super().__init__(**kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_90(VAR_62=None, VAR_9=None, VAR_146=None, VAR_147=None, VAR_136=...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.website.render import build_page\n",
"from frappe.utils.pdf import get_pdf\n",
"VAR_1.form_dict.doctype = VAR_62\n",
"VAR_1.form_dict.name = VAR_9\n",
"VAR_1.form_dict.format = VAR_1... | [
"def get_print(doctype=None, name=None, print_format=None, style=None, html=...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.website.render import build_page\n",
"from frappe.utils.pdf import get_pdf\n",
"local.form_dict.doctype = doctype\n",
"local.form_dict.name = name\n",
"local.form_dict.format = pri... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_82(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if hasattr(self, '_wiki'\n",
"self._wiki.automenu()\n"
] | [
"def wikimenu(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if hasattr(self, '_wiki'\n",
"self._wiki.automenu()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/user/devices/%s', VAR_16)\n",
"VAR_19 = await self.client.get_json(VAR_5=destination, VAR_2=path, VAR_8=\n timeout)\n",
"return VAR_19\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/user/devices/%s', user_id)\n",
"content = await self.client.get_json(destination=destination, path=path,\n timeout=timeout)\n",
"return content\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.reactor.advance(100)\n",
"VAR_35 = PerspectivesKeyFetcher(self.hs)\n",
"VAR_34 = self.mock_perspective_server.server_name\n",
"VAR_36 = signedjson.key.generate_signing_key('ver1')\n",
"VAR_37 = signedjson.key.get_verify_key(VAR_36)\n",
"VAR_3... | [
"def test_get_perspectives_own_key(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.reactor.advance(100)\n",
"fetcher = PerspectivesKeyFetcher(self.hs)\n",
"SERVER_NAME = self.mock_perspective_server.server_name\n",
"testkey = signedjson.key.generate_signing_key('ver1')\n",
"testverifykey = signedjson.key... | [
0,
0,
0,
0,
0,
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",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"E... |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for banned in self.banned_specs:\n",
"if re.match(banned, self.spec, re.IGNORECASE):\n",
"return False\n",
"return True\n"
] | [
"def is_banned(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for banned in self.banned_specs:\n",
"if re.match(banned, self.spec, re.IGNORECASE):\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._create_alias(self.test_user)\n",
"VAR_10 = self.get_success(self.handler.delete_association(create_requester(\n self.test_user), self.room_alias))\n",
"self.assertEquals(self.room_id, VAR_10)\n",
"self.get_failure(self.handler.get_association... | [
"def test_delete_alias_creator(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._create_alias(self.test_user)\n",
"result = self.get_success(self.handler.delete_association(create_requester(\n self.test_user), self.room_alias))\n",
"self.assertEquals(self.room_id, result)\n",
"self.get_failure(self.handl... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
"self._record_user(VAR_0, 'xyz', 'display 0')\n",
"self._record_user(VAR_0, 'fco', 'display 1', 'token1', 'ip1')\n",
"self._record_user(VAR_0, 'abc', 'display 2', 'token2', 'ip2')\n",
"self._record_user(VAR_0, 'abc', 'display 2', 'token3', 'ip3')\n",
"self._record_user(VAR_1, 'd... | [
"def _record_users(self):...\n",
"self._record_user(user1, 'xyz', 'display 0')\n",
"self._record_user(user1, 'fco', 'display 1', 'token1', 'ip1')\n",
"self._record_user(user1, 'abc', 'display 2', 'token2', 'ip2')\n",
"self._record_user(user1, 'abc', 'display 2', 'token3', 'ip3')\n",
"self._record_user(use... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_21(self):...\n",
"VAR_26 = np.array([[1], [2]])\n",
"VAR_27 = np.array(range(5))\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_31, VAR_53=x0, VAR_54=x1)\n",
"VAR_20 = 'x=' + VAR_31 + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_string(VAR_20, '', '')\n... | [
"def testInputParserErrorWrongName(self):...\n",
"x0 = np.array([[1], [2]])\n",
"x1 = np.array(range(5))\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0, b=x1)\n",
"input_str = 'x=' + input_path + '[c]'\n",
"saved_model_cli.load_inputs_from_input_arg_strin... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(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_administrator:\n",
"return VAR_0(VAR_1, *VAR_2, **kwargs)\n"
] | [
"def administrator_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_administrator:\n",
"return view_func(request, *args, **k... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_66(self, VAR_36='Comment', VAR_37=None, VAR_38=None, VAR_39=None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = frappe.get_doc({'doctype': 'Comment', 'comment_type': VAR_36,\n 'comment_email': VAR_38 or frappe.session.user, 'comment_by': VAR_41,\n 'reference_doctype': self.doctype, 'reference_name... | [
"def add_comment(self, comment_type='Comment', text=None, comment_email=None,...\n",
"\"\"\"docstring\"\"\"\n",
"out = frappe.get_doc({'doctype': 'Comment', 'comment_type': comment_type,\n 'comment_email': comment_email or frappe.session.user, 'comment_by':\n comment_by, 'reference_doctype': self.doctype,... | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_42.append(VAR_53)\n"
] | [
"@staticmethod...\n",
"addresses.append(address)\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_49(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27.dump(self.server_info(), VAR_102, indent=2)\n"
] | [
"def write_server_info_file(self):...\n",
"\"\"\"docstring\"\"\"\n",
"json.dump(self.server_info(), f, indent=2)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_1(VAR_1):...\n",
"if not VAR_1:\n",
"return ''\n",
"VAR_10 = f'([\\\\[\\\\s\\\\S\\\\]]*?)\\\\(([\\\\s\\\\S]*?):([\\\\[\\\\s\\\\S\\\\]]*?)\\\\)'\n",
"if re.match(VAR_10, VAR_1):\n",
"VAR_135 = re.search(VAR_10, VAR_1, re.IGNORECASE).group(2)\n",
"return mark_safe(markdown(VAR_1, extensions=[Esc... | [
"def get_markdown(text):...\n",
"if not text:\n",
"return ''\n",
"pattern = f'([\\\\[\\\\s\\\\S\\\\]]*?)\\\\(([\\\\s\\\\S]*?):([\\\\[\\\\s\\\\S\\\\]]*?)\\\\)'\n",
"if re.match(pattern, text):\n",
"scheme = re.search(pattern, text, re.IGNORECASE).group(2)\n",
"return mark_safe(markdown(text, extensions=[... | [
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"async def FUNC_8(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"async def get_keys(self, keys_to_fetch):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Docstring"
] |
[
"def FUNC_2(self):...\n",
"VAR_6 = Mock()\n",
"VAR_3 = '@foo:bar'\n",
"VAR_7 = 5000000\n",
"VAR_8 = UserPresenceState.default(VAR_3)\n",
"VAR_8 = VAR_8.copy_and_replace(VAR_10=PresenceState.ONLINE, last_active_ts=\n now - LAST_ACTIVE_GRANULARITY - 10, currently_active=True)\n",
"VAR_9 = VAR_8.copy_an... | [
"def test_online_to_online_last_active_noop(self):...\n",
"wheel_timer = Mock()\n",
"user_id = '@foo:bar'\n",
"now = 5000000\n",
"prev_state = UserPresenceState.default(user_id)\n",
"prev_state = prev_state.copy_and_replace(state=PresenceState.ONLINE,\n last_active_ts=now - LAST_ACTIVE_GRANULARITY - 10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_19(self):...\n",
"VAR_5 = self.get_counts('html')\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertHTMLEqual(VAR_5.content.decode(), 'string')\n"
] | [
"def test_counts_view_html(self):...\n",
"response = self.get_counts('html')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertHTMLEqual(response.content.decode(),\n \"\"\"\n<table>\n <tr>\n <th>Name</th>\n <th>Email</th>\n <th>Count total</th>\n <th>Edits tota... | [
0,
0,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_23(self, VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"self._subscribers.add(VAR_19)\n"
] | [
"def add_subscriber(self, conn):...\n",
"\"\"\"docstring\"\"\"\n",
"self._subscribers.add(conn)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def __init__(self, VAR_58, *VAR_6, **VAR_7):...\n",
"super().__init__(*VAR_6, **kwargs)\n",
"if not VAR_58.source_review:\n",
"self.fields['scope'].choices = self.fields['scope'].choices[1:]\n"
] | [
"def __init__(self, project, *args, **kwargs):...\n",
"super().__init__(*args, **kwargs)\n",
"if not project.source_review:\n",
"self.fields['scope'].choices = self.fields['scope'].choices[1:]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'"
] |
[
"def FUNC_4(VAR_13, VAR_18):...\n",
"return os.path.join(VAR_3, VAR_13, VAR_18)\n"
] | [
"def _get_obj_abosolute_path(dataset, rel_path):...\n",
"return os.path.join(DATAROOT, dataset, rel_path)\n"
] | [
0,
1
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"for i in self.REQUIRED_ON_BACKGROUND_TASK_STARTUP:\n",
"getattr(self, 'get_' + i + '_handler')()\n"
] | [
"def setup_background_tasks(self) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"for i in self.REQUIRED_ON_BACKGROUND_TASK_STARTUP:\n",
"getattr(self, 'get_' + i + '_handler')()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Expr'"
] |
[
"def FUNC_10(self, VAR_44):...\n",
"self.tokens.append({'type': 'heading', 'level': len(VAR_44.group(1)),\n 'text': VAR_44.group(2)})\n"
] | [
"def parse_heading(self, m):...\n",
"self.tokens.append({'type': 'heading', 'level': len(m.group(1)), 'text': m.\n group(2)})\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_32(VAR_87):...\n",
"VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n"
] | [
"def hash_update(value):...\n",
"hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(VAR_3.value, ast.Compare) or isinstance(VAR_3.value, ast\n",
"self.generic_visit(VAR_3)\n"
] | [
"def visit_Expr(self, node):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(node.value, ast.Compare) or isinstance(node.value, ast.\n",
"self.generic_visit(node)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"def FUNC_78(self):...\n",
"VAR_68 = self.token['ordered']\n",
"VAR_67 = self.renderer.placeholder()\n",
"while self.pop()['type'] != 'list_end':\n",
"VAR_67 += self.tok()\n",
"return self.renderer.list(VAR_67, VAR_68)\n"
] | [
"def output_list(self):...\n",
"ordered = self.token['ordered']\n",
"body = self.renderer.placeholder()\n",
"while self.pop()['type'] != 'list_end':\n",
"body += self.tok()\n",
"return self.renderer.list(body, ordered)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"def FUNC_14(self, VAR_5: str, VAR_12: SigningKey, VAR_13: int) ->dict:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = signedjson.key.get_verify_key(VAR_12)\n",
"VAR_47 = '%s:%s' % (VAR_6.alg, VAR_6.version)\n",
"VAR_16 = {'server_name': VAR_5, 'old_verify_keys': {}, 'valid_until_ts':\n VAR_13, 'verify_keys'... | [
"def build_perspectives_response(self, server_name: str, signing_key:...\n",
"\"\"\"docstring\"\"\"\n",
"verify_key = signedjson.key.get_verify_key(signing_key)\n",
"verifykey_id = '%s:%s' % (verify_key.alg, verify_key.version)\n",
"response = {'server_name': server_name, 'old_verify_keys': {},\n 'valid_... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_98(VAR_91=None, VAR_158=False, VAR_159=True, VAR_160=None, VAR_161...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils.logger import get_logger\n",
"return get_logger(VAR_91=module, VAR_158=with_more_info, VAR_159=allow_site,\n VAR_160=filter, VAR_161=max_size, VAR_162=file_count)\n"
] | [
"def logger(module=None, with_more_info=False, allow_site=True, filter=None,...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils.logger import get_logger\n",
"return get_logger(module=module, with_more_info=with_more_info, allow_site=\n allow_site, filter=filter, max_size=max_size, file_count=file_count)\... | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_15():...\n",
"random.seed(VAR_24)\n",
"return list(map(lambda x: x + VAR_5 * VAR_45, sorted(random.sample(list(\n range(VAR_5)), VAR_44))))\n"
] | [
"def generate_mix_indices():...\n",
"random.seed(seed)\n",
"return list(map(lambda x: x + ITEMS_PER_ITERATION * iteration_count, sorted\n (random.sample(list(range(ITEMS_PER_ITERATION)), mix_per_iteration))))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(VAR_0):...\n",
"@wraps(VAR_0)...\n",
"if VAR_1.user.is_authenticated:\n",
"return redirect(VAR_1.GET.get('next', VAR_1.user.st.get_absolute_url()))\n",
"return VAR_0(VAR_1, *VAR_2, **kwargs)\n"
] | [
"def guest_only(view_func):...\n",
"@wraps(view_func)...\n",
"if request.user.is_authenticated:\n",
"return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n",
"return view_func(request, *args, **kwargs)\n"
] | [
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_18(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._looping_call:\n",
"self._looping_call.stop()\n",
"self._looping_call = None\n"
] | [
"def stop(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._looping_call:\n",
"self._looping_call.stop()\n",
"self._looping_call = None\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_1(self, VAR_11: RoomStreamToken):...\n",
"VAR_18 = VAR_11.stream\n",
"self.max_stream_ordering = max(VAR_18, self.max_stream_ordering or 0)\n",
"self._start_processing()\n"
] | [
"def on_new_notifications(self, max_token: RoomStreamToken):...\n",
"max_stream_ordering = max_token.stream\n",
"self.max_stream_ordering = max(max_stream_ordering, self.\n max_stream_ordering or 0)\n",
"self._start_processing()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.