lines
listlengths
1
383
raw_lines
listlengths
1
383
label
listlengths
1
383
type
listlengths
1
383
[ "@app.route('/cached.gif')...\n", "VAR_13 = request.base_url.replace('/cached.gif', '/')\n", "VAR_9 = request.path.replace('/cached.gif', '/')\n", "VAR_6 = request.url_root\n", "VAR_45 = pluginManager.get_implementations(octoprint.plugin.UiPlugin,\n sorting_context='UiPlugin.on_ui_render')\n", "for VAR...
[ "@app.route('/cached.gif')...\n", "url = request.base_url.replace('/cached.gif', '/')\n", "path = request.path.replace('/cached.gif', '/')\n", "base_url = request.url_root\n", "ui_plugins = pluginManager.get_implementations(octoprint.plugin.UiPlugin,\n sorting_context='UiPlugin.on_ui_render')\n", "for ...
[ 0, 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'", "Assign'", "For", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Return'", "Expr'", "Condition", "Assign'", "Return'", "Expr'", "Expr'", "Return'", "Return'...
[ "def FUNC_6(self, VAR_3, VAR_4):...\n", "return django.forms.DecimalField(**options)\n" ]
[ "def create_number_field(self, field, options):...\n", "return django.forms.DecimalField(**options)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import contextlib\n", "import errno\n", "import fnmatch\n", "import json\n", "import hashlib\n", "import hmac\n", "import pathlib\n", "import typing\n", "import flask\n", "VAR_0 = flask.Flask('xmpp-http-upload')\n", "VAR_0.config.from_envvar('XMPP_HTTP_UPLOAD_CONFIG')\n", "VAR_1 = VAR_0\n", ...
[ "import contextlib\n", "import errno\n", "import fnmatch\n", "import json\n", "import hashlib\n", "import hmac\n", "import pathlib\n", "import typing\n", "import flask\n", "app = flask.Flask('xmpp-http-upload')\n", "app.config.from_envvar('XMPP_HTTP_UPLOAD_CONFIG')\n", "application = app\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "Expr'", "Assign'", "Condition", "ImportFrom'", "FunctionDef'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_13(self, VAR_44):...\n", "VAR_46 = VAR_44.group(2)\n", "self.tokens.append({'type': 'list_start', 'ordered': '.' in VAR_46})\n", "VAR_45 = VAR_44.group(0)\n", "self._process_list_item(VAR_45, VAR_46)\n", "self.tokens.append({'type': 'list_end'})\n" ]
[ "def parse_list_block(self, m):...\n", "bull = m.group(2)\n", "self.tokens.append({'type': 'list_start', 'ordered': '.' in bull})\n", "cap = m.group(0)\n", "self._process_list_item(cap, bull)\n", "self.tokens.append({'type': 'list_end'})\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "if salt.utils.is_windows():\n", "return True\n", "if VAR_6 == salt.utils.get_user():\n", "return True\n", "import pwd\n", "VAR_45 = pwd.getpwnam(VAR_6)\n", "VAR_32 = 'User not found: \"{0}\"'.format(VAR_6)\n", "return True\n", "if hasattr(VA...
[ "def check_user(user):...\n", "\"\"\"docstring\"\"\"\n", "if salt.utils.is_windows():\n", "return True\n", "if user == salt.utils.get_user():\n", "return True\n", "import pwd\n", "pwuser = pwd.getpwnam(user)\n", "msg = 'User not found: \"{0}\"'.format(user)\n", "return True\n", "if hasattr(os, '...
[ 0, 0, 0, 0, 0, 0, 0, 0, 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", "Return'", "Import'", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Expr'", "Co...
[ "def FUNC_7(self):...\n", "" ]
[ "def getUserId(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@wraps(VAR_4)...\n", "if VAR_87.role_download():\n", "return VAR_4(*VAR_49, **kwargs)\n", "abort(403)\n" ]
[ "@wraps(f)...\n", "if current_user.role_download():\n", "return f(*args, **kwargs)\n", "abort(403)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Expr'" ]
[ "def FUNC_35(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(['scan', '--dir', VAR_9, '--tag_set', 'serve'])\n", "VAR_48 = saved_model_cli._OP_DENYLIST\n", "saved_model_cli._OP_DENYLIST = set(['VariableV2'])\n", ...
[ "def testScanCommandFoundDenylistedOp(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(['scan', '--dir', base_path, '--tag_set',\n 'serve'])\n", "op_denylist = saved_model_cli._OP_DENYLIST\n", "save...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_20(self) ->bool:...\n", "\"\"\"docstring\"\"\"\n", "return self.force_training or self.core\n" ]
[ "def should_retrain_core(self) ->bool:...\n", "\"\"\"docstring\"\"\"\n", "return self.force_training or self.core\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@VAR_8.route('/api/queue/push/', methods=['POST'])...\n", "VAR_64 = request.json['data']\n", "VAR_67 = request.json['action']\n", "VAR_68, VAR_69 = queue.push({'data': VAR_64}, VAR_67)\n", "return {'hash': VAR_68, 'queue_position': VAR_69}\n" ]
[ "@app.route('/api/queue/push/', methods=['POST'])...\n", "data = request.json['data']\n", "action = request.json['action']\n", "job_hash, queue_position = queue.push({'data': data}, action)\n", "return {'hash': job_hash, 'queue_position': queue_position}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(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', 'serve'])\n", "saved_model_cli.show(VAR_10)\n", "VAR_11 = out.getvalue().strip()\n", "VAR_15 = (\n 'The given ...
[ "def testShowCommandSignature(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'])\n", "saved_model_cli.show(args)\n", "output = out.getvalue().stri...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_12):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = {rq for rq in VAR_12 if not rq.key_ready.called}\n", "async def FUNC_14():...\n", "for f in self._key_fetchers:\n", "VAR_0.error('Unexpected error in _get_server_verify_keys: %s', err)\n", "run_in_background(FUNC_14)\n", "if not VA...
[ "def _get_server_verify_keys(self, verify_requests):...\n", "\"\"\"docstring\"\"\"\n", "remaining_requests = {rq for rq in verify_requests if not rq.key_ready.called}\n", "async def do_iterations():...\n", "for f in self._key_fetchers:\n", "logger.error('Unexpected error in _get_server_verify_keys: %s', e...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "AsyncFunctionDef'", "For", "Expr'", "Expr'", "Condition", "Condition", "For", "Return'", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_14(self, VAR_1):...\n", "VAR_5 = VAR_1.MagicMock()\n", "VAR_26 = VAR_1.MagicMock()\n", "VAR_23 = oai.Schema(type='array')\n", "from openapi_python_client.parser.properties import property_from_data\n", "VAR_4 = property_from_data(VAR_5=name, VAR_26=required, VAR_23=data)\n", "assert VAR_4 == P...
[ "def test_property_from_data_array_no_items(self, mocker):...\n", "name = mocker.MagicMock()\n", "required = mocker.MagicMock()\n", "data = oai.Schema(type='array')\n", "from openapi_python_client.parser.properties import property_from_data\n", "p = property_from_data(name=name, required=required, data=da...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Assign'", "Assert'" ]
[ "def FUNC_1(self, **VAR_4):...\n", "VAR_15 = super(CLASS_0, self).get_context_data(**kwargs)\n", "VAR_15['layout'] = self.layout\n", "VAR_15['csrf_token_str'] = get_token(self.request)\n", "VAR_15['current_cell_coords'] = self.current_cell_coords\n", "VAR_15['current_cell'] = self.current_cell\n", "VAR_...
[ "def get_context_data(self, **kwargs):...\n", "ctx = super(EditorView, self).get_context_data(**kwargs)\n", "ctx['layout'] = self.layout\n", "ctx['csrf_token_str'] = get_token(self.request)\n", "ctx['current_cell_coords'] = self.current_cell_coords\n", "ctx['current_cell'] = self.current_cell\n", "ctx['...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_2(self, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_19(VAR_14)\n" ]
[ "def escape(self, text):...\n", "\"\"\"docstring\"\"\"\n", "return escape(text)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "import json, datetime\n", "from frappe import _, scrub\n", "import frappe.desk.query_report\n", "from frappe.utils import cint, cstr\n", "from frappe.model.document import Document\n", "from frappe.modules.export_file import export_to_fi...
[ "from __future__ import unicode_literals\n", "import frappe\n", "import json, datetime\n", "from frappe import _, scrub\n", "import frappe.desk.query_report\n", "from frappe.utils import cint, cstr\n", "from frappe.model.document import Document\n", "from frappe.modules.export_file import export_to_fi...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "...
[ "def FUNC_23(VAR_27):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_27.is_valid:\n", "return HttpResponseBadRequest(_('This invoice is already active.'))\n", "VAR_27.is_valid = True\n", "VAR_27.save()\n", "VAR_74 = _('The registration codes for invoice {0} have been re-activated.'\n ).format(VAR_27.id)\n...
[ "def re_validate_invoice(obj_invoice):...\n", "\"\"\"docstring\"\"\"\n", "if obj_invoice.is_valid:\n", "return HttpResponseBadRequest(_('This invoice is already active.'))\n", "obj_invoice.is_valid = True\n", "obj_invoice.save()\n", "message = _('The registration codes for invoice {0} have been re-activ...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "return u'%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s'\n" ]
[ "def _log_format_default(self):...\n", "\"\"\"docstring\"\"\"\n", "return u'%(color)s[%(levelname)1.1s %(asctime)s.%(msecs).03d %(name)s]%(end_color)s %(message)s'\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@VAR_0.route('/admin/book/convert/<int:book_id>', methods=['POST'])...\n", "VAR_77 = VAR_33.form.get('book_format_from', None)\n", "VAR_78 = VAR_33.form.get('book_format_to', None)\n", "if VAR_77 is None or VAR_78 is None:\n", "flash(_(u'Source or destination format for conversion missing'), category=\n ...
[ "@editbook.route('/admin/book/convert/<int:book_id>', methods=['POST'])...\n", "book_format_from = request.form.get('book_format_from', None)\n", "book_format_to = request.form.get('book_format_to', None)\n", "if book_format_from is None or book_format_to is None:\n", "flash(_(u'Source or destination format...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Return'", "Assign'", "Condition", "Expr'", "Expr'", "Return'" ]
[ "@VAR_2.route('/ajax/domainlist/<int:allow>')...\n", "VAR_64 = ub.session.query(ub.Registration).filter(ub.Registration.allow ==\n VAR_7).all()\n", "VAR_67 = json.dumps([{'domain': r.domain.replace('%', '*').replace('_', '?'\n ), 'id': r.id} for r in VAR_64])\n", "VAR_68 = json.dumps(VAR_67.replace('\"'...
[ "@admi.route('/ajax/domainlist/<int:allow>')...\n", "answer = ub.session.query(ub.Registration).filter(ub.Registration.allow ==\n allow).all()\n", "json_dumps = json.dumps([{'domain': r.domain.replace('%', '*').replace('_',\n '?'), 'id': r.id} for r in answer])\n", "js = json.dumps(json_dumps.replace('\...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_0.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_104 = FUNC_58(f'/internal/jobs/{VAR_9}/subjobs/{VAR_11}', 'get')\n", "return jsonify({'success': False, 'message': str(err)}), 400\n", "return jsonify(VAR_104)\n" ]
[ "@gui.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "subjob_info = query_internal_api(f'/internal/jobs/{job_id}/subjobs/{subjob_id}'\n , 'get')\n", "return jsonify({'success': False, 'message': str(err)}), 400\n", "return jsonify(subjob_info)\n...
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Return'", "Return'" ]
[ "def FUNC_3(self, VAR_3, VAR_4):...\n", "return django.forms.DateTimeField(**options)\n" ]
[ "def create_datetime_field(self, field, options):...\n", "return django.forms.DateTimeField(**options)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_8 = self.register_user('kermit', 'test')\n", "VAR_9 = self.login('kermit', 'test')\n", "VAR_6 = self.helper.create_room_as(room_creator=user_id, VAR_9=tok)\n", "VAR_10 = 'sometoken'\n", "self.helper.send_state(VAR_6=room_id, event_type=EventTypes.\n ThirdPartyInvite, stat...
[ "def test_exchange_revoked_invite(self):...\n", "user_id = self.register_user('kermit', 'test')\n", "tok = self.login('kermit', 'test')\n", "room_id = self.helper.create_room_as(room_creator=user_id, tok=tok)\n", "invite_token = 'sometoken'\n", "self.helper.send_state(room_id=room_id, event_type=EventType...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "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'" ]
[ "@pyqtSlot('QNetworkReply*', 'QAuthenticator*')...\n", "\"\"\"docstring\"\"\"\n", "VAR_30 = False\n", "if not self.netrc_used:\n", "self.netrc_used = True\n", "if not VAR_30:\n", "VAR_30 = shared.netrc_authentication(VAR_16.url(), VAR_19)\n", "VAR_28 = self._get_abort_signals(VAR_16)\n", "shared.aut...
[ "@pyqtSlot('QNetworkReply*', 'QAuthenticator*')...\n", "\"\"\"docstring\"\"\"\n", "netrc_success = False\n", "if not self.netrc_used:\n", "self.netrc_used = True\n", "if not netrc_success:\n", "netrc_success = shared.netrc_authentication(reply.url(), authenticator)\n", "abort_on = self._get_abort_sign...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "@contextlib.contextmanager...\n", "" ]
[ "@contextlib.contextmanager...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "@VAR_0.route('/api/jobs/create', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = {'template_id': request.json.get('template_id'), 'job_name':\n request.json.get('job_name')}\n", "VAR_98 = FUNC_58('/internal/jobs/create', 'post', json=data)\n", "return jsonify({'success': False, 'message': ...
[ "@gui.route('/api/jobs/create', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "data = {'template_id': request.json.get('template_id'), 'job_name': request\n .json.get('job_name')}\n", "response_info = query_internal_api('/internal/jobs/create', 'post', json=data)\n", "return jsonify({'success': Fal...
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_32(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_done_succeeds(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, '/p...
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "import logging\n", "from prometheus_client import Counter\n", "from twisted.internet.error import AlreadyCalled, AlreadyCancelled\n", "from synapse.api.constants import EventTypes\n", "from synapse.logging import opentracing\n", "from synapse.metrics.background_process_metrics import run_as_background_pr...
[ "import logging\n", "from prometheus_client import Counter\n", "from twisted.internet.error import AlreadyCalled, AlreadyCancelled\n", "from synapse.api.constants import EventTypes\n", "from synapse.logging import opentracing\n", "from synapse.metrics.background_process_metrics import run_as_background_pr...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assig...
[ "def FUNC_67(VAR_10):...\n", "VAR_213 = {}\n", "for VAR_30, VAR_108 in (['x', VAR_10.getPosX()], ['y', VAR_10.getPosY()]):\n", "if VAR_108 is not None:\n", "return VAR_213\n", "VAR_213[VAR_30] = {'value': VAR_108.getValue(), 'unit': str(VAR_108.getUnit())}\n" ]
[ "def marshal_pos(w):...\n", "d = {}\n", "for x, p in (['x', w.getPosX()], ['y', w.getPosY()]):\n", "if p is not None:\n", "return d\n", "d[x] = {'value': p.getValue(), 'unit': str(p.getUnit())}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Condition", "Return'", "Assign'" ]
[ "def FUNC_11(self, VAR_4, VAR_39, VAR_40):...\n", "if VAR_40 == u'*':\n", "self.ip = u''\n" ]
[ "def _ip_changed(self, name, old, new):...\n", "if new == u'*':\n", "self.ip = u''\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'" ]
[ "def FUNC_31(self):...\n", "self.parser = saved_model_cli.create_parser()\n", "VAR_9 = test.test_src_dir_path(VAR_0)\n", "VAR_44 = np.array([[1], [2]])\n", "VAR_45 = np.zeros((6, 3))\n", "VAR_31 = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutOverwrite_inputs.npz')\n", "np.savez(VAR_31, VAR_2...
[ "def testRunCommandOutputFileExistError(self):...\n", "self.parser = saved_model_cli.create_parser()\n", "base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n", "x = np.array([[1], [2]])\n", "x_notused = np.zeros((6, 3))\n", "input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutOverwrit...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_27(VAR_9, VAR_14, VAR_15=False, VAR_10=None):...\n", "VAR_10 = VAR_10 or []\n", "if not config.config_read_column:\n", "if VAR_14:\n", "if VAR_14:\n", "VAR_3.error('Custom Column No.%d is not existing in calibre database',\n config.config_read_column)\n", "if VAR_15:\n", "VAR_126 = and_(u...
[ "def render_read_books(page, are_read, as_xml=False, order=None):...\n", "order = order or []\n", "if not config.config_read_column:\n", "if are_read:\n", "if are_read:\n", "log.error('Custom Column No.%d is not existing in calibre database', config\n .config_read_column)\n", "if as_xml:\n", "db_fi...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_2 = FUNC_2(VAR_0)\n", "VAR_0.write('string' % VAR_0.cfg.url_prefix_static)\n", "VAR_3 = []\n", "for macro in FUNC_1(VAR_0):\n", "if macro == 'BR':\n", "VAR_0.write('\\n'.join(VAR_3))\n", "VAR_35 = ' selected=\"selected\"'\n", "VAR_35 = ''\n", "VAR_0.write(\"\"\"\n ...
[ "def macro_dialog(request):...\n", "help = get_macro_help(request)\n", "request.write(\n \"\"\"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<html>\n <head>\n <title>Insert Macro</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta content=\"noindex...
[ 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'", "Expr'", "Assign'", "For", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "For", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_162(VAR_10):...\n", "if VAR_187:\n", "self.amfrpc3_procedures[VAR_187 + '.' + VAR_10.__name__] = VAR_10\n", "self.amfrpc3_procedures[VAR_10.__name__] = VAR_10\n", "return VAR_10\n" ]
[ "def _amfrpc3(f):...\n", "if domain:\n", "self.amfrpc3_procedures[domain + '.' + f.__name__] = f\n", "self.amfrpc3_procedures[f.__name__] = f\n", "return f\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_15(self, VAR_4, VAR_39, VAR_40):...\n", "self.log.warn(\"\"\"\n webapp_settings is deprecated, use tornado_settings.\n\"\"\")\n", "self.tornado_settings = VAR_40\n" ]
[ "def _webapp_settings_changed(self, name, old, new):...\n", "self.log.warn(\"\"\"\n webapp_settings is deprecated, use tornado_settings.\n\"\"\")\n", "self.tornado_settings = new\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "def FUNC_20(VAR_9, VAR_12, VAR_10):...\n", "VAR_63, VAR_64, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, db.\n Books.authors.any(db.Authors.id == VAR_12), [VAR_10[0][0], db.Series.\n name, db.Books.series_index], db.books_series_link, db.Books.id == db.\n books_series_link.c.book, db.Series)\n...
[ "def render_author_books(page, author_id, order):...\n", "entries, __, pagination = calibre_db.fill_indexpage(page, 0, db.Books, db.\n Books.authors.any(db.Authors.id == author_id), [order[0][0], db.Series.\n name, db.Books.series_index], db.books_series_link, db.Books.id == db.\n books_series_link.c.boo...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'" ]
[ "@staticmethod...\n", "VAR_1.smooth()\n", "return VAR_1.encode(formatter=UnsortedAttributes()).decode('utf-8')\n" ]
[ "@staticmethod...\n", "soup.smooth()\n", "return soup.encode(formatter=UnsortedAttributes()).decode('utf-8')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Expr'", "Return'" ]
[ "def FUNC_8(VAR_11: List[Text], VAR_12: Text) ->Type['Validator']:...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_14(VAR_20: Text) ->bool:...\n", "return VAR_20 is not None and any([VAR_20.endswith(file_type) for file_type in\n VAR_11])\n" ]
[ "def file_type_validator(valid_file_types: List[Text], error_message: Text...\n", "\"\"\"docstring\"\"\"\n", "def is_valid(path: Text) ->bool:...\n", "return path is not None and any([path.endswith(file_type) for file_type in\n valid_file_types])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Return'" ]
[ "def FUNC_10(VAR_0, VAR_1, VAR_3):...\n", "VAR_3.add(GET, 'http://example.org', body='Example\\n')\n", "VAR_10 = 'bookmarks'\n", "VAR_0.config['DEFAULT_BOOKMARKS_DIR'] = VAR_10\n", "create_dir(VAR_10)\n", "VAR_8 = VAR_1.post('/bookmarks/new', data={'url': 'http://example.org',\n 'submit': 'true'})\n", ...
[ "def test_creating_bookmark_without_passing_path_saves_to_default_dir(test_app,...\n", "mocked_responses.add(GET, 'http://example.org', body='Example\\n')\n", "bookmarks_dir = 'bookmarks'\n", "test_app.config['DEFAULT_BOOKMARKS_DIR'] = bookmarks_dir\n", "create_dir(bookmarks_dir)\n", "resp = client.post('...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assert'" ]
[ "def FUNC_5(self, VAR_2: Text, VAR_3: Text) ->Tuple[Text, Text]:...\n", "\"\"\"docstring\"\"\"\n", "import tempfile\n", "VAR_22 = tempfile.mkdtemp()\n", "VAR_23 = self._tar_name(VAR_3, VAR_8=False)\n", "VAR_21 = shutil.make_archive(os.path.join(VAR_22, VAR_23), 'gztar',\n root_dir=model_directory, base...
[ "def _compress(self, model_directory: Text, model_name: Text) ->Tuple[Text, Text...\n", "\"\"\"docstring\"\"\"\n", "import tempfile\n", "dirpath = tempfile.mkdtemp()\n", "base_name = self._tar_name(model_name, include_extension=False)\n", "tar_name = shutil.make_archive(os.path.join(dirpath, base_name), '...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_1: AbstractEventLoop, VAR_2: float=0.1) ->AbstractEventLoop:...\n", "logging.info('Enabling coroutine debugging. Loop id {}.'.format(id(asyncio.\n get_event_loop())))\n", "VAR_1.set_debug(True)\n", "VAR_1.slow_callback_duration = VAR_2\n", "warnings.simplefilter('always', ResourceWarning)...
[ "def enable_async_loop_debugging(event_loop: AbstractEventLoop,...\n", "logging.info('Enabling coroutine debugging. Loop id {}.'.format(id(asyncio.\n get_event_loop())))\n", "event_loop.set_debug(True)\n", "event_loop.slow_callback_duration = slow_callback_duration\n", "warnings.simplefilter('always', Re...
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_75(self, VAR_2, VAR_174=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_176 = None\n", "VAR_177 = self.form_class(VAR_2.POST.copy())\n", "if VAR_177.is_valid():\n", "VAR_304 = VAR_177.cleaned_data['username']\n", "return self.handle_not_logged_in(VAR_2, VAR_176, VAR_177)\n", "VAR_305 = VAR_177...
[ "def post(self, request, api_version=None):...\n", "\"\"\"docstring\"\"\"\n", "error = None\n", "form = self.form_class(request.POST.copy())\n", "if form.is_valid():\n", "username = form.cleaned_data['username']\n", "return self.handle_not_logged_in(request, error, form)\n", "password = form.cleaned_d...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", ...
[ "def FUNC_27(self, VAR_27):...\n", "VAR_73 = self.playlistdb.deletePlaylist(VAR_27, self.getUserId(),\n override_owner=False)\n", "if VAR_73 == 'success':\n", "return VAR_73\n" ]
[ "def api_deleteplaylist(self, playlistid):...\n", "res = self.playlistdb.deletePlaylist(playlistid, self.getUserId(),\n override_owner=False)\n", "if res == 'success':\n", "return res\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_61(VAR_2, VAR_39, **VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_310, VAR_375 in VAR_6.items():\n", "VAR_2.session['callback'][VAR_39][VAR_310] = VAR_375\n" ]
[ "def update_callback(request, cbString, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "for key, value in kwargs.items():\n", "request.session['callback'][cbString][key] = value\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Assign'" ]
[ "async def FUNC_5(self, VAR_15: str) ->None:...\n", "\"\"\"docstring\"\"\"\n", "await self.store.mark_remote_user_device_cache_as_stale(VAR_15)\n", "VAR_0.exception('Failed to resync device for %s', VAR_15)\n", "if self.config.worker_app:\n", "await self._user_device_resync(VAR_27=sender)\n", "await sel...
[ "async def _resync_device(self, sender: str) ->None:...\n", "\"\"\"docstring\"\"\"\n", "await self.store.mark_remote_user_device_cache_as_stale(sender)\n", "logger.exception('Failed to resync device for %s', sender)\n", "if self.config.worker_app:\n", "await self._user_device_resync(user_id=sender)\n", ...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Docstring", "Expr'", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "self.assertFormfield(models.Album, 'cover_art', widgets.AdminFileWidget)\n" ]
[ "def testFileField(self):...\n", "self.assertFormfield(models.Album, 'cover_art', widgets.AdminFileWidget)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_65(self):...\n", "\"\"\"docstring\"\"\"\n", "return '/app/Form/{doctype}/{name}'.format(VAR_2=self.doctype, VAR_3=self.name)\n" ]
[ "def get_url(self):...\n", "\"\"\"docstring\"\"\"\n", "return '/app/Form/{doctype}/{name}'.format(doctype=self.doctype, name=self.name\n )\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_43(self, VAR_53, VAR_54):...\n", "return VAR_53 * VAR_54\n" ]
[ "def multiply(self, a, b):...\n", "return a * b\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@defer.inlineCallbacks...\n", "VAR_11 = self.mock_handler.get_displayname\n", "VAR_11.return_value = defer.succeed('Frank')\n", "VAR_12, VAR_13 = yield self.mock_resource.trigger('GET', \n '/profile/%s/displayname' % VAR_0, None)\n", "self.assertEquals(200, VAR_12)\n", "self.assertEquals({'displayname...
[ "@defer.inlineCallbacks...\n", "mocked_get = self.mock_handler.get_displayname\n", "mocked_get.return_value = defer.succeed('Frank')\n", "code, response = yield self.mock_resource.trigger('GET', \n '/profile/%s/displayname' % myid, None)\n", "self.assertEquals(200, code)\n", "self.assertEquals({'displa...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_0.route('/create/runfile', methods=['GET', 'POST'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_50 = os.path.join(VAR_0.config['UPLOAD_FOLDER'], 'runfile.py')\n", "if request.method == 'POST':\n", "VAR_89 = request.form.get('runfile-data')\n", "return render_template('runfile.html', title='Runfile')\n", ...
[ "@gui.route('/create/runfile', methods=['GET', 'POST'])...\n", "\"\"\"docstring\"\"\"\n", "runfile_path = os.path.join(gui.config['UPLOAD_FOLDER'], 'runfile.py')\n", "if request.method == 'POST':\n", "runfile_data = request.form.get('runfile-data')\n", "return render_template('runfile.html', title='Runfil...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_39(self):...\n", "VAR_14 = self._makeOne()\n", "VAR_15 = VAR_14.createErrorInfo(AttributeError('nonesuch'), (12, 3))\n", "self.assertTrue(VAR_15.type is AttributeError)\n", "self.assertEqual(VAR_15.__allow_access_to_unprotected_subobjects__, 1)\n" ]
[ "def test_createErrorInfo_returns_unrestricted_object(self):...\n", "context = self._makeOne()\n", "info = context.createErrorInfo(AttributeError('nonesuch'), (12, 3))\n", "self.assertTrue(info.type is AttributeError)\n", "self.assertEqual(info.__allow_access_to_unprotected_subobjects__, 1)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def __call__(self, VAR_10, VAR_13, VAR_14, VAR_12):...\n", "VAR_11 = VAR_13.get('request')\n", "VAR_10 = self.traverse(VAR_10, VAR_11, VAR_12)\n", "if VAR_14 is False:\n", "return VAR_10\n", "if getattr(VAR_10, '__call__', VAR_0) is not VAR_0 or isinstance(VAR_10, type):\n", "return VAR_10()\n", "ret...
[ "def __call__(self, base, econtext, call, path_items):...\n", "request = econtext.get('request')\n", "base = self.traverse(base, request, path_items)\n", "if call is False:\n", "return base\n", "if getattr(base, '__call__', _marker) is not _marker or isinstance(base, type):\n", "return base()\n", "ret...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def __init__(self, VAR_14: FavaLedger) ->None:...\n", "super().__init__(VAR_14)\n", "self.lock = threading.Lock()\n" ]
[ "def __init__(self, ledger: FavaLedger) ->None:...\n", "super().__init__(ledger)\n", "self.lock = threading.Lock()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "def FUNC_8(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(self\n .doctype)\n" ]
[ "def raise_no_permission_to(self, perm_type):...\n", "\"\"\"docstring\"\"\"\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(self\n .doctype)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'" ]
[ "def FUNC_56():...\n", "VAR_3 = request.args(0)\n", "from gluon.serializers import loads_json\n", "if not session.plugins:\n", "return dict(VAR_94=session.plugins['results'], VAR_3=request.args(0))\n", "VAR_199 = urlopen('http://www.web2pyslices.com/' +\n 'public/api.json/action/list/content/Package?pa...
[ "def plugins():...\n", "app = request.args(0)\n", "from gluon.serializers import loads_json\n", "if not session.plugins:\n", "return dict(plugins=session.plugins['results'], app=request.args(0))\n", "rawlist = urlopen('http://www.web2pyslices.com/' +\n 'public/api.json/action/list/content/Package?packa...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "ImportFrom'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_14(self, VAR_18, VAR_19=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_48 = []\n", "if not VAR_19:\n", "VAR_19 = self.meta.get_field(VAR_18)\n", "for VAR_21 in self.get(VAR_19.fieldname):\n", "VAR_21.db_update()\n", "if VAR_19.options in (self.flags.ignore_children_type or []):\n", "VAR_48....
[ "def update_child_table(self, fieldname, df=None):...\n", "\"\"\"docstring\"\"\"\n", "rows = []\n", "if not df:\n", "df = self.meta.get_field(fieldname)\n", "for d in self.get(df.fieldname):\n", "d.db_update()\n", "if df.options in (self.flags.ignore_children_type or []):\n", "rows.append(d.name)\n"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "For", "Expr'", "Condition", "Expr'", "Return'", "Condition", "Assign'", "Expr'", "Condition", "Expr'" ]
[ "def __call__(self, VAR_9):...\n", "if not re.compile('^\\\\w+$').match(VAR_9):\n", "return VAR_9, T('Invalid application name')\n", "if not request.vars.overwrite and os.path.exists(os.path.join(apath(VAR_122\n", "return VAR_9, T('Application exists already')\n", "return VAR_9, None\n" ]
[ "def __call__(self, value):...\n", "if not re.compile('^\\\\w+$').match(value):\n", "return value, T('Invalid application name')\n", "if not request.vars.overwrite and os.path.exists(os.path.join(apath(r=\n", "return value, T('Application exists already')\n", "return value, None\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_3, VAR_4):...\n", "return django.forms.CharField(widget=django.forms.Textarea, **options)\n" ]
[ "def create_multiline_field(self, field, options):...\n", "return django.forms.CharField(widget=django.forms.Textarea, **options)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_5(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.register_user('user', 'pass')\n", "VAR_10 = self.login('user', 'pass')\n", "VAR_11 = self.register_user('otheruser', 'pass')\n", "VAR_12 = self.login('otheruser', 'pass')\n", "VAR_18 = self.register_user('yetanotheruser', 'pass')\n", "...
[ "def test_sends_high_priority_for_atroom(self):...\n", "\"\"\"docstring\"\"\"\n", "user_id = self.register_user('user', 'pass')\n", "access_token = self.login('user', 'pass')\n", "other_user_id = self.register_user('otheruser', 'pass')\n", "other_access_token = self.login('otheruser', 'pass')\n", "yet_a...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_25.whitelist()...\n", "VAR_25.desk.form.run_method.runserverobj(VAR_3, VAR_4=docs, VAR_5=dt, VAR_6\n =dn, VAR_7=arg, VAR_8=args)\n" ]
[ "@frappe.whitelist()...\n", "frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn,\n arg=arg, args=args)\n" ]
[ 2, 2 ]
[ "Condition", "Expr'" ]
[ "def FUNC_69(self):...\n", "\"\"\"docstring\"\"\"\n", "return hashlib.sha224(get_datetime_str(self.creation).encode()).hexdigest()\n" ]
[ "def get_signature(self):...\n", "\"\"\"docstring\"\"\"\n", "return hashlib.sha224(get_datetime_str(self.creation).encode()).hexdigest()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_29(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.ignore_permissions or frappe.flags.in_install:\n", "return\n", "if frappe.session.user == 'Administrator':\n", "return\n", "VAR_57 = self.get_permlevel_access()\n", "VAR_58 = self.meta.get_high_permlevel_fields()\n", "if VAR_58:\n"...
[ "def validate_higher_perm_levels(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.ignore_permissions or frappe.flags.in_install:\n", "return\n", "if frappe.session.user == 'Administrator':\n", "return\n", "has_access_to = self.get_permlevel_access()\n", "high_permlevel_fields = self.meta.get_hi...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "For", "Assign'", "Condition", "For", "Expr'" ]
[ "@VAR_1.route('/ajax/simulatemerge', methods=['POST'])...\n", "VAR_79 = VAR_32.get_json().get('Merge_books')\n", "if VAR_79:\n", "VAR_100 = calibre_db.get_book(VAR_79[0]).title\n", "return ''\n", "VAR_79.pop(0)\n", "if VAR_100:\n", "for VAR_15 in VAR_79:\n", "VAR_118 = []\n", "return json.dumps({'...
[ "@editbook.route('/ajax/simulatemerge', methods=['POST'])...\n", "vals = request.get_json().get('Merge_books')\n", "if vals:\n", "to_book = calibre_db.get_book(vals[0]).title\n", "return ''\n", "vals.pop(0)\n", "if to_book:\n", "for book_id in vals:\n", "from_book = []\n", "return json.dumps({'to'...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Condition", "For", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_3(VAR_2, VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "return toBoolean(VAR_2.GET.get(VAR_3, VAR_4))\n" ]
[ "def get_bool_or_default(request, name, default):...\n", "\"\"\"docstring\"\"\"\n", "return toBoolean(request.GET.get(name, default))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_62(VAR_95):...\n", "VAR_32 = re.compile('^plugin_' + VAR_96 + '(/.*|\\\\..*)?$')\n", "return [VAR_70 for VAR_70 in VAR_95 if VAR_70 and VAR_32.match(VAR_70)]\n" ]
[ "def filter_plugins(items):...\n", "regex = re.compile('^plugin_' + plugin + '(/.*|\\\\..*)?$')\n", "return [item for item in items if item and regex.match(item)]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_3, VAR_5):...\n", "if VAR_3['aggregate_function'] == 'count':\n", "VAR_32 = 'Count'\n", "VAR_33 = {'avg': 'Average', 'sum': 'Sum'}\n", "return VAR_32\n", "VAR_34 = VAR_5.get_label(VAR_3.aggregate_on)\n", "VAR_32 = _('{function} of {fieldlabel}').format(function=sql_fn_map[args.\n aggr...
[ "def get_group_by_column_label(args, meta):...\n", "if args['aggregate_function'] == 'count':\n", "label = 'Count'\n", "sql_fn_map = {'avg': 'Average', 'sum': 'Sum'}\n", "return label\n", "aggregate_on_label = meta.get_label(args.aggregate_on)\n", "label = _('{function} of {fieldlabel}').format(function...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "@VAR_0.route('/shelf/massadd/<int:shelf_id>')...\n", "VAR_0 = ub.session.query(ub.Shelf).filter(ub.Shelf.id == VAR_3).first()\n", "if VAR_0 is None:\n", "VAR_1.error('Invalid shelf specified: %s', VAR_3)\n", "if not FUNC_0(VAR_0):\n", "flash(_(u'Invalid shelf specified'), category='error')\n", "VAR_1.w...
[ "@shelf.route('/shelf/massadd/<int:shelf_id>')...\n", "shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()\n", "if shelf is None:\n", "log.error('Invalid shelf specified: %s', shelf_id)\n", "if not check_shelf_edit_permissions(shelf):\n", "flash(_(u'Invalid shelf specified'), catego...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Return'", "Expr'", "Assign'", "Expr'", "Return'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Assign'", "For", "Condition", "Expr'", "For", "Expr'", "Assign'", "Co...
[ "def FUNC_63(VAR_121=True, VAR_24=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_24:\n", "VAR_24 = VAR_1.sites_path\n", "VAR_189 = FUNC_69(os.path.join(VAR_24, 'apps.txt'), VAR_126=True)\n", "if VAR_121:\n", "for VAR_219 in FUNC_69(os.path.join(VAR_1.site_path, 'apps.txt')):\n", "if 'frappe' in ...
[ "def get_all_apps(with_internal_apps=True, sites_path=None):...\n", "\"\"\"docstring\"\"\"\n", "if not sites_path:\n", "sites_path = local.sites_path\n", "apps = get_file_items(os.path.join(sites_path, 'apps.txt'), raise_not_found\n =True)\n", "if with_internal_apps:\n", "for app in get_file_items(os...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Condition", "For", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_19(VAR_33):...\n", "import stat\n", "from datetime import datetime\n", "from octoprint.util.tz import UTC_TZ\n", "VAR_88 = 0\n", "for VAR_9 in VAR_33:\n", "if VAR_88:\n", "VAR_138 = os.stat(VAR_9)\n", "VAR_88 = datetime.fromtimestamp(VAR_88).replace(microsecond=0).replace(tzinfo\n =UTC_...
[ "def _compute_date(files):...\n", "import stat\n", "from datetime import datetime\n", "from octoprint.util.tz import UTC_TZ\n", "max_timestamp = 0\n", "for path in files:\n", "if max_timestamp:\n", "s = os.stat(path)\n", "max_timestamp = datetime.fromtimestamp(max_timestamp).replace(microsecond=0\n ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Assign'" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "FUNC_7(VAR_2)\n", "VAR_7 = VAR_7 or VAR_350('webindex')\n", "return HttpResponseRedirect(VAR_7)\n" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "switch_active_group(request)\n", "url = url or reverse('webindex')\n", "return HttpResponseRedirect(url)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Return'" ]
[ "def __setattr__(self, VAR_46, VAR_105):...\n", "self[VAR_46] = VAR_105\n" ]
[ "def __setattr__(self, key, value):...\n", "self[key] = value\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_1(VAR_2, VAR_3, VAR_4, **VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_32 = frappe.get_doc(VAR_2, VAR_3)\n", "VAR_32.unlock()\n", "getattr(VAR_32, VAR_4)(**kwargs)\n", "frappe.db.rollback()\n", "if frappe.local.message_log:\n", "VAR_87 = json.loads(frappe.local.message_log[-1]).get('message...
[ "def execute_action(doctype, name, action, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "doc = frappe.get_doc(doctype, name)\n", "doc.unlock()\n", "getattr(doc, action)(**kwargs)\n", "frappe.db.rollback()\n", "if frappe.local.message_log:\n", "msg = json.loads(frappe.local.message_log[-1]).get('messag...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "VAR_11 = FauxObject('rc')\n", "VAR_12 = FauxRoot('root').__of__(VAR_11)\n", "VAR_13 = FauxContainer('folder').__of__(VAR_12)\n", "VAR_14 = FauxObject('object').__of__(VAR_13)\n", "return VAR_11, VAR_12, VAR_13, VAR_14\n" ]
[ "def _makeTree(self):...\n", "rc = FauxObject('rc')\n", "root = FauxRoot('root').__of__(rc)\n", "folder = FauxContainer('folder').__of__(root)\n", "object = FauxObject('object').__of__(folder)\n", "return rc, root, folder, object\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_10(self) ->None:...\n", "VAR_16 = self.package_dir / 'models'\n", "VAR_16.mkdir()\n", "VAR_17 = VAR_16 / '__init__.py'\n", "VAR_18 = []\n", "VAR_19 = self.env.get_template('types.py')\n", "VAR_20 = VAR_16 / 'types.py'\n", "VAR_20.write_text(VAR_19.render())\n", "VAR_21 = self.env.get_templ...
[ "def _build_models(self) ->None:...\n", "models_dir = self.package_dir / 'models'\n", "models_dir.mkdir()\n", "models_init = models_dir / '__init__.py'\n", "imports = []\n", "types_template = self.env.get_template('types.py')\n", "types_path = models_dir / 'types.py'\n", "types_path.write_text(types_t...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Expr'", "For", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_11(self):...\n", "if not self.json:\n", "self.json = '{}'\n" ]
[ "def update_report_json(self):...\n", "if not self.json:\n", "self.json = '{}'\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'" ]
[ "def FUNC_16(VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "VAR_41 = example_pb2.Example()\n", "for feature_name, feature_list in VAR_19.items():\n", "if not isinstance(feature_list, list):\n", "return VAR_41.SerializeToString()\n", "if isinstance(feature_list[0], float):\n", "VAR_41.features.feature[fea...
[ "def _create_example_string(example_dict):...\n", "\"\"\"docstring\"\"\"\n", "example = example_pb2.Example()\n", "for feature_name, feature_list in example_dict.items():\n", "if not isinstance(feature_list, list):\n", "return example.SerializeToString()\n", "if isinstance(feature_list[0], float):\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_17(self):...\n", "self.assert_expected(self.folder.t, 'CheckPathNothing.html')\n" ]
[ "def testPathNothing(self):...\n", "self.assert_expected(self.folder.t, 'CheckPathNothing.html')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@app.route('/user/edit', methods=['GET', 'POST'])...\n", "VAR_9 = forms.UserForm()\n", "if VAR_9.validate_on_submit():\n", "VAR_31 = get_db()\n", "VAR_9.username.data = current_user.username\n", "VAR_31.update({'username': VAR_9.username.data, 'hashed_password':\n generate_password_hash(VAR_9.password...
[ "@app.route('/user/edit', methods=['GET', 'POST'])...\n", "form = forms.UserForm()\n", "if form.validate_on_submit():\n", "db = get_db()\n", "form.username.data = current_user.username\n", "db.update({'username': form.username.data, 'hashed_password':\n generate_password_hash(form.password.data)}, doc_...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Return'", "Expr'", "Return'" ]
[ "import os\n", "from ConfigParser import ConfigParser, NoSectionError, NoOptionError\n", "from swift.common.memcached import MemcacheRing\n", "\"\"\"\n Caching middleware that manages caching in swift.\n \"\"\"\n", "def __init__(self, VAR_2, VAR_3):...\n", "self.app = VAR_2\n", "self.memcache_serv...
[ "import os\n", "from ConfigParser import ConfigParser, NoSectionError, NoOptionError\n", "from swift.common.memcached import MemcacheRing\n", "\"\"\"\n Caching middleware that manages caching in swift.\n \"\"\"\n", "def __init__(self, app, conf):...\n", "self.app = app\n", "self.memcache_servers =...
[ 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 5, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@FUNC_0...\n", "return RegistrationHandler(self)\n" ]
[ "@cache_in_self...\n", "return RegistrationHandler(self)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "import re\n", "from django.template.base import Token, TokenType\n", "import pytest\n", "from django_unicorn.components import UnicornView\n", "from django_unicorn.templatetags.unicorn import unicorn\n", "from django_unicorn.utils import generate_checksum\n", "from example.coffee.models import Flavor\n...
[ "import re\n", "from django.template.base import Token, TokenType\n", "import pytest\n", "from django_unicorn.components import UnicornView\n", "from django_unicorn.templatetags.unicorn import unicorn\n", "from django_unicorn.utils import generate_checksum\n", "from example.coffee.models import Flavor\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, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "...
[ "@override_settings(LOGIN_URL='/login/')...\n", "VAR_3 = self.client.get('/password_change/done/')\n", "self.assertEqual(VAR_3.status_code, 302)\n", "self.assertURLEqual(VAR_3.url, '/login/?next=/password_change/done/')\n" ]
[ "@override_settings(LOGIN_URL='/login/')...\n", "response = self.client.get('/password_change/done/')\n", "self.assertEqual(response.status_code, 302)\n", "self.assertURLEqual(response.url, '/login/?next=/password_change/done/')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_94, VAR_218, VAR_219={}):...\n", "self.config = configparser.ConfigParser(VAR_219)\n", "self.config.read(VAR_94)\n", "if not self.config.has_section(VAR_218):\n", "self.config.add_section(VAR_218)\n", "self.section = VAR_218\n", "self.filename = VAR_94\n" ]
[ "def __init__(self, filename, section, default_values={}):...\n", "self.config = configparser.ConfigParser(default_values)\n", "self.config.read(filename)\n", "if not self.config.has_section(section):\n", "self.config.add_section(section)\n", "self.section = section\n", "self.filename = filename\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_26(VAR_57, VAR_58):...\n", "if VAR_57 == 'tab':\n", "return VAR_58 != 'timelapse' or VAR_51\n", "return True\n" ]
[ "def default_template_filter(template_type, template_key):...\n", "if template_type == 'tab':\n", "return template_key != 'timelapse' or enable_timelapse\n", "return True\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_21(VAR_9, VAR_5, VAR_10):...\n", "VAR_38 = calibre_db.session.query(db.Publishers).filter(db.Publishers.id ==\n VAR_5).first()\n", "if VAR_38:\n", "VAR_63, VAR_68, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, db.\n Books.publishers.any(db.Publishers.id == VAR_5), [db.Series.name,\n ...
[ "def render_publisher_books(page, book_id, order):...\n", "publisher = calibre_db.session.query(db.Publishers).filter(db.Publishers.id ==\n book_id).first()\n", "if publisher:\n", "entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books,\n db.Books.publishers.any(db.Publishers.id == bo...
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_153(VAR_114):...\n", "def FUNC_118(*VAR_9, **VAR_13):...\n", "VAR_431, VAR_432, VAR_141 = self.basic()\n", "VAR_141 = VAR_141 or self.user\n", "VAR_433 = VAR_145\n", "if callable(VAR_433):\n", "VAR_433 = VAR_433()\n", "if VAR_433:\n", "if not VAR_141:\n", "if callable(VAR_144):\n", "if...
[ "def decorator(action):...\n", "def f(*a, **b):...\n", "basic_allowed, basic_accepted, user = self.basic()\n", "user = user or self.user\n", "login_required = requires_login\n", "if callable(login_required):\n", "login_required = login_required()\n", "if login_required:\n", "if not user:\n", "if c...
[ 0, 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'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Condition", "Assign'", "Return'", "Return'", "Expr'", "Assign'", "Ret...
[ "def FUNC_7(self, VAR_2):...\n", "self.add_change()\n", "return self.client.post(reverse('credits', VAR_3=self.get_kwargs()), {\n 'period': '', 'style': VAR_2, 'start_date': '2000-01-01', 'end_date':\n '2100-01-01'})\n" ]
[ "def get_credits(self, style):...\n", "self.add_change()\n", "return self.client.post(reverse('credits', kwargs=self.get_kwargs()), {\n 'period': '', 'style': style, 'start_date': '2000-01-01', 'end_date':\n '2100-01-01'})\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_5(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_3.func, ast.Name):\n", "VAR_11 = None\n", "if VAR_3.func.id == 'ObjectId':\n", "VAR_11 = \"('\" + VAR_3.args[0].s + \"')\"\n", "if VAR_3.func.id == 'datetime':\n", "if VAR_11:\n", "VAR_12 = []\n", "self.current_value = ...
[ "def visit_Call(self, node):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(node.func, ast.Name):\n", "expr = None\n", "if node.func.id == 'ObjectId':\n", "expr = \"('\" + node.args[0].s + \"')\"\n", "if node.func.id == 'datetime':\n", "if expr:\n", "values = []\n", "self.current_value = eval(no...
[ 0, 0, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 5 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "For", "Expr'", "Assign'" ]
[ "def FUNC_57(self, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3, VAR_136=VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_254 = self.table_user()\n", "VAR_56 = VAR_263.request\n", "VAR_139 = VAR_263.session\n", "if VAR_112 is VAR_3:\n", "VAR_112 = self.get_vars_next() or self.settings.reset_password_next\n...
[ "def confirm_registration(self, next=DEFAULT, onvalidation=DEFAULT, onaccept...\n", "\"\"\"docstring\"\"\"\n", "table_user = self.table_user()\n", "request = current.request\n", "session = current.session\n", "if next is DEFAULT:\n", "next = self.get_vars_next() or self.settings.reset_password_next\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", ...
[ "def FUNC_71(VAR_43, VAR_126=False):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_43, text_type):\n", "VAR_43 = VAR_43.encode('utf-8')\n", "if os.path.exists(VAR_43):\n", "return FUNC_1(f.read())\n", "if VAR_126:\n", "return None\n" ]
[ "def read_file(path, raise_not_found=False):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(path, text_type):\n", "path = path.encode('utf-8')\n", "if os.path.exists(path):\n", "return as_unicode(f.read())\n", "if raise_not_found:\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_17(self):...\n", "def FUNC_28(VAR_5):...\n", "VAR_26 = rest_framework.smart_urlquote\n", "rest_framework.smart_urlquote = FUNC_28\n", "assert rest_framework.smart_urlquote_wrapper('test') is None\n", "rest_framework.smart_urlquote = VAR_26\n" ]
[ "def test_smart_urlquote_wrapper_handles_value_error(self):...\n", "def mock_smart_urlquote(url):...\n", "old = rest_framework.smart_urlquote\n", "rest_framework.smart_urlquote = mock_smart_urlquote\n", "assert rest_framework.smart_urlquote_wrapper('test') is None\n", "rest_framework.smart_urlquote = old\...
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Assign'", "Assert'", "Assign'" ]
[ "@staticmethod...\n", "VAR_28 = urlparse(VAR_4.url)\n", "return {'http_host': VAR_4.host, 'server_port': VAR_28.port, 'script_name':\n VAR_4.path, 'get_data': VAR_4.args.copy(), 'post_data': VAR_4.form.copy\n (), 'https': 'on' if current_app.config.get('ONELOGIN_HTTPS') else 'off'}\n" ]
[ "@staticmethod...\n", "url_data = urlparse(req.url)\n", "return {'http_host': req.host, 'server_port': url_data.port, 'script_name':\n req.path, 'get_data': req.args.copy(), 'post_data': req.form.copy(),\n 'https': 'on' if current_app.config.get('ONELOGIN_HTTPS') else 'off'}\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "def FUNC_5(self, VAR_11, VAR_12, *VAR_6, **VAR_13):...\n", "VAR_11.write(util.read_input(VAR_12))\n", "assert not VAR_11._v_errors, 'Template errors: %s' % VAR_11._v_errors\n", "VAR_15 = util.read_output(VAR_12)\n", "if not isinstance(VAR_15, str):\n", "VAR_15 = str(VAR_15, 'utf-8')\n", "VAR_16 = VAR_1...
[ "def assert_expected_unicode(self, t, fname, *args, **kwargs):...\n", "t.write(util.read_input(fname))\n", "assert not t._v_errors, 'Template errors: %s' % t._v_errors\n", "expect = util.read_output(fname)\n", "if not isinstance(expect, str):\n", "expect = str(expect, 'utf-8')\n", "out = t(*args, **kwar...
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assert'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_13(VAR_0):...\n", "VAR_0.DEBUG = True\n", "VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentCalls2'\")\n", "VAR_7 = unicorn(None, VAR_6)\n", "VAR_8 = {}\n", "VAR_12 = VAR_7.render(VAR_8)\n", "assert '<script type=\"module\"' in VAR_12\n", "ass...
[ "def test_unicorn_render_calls_with_arg(settings):...\n", "settings.DEBUG = True\n", "token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentCalls2'\")\n", "unicorn_node = unicorn(None, token)\n", "context = {}\n", "html = unicorn_node.render(context)\n", "asse...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Assert'" ]
[ "def FUNC_1(self) ->dict:...\n", "VAR_32 = self.default_config()\n", "VAR_32['worker_app'] = 'synapse.app.generic_worker'\n", "VAR_32['worker_replication_host'] = 'testserv'\n", "VAR_32['worker_replication_http_port'] = '8765'\n", "return VAR_32\n" ]
[ "def _get_worker_hs_config(self) ->dict:...\n", "config = self.default_config()\n", "config['worker_app'] = 'synapse.app.generic_worker'\n", "config['worker_replication_host'] = 'testserv'\n", "config['worker_replication_http_port'] = '8765'\n", "return config\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __call__(self, VAR_10, VAR_13, VAR_14, VAR_12):...\n", "VAR_11 = VAR_13.get('request')\n", "if VAR_12:\n", "VAR_10 = self.traverse(VAR_10, VAR_11, VAR_12)\n", "if VAR_14 is False:\n", "return VAR_10\n", "if getattr(VAR_10, '__call__', VAR_0) is not VAR_0 or callable(VAR_10):\n", "VAR_10 = render(...
[ "def __call__(self, base, econtext, call, path_items):...\n", "request = econtext.get('request')\n", "if path_items:\n", "base = self.traverse(base, request, path_items)\n", "if call is False:\n", "return base\n", "if getattr(base, '__call__', _marker) is not _marker or callable(base):\n", "base = ren...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'" ]
[ "__version__ = '4.6.4'\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "import os\n", "VAR_0 = __path__[0]\n", "VAR_1 = os.path.join(VAR_0, 'includes')\n", "VAR_2 = [VAR_1, VAR_0]\n", "for name in os.listdir(VAR_1):\n", "VAR_3 = os.path.join(VAR_1, name)\n", "return VAR_2\n", "if os.path.is...
[ "__version__ = '4.6.4'\n", "def get_include():...\n", "\"\"\"docstring\"\"\"\n", "import os\n", "lxml_path = __path__[0]\n", "include_path = os.path.join(lxml_path, 'includes')\n", "includes = [include_path, lxml_path]\n", "for name in os.listdir(include_path):\n", "path = os.path.join(include_path,...
[ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Assign'", "FunctionDef'", "Docstring", "Import'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_4 = self.get_success(self.store.create_e2e_room_keys_version('user_id',\n {'algorithm': 'rot13', 'auth_data': {}}))\n", "self.get_success(self.store.add_e2e_room_keys('user_id', VAR_4, [('room',\n 'session', VAR_0)]))\n", "VAR_5 = self.get_success(self.store.create_e2e_roo...
[ "def test_room_keys_version_delete(self):...\n", "version1 = self.get_success(self.store.create_e2e_room_keys_version(\n 'user_id', {'algorithm': 'rot13', 'auth_data': {}}))\n", "self.get_success(self.store.add_e2e_room_keys('user_id', version1, [('room',\n 'session', room_key)]))\n", "version2 = self.g...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_7(VAR_1):...\n", "VAR_20.throw(_('Invalid Search Field {0}').format(VAR_1), VAR_20.DataError)\n" ]
[ "def _raise_exception(searchfield):...\n", "frappe.throw(_('Invalid Search Field {0}').format(searchfield), frappe.\n DataError)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]