lines
sequencelengths
1
383
raw_lines
sequencelengths
1
383
label
sequencelengths
1
383
type
sequencelengths
1
383
[ "@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n", "return VAR_45 + 2\n" ]
[ "@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n", "return x + 2\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __init__(self, VAR_59, VAR_43=None, **VAR_20):...\n", "self.renderer = VAR_59\n", "self.links = {}\n", "self.footnotes = {}\n", "self.footnote_index = 0\n", "if not VAR_43:\n", "VAR_43 = self.grammar_class()\n", "VAR_20.update(self.renderer.options)\n", "if VAR_20.get('hard_wrap'):\n", "VAR_43.hard_wrap()\n", "self.rules = VAR_43\n", "self._in_link = False\n", "self._in_footnote = False\n", "self._parse_inline_html = VAR_20.get('parse_inline_html')\n" ]
[ "def __init__(self, renderer, rules=None, **kwargs):...\n", "self.renderer = renderer\n", "self.links = {}\n", "self.footnotes = {}\n", "self.footnote_index = 0\n", "if not rules:\n", "rules = self.grammar_class()\n", "kwargs.update(self.renderer.options)\n", "if kwargs.get('hard_wrap'):\n", "rules.hard_wrap()\n", "self.rules = rules\n", "self._in_link = False\n", "self._in_footnote = False\n", "self._parse_inline_html = kwargs.get('parse_inline_html')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_19(self):...\n", "VAR_26 = np.array([[1], [2]])\n", "VAR_31 = os.path.join(test.get_temp_dir(), 'input.npz')\n", "np.savez(VAR_31, VAR_53=x0)\n", "VAR_27 = np.ones([2, 10])\n", "VAR_20 = 'x0=' + VAR_31 + '[a]'\n", "VAR_21 = 'x0=np.ones([2,10])'\n", "VAR_30 = saved_model_cli.load_inputs_from_input_arg_string(VAR_20, VAR_21, '')\n", "self.assertTrue(np.all(VAR_30['x0'] == VAR_27))\n" ]
[ "def testInputParserBothDuplicate(self):...\n", "x0 = np.array([[1], [2]])\n", "input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n", "np.savez(input_path, a=x0)\n", "x1 = np.ones([2, 10])\n", "input_str = 'x0=' + input_path + '[a]'\n", "input_expr_str = 'x0=np.ones([2,10])'\n", "feed_dict = saved_model_cli.load_inputs_from_input_arg_string(input_str,\n input_expr_str, '')\n", "self.assertTrue(np.all(feed_dict['x0'] == x1))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_24(self, VAR_1):...\n", "VAR_5 = VAR_1.MagicMock()\n", "VAR_26 = VAR_1.MagicMock()\n", "VAR_23 = oai.Schema.construct(type='string', schema_format=mocker.MagicMock())\n", "VAR_35 = VAR_1.patch(f'{VAR_0}.StringProperty')\n", "from openapi_python_client.parser.properties import _string_based_property\n", "VAR_4 = VAR_29(VAR_5=name, VAR_26=required, VAR_23=data)\n", "VAR_35.assert_called_once_with(VAR_5=name, VAR_26=required, pattern=None,\n default=None)\n", "assert VAR_4 == VAR_35.return_value\n", "VAR_35.reset_mock()\n", "VAR_23.default = VAR_1.MagicMock()\n", "VAR_23.pattern = VAR_1.MagicMock()\n", "VAR_29(VAR_5=name, VAR_26=required, VAR_23=data)\n", "VAR_35.assert_called_once_with(VAR_5=name, VAR_26=required, pattern=data.\n pattern, default=data.default)\n" ]
[ "def test__string_based_property_unsupported_format(self, mocker):...\n", "name = mocker.MagicMock()\n", "required = mocker.MagicMock()\n", "data = oai.Schema.construct(type='string', schema_format=mocker.MagicMock())\n", "StringProperty = mocker.patch(f'{MODULE_NAME}.StringProperty')\n", "from openapi_python_client.parser.properties import _string_based_property\n", "p = _string_based_property(name=name, required=required, data=data)\n", "StringProperty.assert_called_once_with(name=name, required=required,\n pattern=None, default=None)\n", "assert p == StringProperty.return_value\n", "StringProperty.reset_mock()\n", "data.default = mocker.MagicMock()\n", "data.pattern = mocker.MagicMock()\n", "_string_based_property(name=name, required=required, data=data)\n", "StringProperty.assert_called_once_with(name=name, required=required,\n pattern=data.pattern, default=data.default)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Assign'", "Expr'", "Assert'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_5):...\n", "async def FUNC_7(VAR_1, VAR_4):...\n", "async def FUNC_6(VAR_6):...\n", "VAR_7 = await VAR_4(VAR_6)\n", "VAR_11 = VAR_5.get(ex.status)\n", "return FUNC_6\n", "VAR_11 = VAR_5.get(VAR_7.status)\n", "if VAR_11 is None:\n", "if VAR_11 is None:\n", "return await FUNC_3(VAR_6, ex)\n", "return await VAR_11(VAR_6, ex)\n", "return VAR_7\n", "return await VAR_11(VAR_6, VAR_7)\n" ]
[ "def error_pages(overrides):...\n", "async def middleware(app, handler):...\n", "async def middleware_handler(request):...\n", "response = await handler(request)\n", "override = overrides.get(ex.status)\n", "return middleware_handler\n", "override = overrides.get(response.status)\n", "if override is None:\n", "if override is None:\n", "return await handle_any(request, ex)\n", "return await override(request, ex)\n", "return response\n", "return await override(request, response)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "AsyncFunctionDef'", "AsyncFunctionDef'", "Assign'", "Assign'", "Return'", "Assign'", "Condition", "Condition", "Return'", "Return'", "Return'", "Return'" ]
[ "def FUNC_15(self, VAR_26: str, *, VAR_29: Optional[Type[Any]]=None, VAR_13:...\n", "return self.api_route(VAR_26=path, VAR_29=response_model, VAR_13=\n status_code, VAR_30=tags, VAR_31=dependencies, VAR_32=summary, VAR_33=\n description, VAR_34=response_description, VAR_35=responses, VAR_36=\n deprecated, VAR_37=['DELETE'], VAR_38=operation_id, VAR_16=\n response_model_include, VAR_17=response_model_exclude, VAR_18=\n response_model_by_alias, VAR_19=response_model_exclude_unset, VAR_20=\n response_model_exclude_defaults, VAR_21=response_model_exclude_none,\n VAR_39=include_in_schema, VAR_14=response_class, VAR_28=name, VAR_40=\n callbacks)\n" ]
[ "def delete(self, path: str, *, response_model: Optional[Type[Any]]=None,...\n", "return self.api_route(path=path, response_model=response_model, status_code\n =status_code, tags=tags, dependencies=dependencies, summary=summary,\n description=description, response_description=response_description,\n responses=responses, deprecated=deprecated, methods=['DELETE'],\n operation_id=operation_id, response_model_include=\n response_model_include, response_model_exclude=response_model_exclude,\n response_model_by_alias=response_model_by_alias,\n response_model_exclude_unset=response_model_exclude_unset,\n response_model_exclude_defaults=response_model_exclude_defaults,\n response_model_exclude_none=response_model_exclude_none,\n include_in_schema=include_in_schema, response_class=response_class,\n name=name, callbacks=callbacks)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@VAR_1.context_processor...\n", "\"\"\"docstring\"\"\"\n", "return dict(VAR_5=g.ledger)\n" ]
[ "@app.context_processor...\n", "\"\"\"docstring\"\"\"\n", "return dict(ledger=g.ledger)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_6(self, VAR_26='XXX ERROR MESSAGE NEEDED'):...\n", "self.errors.append(VAR_26)\n", "if self.strict:\n" ]
[ "def serializeError(self, data='XXX ERROR MESSAGE NEEDED'):...\n", "self.errors.append(data)\n", "if self.strict:\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition" ]
[ "def FUNC_0(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = saved_model_utils.get_saved_model_tag_sets(VAR_2)\n", "print('The given SavedModel contains the following tag-sets:')\n", "for VAR_3 in sorted(VAR_22):\n", "print('%r' % ', '.join(sorted(VAR_3)))\n" ]
[ "def _show_tag_sets(saved_model_dir):...\n", "\"\"\"docstring\"\"\"\n", "tag_sets = saved_model_utils.get_saved_model_tag_sets(saved_model_dir)\n", "print('The given SavedModel contains the following tag-sets:')\n", "for tag_set in sorted(tag_sets):\n", "print('%r' % ', '.join(sorted(tag_set)))\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "For", "Expr'" ]
[ "def FUNC_7(self) ->Sequence[GeneratorError]:...\n", "VAR_6 = []\n", "for collection in self.openapi.endpoint_collections_by_tag.values():\n", "VAR_6.extend(collection.parse_errors)\n", "VAR_6.extend(self.openapi.schemas.errors)\n", "return VAR_6\n" ]
[ "def _get_errors(self) ->Sequence[GeneratorError]:...\n", "errors = []\n", "for collection in self.openapi.endpoint_collections_by_tag.values():\n", "errors.extend(collection.parse_errors)\n", "errors.extend(self.openapi.schemas.errors)\n", "return errors\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_78(VAR_133, VAR_134, VAR_135):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils\n", "return frappe.utils.compare(VAR_133, VAR_134, VAR_135)\n" ]
[ "def compare(val1, condition, val2):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils\n", "return frappe.utils.compare(val1, condition, val2)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Return'" ]
[ "def FUNC_59(VAR_5, VAR_52):...\n", "VAR_5 = os.path.join(apath(VAR_3, VAR_122=request), VAR_5)\n", "if VAR_52 in read_file(VAR_5, 'r'):\n", "return True\n", "return False\n" ]
[ "def match(filename, keywords):...\n", "filename = os.path.join(apath(app, r=request), filename)\n", "if keywords in read_file(filename, 'r'):\n", "return True\n", "return False\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "@VAR_0.route('/jobs', methods=['GET', 'POST'])...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'POST':\n", "VAR_84['jobs_per_page'] = int(request.form.get('jobs-per-page'))\n", "VAR_51 = int(request.args.get('page')) if request.args.get('page'\n ) is not None else 0\n", "VAR_84['jobs_filter'] = {key: request.form.get(form_name) for key,\n form_name in zip(['status', 'application', 'backend'], ['job-status',\n 'job-application', 'job-backend'])}\n", "VAR_53 = VAR_84['jobs_per_page']\n", "VAR_92 = FUNC_58('/internal/jobs/length', 'get', VAR_73=session['jobs_filter'])\n", "flash(str(err), 'danger')\n", "return render_template('jobs.html', title='Jobs', VAR_93=jobs_info,\n backends=plugins['backends'], applications=plugins['applications'],\n VAR_91=number_of_pages, VAR_51=current_page, VAR_5=status_color)\n", "VAR_91 = int(VAR_92) // int(VAR_53) + 1\n", "return redirect(url_for('dashboard'))\n", "if VAR_51 >= VAR_91:\n", "return redirect(url_for('jobs_page', page=number_of_pages - 1))\n", "VAR_73 = VAR_84['jobs_filter'].copy()\n", "VAR_73.update({'recent': True, 'length': VAR_53, 'offset': VAR_51})\n", "VAR_93 = FUNC_58('/internal/jobs', 'get', VAR_73=params)\n" ]
[ "@gui.route('/jobs', methods=['GET', 'POST'])...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'POST':\n", "session['jobs_per_page'] = int(request.form.get('jobs-per-page'))\n", "current_page = int(request.args.get('page')) if request.args.get('page'\n ) is not None else 0\n", "session['jobs_filter'] = {key: request.form.get(form_name) for key,\n form_name in zip(['status', 'application', 'backend'], ['job-status',\n 'job-application', 'job-backend'])}\n", "jobs_per_page = session['jobs_per_page']\n", "jobs_length = query_internal_api('/internal/jobs/length', 'get', params=\n session['jobs_filter'])\n", "flash(str(err), 'danger')\n", "return render_template('jobs.html', title='Jobs', jobs_info=jobs_info,\n backends=plugins['backends'], applications=plugins['applications'],\n number_of_pages=number_of_pages, current_page=current_page,\n status_color=status_color)\n", "number_of_pages = int(jobs_length) // int(jobs_per_page) + 1\n", "return redirect(url_for('dashboard'))\n", "if current_page >= number_of_pages:\n", "return redirect(url_for('jobs_page', page=number_of_pages - 1))\n", "params = session['jobs_filter'].copy()\n", "params.update({'recent': True, 'length': jobs_per_page, 'offset': current_page}\n )\n", "jobs_info = query_internal_api('/internal/jobs', 'get', params=params)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Return'", "Condition", "Return'", "Assign'", "Expr'", "Assign'" ]
[ "@contextlib.contextmanager...\n", "VAR_1, VAR_2 = StringIO(), StringIO()\n", "VAR_3, VAR_4 = VAR_8.stdout, VAR_8.stderr\n", "VAR_8.stdout, VAR_8.stderr = VAR_1, VAR_2\n", "VAR_8.stdout, VAR_8.stderr = VAR_3, VAR_4\n", "yield VAR_8.stdout, VAR_8.stderr\n" ]
[ "@contextlib.contextmanager...\n", "new_out, new_err = StringIO(), StringIO()\n", "old_out, old_err = sys.stdout, sys.stderr\n", "sys.stdout, sys.stderr = new_out, new_err\n", "sys.stdout, sys.stderr = old_out, old_err\n", "yield sys.stdout, sys.stderr\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "async def FUNC_32(self, VAR_5, VAR_11, VAR_38, VAR_39, VAR_17):...\n", "VAR_101 = await self.auth.check_host_in_room(VAR_11, VAR_5)\n", "if not VAR_101:\n", "VAR_17 = min(VAR_17, 20)\n", "VAR_65 = await self.store.get_missing_events(VAR_11=room_id, VAR_38=\n earliest_events, VAR_39=latest_events, VAR_17=limit)\n", "VAR_65 = await filter_events_for_server(self.storage, VAR_5, VAR_65)\n", "return VAR_65\n" ]
[ "async def on_get_missing_events(self, origin, room_id, earliest_events,...\n", "in_room = await self.auth.check_host_in_room(room_id, origin)\n", "if not in_room:\n", "limit = min(limit, 20)\n", "missing_events = await self.store.get_missing_events(room_id=room_id,\n earliest_events=earliest_events, latest_events=latest_events, limit=limit)\n", "missing_events = await filter_events_for_server(self.storage, origin,\n missing_events)\n", "return missing_events\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_11():...\n", "\"\"\"docstring\"\"\"\n", "from frappe.utils import get_traceback\n", "return FUNC_11()\n" ]
[ "def get_traceback():...\n", "\"\"\"docstring\"\"\"\n", "from frappe.utils import get_traceback\n", "return get_traceback()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Return'" ]
[ "@VAR_0.route('/logout', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "if current_user.is_authenticated:\n", "logout_user()\n", "return redirect(url_for('login'))\n" ]
[ "@gui.route('/logout', methods=['GET'])...\n", "\"\"\"docstring\"\"\"\n", "if current_user.is_authenticated:\n", "logout_user()\n", "return redirect(url_for('login'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Expr'", "Return'" ]
[ "@pyqtSlot()...\n", "\"\"\"docstring\"\"\"\n", "self.adopted_downloads -= 1\n", "log.downloads.debug('Adopted download destroyed, {} left.'.format(self.\n adopted_downloads))\n", "assert self.adopted_downloads >= 0\n", "if self.adopted_downloads == 0:\n", "self.deleteLater()\n" ]
[ "@pyqtSlot()...\n", "\"\"\"docstring\"\"\"\n", "self.adopted_downloads -= 1\n", "log.downloads.debug('Adopted download destroyed, {} left.'.format(self.\n adopted_downloads))\n", "assert self.adopted_downloads >= 0\n", "if self.adopted_downloads == 0:\n", "self.deleteLater()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "AugAssign'", "Expr'", "Assert'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "self.visit(VAR_3.value)\n", "self.current_value += '.' + VAR_3.attr\n" ]
[ "def visit_Attribute(self, node):...\n", "\"\"\"docstring\"\"\"\n", "self.visit(node.value)\n", "self.current_value += '.' + node.attr\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "AugAssign'" ]
[ "def FUNC_6(VAR_10):...\n", "return os.path.join(VAR_4, VAR_10)\n" ]
[ "def _get_obj_absolute_path(obj_path):...\n", "return os.path.join(DATAROOT, obj_path)\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "@staticmethod...\n", "VAR_24 = VAR_1.s3_access_key\n", "VAR_25 = VAR_1.s3_secret_key\n", "VAR_26 = boto.s3.connection.OrdinaryCallingFormat()\n", "return boto.s3.connection.S3Connection(aws_access_key_id=access,\n aws_secret_access_key=secret, is_secure=False, calling_format=calling,\n port=FLAGS.s3_port, host=FLAGS.s3_host)\n" ]
[ "@staticmethod...\n", "access = FLAGS.s3_access_key\n", "secret = FLAGS.s3_secret_key\n", "calling = boto.s3.connection.OrdinaryCallingFormat()\n", "return boto.s3.connection.S3Connection(aws_access_key_id=access,\n aws_secret_access_key=secret, is_secure=False, calling_format=calling,\n port=FLAGS.s3_port, host=FLAGS.s3_host)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "VAR_19 = VAR_2.session['connector'].server_id\n", "VAR_64 = FUNC_13(VAR_2, VAR_6, VAR_19=server_id, VAR_8=conn)\n", "if VAR_64 is None:\n", "VAR_92, VAR_16 = VAR_64\n", "VAR_16 = VAR_16 and float(VAR_16) or 0.9\n", "VAR_60 = webgateway_cache.getSplitChannelImage(VAR_2, VAR_19, VAR_92,\n VAR_22, VAR_23)\n", "if VAR_60 is None:\n", "VAR_60 = VAR_92.renderSplitChannel(VAR_22, VAR_23, VAR_98=compress_quality)\n", "VAR_61 = HttpResponse(VAR_60, content_type='image/jpeg')\n", "if VAR_60 is None:\n", "return VAR_61\n", "webgateway_cache.setSplitChannelImage(VAR_2, VAR_19, VAR_92, VAR_22, VAR_23,\n VAR_60)\n" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "server_id = request.session['connector'].server_id\n", "pi = _get_prepared_image(request, iid, server_id=server_id, conn=conn)\n", "if pi is None:\n", "img, compress_quality = pi\n", "compress_quality = compress_quality and float(compress_quality) or 0.9\n", "jpeg_data = webgateway_cache.getSplitChannelImage(request, server_id, img, z, t\n )\n", "if jpeg_data is None:\n", "jpeg_data = img.renderSplitChannel(z, t, compression=compress_quality)\n", "rsp = HttpResponse(jpeg_data, content_type='image/jpeg')\n", "if jpeg_data is None:\n", "return rsp\n", "webgateway_cache.setSplitChannelImage(request, server_id, img, z, t, jpeg_data)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Expr'" ]
[ "def FUNC_8(VAR_19):...\n", "if VAR_2:\n", "return 'file://' + FUNC_10(VAR_19)\n", "return url_for('.get_object_src_http', VAR_20=object_path)\n" ]
[ "def _get_object_src_uri(object_path):...\n", "if LOCAL_OBJ_URI:\n", "return 'file://' + _get_obj_absolute_path(object_path)\n", "return url_for('.get_object_src_http', obj_path=object_path)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1():...\n", "\"\"\"docstring\"\"\"\n", "VAR_23 = {'installer': {'name': 'pip', 'version': pip.__version__},\n 'python': platform.python_version(), 'implementation': {'name':\n platform.python_implementation()}}\n", "if VAR_23['implementation']['name'] == 'CPython':\n", "VAR_23['implementation']['version'] = platform.python_version()\n", "if VAR_23['implementation']['name'] == 'PyPy':\n", "if sys.platform.startswith('linux'):\n", "if sys.pypy_version_info.releaselevel == 'final':\n", "if VAR_23['implementation']['name'] == 'Jython':\n", "from pip._vendor import distro\n", "if sys.platform.startswith('darwin') and platform.mac_ver()[0]:\n", "VAR_103 = sys.pypy_version_info[:3]\n", "VAR_103 = sys.pypy_version_info\n", "VAR_23['implementation']['version'] = platform.python_version()\n", "if VAR_23['implementation']['name'] == 'IronPython':\n", "VAR_70 = dict(filter(lambda x: x[1], zip(['name', 'version', 'id'], distro.\n linux_distribution())))\n", "VAR_23['distro'] = {'name': 'macOS', 'version': platform.mac_ver()[0]}\n", "if platform.system():\n", "VAR_23['implementation']['version'] = '.'.join([str(x) for x in VAR_103])\n", "VAR_23['implementation']['version'] = platform.python_version()\n", "VAR_71 = dict(filter(lambda x: x[1], zip(['lib', 'version'], libc_ver())))\n", "VAR_23.setdefault('system', {})['name'] = platform.system()\n", "if platform.release():\n", "if VAR_71:\n", "VAR_23.setdefault('system', {})['release'] = platform.release()\n", "if platform.machine():\n", "VAR_70['libc'] = VAR_71\n", "if VAR_70:\n", "VAR_23['cpu'] = platform.machine()\n", "if VAR_0:\n", "VAR_23['distro'] = VAR_70\n", "VAR_23['openssl_version'] = VAR_68.OPENSSL_VERSION\n", "VAR_24 = get_installed_version('setuptools')\n", "if VAR_24 is not None:\n", "VAR_23['setuptools_version'] = VAR_24\n", "VAR_23['ci'] = True if FUNC_0() else None\n", "VAR_25 = os.environ.get('PIP_USER_AGENT_USER_DATA')\n", "if VAR_25 is not None:\n", "VAR_23['user_data'] = VAR_25\n", "return '{data[installer][name]}/{data[installer][version]} {json}'.format(\n VAR_23=data, json=json.dumps(data, separators=(',', ':'), sort_keys=True))\n" ]
[ "def user_agent():...\n", "\"\"\"docstring\"\"\"\n", "data = {'installer': {'name': 'pip', 'version': pip.__version__}, 'python':\n platform.python_version(), 'implementation': {'name': platform.\n python_implementation()}}\n", "if data['implementation']['name'] == 'CPython':\n", "data['implementation']['version'] = platform.python_version()\n", "if data['implementation']['name'] == 'PyPy':\n", "if sys.platform.startswith('linux'):\n", "if sys.pypy_version_info.releaselevel == 'final':\n", "if data['implementation']['name'] == 'Jython':\n", "from pip._vendor import distro\n", "if sys.platform.startswith('darwin') and platform.mac_ver()[0]:\n", "pypy_version_info = sys.pypy_version_info[:3]\n", "pypy_version_info = sys.pypy_version_info\n", "data['implementation']['version'] = platform.python_version()\n", "if data['implementation']['name'] == 'IronPython':\n", "distro_infos = dict(filter(lambda x: x[1], zip(['name', 'version', 'id'],\n distro.linux_distribution())))\n", "data['distro'] = {'name': 'macOS', 'version': platform.mac_ver()[0]}\n", "if platform.system():\n", "data['implementation']['version'] = '.'.join([str(x) for x in\n pypy_version_info])\n", "data['implementation']['version'] = platform.python_version()\n", "libc = dict(filter(lambda x: x[1], zip(['lib', 'version'], libc_ver())))\n", "data.setdefault('system', {})['name'] = platform.system()\n", "if platform.release():\n", "if libc:\n", "data.setdefault('system', {})['release'] = platform.release()\n", "if platform.machine():\n", "distro_infos['libc'] = libc\n", "if distro_infos:\n", "data['cpu'] = platform.machine()\n", "if HAS_TLS:\n", "data['distro'] = distro_infos\n", "data['openssl_version'] = ssl.OPENSSL_VERSION\n", "setuptools_version = get_installed_version('setuptools')\n", "if setuptools_version is not None:\n", "data['setuptools_version'] = setuptools_version\n", "data['ci'] = True if looks_like_ci() else None\n", "user_data = os.environ.get('PIP_USER_AGENT_USER_DATA')\n", "if user_data is not None:\n", "data['user_data'] = user_data\n", "return '{data[installer][name]}/{data[installer][version]} {json}'.format(data\n =data, json=json.dumps(data, separators=(',', ':'), sort_keys=True))\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, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "For", "Condition", "Condition", "ImportFrom'", "For", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_14(self, **VAR_4):...\n", "self.view_config.publish()\n", "return HttpResponse(\n '<html><script>parent.location.reload()</script>%s.</html>' % _(\n 'Published'))\n" ]
[ "def dispatch_publish(self, **kwargs):...\n", "self.view_config.publish()\n", "return HttpResponse(\n '<html><script>parent.location.reload()</script>%s.</html>' % _(\n 'Published'))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "@VAR_2.route('/admin/debug')...\n", "return debug_info.send_debug()\n" ]
[ "@admi.route('/admin/debug')...\n", "return debug_info.send_debug()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_121(self):...\n", "if self.folders:\n", "return SPAN(H3('Folders'), TABLE(*[TR(TD(A(folder, _href=URL(args=self.args +\n [folder])))) for folder in self.folders], **dict(_class='table')))\n", "return ''\n" ]
[ "def table_folders(self):...\n", "if self.folders:\n", "return SPAN(H3('Folders'), TABLE(*[TR(TD(A(folder, _href=URL(args=self.args +\n [folder])))) for folder in self.folders], **dict(_class='table')))\n", "return ''\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_35(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_53 = VAR_2.GET\n", "VAR_1.error(traceback.format_exc())\n", "VAR_136 = {'search': unicode(VAR_53.get('text', '')).encode('utf8'), 'ctx':\n VAR_53.get('ctx', ''), 'grabData': not not VAR_53.get('grabData', False\n ), 'parents': not not bool(VAR_53.get('parents', False)), 'start': int(\n VAR_53.get('start', 0)), 'limit': int(VAR_53.get('limit', 0)), 'key':\n VAR_53.get('key', None)}\n", "return {}\n", "VAR_215 = VAR_53.get('author', '')\n", "if VAR_215:\n", "VAR_136['search'] += ' author:' + VAR_215\n", "return VAR_136\n" ]
[ "def searchOptFromRequest(request):...\n", "\"\"\"docstring\"\"\"\n", "r = request.GET\n", "logger.error(traceback.format_exc())\n", "opts = {'search': unicode(r.get('text', '')).encode('utf8'), 'ctx': r.get(\n 'ctx', ''), 'grabData': not not r.get('grabData', False), 'parents': \n not not bool(r.get('parents', False)), 'start': int(r.get('start', 0)),\n 'limit': int(r.get('limit', 0)), 'key': r.get('key', None)}\n", "return {}\n", "author = r.get('author', '')\n", "if author:\n", "opts['search'] += ' author:' + author\n", "return opts\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "AugAssign'", "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 aggregate_function], fieldlabel=aggregate_on_label)\n" ]
[ "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=sql_fn_map[args.\n aggregate_function], fieldlabel=aggregate_on_label)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_54(VAR_2, VAR_42, VAR_8=None, VAR_43=None, VAR_44=False, **VAR_9):...\n", "VAR_24 = VAR_8.createServiceOptsDict()\n", "VAR_24.setOmeroGroup('-1')\n", "VAR_53 = VAR_8.getSharedResources()\n", "VAR_23 = VAR_53.openTable(omero.model.OriginalFileI(VAR_42), VAR_24)\n", "if not VAR_23:\n", "return dict(VAR_176='Table %s not found' % fileid)\n", "VAR_251 = VAR_23.getHeaders()\n", "if not VAR_44:\n", "VAR_253 = VAR_23.getNumberOfRows()\n", "VAR_23.close()\n", "VAR_261 = {'columns': [{'name': col.name, 'description': col.description,\n 'type': col.__class__.__name__} for col in VAR_251], 'totalCount': VAR_253}\n", "return VAR_261\n" ]
[ "def _table_metadata(request, fileid, conn=None, query=None, lazy=False, **...\n", "ctx = conn.createServiceOptsDict()\n", "ctx.setOmeroGroup('-1')\n", "r = conn.getSharedResources()\n", "t = r.openTable(omero.model.OriginalFileI(fileid), ctx)\n", "if not t:\n", "return dict(error='Table %s not found' % fileid)\n", "cols = t.getHeaders()\n", "if not lazy:\n", "rows = t.getNumberOfRows()\n", "t.close()\n", "rsp_data = {'columns': [{'name': col.name, 'description': col.description,\n 'type': col.__class__.__name__} for col in cols], 'totalCount': rows}\n", "return rsp_data\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_1(self):...\n", "PlacelessSetup.tearDown(self)\n" ]
[ "def tearDown(self):...\n", "PlacelessSetup.tearDown(self)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_6(VAR_11):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = [VAR_11]\n", "VAR_26, VAR_27 = VAR_54.path.split(VAR_11)\n", "if VAR_27 == '':\n", "VAR_25 = [VAR_26]\n", "while VAR_26 != VAR_25[0]:\n", "VAR_26, VAR_27 = VAR_54.path.split(VAR_26)\n", "VAR_25.insert(0, VAR_26)\n", "return VAR_25\n", "VAR_26, VAR_27 = VAR_54.path.split(VAR_26)\n" ]
[ "def list_path_traversal(path):...\n", "\"\"\"docstring\"\"\"\n", "out = [path]\n", "head, tail = os.path.split(path)\n", "if tail == '':\n", "out = [head]\n", "while head != out[0]:\n", "head, tail = os.path.split(head)\n", "out.insert(0, head)\n", "return out\n", "head, tail = os.path.split(head)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Return'", "Assign'" ]
[ "def __init__(self):...\n", "self.loadSettings()\n" ]
[ "def __init__(self):...\n", "self.loadSettings()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_48:\n", "VAR_66 = omero.sys.Parameters()\n", "VAR_66.map = {'id': rlong(VAR_14)}\n", "VAR_65 = VAR_8.getQueryService().findByQuery(\n 'select s from Shape s where s.id = :id', VAR_66, VAR_8.SERVICE_OPTS)\n", "if VAR_65 is None:\n", "VAR_99 = int(VAR_65.getWidth().getValue())\n", "VAR_100 = int(VAR_65.getHeight().getValue())\n", "VAR_68 = unwrap(VAR_65.getFillColor())\n", "VAR_101 = 255, 255, 0, 255\n", "if VAR_68 is not None:\n", "VAR_68 = rgb_int2rgba(VAR_68)\n", "VAR_102 = VAR_65.getBytes()\n", "VAR_101 = VAR_68[0], VAR_68[1], VAR_68[2], int(VAR_68[3] * 255)\n", "VAR_103 = numpy.fromstring(VAR_102, dtype=numpy.uint8)\n", "VAR_104 = numpy.unpackbits(VAR_103)\n", "VAR_92 = Image.new('RGBA', VAR_7=(width, height), VAR_68=(0, 0, 0, 0))\n", "VAR_30 = 0\n", "VAR_29 = 0\n", "for pix in VAR_104:\n", "if pix == 1:\n", "VAR_54 = BytesIO()\n", "VAR_92.putpixel((VAR_30, VAR_29), VAR_101)\n", "VAR_30 += 1\n", "VAR_92.save(VAR_54, 'png', quality=int(100))\n", "if VAR_30 > VAR_99 - 1:\n", "VAR_105 = VAR_54.getvalue()\n", "VAR_30 = 0\n", "return HttpResponse(VAR_105, content_type='image/png')\n", "VAR_29 += 1\n" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "if not numpyInstalled:\n", "params = omero.sys.Parameters()\n", "params.map = {'id': rlong(shapeId)}\n", "shape = conn.getQueryService().findByQuery(\n 'select s from Shape s where s.id = :id', params, conn.SERVICE_OPTS)\n", "if shape is None:\n", "width = int(shape.getWidth().getValue())\n", "height = int(shape.getHeight().getValue())\n", "color = unwrap(shape.getFillColor())\n", "fill = 255, 255, 0, 255\n", "if color is not None:\n", "color = rgb_int2rgba(color)\n", "mask_packed = shape.getBytes()\n", "fill = color[0], color[1], color[2], int(color[3] * 255)\n", "intarray = numpy.fromstring(mask_packed, dtype=numpy.uint8)\n", "binarray = numpy.unpackbits(intarray)\n", "img = Image.new('RGBA', size=(width, height), color=(0, 0, 0, 0))\n", "x = 0\n", "y = 0\n", "for pix in binarray:\n", "if pix == 1:\n", "rv = BytesIO()\n", "img.putpixel((x, y), fill)\n", "x += 1\n", "img.save(rv, 'png', quality=int(100))\n", "if x > width - 1:\n", "png = rv.getvalue()\n", "x = 0\n", "return HttpResponse(png, content_type='image/png')\n", "y += 1\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 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Expr'", "AugAssign'", "Expr'", "Condition", "Assign'", "Assign'", "Return'", "AugAssign'" ]
[ "def FUNC_4(VAR_13):...\n", "return math.pow(VAR_13, 1.0 / 3)\n" ]
[ "def _cbrt(x):...\n", "return math.pow(x, 1.0 / 3)\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Return'" ]
[ "from typing import Any, List\n", "import bleach\n", "from .rest_api import ValidationError\n", "VAR_0 = ['a', 'img', 'br', 'p', 'span', 'blockquote', 'strike', 'del',\n 'ins', 'strong', 'u', 'em', 'sup', 'sub', 'pre', 'h1', 'h2', 'h3', 'h4',\n 'h5', 'h6', 'ol', 'ul', 'li', 'table', 'caption', 'thead', 'tbody',\n 'th', 'tr', 'td', 'div']\n", "VAR_1 = VAR_0 + ['video']\n", "def FUNC_0(VAR_2: str, VAR_3: str, VAR_4: str) ->bool:...\n", "return True\n" ]
[ "from typing import Any, List\n", "import bleach\n", "from .rest_api import ValidationError\n", "allowed_tags_strict = ['a', 'img', 'br', 'p', 'span', 'blockquote',\n 'strike', 'del', 'ins', 'strong', 'u', 'em', 'sup', 'sub', 'pre', 'h1',\n 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'li', 'table', 'caption',\n 'thead', 'tbody', 'th', 'tr', 'td', 'div']\n", "allowed_tags_permissive = allowed_tags_strict + ['video']\n", "def allow_all(tag: str, name: str, value: str) ->bool:...\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 2 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "@app.before_request...\n", "VAR_6 = request.path.startswith('/login') or request.path.startswith('/static'\n ) or request.path.startswith('/api/login')\n", "if not current_user.is_authenticated and not VAR_6:\n", "return redirect(url_for('login', next=request.path))\n", "return\n" ]
[ "@app.before_request...\n", "allowed_path = request.path.startswith('/login') or request.path.startswith(\n '/static') or request.path.startswith('/api/login')\n", "if not current_user.is_authenticated and not allowed_path:\n", "return redirect(url_for('login', next=request.path))\n", "return\n" ]
[ 0, 0, 0, 0, 0 ]
[ "For", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_2(VAR_4):...\n", "@wraps(VAR_4)...\n", "if VAR_87.role_viewer():\n", "return VAR_4(*VAR_49, **kwargs)\n", "abort(403)\n", "return FUNC_71\n" ]
[ "def viewer_required(f):...\n", "@wraps(f)...\n", "if current_user.role_viewer():\n", "return f(*args, **kwargs)\n", "abort(403)\n", "return inner\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_96(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "self.csv_procedures[VAR_10.__name__] = VAR_10\n", "return VAR_10\n" ]
[ "def csv(self, f):...\n", "\"\"\"docstring\"\"\"\n", "self.csv_procedures[f.__name__] = f\n", "return f\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "from django.conf.urls import url\n", "from shuup.xtheme.views.command import command_dispatch\n", "from shuup.xtheme.views.editor import EditorView\n", "from shuup.xtheme.views.extra import extra_view_dispatch\n", "from shuup.xtheme.views.plugins import get_category_products_highlight, get_product_cross_sell_highlight, get_product_highlight, get_prouduct_selections_highlight\n", "VAR_0 = [url('^xtheme/editor/$', EditorView.as_view(), name='xtheme_editor'\n ), url('^xtheme/(?P<view>.+)/*$', extra_view_dispatch, name=\n 'xtheme_extra_view'), url('^xtheme/$', command_dispatch, name='xtheme'),\n url(\n '^xtheme-prod-hl/(?P<plugin_type>.*)/(?P<cutoff_days>\\\\d+)/(?P<count>\\\\d+)/(?P<cache_timeout>\\\\d+)/$'\n , get_product_highlight, name='xtheme-product-highlight'), url('string'\n .strip(), get_product_cross_sell_highlight, name=\n 'xtheme-product-cross-sells-highlight'), url(\n '^xtheme-cat-products-hl/(?P<category_id>\\\\d+)/(?P<count>\\\\d+)/(?P<cache_timeout>\\\\d+)/$'\n , get_category_products_highlight, name=\n 'xtheme-category-products-highlight'), url(\n '^xtheme-prod-selections-hl/(?P<product_ids>.*)/(?P<cache_timeout>\\\\d+)/$',\n get_prouduct_selections_highlight, name=\n 'xtheme-product-selections-highlight')]\n" ]
[ "from django.conf.urls import url\n", "from shuup.xtheme.views.command import command_dispatch\n", "from shuup.xtheme.views.editor import EditorView\n", "from shuup.xtheme.views.extra import extra_view_dispatch\n", "from shuup.xtheme.views.plugins import get_category_products_highlight, get_product_cross_sell_highlight, get_product_highlight, get_prouduct_selections_highlight\n", "urlpatterns = [url('^xtheme/editor/$', EditorView.as_view(), name=\n 'xtheme_editor'), url('^xtheme/(?P<view>.+)/*$', extra_view_dispatch,\n name='xtheme_extra_view'), url('^xtheme/$', command_dispatch, name=\n 'xtheme'), url(\n '^xtheme-prod-hl/(?P<plugin_type>.*)/(?P<cutoff_days>\\\\d+)/(?P<count>\\\\d+)/(?P<cache_timeout>\\\\d+)/$'\n , get_product_highlight, name='xtheme-product-highlight'), url(\n \"\"\"\n ^xtheme-prod-cross-sell-hl/\n (?P<product_id>.*)/(?P<relation_type>.*)/(?P<use_parents>\\\\d+)/\n (?P<count>\\\\d+)/(?P<cache_timeout>\\\\d+)/$\n \"\"\"\n .strip(), get_product_cross_sell_highlight, name=\n 'xtheme-product-cross-sells-highlight'), url(\n '^xtheme-cat-products-hl/(?P<category_id>\\\\d+)/(?P<count>\\\\d+)/(?P<cache_timeout>\\\\d+)/$'\n , get_category_products_highlight, name=\n 'xtheme-category-products-highlight'), url(\n '^xtheme-prod-selections-hl/(?P<product_ids>.*)/(?P<cache_timeout>\\\\d+)/$',\n get_prouduct_selections_highlight, name=\n 'xtheme-product-selections-highlight')]\n" ]
[ 0, 0, 0, 0, 0, 2 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'" ]
[ "async def FUNC_20(VAR_23):...\n", "self.assertEquals(current_context().request, 'context_11')\n", "self.assertEqual(VAR_23, {'server10': {FUNC_0(VAR_20): 0}})\n", "await make_deferred_yieldable(VAR_22)\n", "return {'server10': {FUNC_0(VAR_20): FetchKeyResult(get_verify_key(VAR_20),\n 100)}}\n" ]
[ "async def first_lookup_fetch(keys_to_fetch):...\n", "self.assertEquals(current_context().request, 'context_11')\n", "self.assertEqual(keys_to_fetch, {'server10': {get_key_id(key1): 0}})\n", "await make_deferred_yieldable(first_lookup_deferred)\n", "return {'server10': {get_key_id(key1): FetchKeyResult(get_verify_key(key1),\n 100)}}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_5(self):...\n", "assert controller_name(CLASS_12) == 'user'\n" ]
[ "def test_it_strips_resource(self):...\n", "assert controller_name(UserResource) == 'user'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assert'" ]
[ "def FUNC_42(self):...\n", "self.helper.join(self.room_id, user=self.second_user_id, VAR_52=self.second_tok\n )\n", "VAR_12 = 'hello'\n", "VAR_22, VAR_23 = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/kick'.format(self.room_id), VAR_19={\n 'reason': reason, 'user_id': self.second_user_id}, VAR_16=self.second_tok)\n", "self.assertEqual(VAR_23.code, 200, VAR_23.result)\n", "self._check_for_reason(VAR_12)\n" ]
[ "def test_kick_reason(self):...\n", "self.helper.join(self.room_id, user=self.second_user_id, tok=self.second_tok)\n", "reason = 'hello'\n", "request, channel = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/kick'.format(self.room_id), content={\n 'reason': reason, 'user_id': self.second_user_id}, access_token=self.\n second_tok)\n", "self.assertEqual(channel.code, 200, channel.result)\n", "self._check_for_reason(reason)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_32(self):...\n", "if self.meta.istable:\n", "VAR_85 = frappe.get_meta(self.parenttype).permissions\n", "VAR_85 = self.meta.permissions\n", "return VAR_85\n" ]
[ "def get_permissions(self):...\n", "if self.meta.istable:\n", "permissions = frappe.get_meta(self.parenttype).permissions\n", "permissions = self.meta.permissions\n", "return permissions\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(VAR_7, VAR_8='Argument', VAR_6=0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_29 = ' ' * VAR_6\n", "def FUNC_34(VAR_34):...\n", "VAR_66 = \"'\" * isinstance(VAR_34, str)\n", "return VAR_66 + str(VAR_34) + VAR_66\n" ]
[ "def _print_args(arguments, argument_type='Argument', indent=0):...\n", "\"\"\"docstring\"\"\"\n", "indent_str = ' ' * indent\n", "def _maybe_add_quotes(value):...\n", "is_quotes = \"'\" * isinstance(value, str)\n", "return is_quotes + str(value) + is_quotes\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_7(VAR_1):...\n", "VAR_20.throw(_('Invalid Search Field {0}').format(VAR_1), VAR_20.DataError)\n" ]
[ "def _raise_exception(searchfield):...\n", "frappe.throw(_('Invalid Search Field {0}').format(searchfield), frappe.\n DataError)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_27, VAR_9):...\n", "self._base_builder = VAR_27\n", "self._event_id = VAR_9\n" ]
[ "def __init__(self, base_builder, event_id):...\n", "self._base_builder = base_builder\n", "self._event_id = event_id\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_10: 'HomeServer', VAR_11: str, VAR_12: jinja2....\n", "self.hs = VAR_10\n", "self.template_html = VAR_12\n", "self.template_text = VAR_13\n", "self.sendmail = self.hs.get_sendmail()\n", "self.store = self.hs.get_datastore()\n", "self.macaroon_gen = self.hs.get_macaroon_generator()\n", "self.state_handler = self.hs.get_state_handler()\n", "self.storage = VAR_10.get_storage()\n", "self.app_name = VAR_11\n", "self.email_subjects = VAR_10.config.email_subjects\n", "VAR_0.info('Created Mailer for app_name %s' % VAR_11)\n" ]
[ "def __init__(self, hs: 'HomeServer', app_name: str, template_html: jinja2....\n", "self.hs = hs\n", "self.template_html = template_html\n", "self.template_text = template_text\n", "self.sendmail = self.hs.get_sendmail()\n", "self.store = self.hs.get_datastore()\n", "self.macaroon_gen = self.hs.get_macaroon_generator()\n", "self.state_handler = self.hs.get_state_handler()\n", "self.storage = hs.get_storage()\n", "self.app_name = app_name\n", "self.email_subjects = hs.config.email_subjects\n", "logger.info('Created Mailer for app_name %s' % app_name)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_0(**VAR_1):...\n", "if 'event_id' not in VAR_1:\n", "VAR_1['event_id'] = 'fake_event_id'\n", "if 'type' not in VAR_1:\n", "VAR_1['type'] = 'fake_type'\n", "return make_event_from_dict(VAR_1)\n" ]
[ "def MockEvent(**kwargs):...\n", "if 'event_id' not in kwargs:\n", "kwargs['event_id'] = 'fake_event_id'\n", "if 'type' not in kwargs:\n", "kwargs['type'] = 'fake_type'\n", "return make_event_from_dict(kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_14(VAR_0):...\n", "VAR_0.DEBUG = True\n", "VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentParent'\")\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", "assert len(re.findall('<script type=\"module\"', VAR_12)) == 1\n", "assert '\"calls\":[]' in VAR_12\n" ]
[ "def test_unicorn_render_calls_no_mount_call(settings):...\n", "settings.DEBUG = True\n", "token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentParent'\")\n", "unicorn_node = unicorn(None, token)\n", "context = {}\n", "html = unicorn_node.render(context)\n", "assert '<script type=\"module\"' in html\n", "assert len(re.findall('<script type=\"module\"', html)) == 1\n", "assert '\"calls\":[]' in html\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Assert'" ]
[ "def FUNC_3(VAR_5, VAR_6=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = int(VAR_5)\n", "VAR_22 = objreg.get('web-history')\n", "if VAR_6 is not None:\n", "VAR_34 = VAR_22.entries_before(VAR_5, limit=1000, VAR_6=offset)\n", "VAR_35 = VAR_5 - 24 * 60 * 60\n", "return [{'url': e.url, 'title': e.title or e.url, 'time': e.atime} for e in\n VAR_34]\n", "VAR_34 = VAR_22.entries_between(VAR_35, VAR_5)\n" ]
[ "def history_data(start_time, offset=None):...\n", "\"\"\"docstring\"\"\"\n", "start_time = int(start_time)\n", "hist = objreg.get('web-history')\n", "if offset is not None:\n", "entries = hist.entries_before(start_time, limit=1000, offset=offset)\n", "end_time = start_time - 24 * 60 * 60\n", "return [{'url': e.url, 'title': e.title or e.url, 'time': e.atime} for e in\n entries]\n", "entries = hist.entries_between(end_time, start_time)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 2, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_1(VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = apps.get_model(app_label='acls', model_name='AccessControlList')\n", "VAR_7 = VAR_6.objects.filter_by_access(permission_cabinet_view, VAR_3,\n queryset=document.document_cabinets().all())\n", "return format_html_join('\\n', '<div class=\"cabinet-display\">{}</div>', ((\n cabinet.get_full_path(),) for cabinet in VAR_7))\n" ]
[ "def widget_document_cabinets(document, user):...\n", "\"\"\"docstring\"\"\"\n", "AccessControlList = apps.get_model(app_label='acls', model_name=\n 'AccessControlList')\n", "cabinets = AccessControlList.objects.filter_by_access(permission_cabinet_view,\n user, queryset=document.document_cabinets().all())\n", "return format_html_join('\\n', '<div class=\"cabinet-display\">{}</div>', ((\n cabinet.get_full_path(),) for cabinet in cabinets))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_14(VAR_15):...\n", "VAR_52 = calibre_db.session.query(db.Custom_Columns).filter(db.\n Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n", "VAR_17 = calibre_db.get_filtered_book(VAR_15, allow_show_archived=True)\n", "if not VAR_17:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "for lang in VAR_17.languages:\n", "return redirect(url_for('web.index'))\n", "lang.language_name = isoLanguages.get_language_name(get_locale(), lang.\n lang_code)\n", "VAR_17 = calibre_db.order_authors(VAR_17)\n", "VAR_53 = []\n", "for VAR_38 in VAR_17.authors:\n", "VAR_53.append(VAR_38.name.replace('|', ','))\n", "VAR_54 = list()\n", "VAR_55 = list()\n", "VAR_56 = None\n", "if config.config_converterpath:\n", "for file in VAR_17.data:\n", "if config.config_kepubifypath and 'epub' in [file.format.lower() for file in\n", "if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM:\n", "VAR_56 = True\n", "if config.config_converterpath:\n", "VAR_54.append(file.format.lower())\n", "if not config.config_converterpath:\n", "VAR_55 = constants.EXTENSIONS_CONVERT_TO[:]\n", "if VAR_56:\n", "VAR_54.append('epub')\n", "for file in VAR_17.data:\n", "VAR_55.append('kepub')\n", "return render_title_template('book_edit.html', VAR_17=book, VAR_115=\n author_names, VAR_52=cc, VAR_37=_(u'edit metadata'), page='editbook',\n conversion_formats=allowed_conversion_formats, config=config,\n source_formats=valid_source_formats)\n", "if file.format.lower() in VAR_55:\n", "VAR_55.remove(file.format.lower())\n" ]
[ "def render_edit_book(book_id):...\n", "cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.\n datatype.notin_(db.cc_exceptions)).all()\n", "book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n", "if not book:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "for lang in book.languages:\n", "return redirect(url_for('web.index'))\n", "lang.language_name = isoLanguages.get_language_name(get_locale(), lang.\n lang_code)\n", "book = calibre_db.order_authors(book)\n", "author_names = []\n", "for authr in book.authors:\n", "author_names.append(authr.name.replace('|', ','))\n", "valid_source_formats = list()\n", "allowed_conversion_formats = list()\n", "kepub_possible = None\n", "if config.config_converterpath:\n", "for file in book.data:\n", "if config.config_kepubifypath and 'epub' in [file.format.lower() for file in\n", "if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM:\n", "kepub_possible = True\n", "if config.config_converterpath:\n", "valid_source_formats.append(file.format.lower())\n", "if not config.config_converterpath:\n", "allowed_conversion_formats = constants.EXTENSIONS_CONVERT_TO[:]\n", "if kepub_possible:\n", "valid_source_formats.append('epub')\n", "for file in book.data:\n", "allowed_conversion_formats.append('kepub')\n", "return render_title_template('book_edit.html', book=book, authors=\n author_names, cc=cc, title=_(u'edit metadata'), page='editbook',\n conversion_formats=allowed_conversion_formats, config=config,\n source_formats=valid_source_formats)\n", "if file.format.lower() in allowed_conversion_formats:\n", "allowed_conversion_formats.remove(file.format.lower())\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "For", "Return'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "For", "For", "For", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "For", "Expr'", "Return'", "For", "Expr'" ]
[ "def FUNC_0(VAR_2):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def SerializeError(Exception):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_2(self, VAR_3: Text, VAR_4: Text) ->None:...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = VAR_3\n", "if not VAR_3.endswith('tar.gz'):\n", "VAR_21 = self._tar_name(VAR_3)\n", "self._retrieve_tar(VAR_21)\n", "self._decompress(os.path.basename(VAR_21), VAR_4)\n" ]
[ "def retrieve(self, model_name: Text, target_path: Text) ->None:...\n", "\"\"\"docstring\"\"\"\n", "tar_name = model_name\n", "if not model_name.endswith('tar.gz'):\n", "tar_name = self._tar_name(model_name)\n", "self._retrieve_tar(tar_name)\n", "self._decompress(os.path.basename(tar_name), target_path)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "assert VAR_3.startswith('file:'\n ), 'You can only turn file: urls into filenames (not %r)' % VAR_3\n", "VAR_43, VAR_32, VAR_44, VAR_43, VAR_43 = urllib_parse.urlsplit(VAR_3)\n", "if not VAR_32 or VAR_32 == 'localhost':\n", "VAR_32 = ''\n", "if sys.platform == 'win32':\n", "VAR_44 = urllib_request.url2pathname(VAR_32 + VAR_44)\n", "VAR_32 = '\\\\\\\\' + VAR_32\n", "return VAR_44\n" ]
[ "def url_to_path(url):...\n", "\"\"\"docstring\"\"\"\n", "assert url.startswith('file:'\n ), 'You can only turn file: urls into filenames (not %r)' % url\n", "_, netloc, path, _, _ = urllib_parse.urlsplit(url)\n", "if not netloc or netloc == 'localhost':\n", "netloc = ''\n", "if sys.platform == 'win32':\n", "path = urllib_request.url2pathname(netloc + path)\n", "netloc = '\\\\\\\\' + netloc\n", "return path\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Assign'", "Return'" ]
[ "@VAR_8.route('/api/flag/', methods=['POST'])...\n", "FUNC_13('flag')\n", "VAR_64 = request.json['data']\n", "FUNC_14(VAR_64['input_data'], VAR_64['output_data'], VAR_64.get(\n 'flag_option'), VAR_64.get('flag_index'), current_user.id if\n current_user.is_authenticated else None)\n", "return jsonify(success=True)\n" ]
[ "@app.route('/api/flag/', methods=['POST'])...\n", "log_feature_analytics('flag')\n", "data = request.json['data']\n", "flag_data(data['input_data'], data['output_data'], data.get('flag_option'),\n data.get('flag_index'), current_user.id if current_user.\n is_authenticated else None)\n", "return jsonify(success=True)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_1, VAR_2=None):...\n", "super(CLASS_0, self).__init__(VAR_1)\n", "self.title = VAR_2\n", "self.links = []\n" ]
[ "def __init__(self, message, title=None):...\n", "super(Problem, self).__init__(message)\n", "self.title = title\n", "self.links = []\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_22(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.priority == 2:\n", "return 'warning'\n", "if self.priority == 1:\n", "return 'danger'\n", "if self.priority == 5:\n", "return 'success'\n", "return ''\n" ]
[ "def _get_priority_css_class(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.priority == 2:\n", "return 'warning'\n", "if self.priority == 1:\n", "return 'danger'\n", "if self.priority == 5:\n", "return 'success'\n", "return ''\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_3, VAR_4, VAR_6):...\n", "self.room_id = self.helper.create_room_as(self.user_id)\n" ]
[ "def prepare(self, reactor, clock, hs):...\n", "self.room_id = self.helper.create_room_as(self.user_id)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_81(VAR_19):...\n", "if self.parentfield:\n", "return '{} {} #{}: {} {}'.format(frappe.bold(_(self.doctype)), _('Row'),\n self.idx, _('Value cannot be negative for'), frappe.bold(_(VAR_19.label)))\n", "return _('Value cannot be negative for {0}: {1}').format(_(VAR_19.parent),\n frappe.bold(_(VAR_19.label)))\n" ]
[ "def get_msg(df):...\n", "if self.parentfield:\n", "return '{} {} #{}: {} {}'.format(frappe.bold(_(self.doctype)), _('Row'),\n self.idx, _('Value cannot be negative for'), frappe.bold(_(df.label)))\n", "return _('Value cannot be negative for {0}: {1}').format(_(df.parent),\n frappe.bold(_(df.label)))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_26(VAR_48=[], VAR_49='', VAR_50='No Subject', VAR_51='No Message',...\n", "\"\"\"docstring\"\"\"\n", "VAR_181 = None\n", "if VAR_78:\n", "VAR_51, VAR_181 = get_email_from_template(VAR_78, VAR_79)\n", "VAR_51 = VAR_61 or VAR_51\n", "if VAR_52:\n", "from frappe.utils import md_to_html\n", "if not VAR_53:\n", "VAR_51 = md_to_html(VAR_51)\n", "VAR_74 = True\n", "from frappe.email import queue\n", "queue.send(VAR_48=recipients, VAR_49=sender, VAR_50=subject, VAR_51=message,\n VAR_181=text_content, VAR_54=doctype or reference_doctype, VAR_55=name or\n reference_name, VAR_59=add_unsubscribe_link, VAR_56=unsubscribe_method,\n VAR_57=unsubscribe_params, VAR_58=unsubscribe_message, VAR_60=\n attachments, VAR_63=reply_to, VAR_65=cc, VAR_66=bcc, VAR_67=message_id,\n VAR_68=in_reply_to, VAR_69=send_after, VAR_70=expose_recipients, VAR_71\n =send_priority, VAR_64=queue_separately, VAR_72=communication, VAR_74=\n now, VAR_75=read_receipt, VAR_76=is_notification, VAR_77=inline_images,\n VAR_80=header, VAR_81=print_letterhead, VAR_82=with_container)\n" ]
[ "def sendmail(recipients=[], sender='', subject='No Subject', message=...\n", "\"\"\"docstring\"\"\"\n", "text_content = None\n", "if template:\n", "message, text_content = get_email_from_template(template, args)\n", "message = content or message\n", "if as_markdown:\n", "from frappe.utils import md_to_html\n", "if not delayed:\n", "message = md_to_html(message)\n", "now = True\n", "from frappe.email import queue\n", "queue.send(recipients=recipients, sender=sender, subject=subject, message=\n message, text_content=text_content, reference_doctype=doctype or\n reference_doctype, reference_name=name or reference_name,\n add_unsubscribe_link=add_unsubscribe_link, unsubscribe_method=\n unsubscribe_method, unsubscribe_params=unsubscribe_params,\n unsubscribe_message=unsubscribe_message, attachments=attachments,\n reply_to=reply_to, cc=cc, bcc=bcc, message_id=message_id, in_reply_to=\n in_reply_to, send_after=send_after, expose_recipients=expose_recipients,\n send_priority=send_priority, queue_separately=queue_separately,\n communication=communication, now=now, read_receipt=read_receipt,\n is_notification=is_notification, inline_images=inline_images, header=\n header, print_letterhead=print_letterhead, with_container=with_container)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "ImportFrom'", "Condition", "Assign'", "Assign'", "ImportFrom'", "Expr'" ]
[ "@ensure_csrf_cookie...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n", "VAR_65 = get_course_with_access(VAR_9.user, 'instructor', VAR_10, depth=None)\n", "VAR_64 = VAR_9.GET.get('rolename')\n", "if VAR_64 not in ROLES:\n", "return HttpResponseBadRequest()\n", "def FUNC_85(VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "return {'username': VAR_19.username, 'email': VAR_19.email, 'first_name':\n VAR_19.first_name, 'last_name': VAR_19.last_name}\n" ]
[ "@ensure_csrf_cookie...\n", "\"\"\"docstring\"\"\"\n", "course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n", "course = get_course_with_access(request.user, 'instructor', course_id,\n depth=None)\n", "rolename = request.GET.get('rolename')\n", "if rolename not in ROLES:\n", "return HttpResponseBadRequest()\n", "def extract_user_info(user):...\n", "\"\"\"docstring\"\"\"\n", "return {'username': user.username, 'email': user.email, 'first_name': user.\n first_name, 'last_name': user.last_name}\n" ]
[ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "FunctionDef'", "Docstring", "Return'" ]
[ "def __init__(self, VAR_4, VAR_16=None, VAR_47=True, **VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "self.user = VAR_4\n", "self.language = VAR_16\n", "super().__init__(**kwargs)\n", "self.helper = FormHelper(self)\n", "self.helper.disable_csrf = True\n", "self.helper.form_tag = False\n", "self.helper.layout = Layout(Div(Field('offset', **self.offset_kwargs),\n SearchField('q'), Field('sort_by', template='snippets/sort-field.html'),\n css_class='btn-toolbar', role='toolbar'), ContextDiv(template=\n 'snippets/query-builder.html', VAR_87={'user': self.user, 'month_ago': \n timezone.now() - timedelta(days=31), 'show_builder': show_builder,\n 'language': self.language}), Field('checksum'))\n" ]
[ "def __init__(self, user, language=None, show_builder=True, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "self.user = user\n", "self.language = language\n", "super().__init__(**kwargs)\n", "self.helper = FormHelper(self)\n", "self.helper.disable_csrf = True\n", "self.helper.form_tag = False\n", "self.helper.layout = Layout(Div(Field('offset', **self.offset_kwargs),\n SearchField('q'), Field('sort_by', template='snippets/sort-field.html'),\n css_class='btn-toolbar', role='toolbar'), ContextDiv(template=\n 'snippets/query-builder.html', context={'user': self.user, 'month_ago':\n timezone.now() - timedelta(days=31), 'show_builder': show_builder,\n 'language': self.language}), Field('checksum'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_1(VAR_2, *VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "return FUNC_0(FEDERATION_V1_PREFIX, VAR_2, *VAR_3)\n" ]
[ "def _create_v1_path(path, *args):...\n", "\"\"\"docstring\"\"\"\n", "return _create_path(FEDERATION_V1_PREFIX, path, *args)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_28():...\n", "def FUNC_116(VAR_129):...\n", "def FUNC_121(*VAR_79, **VAR_42):...\n", "if VAR_13.read_from_replica:\n", "FUNC_6()\n", "VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n", "if VAR_1 and hasattr(VAR_1, 'primary_db'):\n", "return VAR_225\n", "VAR_1.db.close()\n", "VAR_1.db = VAR_1.primary_db\n" ]
[ "def read_only():...\n", "def innfn(fn):...\n", "def wrapper_fn(*args, **kwargs):...\n", "if conf.read_from_replica:\n", "connect_replica()\n", "retval = fn(*args, **get_newargs(fn, kwargs))\n", "if local and hasattr(local, 'primary_db'):\n", "return retval\n", "local.db.close()\n", "local.db = local.primary_db\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_0(self):...\n", "super().setUp()\n", "self.user.is_superuser = True\n", "self.user.save()\n" ]
[ "def setUp(self):...\n", "super().setUp()\n", "self.user.is_superuser = True\n", "self.user.save()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_25(self):...\n", "VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'users':\n {'create': coreapi.Link(url='/users/', action='post', fields=[]),\n 'list': coreapi.Link(url='/users/', action='get', fields=[]), 'read':\n coreapi.Link(url='/users/{id}/', action='get', fields=[coreapi.Field(\n 'id', required=True, location='path', schema=coreschema.String())]),\n 'update': coreapi.Link(url='/users/{id}/', action='patch', fields=[\n coreapi.Field('id', required=True, location='path', schema=coreschema.\n String())]), 'friends': {'list': coreapi.Link(url='/users/{id}/friends',\n action='get', fields=[coreapi.Field('id', required=True, location=\n 'path', schema=coreschema.String())]), 'create': coreapi.Link(url=\n '/users/{id}/friends', action='post', fields=[coreapi.Field('id',\n required=True, location='path', schema=coreschema.String())])}}})\n", "VAR_30 = VAR_29['users']\n", "VAR_31 = schema_links(VAR_30)\n", "assert len(VAR_31) is 6\n", "assert 'list' in VAR_31\n", "assert 'create' in VAR_31\n", "assert 'read' in VAR_31\n", "assert 'update' in VAR_31\n", "assert 'friends > list' in VAR_31\n", "assert 'friends > create' in VAR_31\n" ]
[ "def test_default_actions_and_single_custom_action_two_methods(self):...\n", "schema = coreapi.Document(url='', title='Example API', content={'users': {\n 'create': coreapi.Link(url='/users/', action='post', fields=[]), 'list':\n coreapi.Link(url='/users/', action='get', fields=[]), 'read': coreapi.\n Link(url='/users/{id}/', action='get', fields=[coreapi.Field('id',\n required=True, location='path', schema=coreschema.String())]), 'update':\n coreapi.Link(url='/users/{id}/', action='patch', fields=[coreapi.Field(\n 'id', required=True, location='path', schema=coreschema.String())]),\n 'friends': {'list': coreapi.Link(url='/users/{id}/friends', action=\n 'get', fields=[coreapi.Field('id', required=True, location='path',\n schema=coreschema.String())]), 'create': coreapi.Link(url=\n '/users/{id}/friends', action='post', fields=[coreapi.Field('id',\n required=True, location='path', schema=coreschema.String())])}}})\n", "section = schema['users']\n", "flat_links = schema_links(section)\n", "assert len(flat_links) is 6\n", "assert 'list' in flat_links\n", "assert 'create' in flat_links\n", "assert 'read' in flat_links\n", "assert 'update' in flat_links\n", "assert 'friends > list' in flat_links\n", "assert 'friends > create' in flat_links\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Assert'", "Assert'", "Assert'", "Assert'", "Assert'" ]
[ "def __init__(self, VAR_9, VAR_10=None):...\n", "self._name = VAR_9\n", "self._backend = VAR_10\n", "self._function = None\n" ]
[ "def __init__(self, name, backend=None):...\n", "self._name = name\n", "self._backend = backend\n", "self._function = None\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'" ]
[ "@pyqtSlot(QUrl)...\n", "\"\"\"docstring\"\"\"\n" ]
[ "@pyqtSlot(QUrl)...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "Condition", "Docstring" ]
[ "async def FUNC_29(self, VAR_5: str, VAR_1: EventBase, VAR_2: Optional[...\n", "VAR_32 = await self.state_handler.compute_event_context(VAR_1, old_state=state)\n", "if not VAR_3:\n", "VAR_94 = await VAR_32.get_prev_state_ids()\n", "if VAR_1.type == VAR_188.Member and not VAR_1.auth_event_ids():\n", "VAR_173 = self.auth.compute_auth_events(VAR_1, VAR_94, for_verification=True)\n", "if len(VAR_1.prev_event_ids()) == 1 and VAR_1.depth < 5:\n", "VAR_32 = await self.do_auth(VAR_5, VAR_1, VAR_32, VAR_3=auth_events)\n", "VAR_174 = await self.store.get_events(VAR_173)\n", "VAR_189 = await self.store.get_event(VAR_1.prev_event_ids()[0], allow_none=True\n )\n", "if not VAR_32.rejected:\n", "VAR_3 = {(VAR_170.type, VAR_170.state_key): VAR_170 for VAR_170 in VAR_174.\n values()}\n", "if VAR_189 and VAR_189.type == VAR_188.Create:\n", "await self._check_for_soft_fail(VAR_1, VAR_2, VAR_33)\n", "if VAR_1.type == VAR_188.GuestAccess and not VAR_32.rejected:\n", "VAR_3[VAR_189.type, VAR_189.state_key] = VAR_189\n", "await self.maybe_kick_guest_users(VAR_1)\n", "return VAR_32\n" ]
[ "async def _prep_event(self, origin: str, event: EventBase, state: Optional[...\n", "context = await self.state_handler.compute_event_context(event, old_state=state\n )\n", "if not auth_events:\n", "prev_state_ids = await context.get_prev_state_ids()\n", "if event.type == EventTypes.Member and not event.auth_event_ids():\n", "auth_events_ids = self.auth.compute_auth_events(event, prev_state_ids,\n for_verification=True)\n", "if len(event.prev_event_ids()) == 1 and event.depth < 5:\n", "context = await self.do_auth(origin, event, context, auth_events=auth_events)\n", "auth_events_x = await self.store.get_events(auth_events_ids)\n", "c = await self.store.get_event(event.prev_event_ids()[0], allow_none=True)\n", "if not context.rejected:\n", "auth_events = {(e.type, e.state_key): e for e in auth_events_x.values()}\n", "if c and c.type == EventTypes.Create:\n", "await self._check_for_soft_fail(event, state, backfilled)\n", "if event.type == EventTypes.GuestAccess and not context.rejected:\n", "auth_events[c.type, c.state_key] = c\n", "await self.maybe_kick_guest_users(event)\n", "return context\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_2(VAR_3: Union[Text, Path], VAR_4: Any) ->None:...\n", "\"\"\"docstring\"\"\"\n", "pickle.dump(VAR_4, VAR_18)\n" ]
[ "def pickle_dump(filename: Union[Text, Path], obj: Any) ->None:...\n", "\"\"\"docstring\"\"\"\n", "pickle.dump(obj, f)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_29(self):...\n", "" ]
[ "def close(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_143(self, VAR_156, VAR_214=0):...\n", "VAR_63 = self.auth\n", "VAR_101 = VAR_63.db\n", "VAR_212 = VAR_101.wiki_page(VAR_156=slug)\n", "if not self.can_edit(VAR_212):\n", "return self.not_authorized(VAR_212)\n", "VAR_333 = ' '.join(VAR_14.capitalize() for VAR_14 in VAR_156.split('-'))\n", "if not VAR_212:\n", "if not (self.can_manage() or VAR_156.startswith(self.settings.force_prefix)):\n", "VAR_96 = VAR_263.request.post_vars\n", "VAR_263.session.flash = ('slug must have \"%s\" prefix' % self.settings.\n force_prefix)\n", "VAR_101.wiki_page.can_read.default = [CLASS_8.everybody]\n", "if VAR_96.body:\n", "redirect(URL(VAR_11='_create'))\n", "VAR_101.wiki_page.can_edit.default = [VAR_63.user_group_role()]\n", "VAR_96.body = VAR_96.body.replace('://%s' % self.host, '://HOSTNAME')\n", "VAR_7 = SQLFORM(VAR_101.wiki_page, VAR_212, VAR_170=True, VAR_273=\n 'table2cols', showid=False).process()\n", "VAR_101.wiki_page.title.default = VAR_333\n", "if VAR_7.deleted:\n", "VAR_101.wiki_page.slug.default = VAR_156\n", "VAR_263.session.flash = 'page deleted'\n", "if VAR_7.accepted:\n", "if VAR_156 == 'wiki-menu':\n", "redirect(URL())\n", "VAR_263.session.flash = 'page created'\n", "VAR_334 = 'string' % dict(VAR_12=URL(args=('_preview', slug)), link_media=\n 'true' if page else 'false', urlmedia=URL(extension='load', args=(\n '_editmedia', slug), vars=dict(embedded=1)))\n", "VAR_101.wiki_page.body.default = \"\"\"- Menu Item > @////index\n- - Submenu > http://web2py.com\"\"\"\n", "VAR_101.wiki_page.body.default = VAR_101(VAR_101.wiki_page.id == VAR_214\n ).select(VAR_101.wiki_page.body)[0].body if int(VAR_214\n ) > 0 else \"\"\"## %s\n\npage content\"\"\" % VAR_333\n", "redirect(URL(VAR_11=slug))\n", "return dict(VAR_229=TAG[''](form, SCRIPT(script)))\n" ]
[ "def edit(self, slug, from_template=0):...\n", "auth = self.auth\n", "db = auth.db\n", "page = db.wiki_page(slug=slug)\n", "if not self.can_edit(page):\n", "return self.not_authorized(page)\n", "title_guess = ' '.join(c.capitalize() for c in slug.split('-'))\n", "if not page:\n", "if not (self.can_manage() or slug.startswith(self.settings.force_prefix)):\n", "vars = current.request.post_vars\n", "current.session.flash = ('slug must have \"%s\" prefix' % self.settings.\n force_prefix)\n", "db.wiki_page.can_read.default = [Wiki.everybody]\n", "if vars.body:\n", "redirect(URL(args='_create'))\n", "db.wiki_page.can_edit.default = [auth.user_group_role()]\n", "vars.body = vars.body.replace('://%s' % self.host, '://HOSTNAME')\n", "form = SQLFORM(db.wiki_page, page, deletable=True, formstyle='table2cols',\n showid=False).process()\n", "db.wiki_page.title.default = title_guess\n", "if form.deleted:\n", "db.wiki_page.slug.default = slug\n", "current.session.flash = 'page deleted'\n", "if form.accepted:\n", "if slug == 'wiki-menu':\n", "redirect(URL())\n", "current.session.flash = 'page created'\n", "script = (\n \"\"\"\n jQuery(function() {\n if (!jQuery('#wiki_page_body').length) return;\n var pagecontent = jQuery('#wiki_page_body');\n pagecontent.css('font-family',\n 'Monaco,Menlo,Consolas,\"Courier New\",monospace');\n var prevbutton = jQuery('<button class=\"btn nopreview\">Preview</button>');\n var preview = jQuery('<div id=\"preview\"></div>').hide();\n var previewmedia = jQuery('<div id=\"previewmedia\"></div>');\n var form = pagecontent.closest('form');\n preview.insertBefore(form);\n prevbutton.insertBefore(form);\n if(%(link_media)s) {\n var mediabutton = jQuery('<button class=\"btn nopreview\">Media</button>');\n mediabutton.insertBefore(form);\n previewmedia.insertBefore(form);\n mediabutton.click(function() {\n if (mediabutton.hasClass('nopreview')) {\n web2py_component('%(urlmedia)s', 'previewmedia');\n } else {\n previewmedia.empty();\n }\n mediabutton.toggleClass('nopreview');\n });\n }\n prevbutton.click(function(e) {\n e.preventDefault();\n if (prevbutton.hasClass('nopreview')) {\n prevbutton.addClass('preview').removeClass(\n 'nopreview').html('Edit Source');\n try{var wiki_render = jQuery('#wiki_page_render').val()}\n catch(e){var wiki_render = null;}\n web2py_ajax_page('post', '%(url)s', {body: jQuery('#wiki_page_body').val(), render: wiki_render}, 'preview');\n form.fadeOut('fast', function() {preview.fadeIn()});\n } else {\n prevbutton.addClass(\n 'nopreview').removeClass('preview').html('Preview');\n preview.fadeOut('fast', function() {form.fadeIn()});\n }\n })\n })\n \"\"\"\n % dict(url=URL(args=('_preview', slug)), link_media='true' if page else\n 'false', urlmedia=URL(extension='load', args=('_editmedia', slug), vars\n =dict(embedded=1))))\n", "db.wiki_page.body.default = \"\"\"- Menu Item > @////index\n- - Submenu > http://web2py.com\"\"\"\n", "db.wiki_page.body.default = db(db.wiki_page.id == from_template).select(db.\n wiki_page.body)[0].body if int(from_template\n ) > 0 else \"\"\"## %s\n\npage content\"\"\" % title_guess\n", "redirect(URL(args=slug))\n", "return dict(content=TAG[''](form, SCRIPT(script)))\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "For", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@VAR_8.route('/api/queue/status/', methods=['POST'])...\n", "VAR_70 = request.json['hash']\n", "VAR_71, VAR_64 = queue.get_status(VAR_70)\n", "return {'status': VAR_71, 'data': VAR_64}\n" ]
[ "@app.route('/api/queue/status/', methods=['POST'])...\n", "hash = request.json['hash']\n", "status, data = queue.get_status(hash)\n", "return {'status': status, 'data': data}\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_79(self):...\n", "VAR_67 = self.renderer.placeholder()\n", "while self.pop()['type'] != 'list_item_end':\n", "if self.token['type'] == 'text':\n", "return self.renderer.list_item(VAR_67)\n", "VAR_67 += self.tok_text()\n", "VAR_67 += self.tok()\n" ]
[ "def output_list_item(self):...\n", "body = self.renderer.placeholder()\n", "while self.pop()['type'] != 'list_item_end':\n", "if self.token['type'] == 'text':\n", "return self.renderer.list_item(body)\n", "body += self.tok_text()\n", "body += self.tok()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Condition", "Return'", "AugAssign'", "AugAssign'" ]
[ "@pytest.fixture...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = VAR_2 / 'data'\n", "VAR_13 = VAR_2 / 'config'\n", "VAR_14 = VAR_3 / 'rt'\n", "VAR_15 = VAR_2 / 'cache'\n", "VAR_14.ensure(dir=True)\n", "VAR_14.chmod(448)\n", "(VAR_12 / 'qutebrowser' / 'state').write_text(\n \"\"\"[general]\nquickstart-done = 1\nbackend-warning-shown=1\"\"\", encoding=\n 'utf-8', ensure=True)\n", "VAR_16 = {'XDG_DATA_HOME': str(VAR_12), 'XDG_CONFIG_HOME': str(VAR_13),\n 'XDG_RUNTIME_DIR': str(VAR_14), 'XDG_CACHE_HOME': str(VAR_15)}\n", "return VAR_16\n" ]
[ "@pytest.fixture...\n", "\"\"\"docstring\"\"\"\n", "data_dir = tmpdir / 'data'\n", "config_dir = tmpdir / 'config'\n", "runtime_dir = short_tmpdir / 'rt'\n", "cache_dir = tmpdir / 'cache'\n", "runtime_dir.ensure(dir=True)\n", "runtime_dir.chmod(448)\n", "(data_dir / 'qutebrowser' / 'state').write_text(\n \"\"\"[general]\nquickstart-done = 1\nbackend-warning-shown=1\"\"\", encoding=\n 'utf-8', ensure=True)\n", "env = {'XDG_DATA_HOME': str(data_dir), 'XDG_CONFIG_HOME': str(config_dir),\n 'XDG_RUNTIME_DIR': str(runtime_dir), 'XDG_CACHE_HOME': str(cache_dir)}\n", "return env\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_19(VAR_28):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(VAR_28)...\n", "VAR_211 = VAR_2.GET.getlist('debug')\n", "if 'slow' in VAR_211:\n", "time.sleep(5)\n", "if 'fail' in VAR_211:\n", "if 'error' in VAR_211:\n", "return VAR_28(VAR_2, *VAR_116, **kwargs)\n" ]
[ "def debug(f):...\n", "\"\"\"docstring\"\"\"\n", "@wraps(f)...\n", "debug = request.GET.getlist('debug')\n", "if 'slow' in debug:\n", "time.sleep(5)\n", "if 'fail' in debug:\n", "if 'error' in debug:\n", "return f(request, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Condition", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_4 = [{'room': {'timeline': {'limit': 20}, 'state': {'not_types': [\n 'm.room.member']}, 'ephemeral': {'limit': 0, 'not_types': ['*']},\n 'include_leave': False, 'rooms': ['!dee:pik-test'], 'not_rooms': [\n '!gee:pik-test'], 'account_data': {'limit': 0, 'types': ['*']}}}, {\n 'room': {'state': {'types': ['m.room.*'], 'not_rooms': [\n '!726s6s6q:example.com']}, 'timeline': {'limit': 10, 'types': [\n 'm.room.message'], 'not_rooms': ['!726s6s6q:example.com'],\n 'not_senders': ['@spam:example.com'], 'org.matrix.labels': ['#fun'],\n 'org.matrix.not_labels': ['#work']}, 'ephemeral': {'types': [\n 'm.receipt', 'm.typing'], 'not_rooms': ['!726s6s6q:example.com'],\n 'not_senders': ['@spam:example.com']}}, 'presence': {'types': [\n 'm.presence'], 'not_senders': ['@alice:example.com']}, 'event_format':\n 'client', 'event_fields': ['type', 'content', 'sender']}, {\n 'event_fields': ['foo\\\\.bar']}]\n", "for VAR_14 in VAR_4:\n", "self.filtering.check_valid_filter(VAR_14)\n", "self.fail(e)\n" ]
[ "def test_valid_filters(self):...\n", "valid_filters = [{'room': {'timeline': {'limit': 20}, 'state': {'not_types':\n ['m.room.member']}, 'ephemeral': {'limit': 0, 'not_types': ['*']},\n 'include_leave': False, 'rooms': ['!dee:pik-test'], 'not_rooms': [\n '!gee:pik-test'], 'account_data': {'limit': 0, 'types': ['*']}}}, {\n 'room': {'state': {'types': ['m.room.*'], 'not_rooms': [\n '!726s6s6q:example.com']}, 'timeline': {'limit': 10, 'types': [\n 'm.room.message'], 'not_rooms': ['!726s6s6q:example.com'],\n 'not_senders': ['@spam:example.com'], 'org.matrix.labels': ['#fun'],\n 'org.matrix.not_labels': ['#work']}, 'ephemeral': {'types': [\n 'm.receipt', 'm.typing'], 'not_rooms': ['!726s6s6q:example.com'],\n 'not_senders': ['@spam:example.com']}}, 'presence': {'types': [\n 'm.presence'], 'not_senders': ['@alice:example.com']}, 'event_format':\n 'client', 'event_fields': ['type', 'content', 'sender']}, {\n 'event_fields': ['foo\\\\.bar']}]\n", "for filter in valid_filters:\n", "self.filtering.check_valid_filter(filter)\n", "self.fail(e)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Expr'" ]
[ "@VAR_1.route('/<bfile>/download-query/query_result.<result_format>')...\n", "\"\"\"docstring\"\"\"\n", "VAR_16, VAR_30 = g.ledger.query_shell.query_to_file(g.filtered.entries,\n request.args.get('query_string', ''), VAR_20)\n", "VAR_10 = f'{secure_filename(VAR_16.strip())}.{VAR_20}'\n", "return send_file(VAR_30, as_attachment=True, download_name=filename)\n" ]
[ "@app.route('/<bfile>/download-query/query_result.<result_format>')...\n", "\"\"\"docstring\"\"\"\n", "name, data = g.ledger.query_shell.query_to_file(g.filtered.entries, request\n .args.get('query_string', ''), result_format)\n", "filename = f'{secure_filename(name.strip())}.{result_format}'\n", "return send_file(data, as_attachment=True, download_name=filename)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "For", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_121(*VAR_79, **VAR_42):...\n", "if VAR_13.read_from_replica:\n", "FUNC_6()\n", "VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n", "if VAR_1 and hasattr(VAR_1, 'primary_db'):\n", "return VAR_225\n", "VAR_1.db.close()\n", "VAR_1.db = VAR_1.primary_db\n" ]
[ "def wrapper_fn(*args, **kwargs):...\n", "if conf.read_from_replica:\n", "connect_replica()\n", "retval = fn(*args, **get_newargs(fn, kwargs))\n", "if local and hasattr(local, 'primary_db'):\n", "return retval\n", "local.db.close()\n", "local.db = local.primary_db\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_24(self):...\n", "VAR_32 = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.user_id)\n", "VAR_19 = '{\"membership\":\"%s\"}' % Membership.JOIN\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, VAR_19.encode('ascii'))\n", "self.assertEquals(200, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('GET', VAR_32, None)\n", "self.assertEquals(200, VAR_23.code, msg=channel.result['body'])\n", "VAR_33 = {'membership': Membership.JOIN}\n", "self.assertEquals(VAR_33, VAR_23.json_body)\n" ]
[ "def test_rooms_members_self(self):...\n", "path = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.user_id)\n", "content = '{\"membership\":\"%s\"}' % Membership.JOIN\n", "request, channel = self.make_request('PUT', path, content.encode('ascii'))\n", "self.assertEquals(200, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('GET', path, None)\n", "self.assertEquals(200, channel.code, msg=channel.result['body'])\n", "expected_response = {'membership': Membership.JOIN}\n", "self.assertEquals(expected_response, channel.json_body)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_83(VAR_62, *VAR_79, **VAR_42):...\n", "\"\"\"docstring\"\"\"\n", "VAR_42['ignore_permissions'] = True\n", "if not 'limit_page_length' in VAR_42:\n", "VAR_42['limit_page_length'] = 0\n", "return FUNC_82(VAR_62, *VAR_79, **kwargs)\n" ]
[ "def get_all(doctype, *args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "kwargs['ignore_permissions'] = True\n", "if not 'limit_page_length' in kwargs:\n", "kwargs['limit_page_length'] = 0\n", "return get_list(doctype, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "from Products.PageTemplates.Expressions import createTrustedZopeEngine\n", "return createTrustedZopeEngine()\n" ]
[ "def _makeEngine(self):...\n", "from Products.PageTemplates.Expressions import createTrustedZopeEngine\n", "return createTrustedZopeEngine()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Return'" ]
[ "def FUNC_10(VAR_20):...\n", "return os.path.join(VAR_4, VAR_20)\n" ]
[ "def _get_obj_absolute_path(obj_path):...\n", "return os.path.join(DATAROOT, obj_path)\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_15(VAR_3, **VAR_4):...\n", "return 200, {'result': True}\n" ]
[ "def _callback(request, **kwargs):...\n", "return 200, {'result': True}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_13(VAR_30):...\n", "VAR_33 = VAR_30.group(1)\n", "if VAR_33.startswith('0x'):\n", "VAR_36 = int(VAR_33, 16)\n", "if VAR_33.startswith('0') and '.' not in VAR_33:\n", "VAR_13 = complex(VAR_36)\n", "VAR_36 = float(VAR_33)\n", "VAR_36 = int(VAR_33, 8)\n", "VAR_36 = int(VAR_33)\n", "if VAR_13.imag == 0:\n", "VAR_13 = VAR_13.real\n", "return str(VAR_13)\n", "return '%.16f' % VAR_13\n" ]
[ "def handleMatch(m):...\n", "s = m.group(1)\n", "if s.startswith('0x'):\n", "i = int(s, 16)\n", "if s.startswith('0') and '.' not in s:\n", "x = complex(i)\n", "i = float(s)\n", "i = int(s, 8)\n", "i = int(s)\n", "if x.imag == 0:\n", "x = x.real\n", "return str(x)\n", "return '%.16f' % x\n" ]
[ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Return'" ]
[ "def FUNC_77(VAR_233, VAR_234, VAR_235):...\n", "VAR_17 = os.path.basename(VAR_233)\n", "VAR_293 = '%s.%s' % (VAR_17, VAR_234)\n", "VAR_293 = os.path.join(VAR_235, VAR_293)\n", "VAR_212 = 1\n", "VAR_17 = VAR_293[:-(len(VAR_234) + 1)]\n", "while os.path.exists(VAR_293):\n", "VAR_293 = '%s_(%d).%s' % (VAR_17, VAR_212, VAR_234)\n", "return VAR_293\n", "VAR_212 += 1\n" ]
[ "def makeImageName(originalName, extension, folder_name):...\n", "name = os.path.basename(originalName)\n", "imgName = '%s.%s' % (name, extension)\n", "imgName = os.path.join(folder_name, imgName)\n", "i = 1\n", "name = imgName[:-(len(extension) + 1)]\n", "while os.path.exists(imgName):\n", "imgName = '%s_(%d).%s' % (name, i, extension)\n", "return imgName\n", "i += 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "AugAssign'" ]
[ "def __init__(self, VAR_1):...\n", "self.config = VAR_1\n", "VAR_42 = 'res/dist/main.html'\n", "VAR_43 = 'res/login.html'\n", "VAR_44 = 'res/firstrun.html'\n", "self.mainpage = readRes(VAR_42)\n", "self.loginpage = readRes(VAR_43)\n", "self.firstrunpage = readRes(VAR_44)\n", "self.handlers = {'search': self.api_search, 'rememberplaylist': self.\n api_rememberplaylist, 'saveplaylist': self.api_saveplaylist,\n 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.\n api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist,\n 'getmotd': self.api_getmotd, 'restoreplaylist': self.\n api_restoreplaylist, 'getplayables': self.api_getplayables,\n 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser,\n 'userdelete': self.api_userdelete, 'userchangepassword': self.\n api_userchangepassword, 'showplaylists': self.api_showplaylists,\n 'logout': self.api_logout, 'downloadpls': self.api_downloadpls,\n 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.\n api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders':\n self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled,\n 'updatedb': self.api_updatedb, 'getconfiguration': self.\n api_getconfiguration, 'compactlistdir': self.api_compactlistdir,\n 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart,\n 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.\n api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions':\n self.api_getuseroptions, 'setuseroption': self.api_setuseroption,\n 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.\n api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor}\n" ]
[ "def __init__(self, config):...\n", "self.config = config\n", "template_main = 'res/dist/main.html'\n", "template_login = 'res/login.html'\n", "template_firstrun = 'res/firstrun.html'\n", "self.mainpage = readRes(template_main)\n", "self.loginpage = readRes(template_login)\n", "self.firstrunpage = readRes(template_firstrun)\n", "self.handlers = {'search': self.api_search, 'rememberplaylist': self.\n api_rememberplaylist, 'saveplaylist': self.api_saveplaylist,\n 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.\n api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist,\n 'getmotd': self.api_getmotd, 'restoreplaylist': self.\n api_restoreplaylist, 'getplayables': self.api_getplayables,\n 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser,\n 'userdelete': self.api_userdelete, 'userchangepassword': self.\n api_userchangepassword, 'showplaylists': self.api_showplaylists,\n 'logout': self.api_logout, 'downloadpls': self.api_downloadpls,\n 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.\n api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders':\n self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled,\n 'updatedb': self.api_updatedb, 'getconfiguration': self.\n api_getconfiguration, 'compactlistdir': self.api_compactlistdir,\n 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart,\n 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.\n api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions':\n self.api_getuseroptions, 'setuseroption': self.api_setuseroption,\n 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.\n api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_42(self, VAR_77, VAR_78):...\n", "print(self.notebook_info())\n" ]
[ "def _signal_info(self, sig, frame):...\n", "print(self.notebook_info())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_52(self, VAR_5, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = FUNC_0(FEDERATION_UNSTABLE_PREFIX, '/rooms/%s/complexity', VAR_6)\n", "return self.client.get_json(VAR_5=destination, VAR_2=path)\n" ]
[ "def get_room_complexity(self, destination, room_id):...\n", "\"\"\"docstring\"\"\"\n", "path = _create_path(FEDERATION_UNSTABLE_PREFIX, '/rooms/%s/complexity', room_id\n )\n", "return self.client.get_json(destination=destination, path=path)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_6(VAR_8: str, **VAR_9: (str | int)) ->str:...\n", "\"\"\"docstring\"\"\"\n", "FUNC_4(VAR_8, VAR_9)\n", "return VAR_11(VAR_8, **values)\n" ]
[ "def url_for(endpoint: str, **values: (str | int)) ->str:...\n", "\"\"\"docstring\"\"\"\n", "_inject_filters(endpoint, values)\n", "return CACHED_URL_FOR(endpoint, **values)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Return'" ]
[ "def FUNC_103(self, VAR_187='default'):...\n", "\"\"\"docstring\"\"\"\n", "if not isinstance(VAR_187, str):\n", "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(self, domain='default'):...\n", "\"\"\"docstring\"\"\"\n", "if not isinstance(domain, str):\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, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_20(VAR_15=None):...\n", "" ]
[ "def session_commit(success=None):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@app.route('/static/custom.css')...\n", "if not app.config['THEME_CONF'].get('use_custom_css', False):\n", "return ''\n", "return send_from_directory(Path(app.config['USER_DIR']) / 'css', app.config\n ['THEME_CONF']['custom_css_file'])\n" ]
[ "@app.route('/static/custom.css')...\n", "if not app.config['THEME_CONF'].get('use_custom_css', False):\n", "return ''\n", "return send_from_directory(Path(app.config['USER_DIR']) / 'css', app.config\n ['THEME_CONF']['custom_css_file'])\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_12(self):...\n", "if frappe.flags.in_import:\n", "return\n", "if self.is_standard == 'Yes' and (frappe.local.conf.get('developer_mode') or 0\n", "export_to_files(record_list=[['Report', self.name]], record_module=self.\n module, create_init=True)\n", "self.create_report_py()\n" ]
[ "def export_doc(self):...\n", "if frappe.flags.in_import:\n", "return\n", "if self.is_standard == 'Yes' and (frappe.local.conf.get('developer_mode') or 0\n", "export_to_files(record_list=[['Report', self.name]], record_module=self.\n module, create_init=True)\n", "self.create_report_py()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_96(*VAR_79, **VAR_42):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils.background_jobs\n", "return frappe.utils.background_jobs.enqueue_doc(*VAR_79, **kwargs)\n" ]
[ "def enqueue_doc(*args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils.background_jobs\n", "return frappe.utils.background_jobs.enqueue_doc(*args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Return'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = self.client.post('/password_reset/html_email_template/', {'email':\n '[email protected]'})\n", "self.assertEqual(VAR_3.status_code, 302)\n", "self.assertEqual(len(mail.outbox), 1)\n", "VAR_13 = mail.outbox[0].message()\n", "self.assertEqual(len(VAR_13.get_payload()), 2)\n", "self.assertTrue(VAR_13.is_multipart())\n", "self.assertEqual(VAR_13.get_payload(0).get_content_type(), 'text/plain')\n", "self.assertEqual(VAR_13.get_payload(1).get_content_type(), 'text/html')\n", "self.assertTrue('<html>' not in VAR_13.get_payload(0).get_payload())\n", "self.assertTrue('<html>' in VAR_13.get_payload(1).get_payload())\n" ]
[ "def test_html_mail_template(self):...\n", "\"\"\"docstring\"\"\"\n", "response = self.client.post('/password_reset/html_email_template/', {\n 'email': '[email protected]'})\n", "self.assertEqual(response.status_code, 302)\n", "self.assertEqual(len(mail.outbox), 1)\n", "message = mail.outbox[0].message()\n", "self.assertEqual(len(message.get_payload()), 2)\n", "self.assertTrue(message.is_multipart())\n", "self.assertEqual(message.get_payload(0).get_content_type(), 'text/plain')\n", "self.assertEqual(message.get_payload(1).get_content_type(), 'text/html')\n", "self.assertTrue('<html>' not in message.get_payload(0).get_payload())\n", "self.assertTrue('<html>' in message.get_payload(1).get_payload())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_8, *VAR_6, **VAR_7):...\n", "if 'instance' in VAR_7:\n", "VAR_7.pop('instance')\n", "if 'auto_id' not in VAR_7:\n", "VAR_7['auto_id'] = 'id_existing_%s'\n", "super().__init__(VAR_8, *VAR_6, **kwargs)\n" ]
[ "def __init__(self, request, *args, **kwargs):...\n", "if 'instance' in kwargs:\n", "kwargs.pop('instance')\n", "if 'auto_id' not in kwargs:\n", "kwargs['auto_id'] = 'id_existing_%s'\n", "super().__init__(request, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_28(self, VAR_44):...\n", "VAR_49 = VAR_44.group(1)\n", "if VAR_44.group(2) == '@':\n", "VAR_72 = True\n", "VAR_72 = False\n", "return self.renderer.autolink(VAR_49, VAR_72)\n" ]
[ "def output_autolink(self, m):...\n", "link = m.group(1)\n", "if m.group(2) == '@':\n", "is_email = True\n", "is_email = False\n", "return self.renderer.autolink(link, is_email)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]