lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_28(self):...\n",
"return self._has_role(constants.ROLE_ANONYMOUS)\n"
] | [
"def role_anonymous(self):...\n",
"return self._has_role(constants.ROLE_ANONYMOUS)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@require_POST...\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, VAR_20=True)\n",
"if VAR_64 is None:\n",
"VAR_139 = 'false'\n",
"VAR_58 = VAR_64[0]._conn.getEventContext().userId\n",
"if VAR_2.GET.get('ca... | [
"@require_POST...\n",
"\"\"\"docstring\"\"\"\n",
"server_id = request.session['connector'].server_id\n",
"pi = _get_prepared_image(request, iid, server_id=server_id, conn=conn,\n saveDefs=True)\n",
"if pi is None:\n",
"json_data = 'false'\n",
"user_id = pi[0]._conn.getEventContext().userId\n",
"if ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_157(VAR_262=False):...\n",
"VAR_266 = VAR_153(VAR_364=session._cas_service, VAR_143=self.user.id)\n",
"if VAR_266:\n",
"VAR_264 = VAR_266.ticket\n",
"VAR_264 = 'ST-' + web2py_uuid()\n",
"VAR_364 = VAR_139._cas_service\n",
"VAR_153.insert(VAR_364=session._cas_service, VAR_143=self.user.id, VAR_... | [
"def allow_access(interactivelogin=False):...\n",
"row = table(service=session._cas_service, user_id=self.user.id)\n",
"if row:\n",
"ticket = row.ticket\n",
"ticket = 'ST-' + web2py_uuid()\n",
"service = session._cas_service\n",
"table.insert(service=session._cas_service, user_id=self.user.id, ticket=\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/admin/book/<int:book_id>', methods=['GET', 'POST'])...\n",
"VAR_40 = False\n",
"calibre_db.update_title_sort(config)\n",
"VAR_1.debug_or_exception(e)\n",
"if VAR_33.method != 'POST':\n",
"calibre_db.session.rollback()\n",
"return FUNC_14(VAR_14)\n",
"VAR_16 = calibre_db.get_filtered_bo... | [
"@editbook.route('/admin/book/<int:book_id>', methods=['GET', 'POST'])...\n",
"modif_date = False\n",
"calibre_db.update_title_sort(config)\n",
"log.debug_or_exception(e)\n",
"if request.method != 'POST':\n",
"calibre_db.session.rollback()\n",
"return render_edit_book(book_id)\n",
"book = calibre_db.g... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'... |
[
"@VAR_2.route('/oauth/google_callback', endpoint='callback')...\n",
"VAR_14 = FUNC_0().authorized_response()\n",
"VAR_3 = VAR_14['access_token']\n",
"if VAR_3 is None:\n",
"VAR_0.warning('Access token missing in call back request.')\n",
"VAR_5 = FUNC_1(VAR_3)\n",
"flash('Validation error. Please retry.'... | [
"@blueprint.route('/oauth/google_callback', endpoint='callback')...\n",
"resp = google_remote_app().authorized_response()\n",
"access_token = resp['access_token']\n",
"if access_token is None:\n",
"logger.warning('Access token missing in call back request.')\n",
"profile = get_user_profile(access_token)\n... | [
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"R... |
[
"def FUNC_30(self, VAR_8):...\n",
""
] | [
"def get(self, id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_23(VAR_0, VAR_1, VAR_3):...\n",
"VAR_15 = 'a' * 300\n",
"assert os.pathconf('/', 'PC_NAME_MAX') < len(VAR_15)\n",
"VAR_3.add(GET, 'https://example.com', f'<title>{VAR_15}</title>')\n",
"VAR_9 = {'url': 'https://example.com', 'submit': 'true'}\n",
"VAR_8 = VAR_1.post('/bookmarks/new', data=bookma... | [
"def test_bookmark_with_long_title_gets_truncated(test_app, client,...\n",
"long_title = 'a' * 300\n",
"assert os.pathconf('/', 'PC_NAME_MAX') < len(long_title)\n",
"mocked_responses.add(GET, 'https://example.com', f'<title>{long_title}</title>'\n )\n",
"bookmark_data = {'url': 'https://example.com', 'su... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Expr'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_5(self):...\n",
"self.add_change()\n",
"VAR_4 = generate_counts(None, timezone.now() - timedelta(days=1), timezone.\n now() + timedelta(days=1), component=self.component)\n",
"self.assertEqual(VAR_4, VAR_0)\n"
] | [
"def test_counts_one(self):...\n",
"self.add_change()\n",
"data = generate_counts(None, timezone.now() - timedelta(days=1), timezone.\n now() + timedelta(days=1), component=self.component)\n",
"self.assertEqual(data, COUNTS_DATA)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_33(self):...\n",
"return self.filter(VAR_78=True)\n"
] | [
"def public_followups(self):...\n",
"return self.filter(public=True)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_33 = saved_model_utils.get_meta_graph_def(VAR_2, VAR_3)\n",
"return VAR_33.signature_def\n"
] | [
"def get_signature_def_map(saved_model_dir, tag_set):...\n",
"\"\"\"docstring\"\"\"\n",
"meta_graph = saved_model_utils.get_meta_graph_def(saved_model_dir, tag_set)\n",
"return meta_graph.signature_def\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def __call__(self, VAR_14, VAR_43=None):...\n",
"return self.output(VAR_14, VAR_43)\n"
] | [
"def __call__(self, text, rules=None):...\n",
"return self.output(text, rules)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_8(self):...\n",
"VAR_36 = await self.get_resolved_spec()\n",
"return f'https://doi.org/{VAR_36}'\n"
] | [
"async def get_resolved_ref_url(self):...\n",
"resolved_spec = await self.get_resolved_spec()\n",
"return f'https://doi.org/{resolved_spec}'\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_14(self, VAR_0):...\n",
"VAR_13 = VAR_0.patch('httpx.get')\n",
"VAR_15 = VAR_0.patch('yaml.safe_load', side_effect=yaml.YAMLError)\n",
"from openapi_python_client import _get_document\n",
"VAR_7 = VAR_0.MagicMock()\n",
"VAR_11 = VAR_2(VAR_6=None, VAR_7=path)\n",
"VAR_13.assert_not_called()\n",... | [
"def test__get_document_bad_yaml(self, mocker):...\n",
"get = mocker.patch('httpx.get')\n",
"loads = mocker.patch('yaml.safe_load', side_effect=yaml.YAMLError)\n",
"from openapi_python_client import _get_document\n",
"path = mocker.MagicMock()\n",
"result = _get_document(url=None, path=path)\n",
"get.as... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assert'"
] |
[
"def FUNC_86(VAR_123, VAR_86, VAR_124):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_185 = HttpResponse(content_type='text/csv')\n",
"VAR_185['Content-Disposition'] = 'attachment; filename={0}'.format(unicode(\n VAR_123).encode('utf-8'))\n",
"VAR_186 = VAR_26.writer(VAR_185, dialect='excel', quotechar='\"', qu... | [
"def csv_response(filename, header, rows):...\n",
"\"\"\"docstring\"\"\"\n",
"response = HttpResponse(content_type='text/csv')\n",
"response['Content-Disposition'] = 'attachment; filename={0}'.format(unicode\n (filename).encode('utf-8'))\n",
"writer = csv.writer(response, dialect='excel', quotechar='\"',... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_7(VAR_8):...\n",
"VAR_9 = FUNC_6(VAR_8)\n",
"if VAR_8.view_args is not None:\n",
"VAR_10 = VAR_8.view_args.get('query_id', None)\n",
"VAR_12 = None\n",
"VAR_12 = FUNC_5(VAR_9, VAR_10)\n",
"return VAR_12\n"
] | [
"def api_key_load_user_from_request(request):...\n",
"api_key = get_api_key_from_request(request)\n",
"if request.view_args is not None:\n",
"query_id = request.view_args.get('query_id', None)\n",
"user = None\n",
"user = get_user_from_api_key(api_key, query_id)\n",
"return user\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __repr__(self) ->str:...\n",
"return util.repr_(self)\n"
] | [
"def __repr__(self) ->str:...\n",
"return util.repr_(self)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_13(VAR_1):...\n",
"VAR_81 = datetime.datetime.now()\n",
"VAR_1.query(CLASS_16).filter(VAR_81 > CLASS_16.expiration).filter(CLASS_16.\n token_type != 1).delete()\n",
"VAR_1.commit()\n"
] | [
"def clean_database(session):...\n",
"now = datetime.datetime.now()\n",
"session.query(RemoteAuthToken).filter(now > RemoteAuthToken.expiration).filter(\n RemoteAuthToken.token_type != 1).delete()\n",
"session.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_52 = [char for char in string.ascii_uppercase + string.digits + string.\n ascii_lowercase if char not in 'aAeEiIoOuU1l']\n",
"return string.join((random.choice(VAR_52) for VAR_72 in range(VAR_11)), '')\n"
] | [
"def generate_random_string(length):...\n",
"\"\"\"docstring\"\"\"\n",
"chars = [char for char in string.ascii_uppercase + string.digits + string.\n ascii_lowercase if char not in 'aAeEiIoOuU1l']\n",
"return string.join((random.choice(chars) for __ in range(length)), '')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_16(VAR_1):...\n",
"VAR_6 = CLASS_1()\n",
"VAR_6.name = 'Guest'\n",
"VAR_6.email = 'no@email'\n",
"VAR_6.role = constants.ROLE_ANONYMOUS\n",
"VAR_6.password = ''\n",
"VAR_1.add(VAR_6)\n",
"VAR_1.commit()\n",
"VAR_1.rollback()\n"
] | [
"def create_anonymous_user(session):...\n",
"user = User()\n",
"user.name = 'Guest'\n",
"user.email = 'no@email'\n",
"user.role = constants.ROLE_ANONYMOUS\n",
"user.password = ''\n",
"session.add(user)\n",
"session.commit()\n",
"session.rollback()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_5(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_83(VAR_9, VAR_10):...\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_0.error(u'Unable to find course with course key %s', VAR_10)\n",
"VAR_165 = auth.user_has_role(VAR_9.user, CourseSalesAdminRole(VAR_38))\n",
"return HttpResponseNotF... | [
"def require_sales_admin(func):...\n",
"\"\"\"docstring\"\"\"\n",
"def wrapped(request, course_id):...\n",
"course_key = CourseKey.from_string(course_id)\n",
"log.error(u'Unable to find course with course key %s', course_id)\n",
"access = auth.user_has_role(request.user, CourseSalesAdminRole(course_key))\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = Mock(spec=['put_json'])\n",
"VAR_8.put_json.return_value = make_awaitable({})\n",
"self.make_worker_hs('synapse.app.federation_sender', {'send_federation': \n True, 'worker_name': 'sender1', 'federation_sender_instances': [\n 'sender1', 'se... | [
"def test_send_event_sharded(self):...\n",
"\"\"\"docstring\"\"\"\n",
"mock_client1 = Mock(spec=['put_json'])\n",
"mock_client1.put_json.return_value = make_awaitable({})\n",
"self.make_worker_hs('synapse.app.federation_sender', {'send_federation': \n True, 'worker_name': 'sender1', 'federation_sender_in... | [
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"A... |
[
"def FUNC_84(VAR_72, *VAR_73):...\n",
"def FUNC_86(self, VAR_25, *VAR_0, **VAR_1):...\n",
"FUNC_83(self, VAR_72(self, *VAR_0, **kwargs))\n",
"for VAR_6 in VAR_73:\n",
"FUNC_83(self, VAR_6(self, VAR_25, *VAR_0, **kwargs))\n",
"return self._return_value\n"
] | [
"def compose(fn, *hooks):...\n",
"def runner(self, method, *args, **kwargs):...\n",
"add_to_return_value(self, fn(self, *args, **kwargs))\n",
"for f in hooks:\n",
"add_to_return_value(self, f(self, method, *args, **kwargs))\n",
"return self._return_value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"async def FUNC_18(VAR_3):...\n",
"VAR_3.write(b'response')\n",
"VAR_3.finish()\n"
] | [
"async def callback(request):...\n",
"request.write(b'response')\n",
"request.finish()\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def SerializeError(Exception):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_11(self):...\n",
"super().after_script_executed()\n",
"VAR_36, VAR_34 = tempfile.mkstemp(dir=self.temp_dir(), prefix=self.key)\n",
"VAR_37 = self.file_path\n",
"self.file_path = VAR_34\n",
"VAR_0.info(f'Zipping {self.key} to {VAR_34}')\n",
"self.file_path = shutil.make_archive(self.file_path, ... | [
"def after_script_executed(self):...\n",
"super().after_script_executed()\n",
"fd, filename = tempfile.mkstemp(dir=self.temp_dir(), prefix=self.key)\n",
"folder_path = self.file_path\n",
"self.file_path = filename\n",
"logger.info(f'Zipping {self.key} to {filename}')\n",
"self.file_path = shutil.make_ar... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_29(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.ignore_permissions or frappe.flags.in_install:\n",
"return\n",
"if frappe.session.user == 'Administrator':\n",
"return\n",
"VAR_57 = self.get_permlevel_access()\n",
"VAR_58 = self.meta.get_high_permlevel_fields()\n",
"if VAR_58:\n"... | [
"def validate_higher_perm_levels(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.ignore_permissions or frappe.flags.in_install:\n",
"return\n",
"if frappe.session.user == 'Administrator':\n",
"return\n",
"has_access_to = self.get_permlevel_access()\n",
"high_permlevel_fields = self.meta.get_hi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"For",
"Assign'",
"Condition",
"For",
"Expr'"
] |
[
"def FUNC_5(VAR_23, *VAR_24, **VAR_25):...\n",
"VAR_66 = type(VAR_23)\n",
"VAR_56 = fromstring(VAR_23)\n",
"FUNC_4(VAR_56, *VAR_24, **kw)\n",
"return _transform_result(VAR_66, VAR_56)\n"
] | [
"def word_break_html(html, *args, **kw):...\n",
"result_type = type(html)\n",
"doc = fromstring(html)\n",
"word_break(doc, *args, **kw)\n",
"return _transform_result(result_type, doc)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_4):...\n",
"VAR_2 = VAR_4.indexdir\n",
"VAR_3 = VAR_4.dataroot\n"
] | [
"def init(config):...\n",
"INDEXDIR = config.indexdir\n",
"DATAROOT = config.dataroot\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(self, VAR_22):...\n",
"VAR_29 = VAR_22.encode('utf-8')\n",
"VAR_18 = FUNC_7(VAR_29, mode='eval')\n",
"self.restricted_python_transformer.visit(VAR_18)\n",
"self.page_templates_expression_transformer.visit(VAR_18)\n",
"return VAR_18\n"
] | [
"def parse(self, string):...\n",
"encoded = string.encode('utf-8')\n",
"node = parse(encoded, mode='eval')\n",
"self.restricted_python_transformer.visit(node)\n",
"self.page_templates_expression_transformer.visit(node)\n",
"return node\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_167(VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_395 = set(VAR_17.keys())\n",
"VAR_396 = set(['jsonrpc', 'method'])\n",
"VAR_397 = VAR_396 - VAR_395\n",
"if VAR_397:\n",
"if VAR_17['jsonrpc'] != '2.0':\n",
"if 'id' not in VAR_395:\n",
"return False\n",
"return True\n"
] | [
"def validate(data):...\n",
"\"\"\"docstring\"\"\"\n",
"iparms = set(data.keys())\n",
"mandatory_args = set(['jsonrpc', 'method'])\n",
"missing_args = mandatory_args - iparms\n",
"if missing_args:\n",
"if data['jsonrpc'] != '2.0':\n",
"if 'id' not in iparms:\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"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",
"self.key_servers = self.config.key_servers\n"
] | [
"def __init__(self, hs):...\n",
"super().__init__(hs)\n",
"self.clock = hs.get_clock()\n",
"self.client = hs.get_http_client()\n",
"self.key_servers = self.config.key_servers\n"
] | [
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@app.route('/reconnect')...\n",
"calibre_db.reconnect_db(config, ub.app_DB_path)\n",
"return json.dumps({})\n"
] | [
"@app.route('/reconnect')...\n",
"calibre_db.reconnect_db(config, ub.app_DB_path)\n",
"return json.dumps({})\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_7(self, VAR_3, VAR_4):...\n",
"VAR_4['choices'] = map(lambda x: (x.strip(), x.strip()), VAR_3.choices.\n split(','))\n",
"return django.forms.ChoiceField(**options)\n"
] | [
"def create_dropdown_field(self, field, options):...\n",
"options['choices'] = map(lambda x: (x.strip(), x.strip()), field.choices.\n split(','))\n",
"return django.forms.ChoiceField(**options)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_44 = np.array([[1], [2]])\n",
"VAR_45 = np.zeros((6, 3))\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'testRunCommandNewOutdir_inputs.npz'\n )\n",
"VAR_41 = os.path.join(te... | [
"def testRunCommandNewOutdir(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"x = np.array([[1], [2]])\n",
"x_notused = np.zeros((6, 3))\n",
"input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandNewOutdir_inputs.npz')... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(VAR_2: Directive, VAR_13: int, VAR_5: int) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = {VAR_6: VAR_2.meta[VAR_6] for VAR_6 in VAR_2.meta if not VAR_6.\n startswith('_')}\n",
"VAR_2 = VAR_2._replace(VAR_25=meta)\n",
"VAR_26 = align(format_entry(VAR_2, prefix=' ' * indent), VAR_13)\n",
... | [
"def _format_entry(entry: Directive, currency_column: int, indent: int) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"meta = {key: entry.meta[key] for key in entry.meta if not key.startswith('_')}\n",
"entry = entry._replace(meta=meta)\n",
"string = align(format_entry(entry, prefix=' ' * indent), currency_colum... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_54(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_54 = json.dumps({'search_categories': {'room_events': {'search_term':\n 'label', 'filter': self.FILTER_LABELS}}})\n",
"self._send_labelled_messages_in_room()\n",
"VAR_22, VAR_23 = self.make_request('POST', '/search?access_token=%s' % self\n .t... | [
"def test_search_filter_labels(self):...\n",
"\"\"\"docstring\"\"\"\n",
"request_data = json.dumps({'search_categories': {'room_events': {\n 'search_term': 'label', 'filter': self.FILTER_LABELS}}})\n",
"self._send_labelled_messages_in_room()\n",
"request, channel = self.make_request('POST', '/search?acce... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14():...\n",
"VAR_43 = f.readline()\n",
"VAR_43 = '/'.join(VAR_43.split('/')[:-2])\n",
"VAR_33 = []\n",
"for c in VAR_32:\n",
"VAR_33.append(FUNC_10(VAR_43 + '/' + c.strip()))\n",
"return VAR_33\n"
] | [
"def get_class_path():...\n",
"dataset_path = f.readline()\n",
"dataset_path = '/'.join(dataset_path.split('/')[:-2])\n",
"class_paths = []\n",
"for c in classes_list:\n",
"class_paths.append(_get_obj_absolute_path(dataset_path + '/' + c.strip()))\n",
"return class_paths\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_2(VAR_6):...\n",
"return chain(*get_provide_objects(VAR_6))\n"
] | [
"def _get_extension_urlpatterns(provide_category):...\n",
"return chain(*get_provide_objects(provide_category))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_37(self, VAR_15):...\n",
"VAR_76 = VAR_53.session['userid'] == VAR_15\n",
"if VAR_53.session['admin'] and not VAR_76:\n",
"VAR_109 = self.userdb.deleteUser(VAR_15)\n",
"return \"You didn't think that would work, did you?\"\n",
"return 'success' if VAR_109 else 'failed'\n"
] | [
"def api_userdelete(self, userid):...\n",
"is_self = cherrypy.session['userid'] == userid\n",
"if cherrypy.session['admin'] and not is_self:\n",
"deleted = self.userdb.deleteUser(userid)\n",
"return \"You didn't think that would work, did you?\"\n",
"return 'success' if deleted else 'failed'\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_84(VAR_1):...\n",
"def FUNC_83(*VAR_2, **VAR_3):...\n",
"VAR_9 = VAR_2[0]\n",
"VAR_193 = {'error': 'Missing required query parameter(s)', 'parameters': [],\n 'info': {}}\n",
"for VAR_209, extra in VAR_47:\n",
"VAR_199 = object()\n",
"if len(VAR_193['parameters']) > 0:\n",
"if VAR_9.GET.ge... | [
"def decorator(func):...\n",
"def wrapped(*args, **kwargs):...\n",
"request = args[0]\n",
"error_response_data = {'error': 'Missing required query parameter(s)',\n 'parameters': [], 'info': {}}\n",
"for param, extra in required_params:\n",
"default = object()\n",
"if len(error_response_data['paramete... | [
0,
0,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_21(VAR_12, VAR_13, VAR_14, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_12 == 'experimenter':\n",
"if VAR_14 == 'dataset' or VAR_14 == 'plate':\n",
"if VAR_12 == 'project':\n",
"return 'orphan'\n",
"VAR_254 = ProjectI(VAR_241(VAR_13), False)\n",
"if VAR_12 == 'dataset':\n",
"if VAR_1... | [
"def create_link(parent_type, parent_id, child_type, child_id):...\n",
"\"\"\"docstring\"\"\"\n",
"if parent_type == 'experimenter':\n",
"if child_type == 'dataset' or child_type == 'plate':\n",
"if parent_type == 'project':\n",
"return 'orphan'\n",
"project = ProjectI(long(parent_id), False)\n",
"if ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assi... |
[
"@VAR_0.route('/ajax/simulatemerge', methods=['POST'])...\n",
"VAR_81 = VAR_33.get_json().get('Merge_books')\n",
"if VAR_81:\n",
"VAR_99 = calibre_db.get_book(VAR_81[0]).title\n",
"return ''\n",
"VAR_81.pop(0)\n",
"if VAR_99:\n",
"for VAR_14 in VAR_81:\n",
"VAR_118 = []\n",
"return json.dumps({'to... | [
"@editbook.route('/ajax/simulatemerge', methods=['POST'])...\n",
"vals = request.get_json().get('Merge_books')\n",
"if vals:\n",
"to_book = calibre_db.get_book(vals[0]).title\n",
"return ''\n",
"vals.pop(0)\n",
"if to_book:\n",
"for book_id in vals:\n",
"from_book = []\n",
"return json.dumps({'to'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Condition",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"if self.is_standard == 'Yes' and not cint(getattr(frappe.local.conf,\n",
"frappe.throw(_('You are not allowed to delete Standard Report'))\n",
"delete_custom_role('report', self.name)\n"
] | [
"def on_trash(self):...\n",
"if self.is_standard == 'Yes' and not cint(getattr(frappe.local.conf,\n",
"frappe.throw(_('You are not allowed to delete Standard Report'))\n",
"delete_custom_role('report', self.name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_15(VAR_3, **VAR_4):...\n",
"return 200, {'result': True}\n"
] | [
"def test_head_request(self):...\n",
"\"\"\"docstring\"\"\"\n",
"def _callback(request, **kwargs):...\n",
"return 200, {'result': True}\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"@handle_dashboard_error...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_65 = get_course_by_id(SlashSeparatedCourseKey.from_deprecated_string(\n VAR_10))\n",
"VAR_36 = find_unit(VAR_65, VAR_9.GET.get('url'))\n",
"return JsonResponse(dump_module_extensions(VAR_65, VAR_36))\n"
] | [
"@handle_dashboard_error...\n",
"\"\"\"docstring\"\"\"\n",
"course = get_course_by_id(SlashSeparatedCourseKey.from_deprecated_string(\n course_id))\n",
"unit = find_unit(course, request.GET.get('url'))\n",
"return JsonResponse(dump_module_extensions(course, unit))\n"
] | [
0,
0,
0,
3,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"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... |
[
"from __future__ import unicode_literals\n",
"import inspect\n",
"import json\n",
"import six\n",
"import warnings\n",
"from django.conf import settings\n",
"from django.contrib.auth.views import redirect_to_login\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.http.res... | [
"from __future__ import unicode_literals\n",
"import inspect\n",
"import json\n",
"import six\n",
"import warnings\n",
"from django.conf import settings\n",
"from django.contrib.auth.views import redirect_to_login\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.http.res... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
[
"def FUNC_5():...\n",
"return VAR_10\n"
] | [
"def getEngine():...\n",
"return _engine\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/get_update_status', methods=['GET'])...\n",
"if VAR_1['updater']:\n",
"VAR_0.info(u'Update status requested')\n",
"return ''\n",
"return updater_thread.get_available_updates(request.method, VAR_58=get_locale()\n )\n"
] | [
"@admi.route('/get_update_status', methods=['GET'])...\n",
"if feature_support['updater']:\n",
"log.info(u'Update status requested')\n",
"return ''\n",
"return updater_thread.get_available_updates(request.method, locale=get_locale()\n )\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"VAR_20 = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"VAR_22 = saved_model_cli.preprocess_inputs_arg_string(VAR_20)\n",
"self.assertTrue(VAR_22['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'))\n",
"self.assertTrue(VAR_22['i... | [
"def testInputPreProcessFileNames(self):...\n",
"input_str = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"input_dict = saved_model_cli.preprocess_inputs_arg_string(input_str)\n",
"self.assertTrue(input_dict['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._record_users()\n",
"VAR_15 = {'display_name': 'a' * (synapse.handlers.device.\n MAX_DEVICE_DISPLAY_NAME_LEN + 1)}\n",
"self.get_failure(self.handler.update_device(VAR_0, 'abc', VAR_15), synapse.\n api.errors.SynapseError)\n",
"VAR_10 = sel... | [
"def test_update_device_too_long_display_name(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._record_users()\n",
"update = {'display_name': 'a' * (synapse.handlers.device.\n MAX_DEVICE_DISPLAY_NAME_LEN + 1)}\n",
"self.get_failure(self.handler.update_device(user1, 'abc', update), synapse.\n api.errors.... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"@VAR_1.route('/<bfile>/download-journal/')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_31 = datetime.datetime.now().replace(microsecond=0)\n",
"VAR_10 = f'journal_{VAR_31.isoformat()}.beancount'\n",
"VAR_30 = BytesIO(bytes(render_template('beancount_file'), 'utf8'))\n",
"return send_file(VAR_30, as_attachment... | [
"@app.route('/<bfile>/download-journal/')...\n",
"\"\"\"docstring\"\"\"\n",
"now = datetime.datetime.now().replace(microsecond=0)\n",
"filename = f'journal_{now.isoformat()}.beancount'\n",
"data = BytesIO(bytes(render_template('beancount_file'), 'utf8'))\n",
"return send_file(data, as_attachment=True, dow... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"async def FUNC_14(self, VAR_19):...\n",
"VAR_38 = await self.store.get_remote_media_before(VAR_19)\n",
"VAR_39 = 0\n",
"for media in VAR_38:\n",
"VAR_47 = media['media_origin']\n",
"return {'deleted': VAR_39}\n",
"VAR_4 = media['media_id']\n",
"VAR_18 = media['filesystem_id']\n",
"VAR_31 = VAR_47, ... | [
"async def delete_old_remote_media(self, before_ts):...\n",
"old_media = await self.store.get_remote_media_before(before_ts)\n",
"deleted = 0\n",
"for media in old_media:\n",
"origin = media['media_origin']\n",
"return {'deleted': deleted}\n",
"media_id = media['media_id']\n",
"file_id = media['filesy... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"AugAssign'"
] |
[
"def FUNC_21(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('error.html', title='Error while opening qute://url',\n VAR_3=url.toDisplayString(), VAR_8=\n '{} is not available with this backend'.format(url.toDisplayString()))\n",
"return 'text/html', VAR_20\n"
] | [
"def wrong_backend_handler(self, url):...\n",
"\"\"\"docstring\"\"\"\n",
"html = jinja.render('error.html', title='Error while opening qute://url',\n url=url.toDisplayString(), error=\n '{} is not available with this backend'.format(url.toDisplayString()))\n",
"return 'text/html', html\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_60(VAR_5, VAR_38):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_194 = VAR_350(viewname='load_template', args=['userdata'])\n",
"if isinstance(VAR_38, omero.model.FileAnnotationI):\n",
"VAR_308 = VAR_5.getObject('Annotation', VAR_38.id.val)\n",
"if VAR_38.__class__.__name__ in ('ImageI', 'DatasetI', 'P... | [
"def getObjectUrl(conn, obj):...\n",
"\"\"\"docstring\"\"\"\n",
"base_url = reverse(viewname='load_template', args=['userdata'])\n",
"if isinstance(obj, omero.model.FileAnnotationI):\n",
"fa = conn.getObject('Annotation', obj.id.val)\n",
"if obj.__class__.__name__ in ('ImageI', 'DatasetI', 'ProjectI', 'Sc... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"AugAssign'",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_4(VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_7(self):...\n",
"FUNC_3(self.package_data)\n",
"VAR_10.run(self)\n",
"return CLASS_5\n"
] | [
"def check_package_data_first(command):...\n",
"\"\"\"docstring\"\"\"\n",
"def run(self):...\n",
"check_package_data(self.package_data)\n",
"command.run(self)\n",
"return DecoratedCommand\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Expr'",
"Expr'",
"Return'"
] |
[
"async def FUNC_41(self, VAR_46, VAR_47):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_183 = await self.http_client.get_json(VAR_47, {'public_key': VAR_46})\n",
"if 'valid' not in VAR_183 or not VAR_183['valid']:\n"
] | [
"async def _check_key_revocation(self, public_key, url):...\n",
"\"\"\"docstring\"\"\"\n",
"response = await self.http_client.get_json(url, {'public_key': public_key})\n",
"if 'valid' not in response or not response['valid']:\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Condition"
] |
[
"async def FUNC_6(VAR_6):...\n",
"VAR_7 = await VAR_4(VAR_6)\n",
"VAR_10 = 'public; max-age={}'.format(VAR_2)\n",
"if VAR_6.path in VAR_3 or VAR_2 <= 0:\n",
"VAR_10 = 'no-cache'\n",
"VAR_7.headers.setdefault('Cache-Control', VAR_10)\n",
"return VAR_7\n"
] | [
"async def middleware_handler(request):...\n",
"response = await handler(request)\n",
"cache_control_value = 'public; max-age={}'.format(CACHE_MAX_AGE)\n",
"if request.path in NO_CACHE_ENDPOINTS or CACHE_MAX_AGE <= 0:\n",
"cache_control_value = 'no-cache'\n",
"response.headers.setdefault('Cache-Control', ... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"import coreschema\n",
"VAR_37 = OrderedDict([(VAR_11.name, VAR_11.schema or coreschema.String()) for\n VAR_11 in VAR_6.fields])\n",
"VAR_38 = [VAR_11.name for VAR_11 in VAR_6.fields if VAR_11.required]\n",
"VAR_39 = coreschema.Object(VAR_37=properties, VAR_38=required)\n",
"r... | [
"@register.simple_tag...\n",
"import coreschema\n",
"properties = OrderedDict([(field.name, field.schema or coreschema.String()) for\n field in link.fields])\n",
"required = [field.name for field in link.fields if field.required]\n",
"schema = coreschema.Object(properties=properties, required=required)\n... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_88(VAR_176, VAR_177):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_207 = unicodecsv.reader(UniversalNewlineIterator(f), encoding='utf-8')\n",
"VAR_210 = next(VAR_207)\n",
"VAR_210 = []\n",
"VAR_180 = None\n",
"if 'cohort' not in VAR_210:\n",
"VAR_180 = _(\"The file must contain a 'cohort' column c... | [
"def validator(file_storage, file_to_validate):...\n",
"\"\"\"docstring\"\"\"\n",
"reader = unicodecsv.reader(UniversalNewlineIterator(f), encoding='utf-8')\n",
"fieldnames = next(reader)\n",
"fieldnames = []\n",
"msg = None\n",
"if 'cohort' not in fieldnames:\n",
"msg = _(\"The file must contain a 'c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'"
] |
[
"@VAR_2.route('/admin/user/<int:user_id>', methods=['GET', 'POST'])...\n",
"VAR_22 = ub.session.query(ub.User).filter(ub.User.id == VAR_119(VAR_9)).first()\n",
"if not VAR_22 or not config.config_anonbrowse and VAR_22.name == 'Guest':\n",
"flash(_(u'User not found'), category='error')\n",
"VAR_23 = calibre_... | [
"@admi.route('/admin/user/<int:user_id>', methods=['GET', 'POST'])...\n",
"content = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first()\n",
"if not content or not config.config_anonbrowse and content.name == 'Guest':\n",
"flash(_(u'User not found'), category='error')\n",
"languages = calib... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_37(self):...\n",
"VAR_3 = self.client.get(reverse('login'))\n",
"self.assertEqual(VAR_3.status_code, 200)\n",
"if Site._meta.installed:\n",
"VAR_29 = Site.objects.get_current()\n",
"self.assertIsInstance(VAR_3.context['site'], RequestSite)\n",
"self.assertEqual(VAR_3.context['site'], VAR_29)\n... | [
"def test_current_site_in_context_after_login(self):...\n",
"response = self.client.get(reverse('login'))\n",
"self.assertEqual(response.status_code, 200)\n",
"if Site._meta.installed:\n",
"site = Site.objects.get_current()\n",
"self.assertIsInstance(response.context['site'], RequestSite)\n",
"self.asse... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(VAR_14, VAR_15=False, VAR_16=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_16:\n",
"VAR_14 = VAR_2.sub('&', VAR_14)\n",
"VAR_14 = VAR_14.replace('&', '&')\n",
"VAR_14 = VAR_14.replace('<', '<')\n",
"VAR_14 = VAR_14.replace('>', '>')\n",
"if VAR_15:\n",
"VAR_14 = VAR_14.r... | [
"def escape(text, quote=False, smart_amp=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if smart_amp:\n",
"text = _escape_pattern.sub('&', text)\n",
"text = text.replace('&', '&')\n",
"text = text.replace('<', '<')\n",
"text = text.replace('>', '>')\n",
"if quote:\n",
"text = text.replace('... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_6(VAR_8: str) ->Dict[str, str]:...\n",
"VAR_25 = None\n",
"VAR_26 = ''\n",
"VAR_27 = {}\n",
"for line in VAR_8.split('\\n'):\n",
"VAR_37 = line.lstrip()\n",
"return VAR_27\n",
"if not VAR_37:\n",
"VAR_38 = len(line) - len(VAR_37)\n",
"if VAR_37.startswith(('Args:', 'Arguments:', 'Paramet... | [
"def _parse_args_from_docstring(docstring: str) ->Dict[str, str]:...\n",
"arg_block_indent = None\n",
"current_arg = ''\n",
"parsed = {}\n",
"for line in docstring.split('\\n'):\n",
"stripped = line.lstrip()\n",
"return parsed\n",
"if not stripped:\n",
"line_indent = len(line) - len(stripped)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"AugAssign'"
] |
[
"def __call__(self, VAR_56):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_95 = VAR_56.getroot\n",
"VAR_56 = VAR_95()\n",
"xhtml_to_html(VAR_56)\n",
"for VAR_16 in VAR_56.iter('image'):\n",
"VAR_16.tag = 'img'\n",
"if not self.comments:\n",
"self.kill_conditional_comments(VAR_56)\n",
"VAR_48 = set(self.k... | [
"def __call__(self, doc):...\n",
"\"\"\"docstring\"\"\"\n",
"getroot = doc.getroot\n",
"doc = getroot()\n",
"xhtml_to_html(doc)\n",
"for el in doc.iter('image'):\n",
"el.tag = 'img'\n",
"if not self.comments:\n",
"self.kill_conditional_comments(doc)\n",
"kill_tags = set(self.kill_tags or ())\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"For",
"Condition",
"Condition",
"Assign'",
"For",
"Expr'",
"Expr'",
"Condit... |
[
"def FUNC_1(VAR_7: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_3(VAR_7, VAR_0)\n"
] | [
"def validate_html_strict(html: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return base_validate_html(html, allowed_tags_strict)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"import os\n",
"from datetime import datetime\n",
"import json\n",
"from shutil import copyfile\n",
"from uuid import uuid4\n",
"from markupsafe import escape\n",
"from lxml.html.clean import clean_html\n",
"from scholarly import scholarly\n",
"VAR_47 = False\n",
"from flask import Blueprint, requ... | [
"import os\n",
"from datetime import datetime\n",
"import json\n",
"from shutil import copyfile\n",
"from uuid import uuid4\n",
"from markupsafe import escape\n",
"from lxml.html.clean import clean_html\n",
"from scholarly import scholarly\n",
"have_scholar = False\n",
"from flask import Blueprint... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"endpoints_by_tag: Dict[str, CLASS_1] = {}\n",
"VAR_14 = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']\n",
"for VAR_8, path_data in VAR_5.items():\n",
"for VAR_9 in VAR_14:\n",
"return endpoints_by_tag\n",
"operation: Optional[oa... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"endpoints_by_tag: Dict[str, EndpointCollection] = {}\n",
"methods = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']\n",
"for path, path_data in data.items():\n",
"for method in methods:\n",
"return endpoints_by_tag\n",
"operation:... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"AnnAssign'",
"Assign'",
"For",
"For",
"Return'",
"AnnAssign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_110(self):...\n",
"def FUNC_165(VAR_215, VAR_224):...\n",
"return serializers.json({'version': '1.1', 'id': VAR_215, 'result': VAR_224,\n 'error': None})\n"
] | [
"def serve_jsonrpc(self):...\n",
"def return_response(id, result):...\n",
"return serializers.json({'version': '1.1', 'id': id, 'result': result,\n 'error': None})\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_83(self, VAR_71):...\n",
"if isinstance(VAR_71, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = VAR_71 or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._return_value.update(VAR_71)\n"
] | [
"def add_to_return_value(self, new_return_value):...\n",
"if isinstance(new_return_value, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = new_return_value or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._return_value.update(new_return_value)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_53(self):...\n",
"frappe.clear_document_cache(self.doctype, self.name)\n"
] | [
"def clear_cache(self):...\n",
"frappe.clear_document_cache(self.doctype, self.name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_5(VAR_25: WebSocket) ->None:...\n",
"VAR_53 = await solve_dependencies(VAR_24=websocket, VAR_10=dependant,\n VAR_22=dependency_overrides_provider)\n",
"VAR_11, VAR_51, VAR_56, VAR_57, VAR_58 = VAR_53\n",
"if VAR_51:\n",
"await VAR_25.close(code=WS_1008_POLICY_VIOLATION)\n",
"assert VAR_... | [
"async def app(websocket: WebSocket) ->None:...\n",
"solved_result = await solve_dependencies(request=websocket, dependant=\n dependant, dependency_overrides_provider=dependency_overrides_provider)\n",
"values, errors, _, _2, _3 = solved_result\n",
"if errors:\n",
"await websocket.close(code=WS_1008_POLI... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assert'",
"Expr'"
] |
[
"def FUNC_42(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from selenium.webdriver.common.keys import Keys\n",
"self.admin_login(username='super', password='secret', login_url='/')\n",
"self.selenium.get('%s%s' % (self.live_server_url, '/admin_widgets/member/add/')\n )\n",
"self.assertEqual(self.get_css_va... | [
"def test_show_hide_date_time_picker_widgets(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from selenium.webdriver.common.keys import Keys\n",
"self.admin_login(username='super', password='secret', login_url='/')\n",
"self.selenium.get('%s%s' % (self.live_server_url, '/admin_widgets/member/add/')\n )\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_12(self, VAR_1: str) ->Optional[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = self._components.get(VAR_1, None)\n",
"return VAR_14.abspath if VAR_14 is not None else None\n"
] | [
"def get_component_path(self, name: str) ->Optional[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"component = self._components.get(name, None)\n",
"return component.abspath if component is not None else None\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_33(VAR_30):...\n",
"print(VAR_29 + VAR_30)\n"
] | [
"def in_print(s):...\n",
"print(indent_str + s)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_11(self, VAR_4: str, VAR_19: str, VAR_20: str) ->Optional[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = await self.blacklisting_http_client.get_json(\n '%s%s/_matrix/identity/api/v1/lookup' % (VAR_1, VAR_4), {'medium':\n VAR_19, 'address': VAR_20})\n",
"VAR_0.warning('Error from v1 i... | [
"async def _lookup_3pid_v1(self, id_server: str, medium: str, address: str...\n",
"\"\"\"docstring\"\"\"\n",
"data = await self.blacklisting_http_client.get_json(\n '%s%s/_matrix/identity/api/v1/lookup' % (id_server_scheme, id_server),\n {'medium': medium, 'address': address})\n",
"logger.warning('Error... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_12(self, VAR_56, VAR_59, VAR_60=None):...\n",
"VAR_83 = []\n",
"for VAR_16 in VAR_56.iter(VAR_60):\n",
"if VAR_59(VAR_16):\n",
"for VAR_16 in VAR_83:\n",
"VAR_83.append(VAR_16)\n",
"VAR_16.drop_tree()\n"
] | [
"def _kill_elements(self, doc, condition, iterate=None):...\n",
"bad = []\n",
"for el in doc.iter(iterate):\n",
"if condition(el):\n",
"for el in bad:\n",
"bad.append(el)\n",
"el.drop_tree()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"For",
"Expr'",
"Expr'"
] |
[
"@VAR_0.tag...\n",
"\"\"\"docstring\"\"\"\n",
"return get_gravatar_url_for_email(VAR_1['request'], VAR_4, VAR_3)\n"
] | [
"@register.tag...\n",
"\"\"\"docstring\"\"\"\n",
"return get_gravatar_url_for_email(context['request'], email, size)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_22():...\n",
"return VAR_43.get('state')\n"
] | [
"def get_state():...\n",
"return session.get('state')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_14(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 post(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 respon... | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_29(VAR_66):...\n",
"VAR_105 = FUNC_28(VAR_66._identifier, VAR_66.on_ui_render, VAR_15=p.\n get_ui_additional_key_data_for_cache, VAR_61=p.\n get_ui_additional_tracked_files, VAR_63=p.get_ui_custom_tracked_files,\n VAR_64=p.get_ui_custom_etag, VAR_65=p.get_ui_custom_lastmodified,\n VAR_62=p.g... | [
"def plugin_view(p):...\n",
"cached = get_cached_view(p._identifier, p.on_ui_render, additional_key_data\n =p.get_ui_additional_key_data_for_cache, additional_files=p.\n get_ui_additional_tracked_files, custom_files=p.\n get_ui_custom_tracked_files, custom_etag=p.get_ui_custom_etag,\n custom_lastmodif... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_44(VAR_62, VAR_9, VAR_97, VAR_103=False):...\n",
"VAR_94 = FUNC_41(VAR_62, VAR_9)\n",
"if isinstance(VAR_97, string_types):\n",
"if VAR_103:\n",
"VAR_188 = [VAR_94.get(f) for f in VAR_97]\n",
"VAR_96('Cannot make dict for single fieldname')\n",
"return VAR_94.get(VAR_97)\n",
"if VAR_103:\n",... | [
"def get_cached_value(doctype, name, fieldname, as_dict=False):...\n",
"doc = get_cached_doc(doctype, name)\n",
"if isinstance(fieldname, string_types):\n",
"if as_dict:\n",
"values = [doc.get(f) for f in fieldname]\n",
"throw('Cannot make dict for single fieldname')\n",
"return doc.get(fieldname)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route(...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = InfluxDBClient(INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_USER,\n INFLUXDB_PASSWORD, INFLUXDB_DATABASE)\n",
"if VAR_17 == '0' and VAR_18 == '0':\n",
"VAR_61 = query_string(VAR_21, VAR_19, VAR_22=channel, VAR_94='COUNT')\n",
"if VAR_17 != '0' and VA... | [
"@blueprint.route(...\n",
"\"\"\"docstring\"\"\"\n",
"dbcon = InfluxDBClient(INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_USER,\n INFLUXDB_PASSWORD, INFLUXDB_DATABASE)\n",
"if start_seconds == '0' and end_seconds == '0':\n",
"query_str = query_string(unit, device_id, channel=channel, value='COUNT')\n",
"if s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assi... |
[
"def FUNC_1(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = FUNC_10(VAR_2, VAR_3)\n",
"print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n",
"for VAR_5 in sorted(VAR_23.keys()):\n",
"print('SignatureDef key: \"%s\"' % VAR_5)\n"
] | [
"def _show_signature_def_map_keys(saved_model_dir, tag_set):...\n",
"\"\"\"docstring\"\"\"\n",
"signature_def_map = get_signature_def_map(saved_model_dir, tag_set)\n",
"print(\n 'The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:'\n )\n",
"for signature_def_key in sorted... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_38(VAR_3, VAR_13, VAR_14='.*\\\\.py$'):...\n",
"VAR_45 = sorted(listdir(apath('%(app)s/%(dir)s/' % {'app': VAR_3, 'dir':\n VAR_13}, VAR_122=request), VAR_14))\n",
"VAR_45 = [x.replace(os.path.sep, '/') for x in VAR_45 if not x.endswith('.bak')\n ]\n",
"return VAR_45\n"
] | [
"def listfiles(app, dir, regexp='.*\\\\.py$'):...\n",
"files = sorted(listdir(apath('%(app)s/%(dir)s/' % {'app': app, 'dir': dir},\n r=request), regexp))\n",
"files = [x.replace(os.path.sep, '/') for x in files if not x.endswith('.bak')]\n",
"return files\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"self._record_users()\n",
"VAR_10 = self.get_success(self.handler.get_device(VAR_0, 'abc'))\n",
"self.assertDictContainsSubset({'user_id': VAR_0, 'device_id': 'abc',\n 'display_name': 'display 2', 'last_seen_ip': 'ip3', 'last_seen_ts': \n 3000000}, VAR_10)\n"
] | [
"def test_get_device(self):...\n",
"self._record_users()\n",
"res = self.get_success(self.handler.get_device(user1, 'abc'))\n",
"self.assertDictContainsSubset({'user_id': user1, 'device_id': 'abc',\n 'display_name': 'display 2', 'last_seen_ip': 'ip3', 'last_seen_ts': \n 3000000}, res)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(self) ->twisted.internet.base.ReactorBase:...\n",
"\"\"\"docstring\"\"\"\n",
"return self._reactor\n"
] | [
"def get_reactor(self) ->twisted.internet.base.ReactorBase:...\n",
"\"\"\"docstring\"\"\"\n",
"return self._reactor\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_27(self, VAR_15, **VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"assert VAR_69 is not None, 'should never reach here without keyring'\n",
"if not VAR_69:\n",
"return\n",
"VAR_78 = self._credentials_to_save\n",
"self._credentials_to_save = None\n",
"if VAR_78 and VAR_15.status_code < 400:\n",
... | [
"def save_credentials(self, resp, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"assert keyring is not None, 'should never reach here without keyring'\n",
"if not keyring:\n",
"return\n",
"creds = self._credentials_to_save\n",
"self._credentials_to_save = None\n",
"if creds and resp.status_code < 400:\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assert'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_4: str) ->str:...\n",
"return ensure_str(VAR_4.replace('&', '&').replace('"', '\"').\n replace('<', '<').replace('>', '>'))\n"
] | [
"def unescape_attributes(value: str) ->str:...\n",
"return ensure_str(value.replace('&', '&').replace('"', '\"').\n replace('<', '<').replace('>', '>'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_3(self, VAR_10: str, VAR_11: str, VAR_14: Iterable[str]) ->Dict[...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_64 = await self.store.get_events(VAR_14, allow_rejected=True)\n",
"VAR_65 = set(VAR_14) - VAR_64.keys()\n",
"if VAR_65:\n",
"VAR_0.debug('Fetching unknown state/auth events %s for room %... | [
"async def _get_events_from_store_or_dest(self, destination: str, room_id:...\n",
"\"\"\"docstring\"\"\"\n",
"fetched_events = await self.store.get_events(event_ids, allow_rejected=True)\n",
"missing_events = set(event_ids) - fetched_events.keys()\n",
"if missing_events:\n",
"logger.debug('Fetching unknow... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Return'"
] |
[
"@FUNC_0...\n",
"return EventBuilderFactory(self)\n"
] | [
"@cache_in_self...\n",
"return EventBuilderFactory(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_200=None, VAR_201=None, VAR_202=None, VAR_203=True,...\n",
"\"\"\"docstring\"\"\"\n",
"self.follow_symlink_out = VAR_204\n",
"self.base = self.normalize_path(VAR_200 or VAR_418.path.join(VAR_263.\n request.folder, 'static'))\n",
"self.basename = VAR_201 or VAR_263.request.function... | [
"def __init__(self, base=None, basename=None, extensions=None,...\n",
"\"\"\"docstring\"\"\"\n",
"self.follow_symlink_out = follow_symlink_out\n",
"self.base = self.normalize_path(base or os.path.join(current.request.folder,\n 'static'))\n",
"self.basename = basename or current.request.function\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"As... |
[
"def FUNC_17(self, VAR_20=False, VAR_15=None, VAR_16=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.name_set and not VAR_20:\n",
"return\n",
"if self.get('__newname'):\n",
"self.name = self.get('__newname')\n",
"if VAR_15:\n",
"self.flags.name_set = True\n",
"self.name = VAR_15\n",
"FUNC_... | [
"def set_new_name(self, force=False, set_name=None, set_child_names=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.name_set and not force:\n",
"return\n",
"if self.get('__newname'):\n",
"self.name = self.get('__newname')\n",
"if set_name:\n",
"self.flags.name_set = True\n",
"self.name = set... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Condition",
"For",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"self.current_value = VAR_3.id\n"
] | [
"def visit_Name(self, node):...\n",
"\"\"\"docstring\"\"\"\n",
"self.current_value = node.id\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_31(self):...\n",
"self.inline._in_footnote = True\n",
"VAR_67 = self.renderer.placeholder()\n",
"VAR_13 = self.token['key']\n",
"while self.pop()['type'] != 'footnote_end':\n",
"VAR_67 += self.tok()\n",
"self.footnotes.append({'key': VAR_13, 'text': VAR_67})\n",
"self.inline._in_footnote = F... | [
"def output_footnote(self):...\n",
"self.inline._in_footnote = True\n",
"body = self.renderer.placeholder()\n",
"key = self.token['key']\n",
"while self.pop()['type'] != 'footnote_end':\n",
"body += self.tok()\n",
"self.footnotes.append({'key': key, 'text': body})\n",
"self.inline._in_footnote = False... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"@VAR_8.route('/static/<path:path>', methods=['GET'])...\n",
"if VAR_8.interface.share:\n",
"return redirect(VAR_39 + VAR_17)\n",
"return send_file(safe_join(VAR_6, VAR_17))\n"
] | [
"@app.route('/static/<path:path>', methods=['GET'])...\n",
"if app.interface.share:\n",
"return redirect(GRADIO_STATIC_ROOT + path)\n",
"return send_file(safe_join(STATIC_PATH_LIB, path))\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_45(self):...\n",
"VAR_12 = 'hello'\n",
"VAR_22, VAR_23 = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/invite'.format(self.room_id), VAR_19={\n 'reason': reason, 'user_id': self.second_user_id}, VAR_16=self.creator_tok)\n",
"self.assertEqual(VAR_23.code, 200, VAR_23.result)\n",
"s... | [
"def test_invite_reason(self):...\n",
"reason = 'hello'\n",
"request, channel = self.make_request('POST',\n '/_matrix/client/r0/rooms/{}/invite'.format(self.room_id), content={\n 'reason': reason, 'user_id': self.second_user_id}, access_token=self.\n creator_tok)\n",
"self.assertEqual(channel.code, 2... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"from __future__ import unicode_literals, print_function\n",
"import frappe\n",
"import time\n",
"from frappe import _, msgprint\n",
"from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff\n",
"from frappe.model.base_document import BaseDocument, get_controller\n",
"from frappe.... | [
"from __future__ import unicode_literals, print_function\n",
"import frappe\n",
"import time\n",
"from frappe import _, msgprint\n",
"from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff\n",
"from frappe.model.base_document import BaseDocument, get_controller\n",
"from frappe.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
2
] | [
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Condi... |
[
"def FUNC_16(self):...\n",
"VAR_3 = self.client.get('/reset/123456/1-1/')\n",
"self.assertContains(VAR_3, 'The password reset link was invalid')\n"
] | [
"def test_confirm_invalid_user(self):...\n",
"response = self.client.get('/reset/123456/1-1/')\n",
"self.assertContains(response, 'The password reset link was invalid')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = self.client.post('/admin_password_reset/', {'email':\n 'staffmember@example.com'}, HTTP_HOST=\n 'www.example:dr.frankenstein@evil.tld')\n",
"self.assertEqual(VAR_3.status_code, 400)\n",
"self.assertEqual(le... | [
"@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.post('/admin_password_reset/', {'email':\n 'staffmember@example.com'}, HTTP_HOST=\n 'www.example:dr.frankenstein@evil.tld')\n",
"self.assertEqual(response.status_code, 400)\n",
"self.assertEq... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.