lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 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_4... | [
"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",
"rule... | [
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_... | [
"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 =... | [
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_prope... | [
"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_py... | [
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... | [
"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 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 deprecate... | [
"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 resp... | [
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'] ... | [
"@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_fil... | [
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... | [
"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, lat... | [
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_... | [
"@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... | [
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.getSpl... | [
"@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,
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['implementatio... | [
"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... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",... |
[
"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(VA... | [
"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(... | [
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 aggr... | [
"def get_group_by_column_label(args, meta):...\n",
"if args['aggregate_function'] == 'count':\n",
"label = 'Count'\n",
"sql_fn_map = {'avg': 'Average', 'sum': 'Sum'}\n",
"return label\n",
"aggregate_on_label = meta.get_label(args.aggregate_on)\n",
"label = _('{function} of {fieldlabel}').format(function... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'"
] |
[
"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 d... | [
"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' %... | [
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"... | [
"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(he... | [
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",
"V... | [
"@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",... | [
0,
0,
0,
0,
0,
0,
0,
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'",
... |
[
"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', ... | [
"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', 'capti... | [
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_se... | [
"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_se... | [
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_... | [
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}... | [
"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_... | [
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(... | [
"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_maca... | [
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",
"ass... | [
"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",
... | [
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 ... | [
"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 ... | [
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... | [
"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(... | [
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 unavai... | [
"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 una... | [
0,
0,
0,
0,
0,
0,
0,
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",
"E... |
[
"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)... | [
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 s... | [
"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 == 'win3... | [
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(s... | [
"@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 jsoni... | [
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(_(VA... | [
"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",
"i... | [
"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_t... | [
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 HttpResponseBadReque... | [
"@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",
"retur... | [
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.... | [
"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",
"sel... | [
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... | [
"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 = lo... | [
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=[corea... | [
"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 Li... | [
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_1... | [
"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.... | [
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... | [
"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_m... | [
0,
0,
0,
0,
0,
0,
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'... |
[
"@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... | [
"@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_te... | [
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': ['*']}}}, {\... | [
"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, 't... | [
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_fil... | [
"@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... | [
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=ch... | [
"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, cha... | [
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_1... | [
"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' % (V... | [
"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 =... | [
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 = {'searc... | [
"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 = rea... | [
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 'staffmember@example.com'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertEqual(len(mail.outbox), 1)\n",
"VAR_13 = mail.outbox[0].message()\n",
"self.asse... | [
"def test_html_mail_template(self):...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.post('/password_reset/html_email_template/', {\n 'email': 'staffmember@example.com'})\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertEqual(len(mail.outbox), 1)\n",
"message = mail.outbox[0].m... | [
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'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.