lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"@VAR_2.route('/table')...\n",
"VAR_78 = VAR_87.view_settings.get('table', {})\n",
"return render_title_template('book_table.html', VAR_149=_(u'Books List'),\n VAR_9='book_table', visiblility=visibility)\n"
] | [
"@web.route('/table')...\n",
"visibility = current_user.view_settings.get('table', {})\n",
"return render_title_template('book_table.html', title=_(u'Books List'),\n page='book_table', visiblility=visibility)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_43(self, VAR_53, VAR_54):...\n",
"return VAR_53 * VAR_54\n"
] | [
"def multiply(self, a, b):...\n",
"return a * b\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_87(self):...\n",
"if not self.can_edit():\n",
"return self.not_authorized()\n",
"VAR_101 = self.auth.db\n",
"VAR_338 = VAR_101(VAR_101.wiki_page.id > 0).select(VAR_101.wiki_page.id,\n VAR_101.wiki_page.slug)\n",
"VAR_61 = [OPTION(VAR_266.slug, _value=row.id) for VAR_266 in VAR_338]\n",
"VAR... | [
"def create(self):...\n",
"if not self.can_edit():\n",
"return self.not_authorized()\n",
"db = self.auth.db\n",
"slugs = db(db.wiki_page.id > 0).select(db.wiki_page.id, db.wiki_page.slug)\n",
"options = [OPTION(row.slug, _value=row.id) for row in slugs]\n",
"options.insert(0, OPTION('', _value=''))\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"@VAR_0.route('/api/preferences/get/<key>')...\n",
"if get_user() is None:\n",
"return 'Authentication required', 401\n",
"if VAR_10 in VAR_31():\n",
"return Response(json.dumps({'key': VAR_10, 'value': VAR_31()[VAR_10]}))\n",
"return Response(json.dumps({'key': VAR_10, 'error': 'novalue'}))\n"
] | [
"@app.route('/api/preferences/get/<key>')...\n",
"if get_user() is None:\n",
"return 'Authentication required', 401\n",
"if key in get_preferences():\n",
"return Response(json.dumps({'key': key, 'value': get_preferences()[key]}))\n",
"return Response(json.dumps({'key': key, 'error': 'novalue'}))\n"
] | [
0,
0,
0,
0,
2,
2
] | [
"Condition",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_13():...\n",
"yield '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n'\n",
"if VAR_1:\n",
"yield '<?xml-stylesheet type=\"text/xsl\" href=\"/scopelist.xsl\" ?>\\n'\n",
"yield '<objectlist count=\"{:d}\">\\n'.format(VAR_43)\n",
"VAR_44 = 0\n",
"VAR_45 = 0\n",
"if VAR_27:\n",
"VAR_44 = int(VAR... | [
"def generate():...\n",
"yield '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n'\n",
"if STYLE:\n",
"yield '<?xml-stylesheet type=\"text/xsl\" href=\"/scopelist.xsl\" ?>\\n'\n",
"yield '<objectlist count=\"{:d}\">\\n'.format(total_entries)\n",
"mix_per_iteration = 0\n",
"iteration_count = 0\n",
"if mak... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def __str__(self):...\n",
"return '%s' % self.name\n"
] | [
"def __str__(self):...\n",
"return '%s' % self.name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@wraps(VAR_14)...\n",
"VAR_112 = None\n",
"if 'X-Access-Token' in request.headers:\n",
"VAR_112 = request.headers['X-Access-Token']\n",
"if not VAR_112:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"VAR_13 = jwt.decode(VAR_112, VAR_0.config['SECRET_KEY'], algorithms=[... | [
"@wraps(f)...\n",
"token = None\n",
"if 'X-Access-Token' in request.headers:\n",
"token = request.headers['X-Access-Token']\n",
"if not token:\n",
"return jsonify({'success': False, 'message': 'Token is missing'}), 401\n",
"data = jwt.decode(token, gui.config['SECRET_KEY'], algorithms=['HS256'])\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_15():...\n",
"random.seed(VAR_24)\n",
"return list(map(lambda x: x + VAR_5 * VAR_45, sorted(random.sample(list(\n range(VAR_5)), VAR_44))))\n"
] | [
"def generate_mix_indices():...\n",
"random.seed(seed)\n",
"return list(map(lambda x: x + ITEMS_PER_ITERATION * iteration_count, sorted\n (random.sample(list(range(ITEMS_PER_ITERATION)), mix_per_iteration))))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_135 = ReportStore.from_config(config_name='FINANCIAL_REPORTS')\n",
"VAR_63 = {'downloads': [dict(VAR_16=name, VAR_147=url, link=HTML(\n '<a href=\"{}\">{}</a>').format(HTML(url... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"report_store = ReportStore.from_config(config_name='FINANCIAL_REPORTS')\n",
"response_payload = {'downloads': [dict(name=name, url=url, link=HTML(\n '<a href=\"{}\">{}</a>').... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self, VAR_5) ->CLASS_4:...\n",
"return CLASS_4(os.path.join(self.directory(), VAR_5))\n"
] | [
"def relative(self, relativePath) ->FileInputSource:...\n",
"return FileInputSource(os.path.join(self.directory(), relativePath))\n"
] | [
0,
1
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
"return os.path.join(os.path.dirname(__file__), VAR_0)\n"
] | [
"def fpath(name):...\n",
"return os.path.join(os.path.dirname(__file__), name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_16(self, VAR_19: int, VAR_20: int=0, VAR_21: bool=True) ->Tuple[...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = await self.store.get_local_media_before(VAR_19, VAR_20, VAR_21)\n",
"return await self._remove_local_media_from_disk(VAR_38)\n"
] | [
"async def delete_old_local_media(self, before_ts: int, size_gt: int=0,...\n",
"\"\"\"docstring\"\"\"\n",
"old_media = await self.store.get_local_media_before(before_ts, size_gt,\n keep_profiles)\n",
"return await self._remove_local_media_from_disk(old_media)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_0():...\n",
"VAR_6 = gspread.authorize(VAR_14).open('문학따먹기')\n",
"VAR_7 = VAR_6.get_worksheet(0)\n",
"VAR_8 = VAR_7.get_all_values()\n",
"print(VAR_8)\n",
"VAR_16 = []\n",
"VAR_3 = VAR_16\n",
"for row in VAR_8[1:]:\n",
"print(VAR_16)\n",
"VAR_31 = namedtuple('Munhak', VAR_8[0])(*row)\n",... | [
"def update():...\n",
"gc = gspread.authorize(credentials).open('문학따먹기')\n",
"wks = gc.get_worksheet(0)\n",
"rows = wks.get_all_values()\n",
"print(rows)\n",
"data = []\n",
"munhak_rows_data = data\n",
"for row in rows[1:]:\n",
"print(data)\n",
"row_tuple = namedtuple('Munhak', rows[0])(*row)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Expr'"
] |
[
"@VAR_0.route('/shelf/order/<int:shelf_id>', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"VAR_20 = request.form.to_dict()\n",
"VAR_0 = ub.session.query(ub.Shelf).filter(ub.Shelf.id == VAR_3).first()\n",
"VAR_18 = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == VAR_3\n ).... | [
"@shelf.route('/shelf/order/<int:shelf_id>', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"to_save = request.form.to_dict()\n",
"shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()\n",
"books_in_shelf = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf ==\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"AugAssign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_41(self, VAR_44):...\n",
"VAR_14 = VAR_44.group(0)\n",
"return self.renderer.text(VAR_14)\n"
] | [
"def output_text(self, m):...\n",
"text = m.group(0)\n",
"return self.renderer.text(text)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"self.assertFormfield(models.Event, 'start_time', widgets.AdminTimeWidget)\n"
] | [
"def testTimeField(self):...\n",
"self.assertFormfield(models.Event, 'start_time', widgets.AdminTimeWidget)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_84(self, VAR_148, VAR_153, VAR_168=0):...\n",
"if not self.settings.auth:\n",
"return True\n",
"VAR_150 = VAR_168.id\n",
"VAR_150 = VAR_168\n",
"return self.settings.auth.has_permission(VAR_148, str(VAR_153), VAR_150)\n"
] | [
"def has_permission(self, name, table, record=0):...\n",
"if not self.settings.auth:\n",
"return True\n",
"record_id = record.id\n",
"record_id = record\n",
"return self.settings.auth.has_permission(name, str(table), record_id)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_31(VAR_31):...\n",
"VAR_63 = \"'\" * isinstance(VAR_31, str)\n",
"return VAR_63 + str(VAR_31) + VAR_63\n"
] | [
"def _maybe_add_quotes(value):...\n",
"is_quotes = \"'\" * isinstance(value, str)\n",
"return is_quotes + str(value) + is_quotes\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def __call__(self, VAR_11):...\n",
"self._function = VAR_11\n",
"VAR_2[self._name] = self.wrapper\n",
"return VAR_11\n"
] | [
"def __call__(self, function):...\n",
"self._function = function\n",
"_HANDLERS[self._name] = self.wrapper\n",
"return function\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(VAR_12, VAR_1):...\n",
"if not VAR_12.dialect.has_table(VAR_12.connect(), 'book_read_link'):\n",
"CLASS_8.__table__.create(bind=engine)\n",
"if not VAR_12.dialect.has_table(VAR_12.connect(), 'bookmark'):\n",
"CLASS_9.__table__.create(bind=engine)\n",
"if not VAR_12.dialect.has_table(VAR_12.con... | [
"def add_missing_tables(engine, session):...\n",
"if not engine.dialect.has_table(engine.connect(), 'book_read_link'):\n",
"ReadBook.__table__.create(bind=engine)\n",
"if not engine.dialect.has_table(engine.connect(), 'bookmark'):\n",
"Bookmark.__table__.create(bind=engine)\n",
"if not engine.dialect.has_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_0, VAR_1, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"return (VAR_0, VAR_1, VAR_2) in self._allowed\n"
] | [
"def is_allowed(self, role, method, resource):...\n",
"\"\"\"docstring\"\"\"\n",
"return (role, method, resource) in self._allowed\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"VAR_29 = self.helper.create_room_as('@some_other_guy:red')\n",
"VAR_22, VAR_23 = self.make_request('GET', '/rooms/%s/members' % VAR_29)\n",
"self.assertEquals(403, VAR_23.code, msg=channel.result['body'])\n"
] | [
"def test_get_member_list_no_permission(self):...\n",
"room_id = self.helper.create_room_as('@some_other_guy:red')\n",
"request, channel = self.make_request('GET', '/rooms/%s/members' % room_id)\n",
"self.assertEquals(403, channel.code, msg=channel.result['body'])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_0.route('/shelf/create', methods=['GET', 'POST'])...\n",
"VAR_0 = ub.Shelf()\n",
"return FUNC_7(VAR_0, VAR_5=_(u'Create a Shelf'), VAR_6='shelfcreate')\n"
] | [
"@shelf.route('/shelf/create', methods=['GET', 'POST'])...\n",
"shelf = ub.Shelf()\n",
"return create_edit_shelf(shelf, page_title=_(u'Create a Shelf'), page=\n 'shelfcreate')\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"import os\n",
"import re\n",
"from flask.testing import FlaskClient\n",
"from flask import request\n",
"from flask_login import current_user\n",
"from responses import RequestsMock, GET\n",
"from werkzeug.security import generate_password_hash\n",
"from archivy.helpers import get_max_id, get_db\n",
... | [
"import os\n",
"import re\n",
"from flask.testing import FlaskClient\n",
"from flask import request\n",
"from flask_login import current_user\n",
"from responses import RequestsMock, GET\n",
"from werkzeug.security import generate_password_hash\n",
"from archivy.helpers import get_max_id, get_db\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,
3,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assert'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assert'",
"Assign'"... |
[
"import logging\n",
"from unittest import TestCase\n",
"from synapse.api.constants import EventTypes\n",
"from synapse.api.errors import AuthError, Codes, SynapseError\n",
"from synapse.api.room_versions import RoomVersions\n",
"from synapse.events import EventBase\n",
"from synapse.federation.federatio... | [
"import logging\n",
"from unittest import TestCase\n",
"from synapse.api.constants import EventTypes\n",
"from synapse.api.errors import AuthError, Codes, SynapseError\n",
"from synapse.api.room_versions import RoomVersions\n",
"from synapse.events import EventBase\n",
"from synapse.federation.federatio... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self, VAR_5, VAR_6, VAR_10, VAR_11=None):...\n",
"VAR_7 = self.get_image_uuid(VAR_5, VAR_6)\n",
"VAR_9 = self.service.update(VAR_5, VAR_7, VAR_10, VAR_11)\n",
"return self._translate_uuid_to_id(VAR_5, VAR_9)\n"
] | [
"def update(self, context, image_id, metadata, data=None):...\n",
"image_uuid = self.get_image_uuid(context, image_id)\n",
"image = self.service.update(context, image_uuid, metadata, data)\n",
"return self._translate_uuid_to_id(context, image)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_25(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_install == 'frappe':\n",
"return\n",
"VAR_51 = self.meta.get_workflow()\n",
"if VAR_51:\n",
"FUNC_25(self)\n",
"if not self._action == 'save':\n",
"set_workflow_state_on_action(self, VAR_51, self._action)\n"
] | [
"def validate_workflow(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if frappe.flags.in_install == 'frappe':\n",
"return\n",
"workflow = self.meta.get_workflow()\n",
"if workflow:\n",
"validate_workflow(self)\n",
"if not self._action == 'save':\n",
"set_workflow_state_on_action(self, workflow, self._act... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_1(VAR_1: HttpRequest) ->Tuple[Dict[str, Any], bool]:...\n",
"if VAR_1.user.is_anonymous:\n",
"return {}, False\n",
"VAR_0 = VAR_1.user.team\n",
"if VAR_0 and FUNC_0(VAR_0, VAR_1):\n",
"VAR_6: Dict[str, Any] = {'isAuthenticated': True}\n",
"return {}, False\n",
"VAR_8 = {}\n",
"if VAR_1.use... | [
"def decide_editor_params(request: HttpRequest) ->Tuple[Dict[str, Any], bool]:...\n",
"if request.user.is_anonymous:\n",
"return {}, False\n",
"team = request.user.team\n",
"if team and on_permitted_domain(team, request):\n",
"response: Dict[str, Any] = {'isAuthenticated': True}\n",
"return {}, False\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"AnnAssign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(VAR_12, *VAR_13, **VAR_14):...\n",
"return VAR_12\n"
] | [
"def _progress_indicator(iterable, *args, **kwargs):...\n",
"return iterable\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_34(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_61 = False\n",
"self._action = 'save'\n",
"if not self.get('__islocal'):\n",
"if self.meta.issingle:\n",
"self.check_docstatus_transition(0)\n",
"VAR_100 = frappe.db.sql(\n \"\"\"select value from tabSingles\n\t\t\t\t\twhere doctype=%s and ... | [
"def check_if_latest(self):...\n",
"\"\"\"docstring\"\"\"\n",
"conflict = False\n",
"self._action = 'save'\n",
"if not self.get('__islocal'):\n",
"if self.meta.issingle:\n",
"self.check_docstatus_transition(0)\n",
"modified = frappe.db.sql(\n \"\"\"select value from tabSingles\n\t\t\t\t\twhere doct... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"return VAR_25.__version__\n"
] | [
"@frappe.whitelist(allow_guest=True)...\n",
"return frappe.__version__\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"VAR_16 = None\n",
"if VAR_25.session.user == 'Guest':\n",
"if VAR_25.get_system_settings('allow_guests_to_upload_files'):\n",
"VAR_16 = VAR_25.get_doc('User', VAR_25.session.user)\n",
"VAR_26 = True\n",
"return\n",
"VAR_26 = False\n",
"VAR_17 = VAR_25.req... | [
"@frappe.whitelist(allow_guest=True)...\n",
"user = None\n",
"if frappe.session.user == 'Guest':\n",
"if frappe.get_system_settings('allow_guests_to_upload_files'):\n",
"user = frappe.get_doc('User', frappe.session.user)\n",
"ignore_permissions = True\n",
"return\n",
"ignore_permissions = False\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
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"... |
[
"def FUNC_22(self, VAR_62: bool=True):...\n",
"super().save(VAR_62=commit)\n",
"if self.changed_access:\n",
"Change.objects.create(VAR_58=self.instance, VAR_98=Change.\n ACTION_ACCESS_EDIT, VAR_4=self.user, details={'access_control': self.\n instance.access_control})\n"
] | [
"def save(self, commit: bool=True):...\n",
"super().save(commit=commit)\n",
"if self.changed_access:\n",
"Change.objects.create(project=self.instance, action=Change.\n ACTION_ACCESS_EDIT, user=self.user, details={'access_control': self.\n instance.access_control})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def __init__(self, VAR_6, VAR_7=False, VAR_8=None, VAR_9=False, VAR_10=None,...\n",
"self.valid = False\n",
"self.lineNumbers = VAR_9\n",
"if VAR_9:\n",
"constants.dryRun = True\n",
"if VAR_6 is None:\n",
"VAR_6 = FUNC_0()\n",
"if VAR_6 is None:\n",
"die('string')\n",
"self.inputSource = InputSou... | [
"def __init__(self, inputFilename, debug=False, token=None, lineNumbers=...\n",
"self.valid = False\n",
"self.lineNumbers = lineNumbers\n",
"if lineNumbers:\n",
"constants.dryRun = True\n",
"if inputFilename is None:\n",
"inputFilename = findImplicitInputFile()\n",
"if inputFilename is None:\n",
"di... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"... |
[
"async def FUNC_14(self, VAR_5: str, VAR_11: str, VAR_27: str) ->EventBase:...\n",
"\"\"\"docstring\"\"\"\n",
"if get_domain_from_id(VAR_27) != VAR_5:\n",
"VAR_0.info(\n 'Got /make_join request for user %r from different origin %s, ignoring',\n VAR_27, VAR_5)\n",
"VAR_28 = await self.store.get_room_ve... | [
"async def on_make_join_request(self, origin: str, room_id: str, user_id: str...\n",
"\"\"\"docstring\"\"\"\n",
"if get_domain_from_id(user_id) != origin:\n",
"logger.info(\n 'Got /make_join request for user %r from different origin %s, ignoring',\n user_id, origin)\n",
"room_version = await self.stor... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/admin/alive', methods=['GET'])...\n",
"return '', 200\n"
] | [
"@admi.route('/admin/alive', methods=['GET'])...\n",
"return '', 200\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_52(self, VAR_70):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<tr>\\n%s</tr>\\n' % VAR_70\n"
] | [
"def table_row(self, content):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<tr>\\n%s</tr>\\n' % content\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_3(VAR_7: str, VAR_8: List[str]) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = VAR_7.replace('\\t', '')\n",
"return bleach.clean(VAR_7, tags=allowed_tags, attributes=allowed_attributes,\n styles=allowed_styles)\n"
] | [
"def base_validate_html(html: str, allowed_tags: List[str]) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"html = html.replace('\\t', '')\n",
"return bleach.clean(html, tags=allowed_tags, attributes=allowed_attributes,\n styles=allowed_styles)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"\"\"\"QtWebEngine specific qute://* handlers and glue code.\"\"\"\n",
"from PyQt5.QtCore import QBuffer, QIODevice\n",
"from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler, QWebEngineUrlRequestJob\n",
"from qutebrowser.browser import qutescheme\n",
"from qutebrowser.utils import log, qtutils\n",
... | [
"\"\"\"QtWebEngine specific qute://* handlers and glue code.\"\"\"\n",
"from PyQt5.QtCore import QBuffer, QIODevice\n",
"from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler, QWebEngineUrlRequestJob\n",
"from qutebrowser.browser import qutescheme\n",
"from qutebrowser.utils import log, qtutils\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Expr'",
"FunctionDef'",
"Expr'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assert'",
"Return'",
"Assert'",
"Expr'",
"Assign'",
"Expr'",
... |
[
"@VAR_0.route('/last/<unique_id>/<measure_type>/<measurement_id>/<period>')...\n",
"\"\"\"docstring\"\"\"\n",
"if not str_is_float(VAR_14):\n",
"return '', 204\n",
"if VAR_12 in ['input', 'math', 'function', 'output', 'pid']:\n",
"VAR_47 = InfluxDBClient(INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_USER,\n I... | [
"@blueprint.route('/last/<unique_id>/<measure_type>/<measurement_id>/<period>')...\n",
"\"\"\"docstring\"\"\"\n",
"if not str_is_float(period):\n",
"return '', 204\n",
"if measure_type in ['input', 'math', 'function', 'output', 'pid']:\n",
"dbcon = InfluxDBClient(INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_USE... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Condition",
... |
[
"def FUNC_7(self, VAR_15) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_24 = []\n",
"VAR_25 = [fi for fi in self.field_infos if fi.param.command_index == VAR_15]\n",
"VAR_25 = sorted(VAR_25)\n",
"for fi in VAR_25:\n",
"fi.before_script_execute()\n",
"return VAR_24\n",
"if fi.cmd_opt.startswith... | [
"def command_args(self, command_index) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"args = []\n",
"commands_field_infos = [fi for fi in self.field_infos if fi.param.\n command_index == command_index]\n",
"commands_field_infos = sorted(commands_field_infos)\n",
"for fi in commands_field_infos:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"For",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_8(self):...\n",
"return self.get_repo_url()\n"
] | [
"async def get_resolved_ref_url(self):...\n",
"return self.get_repo_url()\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Return'"
] |
[
"def FUNC_2(self, VAR_1, VAR_2=None):...\n",
""
] | [
"def get(self, arg, word=None):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_48(self):...\n",
"VAR_86 = {'transcodingenabled': cherry.config['media.transcode'],\n 'fetchalbumart': cherry.config['media.fetch_album_art'], 'isadmin':\n VAR_53.session['admin'], 'username': VAR_53.session['username'],\n 'servepath': 'serve/', 'transcodepath': 'trans/', 'auto_login': self.\n ... | [
"def api_getconfiguration(self):...\n",
"clientconfigkeys = {'transcodingenabled': cherry.config['media.transcode'],\n 'fetchalbumart': cherry.config['media.fetch_album_art'], 'isadmin':\n cherrypy.session['admin'], 'username': cherrypy.session['username'],\n 'servepath': 'serve/', 'transcodepath': 'tran... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_30(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertIs(VAR_5.evaluate('nocall: list'), safe_builtins['list'])\n"
] | [
"def test_list_in_path_expr(self):...\n",
"ec = self._makeContext()\n",
"self.assertIs(ec.evaluate('nocall: list'), safe_builtins['list'])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_0):...\n",
"if not VAR_0.GET.get('redirect'):\n",
"return HttpResponse('You need to pass a url to ?redirect=', status=401)\n",
"if not VAR_0.META.get('HTTP_REFERER'):\n",
"return HttpResponse(\n 'You need to make a request that includes the \"Referer\" header.',\n status=400)\n",
"VA... | [
"def authorize_and_redirect(request):...\n",
"if not request.GET.get('redirect'):\n",
"return HttpResponse('You need to pass a url to ?redirect=', status=401)\n",
"if not request.META.get('HTTP_REFERER'):\n",
"return HttpResponse(\n 'You need to make a request that includes the \"Referer\" header.',\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(VAR_10):...\n",
"return bool(FUNC_8(VAR_10))\n"
] | [
"def is_vcs_url(link):...\n",
"return bool(_get_used_vcs_backend(link))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/logout')...\n",
"if VAR_87 is not None and VAR_87.is_authenticated:\n",
"ub.delete_user_session(VAR_87.id, VAR_91.get('_id', ''))\n",
"VAR_3.debug(u'User logged out')\n",
"logout_user()\n",
"return redirect(url_for('web.login'))\n",
"if VAR_0['oauth'] and (config.config_login_type == 2 o... | [
"@web.route('/logout')...\n",
"if current_user is not None and current_user.is_authenticated:\n",
"ub.delete_user_session(current_user.id, flask_session.get('_id', ''))\n",
"log.debug(u'User logged out')\n",
"logout_user()\n",
"return redirect(url_for('web.login'))\n",
"if feature_support['oauth'] and (... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_22(self, VAR_0):...\n",
"from openapi_python_client import GeneratorData, Project\n",
"VAR_3 = VAR_0.MagicMock(autospec=GeneratorData, title='My Test API')\n",
"VAR_28 = VAR_0.MagicMock()\n",
"VAR_29 = VAR_0.MagicMock()\n",
"VAR_3.schemas.models = {'1': VAR_28, '2': VAR_29}\n",
"VAR_30 = VAR_0... | [
"def test__build_models(self, mocker):...\n",
"from openapi_python_client import GeneratorData, Project\n",
"openapi = mocker.MagicMock(autospec=GeneratorData, title='My Test API')\n",
"model_1 = mocker.MagicMock()\n",
"model_2 = mocker.MagicMock()\n",
"openapi.schemas.models = {'1': model_1, '2': model_2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_37():...\n",
"VAR_72 = 'folder'\n",
"VAR_73 = request.args.get('folder', False) == 'true'\n",
"VAR_74 = request.args.get('filter', '')\n",
"VAR_75 = os.path.normpath(request.args.get('path', ''))\n",
"if os.path.isfile(VAR_75):\n",
"VAR_104 = VAR_75\n",
"VAR_104 = ''\n",
"VAR_75 = os.path.... | [
"def pathchooser():...\n",
"browse_for = 'folder'\n",
"folder_only = request.args.get('folder', False) == 'true'\n",
"file_filter = request.args.get('filter', '')\n",
"path = os.path.normpath(request.args.get('path', ''))\n",
"if os.path.isfile(path):\n",
"oldfile = path\n",
"oldfile = ''\n",
"path ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_3(self, VAR_3, VAR_4, VAR_8):...\n",
"self.depth += 1\n",
"VAR_13 = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Message, 'sender': VAR_4.to_string(), 'state_key':\n VAR_4.to_string(), 'room_id': VAR_3.to_string(), 'content': {'body':\n VAR_8, 'msgtype':... | [
"def inject_message(self, room, user, body):...\n",
"self.depth += 1\n",
"builder = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Message, 'sender': user.to_string(), 'state_key':\n user.to_string(), 'room_id': room.to_string(), 'content': {'body': body,\n 'msgtype... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"AugAssign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_10: Text) ->None:...\n",
"from google.cloud import storage\n",
"super().__init__()\n",
"self.storage_client = storage.Client()\n",
"self._ensure_bucket_exists(VAR_10)\n",
"self.bucket_name = VAR_10\n",
"self.bucket = self.storage_client.bucket(VAR_10)\n"
] | [
"def __init__(self, bucket_name: Text) ->None:...\n",
"from google.cloud import storage\n",
"super().__init__()\n",
"self.storage_client = storage.Client()\n",
"self._ensure_bucket_exists(bucket_name)\n",
"self.bucket_name = bucket_name\n",
"self.bucket = self.storage_client.bucket(bucket_name)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"from __future__ import unicode_literals\n",
"import frappe\n",
"from frappe import _\n",
"import frappe.utils\n",
"import frappe.sessions\n",
"import frappe.desk.form.run_method\n",
"from frappe.utils.response import build_response\n",
"from frappe.api import validate_auth\n",
"from frappe.utils im... | [
"from __future__ import unicode_literals\n",
"import frappe\n",
"from frappe import _\n",
"import frappe.utils\n",
"import frappe.sessions\n",
"import frappe.desk.form.run_method\n",
"from frappe.utils.response import build_response\n",
"from frappe.api import validate_auth\n",
"from frappe.utils im... | [
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"C... |
[
"def FUNC_15(self, VAR_6):...\n",
"VAR_19 = 30\n",
"VAR_20 = []\n",
"VAR_21 = datetime.datetime.now()\n",
"if self.is_standard == 'Yes':\n",
"VAR_20 = self.execute_module(VAR_6)\n",
"VAR_20 = self.execute_script(VAR_6)\n",
"VAR_22 = (datetime.datetime.now() - VAR_21).total_seconds()\n",
"if VAR_22 >... | [
"def execute_script_report(self, filters):...\n",
"threshold = 30\n",
"res = []\n",
"start_time = datetime.datetime.now()\n",
"if self.is_standard == 'Yes':\n",
"res = self.execute_module(filters)\n",
"res = self.execute_script(filters)\n",
"execution_time = (datetime.datetime.now() - start_time).tota... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_128 = VAR_8.getObject('Dataset', VAR_34)\n",
"if VAR_128 is None:\n",
"return HttpJavascriptResponseServerError('\"\"')\n",
"VAR_120 = VAR_9.get('thumbprefix', 'webgateway_render_thumbnail')\n",
"def FUNC_65(VAR_6):...\n",
"return reverse(VAR_1... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"dataset = conn.getObject('Dataset', did)\n",
"if dataset is None:\n",
"return HttpJavascriptResponseServerError('\"\"')\n",
"prefix = kwargs.get('thumbprefix', 'webgateway_render_thumbnail')\n",
"def urlprefix(iid):...\n",
"return reverse(prefix, a... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"@wraps(VAR_2)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return VAR_2(*VAR_48, **kwargs)\n",
"abort(403)\n"
] | [
"@wraps(f)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return f(*args, **kwargs)\n",
"abort(403)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_25(VAR_18):...\n",
"return VAR_18 is not None and bool(VAR_18['wizard']['order'])\n"
] | [
"def wizard_active(templates):...\n",
"return templates is not None and bool(templates['wizard']['order'])\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_27(self):...\n",
"VAR_146 = get_user_model()\n",
"return VAR_146.objects.get(VAR_73=self.submitter_email)\n",
"return None\n"
] | [
"def get_submitter_userprofile(self):...\n",
"User = get_user_model()\n",
"return User.objects.get(email=self.submitter_email)\n",
"return None\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_60():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_78 = 0\n",
"while True:\n",
"VAR_126 = FUNC_58('/ping', 'get')\n",
"time.sleep(2)\n",
"print(\n 'Internal API server not online (mostly because Ganga is booting up), retrying...'\n )\n",
"if VAR_126 is True:\n",
"VAR_78 += 1\n",
"return ... | [
"def ping_internal():...\n",
"\"\"\"docstring\"\"\"\n",
"trials = 0\n",
"while True:\n",
"ping = query_internal_api('/ping', 'get')\n",
"time.sleep(2)\n",
"print(\n 'Internal API server not online (mostly because Ganga is booting up), retrying...'\n )\n",
"if ping is True:\n",
"trials += 1\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"AugAssign'",
"Return'",
"Condition",
"Return'"
] |
[
"@login_required...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"if 'loadfile' in request.files:\n",
"VAR_88 = FUNC_58('/internal/templates', 'get', VAR_73={'recent': True,\n 'length': '6'})\n",
"flash(str(err), 'danger')\n",
"return render_template('create.html', title='Create',... | [
"@login_required...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"if 'loadfile' in request.files:\n",
"templates_info = query_internal_api('/internal/templates', 'get', params={\n 'recent': True, 'length': '6'})\n",
"flash(str(err), 'danger')\n",
"return render_template('create.ht... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Assign'"... |
[
"def FUNC_31(self):...\n",
"self.log.propagate = False\n",
"for VAR_19 in (app_log, access_log, gen_log):\n",
"VAR_19.name = self.log.name\n",
"VAR_89 = logging.getLogger('tornado')\n",
"VAR_89.propagate = True\n",
"VAR_89.parent = self.log\n",
"VAR_89.setLevel(self.log.level)\n"
] | [
"def init_logging(self):...\n",
"self.log.propagate = False\n",
"for log in (app_log, access_log, gen_log):\n",
"log.name = self.log.name\n",
"logger = logging.getLogger('tornado')\n",
"logger.propagate = True\n",
"logger.parent = self.log\n",
"logger.setLevel(self.log.level)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@CLASS_4('backend-warning')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('backend-warning.html', distribution=version.\n distribution(), Distribution=version.Distribution, version=\n pkg_resources.parse_version, title='Legacy backend warning')\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('backend-warning')...\n",
"\"\"\"docstring\"\"\"\n",
"html = jinja.render('backend-warning.html', distribution=version.\n distribution(), Distribution=version.Distribution, version=\n pkg_resources.parse_version, title='Legacy backend warning')\n",
"return 'text/html', html\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_75(VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_192 = json.loads(VAR_9.body or '{}')\n",
"return VAR_192\n"
] | [
"def parse_request_data(request):...\n",
"\"\"\"docstring\"\"\"\n",
"data = json.loads(request.body or '{}')\n",
"return data\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_8):...\n",
"super().__init__(VAR_8)\n",
"self.clock = VAR_8.get_clock()\n",
"self.client = VAR_8.get_http_client()\n"
] | [
"def __init__(self, hs):...\n",
"super().__init__(hs)\n",
"self.clock = hs.get_clock()\n",
"self.client = hs.get_http_client()\n"
] | [
0,
0,
0,
4
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_67(VAR_125, VAR_46, VAR_105):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_105, dict):\n",
"VAR_125.setdefault(VAR_46, {})\n",
"VAR_125.setdefault(VAR_46, [])\n",
"for inkey in VAR_105:\n",
"if not isinstance(VAR_105, list):\n",
"FUNC_67(VAR_125[VAR_46], inkey, VAR_105[inkey])\n",
... | [
"def append_hook(target, key, value):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(value, dict):\n",
"target.setdefault(key, {})\n",
"target.setdefault(key, [])\n",
"for inkey in value:\n",
"if not isinstance(value, list):\n",
"append_hook(target[key], inkey, value[inkey])\n",
"value = [value]\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_4.signature_def[VAR_5].outputs\n"
] | [
"def _get_outputs_tensor_info_from_meta_graph_def(meta_graph_def,...\n",
"\"\"\"docstring\"\"\"\n",
"return meta_graph_def.signature_def[signature_def_key].outputs\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/user/keys/claim')\n",
"VAR_19 = await self.client.post_json(VAR_5=destination, VAR_2=path, VAR_39=\n query_content, VAR_8=timeout)\n",
"return VAR_19\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/user/keys/claim')\n",
"content = await self.client.post_json(destination=destination, path=path,\n data=query_content, timeout=timeout)\n",
"return content\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_62(VAR_120):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_69(os.path.join(os.path.dirname(FUNC_55(VAR_120).__file__),\n 'modules.txt'))\n"
] | [
"def get_module_list(app_name):...\n",
"\"\"\"docstring\"\"\"\n",
"return get_file_items(os.path.join(os.path.dirname(get_module(app_name).\n __file__), 'modules.txt'))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_2(VAR_7=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_7 is None:\n",
"VAR_7 = jupyter_runtime_dir()\n",
"if not os.path.isdir(VAR_7):\n",
"return\n",
"for file in os.listdir(VAR_7):\n",
"if file.startswith('nbserver-'):\n",
"VAR_93 = VAR_27.load(VAR_102)\n",
"if 'pid' in VAR_93 and ch... | [
"def list_running_servers(runtime_dir=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if runtime_dir is None:\n",
"runtime_dir = jupyter_runtime_dir()\n",
"if not os.path.isdir(runtime_dir):\n",
"return\n",
"for file in os.listdir(runtime_dir):\n",
"if file.startswith('nbserver-'):\n",
"info = json.load(f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'",
"For",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(VAR_23, VAR_24, VAR_25, VAR_26=None, VAR_27=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_11(VAR_37):...\n",
"VAR_4, VAR_39 = VAR_37\n",
"VAR_25.write(VAR_4)\n",
"return VAR_39\n"
] | [
"def get_file(destination, path, output_stream, args=None, max_size=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def write_to(r):...\n",
"data, response = r\n",
"output_stream.write(data)\n",
"return response\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_11(self) ->DataStore:...\n",
"if not self.datastores:\n",
"return self.datastores.main\n"
] | [
"def get_datastore(self) ->DataStore:...\n",
"if not self.datastores:\n",
"return self.datastores.main\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"async def FUNC_7(self, VAR_4: str, VAR_16: str, VAR_17: str, VAR_6: str,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_45 = {'country': VAR_16, 'phone_number': VAR_17, 'client_secret': VAR_6,\n 'send_attempt': VAR_12}\n",
"if VAR_14:\n",
"VAR_45['next_link'] = VAR_14\n",
"if self.hs.config.using_identity_ser... | [
"async def requestMsisdnToken(self, id_server: str, country: str,...\n",
"\"\"\"docstring\"\"\"\n",
"params = {'country': country, 'phone_number': phone_number, 'client_secret':\n client_secret, 'send_attempt': send_attempt}\n",
"if next_link:\n",
"params['next_link'] = next_link\n",
"if self.hs.config... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assert'",
"Assign'",
"Return'"
] |
[
"def FUNC_38(VAR_33):...\n",
"if callable(VAR_65):\n",
"return FUNC_19(VAR_33)\n",
"VAR_34 = VAR_65()\n",
"VAR_0.exception(\n 'Error while trying to retrieve custom LastModified value for plugin {}'\n .format(VAR_8))\n",
"if VAR_34:\n",
"return VAR_34\n"
] | [
"def compute_lastmodified(files):...\n",
"if callable(custom_lastmodified):\n",
"return _compute_date(files)\n",
"lastmodified = custom_lastmodified()\n",
"_logger.exception(\n 'Error while trying to retrieve custom LastModified value for plugin {}'\n .format(key))\n",
"if lastmodified:\n",
"retur... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Return'"
] |
[
"async def FUNC_1(self):...\n",
"VAR_24 = self.recently_accessed_remotes\n",
"self.recently_accessed_remotes = set()\n",
"VAR_25 = self.recently_accessed_locals\n",
"self.recently_accessed_locals = set()\n",
"await self.store.update_cached_last_access_time(VAR_25, VAR_24, self.clock.\n time_msec())\n"
... | [
"async def _update_recently_accessed(self):...\n",
"remote_media = self.recently_accessed_remotes\n",
"self.recently_accessed_remotes = set()\n",
"local_media = self.recently_accessed_locals\n",
"self.recently_accessed_locals = set()\n",
"await self.store.update_cached_last_access_time(local_media, remote... | [
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __str__(self):...\n",
"return '%s' % self.filename\n"
] | [
"def __str__(self):...\n",
"return '%s' % self.filename\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = keyring.KeyFetcher()\n",
"VAR_19.get_keys = Mock(return_value=make_awaitable({}))\n",
"VAR_4 = keyring.Keyring(self.hs, key_fetchers=(StoreKeyFetcher(self.hs),\n mock_fetcher))\n",
"VAR_20 = signedjson.key.generate_signing_key(1)\n",
"VAR... | [
"def test_verify_json_for_server_with_null_valid_until_ms(self):...\n",
"\"\"\"docstring\"\"\"\n",
"mock_fetcher = keyring.KeyFetcher()\n",
"mock_fetcher.get_keys = Mock(return_value=make_awaitable({}))\n",
"kr = keyring.Keyring(self.hs, key_fetchers=(StoreKeyFetcher(self.hs),\n mock_fetcher))\n",
"key... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_35(self, VAR_6, VAR_7, VAR_30):...\n",
"if VAR_53.session['admin']:\n",
"if self.userdb.addUser(VAR_6, VAR_7, VAR_30):\n",
"return \"You didn't think that would work, did you?\"\n",
"return 'added new user: %s' % VAR_6\n",
"return 'error, cannot add new user!' % VAR_6\n"
] | [
"def api_adduser(self, username, password, isadmin):...\n",
"if cherrypy.session['admin']:\n",
"if self.userdb.addUser(username, password, isadmin):\n",
"return \"You didn't think that would work, did you?\"\n",
"return 'added new user: %s' % username\n",
"return 'error, cannot add new user!' % username\n... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_18(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"for original, urlized in VAR_2.items():\n",
"assert urlize_quoted_links(original, nofollow=False) == urlized\n"
] | [
"def _urlize_dict_check(self, data):...\n",
"\"\"\"docstring\"\"\"\n",
"for original, urlized in data.items():\n",
"assert urlize_quoted_links(original, nofollow=False) == urlized\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assert'"
] |
[
"@property...\n",
"return False\n"
] | [
"@property...\n",
"return False\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_0.route('/<path:path>', methods=['GET'])...\n",
""
] | [
"@app.route('/<path:path>', methods=['GET'])...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"@VAR_2.route('/import_ldap_users')...\n",
"VAR_33 = {}\n",
"VAR_116 = services.ldap.get_group_members(config.config_ldap_group_name)\n",
"VAR_0.debug_or_exception(e)\n",
"if not VAR_116:\n",
"VAR_33['text'] = _(u'Error: %(ldaperror)s', ldaperror=e)\n",
"VAR_0.debug('LDAP empty response')\n",
"VAR_93 ... | [
"@admi.route('/import_ldap_users')...\n",
"showtext = {}\n",
"new_users = services.ldap.get_group_members(config.config_ldap_group_name)\n",
"log.debug_or_exception(e)\n",
"if not new_users:\n",
"showtext['text'] = _(u'Error: %(ldaperror)s', ldaperror=e)\n",
"log.debug('LDAP empty response')\n",
"impo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"For",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Ass... |
[
"def FUNC_66(self, VAR_13, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_86 = '<a href=\"#fnref-%s\" class=\"footnote\">↩</a>' % VAR_19(VAR_13)\n",
"VAR_14 = VAR_14.rstrip()\n",
"if VAR_14.endswith('</p>'):\n",
"VAR_14 = re.sub('<\\\\/p>$', '%s</p>' % VAR_86, VAR_14)\n",
"VAR_14 = '%s<p>%s</p>' ... | [
"def footnote_item(self, key, text):...\n",
"\"\"\"docstring\"\"\"\n",
"back = '<a href=\"#fnref-%s\" class=\"footnote\">↩</a>' % escape(key)\n",
"text = text.rstrip()\n",
"if text.endswith('</p>'):\n",
"text = re.sub('<\\\\/p>$', '%s</p>' % back, text)\n",
"text = '%s<p>%s</p>' % (text, back)\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = 'cli/' + VAR_1\n",
"VAR_0 = click_web.logger\n",
"VAR_6 = ['shell', 'run', 'routes', 'create-admin']\n",
"VAR_7, *VAR_4 = VAR_1.split('/')\n",
"VAR_3 = ['archivy']\n",
"VAR_2 = CLASS_0()\n",
"VAR_3.extend(VAR_2.command_args(0))\n",
"fo... | [
"def exec(command_path):...\n",
"\"\"\"docstring\"\"\"\n",
"command_path = 'cli/' + command_path\n",
"logger = click_web.logger\n",
"omitted = ['shell', 'run', 'routes', 'create-admin']\n",
"root_command, *commands = command_path.split('/')\n",
"cmd = ['archivy']\n",
"req_to_args = RequestToCommandArg... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Condition",
"FunctionDef'",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Expr'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"instructor_task.api.submit_calculate_grades_csv(VAR_9, VAR_38)\n",
"VAR_196 = _('string')\n",
"VAR_172 = _(\n 'The grade report is being created. To view the status ... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"instructor_task.api.submit_calculate_grades_csv(request, course_key)\n",
"already_running_status = _(\n 'The grade report is currently being created. To view th... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_2, VAR_3, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_51 = None\n",
"VAR_52 = VAR_2.GET.get(VAR_3, VAR_4)\n",
"if VAR_52 is not None:\n",
"VAR_51 = VAR_241(VAR_52)\n",
"return VAR_51\n"
] | [
"def get_long_or_default(request, name, default):...\n",
"\"\"\"docstring\"\"\"\n",
"val = None\n",
"val_raw = request.GET.get(name, default)\n",
"if val_raw is not None:\n",
"val = long(val_raw)\n",
"return val\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"return RoomContextHandler(self)\n"
] | [
"@cache_in_self...\n",
"return RoomContextHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_63(self, VAR_34, VAR_33=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(self.get(VAR_34), list) and len(self.get(VAR_34)) > 0):\n",
"VAR_93 = self.meta.get_label(VAR_34)\n",
"frappe.throw(_('Table {0} cannot be empty').format(VAR_93), VAR_33 or\n frappe.EmptyTableError)\n"
] | [
"def validate_table_has_rows(self, parentfield, raise_exception=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not (isinstance(self.get(parentfield), list) and len(self.get(\n",
"label = self.meta.get_label(parentfield)\n",
"frappe.throw(_('Table {0} cannot be empty').format(label), raise_exception or\n fr... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_5():...\n",
"yield FUNC_2(VAR_4)\n",
"yield from FUNC_1(VAR_2, VAR_3)\n",
"yield f\"\"\"\nERROR: Got exception when reading output from script: {type(e)}\n\"\"\"\n",
"yield traceback.format_exc()\n"
] | [
"def _generate_output():...\n",
"yield _create_cmd_header(commands)\n",
"yield from _run_script_and_generate_stream(req_to_args, cmd)\n",
"yield f\"\"\"\nERROR: Got exception when reading output from script: {type(e)}\n\"\"\"\n",
"yield traceback.format_exc()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_22(self, VAR_36):...\n",
"VAR_28 = self.nodelist.render(VAR_36)\n",
"return pygments_highlight(VAR_28, self.lang, self.style)\n"
] | [
"def render(self, context):...\n",
"text = self.nodelist.render(context)\n",
"return pygments_highlight(text, self.lang, self.style)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"async def FUNC_20(VAR_9=None, VAR_10=False):...\n",
"return synapse.types.create_requester(VAR_0)\n"
] | [
"async def _get_user_by_req(request=None, allow_guest=False):...\n",
"return synapse.types.create_requester(myid)\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Return'"
] |
[
"async def FUNC_12(self, VAR_4: str, VAR_2: str, VAR_19: str, VAR_20: str...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_59 = await self.blacklisting_http_client.get_json(\n '%s%s/_matrix/identity/v2/hash_details' % (VAR_1, VAR_4), {\n 'access_token': VAR_2})\n",
"if not isinstance(VAR_59, dict):\n",
"VAR_0.w... | [
"async def _lookup_3pid_v2(self, id_server: str, id_access_token: str,...\n",
"\"\"\"docstring\"\"\"\n",
"hash_details = await self.blacklisting_http_client.get_json(\n '%s%s/_matrix/identity/v2/hash_details' % (id_server_scheme, id_server),\n {'access_token': id_access_token})\n",
"if not isinstance(ha... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_16(self, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = self.get_doc_before_save()\n",
"return VAR_49.get(VAR_18) != self.get(VAR_18) if VAR_49 else True\n"
] | [
"def has_value_changed(self, fieldname):...\n",
"\"\"\"docstring\"\"\"\n",
"previous = self.get_doc_before_save()\n",
"return previous.get(fieldname) != self.get(fieldname) if previous else True\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, VAR_6):...\n",
"VAR_24 = {'filters': frappe._dict(VAR_6), 'data': None, 'result': None}\n",
"safe_exec(self.report_script, None, VAR_24)\n",
"if VAR_24['data']:\n",
"return VAR_24['data']\n",
"return self.get_columns(), VAR_24['result']\n"
] | [
"def execute_script(self, filters):...\n",
"loc = {'filters': frappe._dict(filters), 'data': None, 'result': None}\n",
"safe_exec(self.report_script, None, loc)\n",
"if loc['data']:\n",
"return loc['data']\n",
"return self.get_columns(), loc['result']\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_42(VAR_62, VAR_9):...\n",
"return '{0}::{1}'.format(VAR_62, VAR_9)\n"
] | [
"def get_document_cache_key(doctype, name):...\n",
"return '{0}::{1}'.format(doctype, name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(self, VAR_8, VAR_9):...\n",
"VAR_11 = Mock(spec=['verify_json_for_server'])\n",
"VAR_11.verify_json_for_server.return_value = defer.succeed(True)\n",
"VAR_12 = Mock(spec=['put_json'])\n",
"VAR_12.put_json.return_value = defer.succeed((200, 'OK'))\n",
"VAR_8.pump((1000,))\n",
"VAR_10 = self.s... | [
"def make_homeserver(self, reactor, clock):...\n",
"mock_keyring = Mock(spec=['verify_json_for_server'])\n",
"mock_keyring.verify_json_for_server.return_value = defer.succeed(True)\n",
"mock_federation_client = Mock(spec=['put_json'])\n",
"mock_federation_client.put_json.return_value = defer.succeed((200, '... | [
0,
0,
0,
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_21(VAR_8, VAR_9):...\n",
"self.query_handlers[VAR_8] = VAR_9\n"
] | [
"def register_query_handler(query_type, handler):...\n",
"self.query_handlers[query_type] = handler\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_35(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import ReplacingUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provideUtility\n",
... | [
"def testReplacingResolver(self):...\n",
"from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver\n",
"from Products.PageTemplates.unicodeconflictresolver import ReplacingUnicodeEncodingConflictResolver\n",
"from zope.component import getUtility\n",
"from zope.component import provide... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"async def FUNC_5(self, VAR_13) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27 = 1\n",
"while True:\n",
"VAR_46 = [(VAR_2, self.key_downloads[VAR_2]) for VAR_2 in VAR_13 if VAR_2 in\n self.key_downloads]\n",
"if not VAR_46:\n",
"VAR_0.info('Waiting for existing lookups for %s to complete [loop %i]... | [
"async def wait_for_previous_lookups(self, server_names) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"loop_count = 1\n",
"while True:\n",
"wait_on = [(server_name, self.key_downloads[server_name]) for server_name in\n server_names if server_name in self.key_downloads]\n",
"if not wait_on:\n",
"logger.i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"AugAssign'"
] |
[
"def FUNC_124(self, VAR_10):...\n",
"if self.follow_symlink_out:\n",
"return VAR_418.path.normpath(VAR_10)\n",
"return VAR_418.path.realpath(VAR_10)\n"
] | [
"def normalize_path(self, f):...\n",
"if self.follow_symlink_out:\n",
"return os.path.normpath(f)\n",
"return os.path.realpath(f)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def get_repo_url(self):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.