lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = VAR_8.getObject('Image', VAR_6)\n",
"if VAR_15 is None:\n",
"VAR_159, VAR_160 = VAR_8.getMaxPlaneSize()\n",
"VAR_86 = VAR_15.getSizeX()\n",
"VAR_87 = VAR_15.getSizeY()\n",
"if VAR_86 * VAR_87 > VAR_159 * VAR_160:\n",
"VAR_231 = \"Histogr... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"image = conn.getObject('Image', iid)\n",
"if image is None:\n",
"maxW, maxH = conn.getMaxPlaneSize()\n",
"sizeX = image.getSizeX()\n",
"sizeY = image.getSizeY()\n",
"if sizeX * sizeY > maxW * maxH:\n",
"msg = \"Histogram not supported for 'big' i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(VAR_19):...\n",
"VAR_36 = FUNC_10(VAR_19)\n",
"VAR_38 = '/'.join(VAR_36.split('/')[:-2]) + '/classes.txt'\n",
"if os.path.isfile(VAR_38):\n",
"return '<object id={} src={} meta={} />'.format(quoteattr(url_for(\n '.get_object_id', VAR_19=object_path)), quoteattr(FUNC_8(VAR_19)),\n quoteattr... | [
"def _get_object_element(object_path):...\n",
"path = _get_obj_absolute_path(object_path)\n",
"class_text = '/'.join(path.split('/')[:-2]) + '/classes.txt'\n",
"if os.path.isfile(class_text):\n",
"return '<object id={} src={} meta={} />'.format(quoteattr(url_for(\n '.get_object_id', object_path=object_pa... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/output_mod/<output_id>/<channel>/<state>/<output_type>/<amount>'...\n",
"\"\"\"docstring\"\"\"\n",
"if not utils_general.user_has_permission('edit_controllers'):\n",
"return 'Insufficient user permissions to manipulate outputs'\n",
"if is_int(VAR_22):\n",
"VAR_88 = int(VAR_22)\n",
"VAR_8... | [
"@blueprint.route(...\n",
"\"\"\"docstring\"\"\"\n",
"if not utils_general.user_has_permission('edit_controllers'):\n",
"return 'Insufficient user permissions to manipulate outputs'\n",
"if is_int(channel):\n",
"output_channel = int(channel)\n",
"channel_dev = db_retrieve_table(OutputChannel).filter(Out... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"super().save()\n",
"self.file_path = tempfile.mkdtemp(dir=self.temp_dir())\n"
] | [
"def save(self):...\n",
"super().save()\n",
"self.file_path = tempfile.mkdtemp(dir=self.temp_dir())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_30(self):...\n",
"VAR_27 = widgets.AdminURLFieldWidget()\n",
"self.assertHTMLEqual(conditional_escape(VAR_27.render('test', '')),\n '<input class=\"vURLField\" name=\"test\" type=\"url\" />')\n",
"self.assertHTMLEqual(conditional_escape(VAR_27.render('test',\n 'http://example.com')), 'string')... | [
"def test_render(self):...\n",
"w = widgets.AdminURLFieldWidget()\n",
"self.assertHTMLEqual(conditional_escape(w.render('test', '')),\n '<input class=\"vURLField\" name=\"test\" type=\"url\" />')\n",
"self.assertHTMLEqual(conditional_escape(w.render('test',\n 'http://example.com')),\n '<p class=\"url... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"return base64.urlsafe_b64encode(VAR_22).rstrip(b'\\n=')\n"
] | [
"def urlsafe_base64_encode(s):...\n",
"\"\"\"docstring\"\"\"\n",
"return base64.urlsafe_b64encode(s).rstrip(b'\\n=')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_66(VAR_12, VAR_27):...\n",
"VAR_91 = FUNC_69(VAR_12, config.config_ldap_user_object)\n",
"VAR_114 = VAR_27[VAR_91][0].decode('utf-8')\n",
"VAR_0.error('Failed to extract LDAP user: %s - %s', VAR_12, ex)\n",
"if ub.session.query(ub.User).filter(VAR_18.lower(ub.User.name) == VAR_114.\n",
"VAR_71 =... | [
"def ldap_import_create_user(user, user_data):...\n",
"user_login_field = extract_dynamic_field_from_filter(user, config.\n config_ldap_user_object)\n",
"username = user_data[user_login_field][0].decode('utf-8')\n",
"log.error('Failed to extract LDAP user: %s - %s', user, ex)\n",
"if ub.session.query(ub.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"... |
[
"def FUNC_26(self, VAR_23, VAR_24, VAR_25, VAR_26=False):...\n",
"VAR_73 = self.playlistdb.savePlaylist(VAR_15=self.getUserId(), VAR_24=1 if\n public else 0, VAR_23=playlist, playlisttitle=playlistname, VAR_26=\n overwrite)\n",
"if VAR_73 == 'success':\n",
"return VAR_73\n"
] | [
"def api_saveplaylist(self, playlist, public, playlistname, overwrite=False):...\n",
"res = self.playlistdb.savePlaylist(userid=self.getUserId(), public=1 if\n public else 0, playlist=playlist, playlisttitle=playlistname, overwrite\n =overwrite)\n",
"if res == 'success':\n",
"return res\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_11(VAR_16):...\n",
"return {VAR_22.domain for VAR_22 in self.room_members}\n"
] | [
"def get_joined_hosts_for_room(room_id):...\n",
"return {member.domain for member in self.room_members}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_103(VAR_46):...\n",
"if VAR_46 not in VAR_1.system_settings:\n",
"VAR_1.system_settings.update({VAR_46: VAR_12.get_single_value(\n 'System Settings', VAR_46)})\n",
"return VAR_1.system_settings.get(VAR_46)\n"
] | [
"def get_system_settings(key):...\n",
"if key not in local.system_settings:\n",
"local.system_settings.update({key: db.get_single_value('System Settings', key)}\n )\n",
"return local.system_settings.get(key)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/series')...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_SERIES):\n",
"if VAR_87.get_view_property('series', 'dir') == 'desc':\n",
"abort(404)\n",
"VAR_10 = db.Series.sort.desc()\n",
"VAR_10 = db.Series.sort.asc()\n",
"VAR_109 = 0\n",
"VAR_109 = 1\n",
"if VAR_87.get_view_propert... | [
"@web.route('/series')...\n",
"if current_user.check_visibility(constants.SIDEBAR_SERIES):\n",
"if current_user.get_view_property('series', 'dir') == 'desc':\n",
"abort(404)\n",
"order = db.Series.sort.desc()\n",
"order = db.Series.sort.asc()\n",
"order_no = 0\n",
"order_no = 1\n",
"if current_user.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"@login_required...\n",
"VAR_11 = TopicPrivate.objects.for_delete_or_404(VAR_5, VAR_1.user)\n",
"if VAR_1.method == 'POST':\n",
"VAR_11.delete()\n",
"return render(VAR_1=request, template_name=\n 'spirit/topic/private/delete.html', context={'topic_private':\n topic_private})\n",
"if VAR_1.user.pk ==... | [
"@login_required...\n",
"topic_private = TopicPrivate.objects.for_delete_or_404(pk, request.user)\n",
"if request.method == 'POST':\n",
"topic_private.delete()\n",
"return render(request=request, template_name=\n 'spirit/topic/private/delete.html', context={'topic_private':\n topic_private})\n",
"if... | [
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def __getattr__(self, VAR_12):...\n",
"if VAR_12 == '__name__':\n",
"return self.__class__.__name__\n",
"return super(CLASS_2, self).getattr(VAR_12)\n"
] | [
"def __getattr__(self, name):...\n",
"if name == '__name__':\n",
"return self.__class__.__name__\n",
"return super(login_required, self).getattr(name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_18(self, VAR_6=None, VAR_7=None, VAR_8=None, VAR_9=False, VAR_10=False...\n",
"if self.report_type in ('Query Report', 'Script Report', 'Custom Report'):\n",
"VAR_13, VAR_15 = self.run_query_report(VAR_6, VAR_8, VAR_10)\n",
"VAR_13, VAR_15 = self.run_standard_report(VAR_6, VAR_7, VAR_8)\n",
"if VA... | [
"def get_data(self, filters=None, limit=None, user=None, as_dict=False,...\n",
"if self.report_type in ('Query Report', 'Script Report', 'Custom Report'):\n",
"columns, result = self.run_query_report(filters, user, ignore_prepared_report)\n",
"columns, result = self.run_standard_report(filters, limit, user)\n... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@Document.whitelist...\n",
"self.db_set('disabled', cint(VAR_16))\n"
] | [
"@Document.whitelist...\n",
"self.db_set('disabled', cint(disable))\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"@staticmethod...\n",
"VAR_24 = '.tar.gz' if VAR_8 else ''\n",
"return f'{VAR_3}{VAR_24}'\n"
] | [
"@staticmethod...\n",
"ext = '.tar.gz' if include_extension else ''\n",
"return f'{model_name}{ext}'\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self, VAR_6, VAR_8='', VAR_7=None):...\n",
"VAR_9, VAR_15 = self.make_request('GET', self.profile_url + VAR_8, VAR_7=\n access_token)\n",
"self.assertEqual(VAR_15.code, VAR_6, VAR_15.result)\n"
] | [
"def request_profile(self, expected_code, url_suffix='', access_token=None):...\n",
"request, channel = self.make_request('GET', self.profile_url + url_suffix,\n access_token=access_token)\n",
"self.assertEqual(channel.code, expected_code, channel.result)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_62(self, VAR_9):...\n",
"return {'username': VAR_9.username, 'password': VAR_9.password, 'email':\n VAR_9.email, 'is_active': VAR_9.is_active, 'is_staff': VAR_9.is_staff,\n 'is_superuser': VAR_9.is_superuser, 'last_login_0': VAR_9.last_login.\n strftime('%Y-%m-%d'), 'last_login_1': VAR_9.last_l... | [
"def get_user_data(self, user):...\n",
"return {'username': user.username, 'password': user.password, 'email': user\n .email, 'is_active': user.is_active, 'is_staff': user.is_staff,\n 'is_superuser': user.is_superuser, 'last_login_0': user.last_login.\n strftime('%Y-%m-%d'), 'last_login_1': user.last_log... | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(VAR_0, VAR_1: FlaskClient):...\n",
"VAR_5 = VAR_1.get('/dataobj/1')\n",
"assert VAR_5.status_code == 302\n"
] | [
"def test_get_dataobj_not_found(test_app, client: FlaskClient):...\n",
"response = client.get('/dataobj/1')\n",
"assert response.status_code == 302\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for higher_quota in self.high_quota_specs:\n",
"if re.match(higher_quota, self.spec, re.IGNORECASE):\n",
"return False\n",
"return True\n"
] | [
"def has_higher_quota(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for higher_quota in self.high_quota_specs:\n",
"if re.match(higher_quota, self.spec, re.IGNORECASE):\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"from twisted.internet import defer\n",
"from synapse.api.errors import NotFoundError\n",
"from synapse.rest.client.v1 import room\n",
"from tests.unittest import HomeserverTestCase\n",
"VAR_0 = '@red:server'\n",
"VAR_1 = [room.register_servlets]\n",
"def FUNC_0(self, VAR_2, VAR_3):...\n",
"VAR_4 = se... | [
"from twisted.internet import defer\n",
"from synapse.api.errors import NotFoundError\n",
"from synapse.rest.client.v1 import room\n",
"from tests.unittest import HomeserverTestCase\n",
"user_id = '@red:server'\n",
"servlets = [room.register_servlets]\n",
"def make_homeserver(self, reactor, clock):...\n... | [
0,
0,
0,
0,
0,
0,
0,
4,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self, VAR_19, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"if settings.PUBLIC_ENABLED:\n",
"if not hasattr(settings, 'PUBLIC_USER'):\n",
"return False\n",
"VAR_0.warn(\n 'OMERO.webpublic enabled but public user (omero.web.public.user) not set, disabling OMERO.webpublic.'\n )\n",
"if not... | [
"def is_valid_public_url(self, server_id, request):...\n",
"\"\"\"docstring\"\"\"\n",
"if settings.PUBLIC_ENABLED:\n",
"if not hasattr(settings, 'PUBLIC_USER'):\n",
"return False\n",
"logger.warn(\n 'OMERO.webpublic enabled but public user (omero.web.public.user) not set, disabling OMERO.webpublic.'\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_71(VAR_43, VAR_126=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_43, text_type):\n",
"VAR_43 = VAR_43.encode('utf-8')\n",
"if os.path.exists(VAR_43):\n",
"return FUNC_1(f.read())\n",
"if VAR_126:\n",
"return None\n"
] | [
"def read_file(path, raise_not_found=False):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(path, text_type):\n",
"path = path.encode('utf-8')\n",
"if os.path.exists(path):\n",
"return as_unicode(f.read())\n",
"if raise_not_found:\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_8():...\n",
"\"\"\"docstring\"\"\"\n",
"session.authorized = None\n",
"if MULTI_USER_MODE:\n",
"redirect(URL('user/logout'))\n",
"redirect(URL('index'))\n"
] | [
"def logout():...\n",
"\"\"\"docstring\"\"\"\n",
"session.authorized = None\n",
"if MULTI_USER_MODE:\n",
"redirect(URL('user/logout'))\n",
"redirect(URL('index'))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = ['--temp-basedir'] + FUNC_0(VAR_4.config)\n",
"VAR_6.start(VAR_11, VAR_16={'LC_ALL': 'C'})\n",
"VAR_6.set_setting('downloads.location.directory', str(VAR_2))\n",
"VAR_6.set_setting('downloads.location.prompt', 'false')\n",
"VAR_7 = 'http://... | [
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"args = ['--temp-basedir'] + _base_args(request.config)\n",
"quteproc_new.start(args, env={'LC_ALL': 'C'})\n",
"quteproc_new.set_setting('downloads.location.directory', str(tmpdir))\n",
"quteproc_new.set_setting('downloads.location.prompt', 'false')\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assert'",
"Assert'"
] |
[
"def FUNC_6():...\n",
"yield '<!-- CLICK_WEB START HEADER -->'\n",
"yield '<div class=\"command-line\">Executing: {}</div>'.format('/'.join(VAR_4))\n",
"yield '<!-- CLICK_WEB END HEADER -->'\n"
] | [
"def generate():...\n",
"yield '<!-- CLICK_WEB START HEADER -->'\n",
"yield '<div class=\"command-line\">Executing: {}</div>'.format('/'.join(commands)\n )\n",
"yield '<!-- CLICK_WEB END HEADER -->'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"self.http_client = Mock()\n",
"return self.setup_test_homeserver(http_client=self.http_client)\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"self.http_client = Mock()\n",
"return self.setup_test_homeserver(http_client=self.http_client)\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"if frappe.flags.in_import:\n",
"return\n",
"VAR_60 = frappe.new_doc(self.doctype, as_dict=True)\n",
"self.update_if_missing(VAR_60)\n",
"for VAR_19 in self.meta.get_table_fields():\n",
"VAR_60 = frappe.new_doc(VAR_19.options, as_dict=True)\n",
"VAR_26 = self.get(VAR_19.fiel... | [
"def _set_defaults(self):...\n",
"if frappe.flags.in_import:\n",
"return\n",
"new_doc = frappe.new_doc(self.doctype, as_dict=True)\n",
"self.update_if_missing(new_doc)\n",
"for df in self.meta.get_table_fields():\n",
"new_doc = frappe.new_doc(df.options, as_dict=True)\n",
"value = self.get(df.fieldnam... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Assign'",
"Condition",
"For",
"Expr'"
] |
[
"def __init__(self, VAR_4: 'HomeServer'):...\n",
"super().__init__(VAR_4)\n",
"self.hs = VAR_4\n",
"self.store = VAR_4.get_datastore()\n",
"self.storage = VAR_4.get_storage()\n",
"self.state_store = self.storage.state\n",
"self.federation_client = VAR_4.get_federation_client()\n",
"self.state_handler ... | [
"def __init__(self, hs: 'HomeServer'):...\n",
"super().__init__(hs)\n",
"self.hs = hs\n",
"self.store = hs.get_datastore()\n",
"self.storage = hs.get_storage()\n",
"self.state_store = self.storage.state\n",
"self.federation_client = hs.get_federation_client()\n",
"self.state_handler = hs.get_state_han... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
... |
[
"async def FUNC_5(VAR_7=None, VAR_8=False):...\n",
"return {'user': UserID.from_string(self.auth_user_id), 'token_id': 1,\n 'is_guest': False}\n"
] | [
"async def get_user_by_access_token(token=None, allow_guest=False):...\n",
"return {'user': UserID.from_string(self.auth_user_id), 'token_id': 1,\n 'is_guest': False}\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Return'"
] |
[
"def FUNC_3(VAR_5, VAR_6=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = int(VAR_5)\n",
"VAR_22 = objreg.get('web-history')\n",
"if VAR_6 is not None:\n",
"VAR_34 = VAR_22.entries_before(VAR_5, limit=1000, VAR_6=offset)\n",
"VAR_35 = VAR_5 - 24 * 60 * 60\n",
"return [{'url': e.url, 'title': html.esc... | [
"def history_data(start_time, offset=None):...\n",
"\"\"\"docstring\"\"\"\n",
"start_time = int(start_time)\n",
"hist = objreg.get('web-history')\n",
"if offset is not None:\n",
"entries = hist.entries_before(start_time, limit=1000, offset=offset)\n",
"end_time = start_time - 24 * 60 * 60\n",
"return ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_30(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertIs(VAR_5.evaluate('nocall: list'), list)\n"
] | [
"def test_list_in_path_expr(self):...\n",
"ec = self._makeContext()\n",
"self.assertIs(ec.evaluate('nocall: list'), list)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_134(self):...\n",
"if isinstance(self.settings.render, basestring):\n",
"VAR_391 = getattr(self, '%s_render' % self.settings.render)\n",
"if callable(self.settings.render):\n",
"return VAR_391\n",
"VAR_391 = self.settings.render\n",
"if isinstance(self.settings.render, dict):\n",
"def FUNC_1... | [
"def get_renderer(self):...\n",
"if isinstance(self.settings.render, basestring):\n",
"r = getattr(self, '%s_render' % self.settings.render)\n",
"if callable(self.settings.render):\n",
"return r\n",
"r = self.settings.render\n",
"if isinstance(self.settings.render, dict):\n",
"def custom_render(page):... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_68 = [('id', 'Order Id'), ('company_name', 'Company Name'), (\n 'company_contact_name', 'Company Contact Name'), (\n 'company_contact_email', 'Company Contact Email'), (\n ... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"query_features = [('id', 'Order Id'), ('company_name', 'Company Name'), (\n 'company_contact_name', 'Company Contact Name'), (\n 'company_contact_email', 'Company Contact Em... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import re\n",
"import secrets\n",
"from typing import Any, Dict, Optional, Tuple\n",
"from urllib.parse import urlparse\n",
"from django.conf import settings\n",
"from django.http import HttpRequest, JsonResponse\n",
"from django.views.decorators.csrf import csrf_exempt\n",
"from rest_framework impor... | [
"import re\n",
"import secrets\n",
"from typing import Any, Dict, Optional, Tuple\n",
"from urllib.parse import urlparse\n",
"from django.conf import settings\n",
"from django.http import HttpRequest, JsonResponse\n",
"from django.views.decorators.csrf import csrf_exempt\n",
"from rest_framework impor... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
4,
4,
0,
0,
0,
4,
4,
4,
0,
4
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
... |
[
"@defer.inlineCallbacks...\n",
"VAR_30 = yield defer.ensureDeferred(self._base_builder.build(VAR_28, VAR_29))\n",
"VAR_30._event_id = self._event_id\n",
"VAR_30._dict['event_id'] = self._event_id\n",
"assert VAR_30.event_id == self._event_id\n",
"return VAR_30\n"
] | [
"@defer.inlineCallbacks...\n",
"built_event = yield defer.ensureDeferred(self._base_builder.build(\n prev_event_ids, auth_event_ids))\n",
"built_event._event_id = self._event_id\n",
"built_event._dict['event_id'] = self._event_id\n",
"assert built_event.event_id == self._event_id\n",
"return built_even... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Return'"
] |
[
"@login_required...\n",
"VAR_12 = get_object_or_404(Topic, VAR_5=topic_id, VAR_7=request.user,\n category_id=settings.ST_TOPIC_PRIVATE_CATEGORY_PK)\n",
"VAR_14 = TopicPrivateJoinForm(VAR_12=topic, VAR_7=request.user, data=\n post_data(request))\n",
"if is_post(VAR_1) and VAR_14.is_valid():\n",
"VAR_11... | [
"@login_required...\n",
"topic = get_object_or_404(Topic, pk=topic_id, user=request.user,\n category_id=settings.ST_TOPIC_PRIVATE_CATEGORY_PK)\n",
"form = TopicPrivateJoinForm(topic=topic, user=request.user, data=post_data(\n request))\n",
"if is_post(request) and form.is_valid():\n",
"topic_private =... | [
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(VAR_3: str, VAR_4: int, VAR_5: int, VAR_6: str, VAR_7: str) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = file.readlines()\n",
"VAR_28.insert(VAR_4, f'{\\' \\' * VAR_5}{VAR_6}: \"{VAR_7}\"\\n')\n",
"file.write(''.join(VAR_28))\n"
] | [
"def insert_metadata_in_file(filename: str, lineno: int, indent: int, key:...\n",
"\"\"\"docstring\"\"\"\n",
"contents = file.readlines()\n",
"contents.insert(lineno, f'{\\' \\' * indent}{key}: \"{value}\"\\n')\n",
"file.write(''.join(contents))\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_10(self, *VAR_0, **VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"return self._save(*VAR_0, **kwargs)\n"
] | [
"def save(self, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"return self._save(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@property...\n",
"return storage.connection.meta.client\n"
] | [
"@property...\n",
"return storage.connection.meta.client\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"from openapi_python_client.parser import properties\n",
"properties._existing_enums = {'test': 'an enum'}\n",
"assert properties.EnumProperty.get_enum('test') == 'an enum'\n",
"properties._existing_enums = {}\n"
] | [
"def test_get_enum(self):...\n",
"from openapi_python_client.parser import properties\n",
"properties._existing_enums = {'test': 'an enum'}\n",
"assert properties.EnumProperty.get_enum('test') == 'an enum'\n",
"properties._existing_enums = {}\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assert'",
"Assign'"
] |
[
"def FUNC_21(self, VAR_19=None):...\n",
"if self.start:\n",
"return True\n",
"return not self.same_part(VAR_19, self._last_item, self.item)\n"
] | [
"def first(self, name=None):...\n",
"if self.start:\n",
"return True\n",
"return not self.same_part(name, self._last_item, self.item)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_17():...\n",
"VAR_180 = []\n",
"for msg_out in VAR_1.message_log:\n",
"VAR_180.append(json.loads(msg_out))\n",
"return VAR_180\n"
] | [
"def get_message_log():...\n",
"log = []\n",
"for msg_out in local.message_log:\n",
"log.append(json.loads(msg_out))\n",
"return log\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/api/plugins', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_110 = FUNC_58('/internal/plugins', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_110)\n"
] | [
"@gui.route('/api/plugins', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"plugins_info = query_internal_api('/internal/plugins', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(plugins_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_65 = get_course_with_access(VAR_9.user, 'instructor', VAR_10, depth=None)\n",
"VAR_19 = get_student_from_identifier(VAR_9.GET.get('unique_student_identifier')\n )\n",
"VAR_63... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"course = get_course_with_access(request.user, 'instructor', course_id,\n depth=None)\n",
"user = get_student_from_identifier(request.GET.get('unique_student_identifier')\n ... | [
0,
0,
0,
0,
3,
3,
0,
0,
0,
3,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Expr'"... |
[
"@property...\n",
"return reverse('upload')\n"
] | [
"@property...\n",
"return reverse('upload')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"from pathlib import Path\n",
"from os.path import sep\n",
"from pkg_resources import require\n",
"from shutil import which\n",
"import frontmatter\n",
"from flask import render_template, flash, redirect, request, url_for, send_file, send_from_directory\n",
"from flask_login import login_user, current_u... | [
"from pathlib import Path\n",
"from os.path import sep\n",
"from pkg_resources import require\n",
"from shutil import which\n",
"import frontmatter\n",
"from flask import render_template, flash, redirect, request, url_for, send_file, send_from_directory\n",
"from flask_login import login_user, current_u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_13(VAR_18, VAR_30):...\n",
"VAR_82 = {}\n",
"for VAR_57, template_collection in VAR_18.items():\n",
"VAR_124 = {}\n",
"return VAR_82\n",
"for VAR_58, template_entry in template_collection['entries'].items():\n",
"if VAR_30(VAR_57, VAR_58):\n",
"VAR_82[VAR_57] = {'order': list(filter(lambda V... | [
"def _filter_templates(templates, template_filter):...\n",
"filtered_templates = {}\n",
"for template_type, template_collection in templates.items():\n",
"filtered_entries = {}\n",
"return filtered_templates\n",
"for template_key, template_entry in template_collection['entries'].items():\n",
"if templat... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"For",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_21(self):...\n",
"assert join('/', '/foo', '/', '/bar') == '/foo/bar'\n"
] | [
"def test_it_strips_neighboring_slashes(self):...\n",
"assert join('/', '/foo', '/', '/bar') == '/foo/bar'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"async def FUNC_5(VAR_6, VAR_7=None, VAR_8=None):...\n",
"VAR_0.exception(VAR_8)\n",
"return web.json_response({'status': 503, 'message':\n 'Service currently unavailable'}, status=503)\n"
] | [
"async def handle_500(request, response=None, error=None):...\n",
"logger.exception(error)\n",
"return web.json_response({'status': 503, 'message':\n 'Service currently unavailable'}, status=503)\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"def FUNC_50():...\n",
"return 'works'\n"
] | [
"def test_url_params_from_lookup_dict_callable(self):...\n",
"def my_callable():...\n",
"return 'works'\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"import re\n",
"import random\n",
"import datetime\n",
"from django.utils.translation import ugettext as _\n",
"from django.utils.translation import ungettext\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"return VAR_0[VAR_1]\n",
"return getattr(VAR_0, VAR_1)\n",
"def FUNC_1(VAR_2):...\n",
"\"\"\"docstrin... | [
"import re\n",
"import random\n",
"import datetime\n",
"from django.utils.translation import ugettext as _\n",
"from django.utils.translation import ungettext\n",
"def get_from_dict_or_object(source, key):...\n",
"return source[key]\n",
"return getattr(source, key)\n",
"def enumerate_string_list(str... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Return'",
"Return'",
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_0):...\n",
"VAR_1 = VAR_0.MagicMock()\n",
"VAR_2 = VAR_0.patch('openapi_python_client._get_document', return_value=\n data_dict)\n",
"VAR_9 = GeneratorError()\n",
"VAR_4 = VAR_0.patch('openapi_python_client.parser.GeneratorData.from_dict',\n return_value=error)\n",
"VAR_5 = VAR_0.pat... | [
"def test__get_project_for_url_or_path_generator_error(mocker):...\n",
"data_dict = mocker.MagicMock()\n",
"_get_document = mocker.patch('openapi_python_client._get_document',\n return_value=data_dict)\n",
"error = GeneratorError()\n",
"from_dict = mocker.patch('openapi_python_client.parser.GeneratorData... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assert'"
] |
[
"@csrf_exempt...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_156 = 0\n",
"VAR_157 = 1\n",
"VAR_158 = ['data_format_error', 'user_not_exist',\n 'user_already_white_listed', 'user_not_enrolled']\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_125, VAR_50, VAR_159 = [], [], []\n",
"VAR_49 = {VAR_160: [] ... | [
"@csrf_exempt...\n",
"\"\"\"docstring\"\"\"\n",
"user_index = 0\n",
"notes_index = 1\n",
"row_errors_key = ['data_format_error', 'user_not_exist',\n 'user_already_white_listed', 'user_not_enrolled']\n",
"course_key = CourseKey.from_string(course_id)\n",
"students, general_errors, success = [], [], []... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"For",
"Return'",
"Assign'",
"Expr'",
"AugAssign'",
... |
[
"def FUNC_6(self, VAR_6):...\n",
"return ''\n"
] | [
"def label_for_value(self, value):...\n",
"return ''\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_2.route('/register', methods=['GET', 'POST'])...\n",
"if not config.config_public_reg:\n",
"abort(404)\n",
"if VAR_87 is not None and VAR_87.is_authenticated:\n",
"return redirect(url_for('web.index'))\n",
"if not config.get_mail_server_configured():\n",
"flash(_(\n u'E-Mail server is not confi... | [
"@web.route('/register', methods=['GET', 'POST'])...\n",
"if not config.config_public_reg:\n",
"abort(404)\n",
"if current_user is not None and current_user.is_authenticated:\n",
"return redirect(url_for('web.index'))\n",
"if not config.get_mail_server_configured():\n",
"flash(_(\n u'E-Mail server is... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Expr'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Condition",
"Assign'",
... |
[
"def FUNC_10(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('dummy2'), 'dummy')\n"
] | [
"def test_evaluate_with_render_DTML_template(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('dummy2'), 'dummy')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_19(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return any([self.nlg, self.nlu, self.core, self.force_training])\n"
] | [
"def is_training_required(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return any([self.nlg, self.nlu, self.core, self.force_training])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def __exit__(self, VAR_171, VAR_105, VAR_178):...\n",
"FUNC_9()\n"
] | [
"def __exit__(self, type, value, traceback):...\n",
"destroy()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_16 = \"\"\"Dear user, \n this is a message \n from,\nsomeone\"\"\"\n",
"self.assertEqual(format_value(VAR_16),\n \"\"\"<pre>Dear user, \n this is a message \n from,\nsomeone</pre>\"\"\")\n"
] | [
"def test_format_value_string_newlines(self):...\n",
"\"\"\"docstring\"\"\"\n",
"text = \"\"\"Dear user, \n this is a message \n from,\nsomeone\"\"\"\n",
"self.assertEqual(format_value(text),\n \"\"\"<pre>Dear user, \n this is a message \n from,\nsomeone</pre>\"\"\")\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"@login_required(setGroupContext=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_54 = None\n",
"VAR_104 = None\n",
"if VAR_28 in ('dataset', 'project', 'image', 'screen', 'plate',\n",
"VAR_94 = {}\n",
"if VAR_28 in ('share', 'sharecomment', 'chat'):\n",
"if VAR_28 is not None and int(VAR_29) > 0:\n",
"... | [
"@login_required(setGroupContext=True)...\n",
"\"\"\"docstring\"\"\"\n",
"template = None\n",
"manager = None\n",
"if o_type in ('dataset', 'project', 'image', 'screen', 'plate',\n",
"kw = {}\n",
"if o_type in ('share', 'sharecomment', 'chat'):\n",
"if o_type is not None and int(o_id) > 0:\n",
"mana... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
4,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0... | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Condition",... |
[
"def FUNC_130(self, VAR_211):...\n",
"return DIV(*[A(VAR_445.strip(), _href=URL(args='_search', vars=dict(q=t))) for\n VAR_445 in VAR_211 or [] if VAR_445.strip()], _class='w2p_wiki_tags')\n"
] | [
"def render_tags(self, tags):...\n",
"return DIV(*[A(t.strip(), _href=URL(args='_search', vars=dict(q=t))) for t in\n tags or [] if t.strip()], _class='w2p_wiki_tags')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"from MoinMoin import config, wikiutil\n",
"from MoinMoin.action.AttachFile import _get_files\n",
"from MoinMoin.Page import Page\n",
"import re\n",
"def FUNC_0(VAR_0):...\n",
"VAR_2 = FUNC_2(VAR_0)\n",
"VAR_0.write('string' % VAR_0.cfg.url_prefix_static)\n",
"VAR_3 = []\n",
... | [
"\"\"\"\n MoinMoin - feed some FCKeditor dialogues\n\n @copyright: 2005-2006 Bastian Blank, Florian Festi, Thomas Waldmann\n @license: GNU GPL, see COPYING for details.\n\"\"\"\n",
"from MoinMoin import config, wikiutil\n",
"from MoinMoin.action.AttachFile import _get_files\n",
"from MoinMoin.Page im... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"For",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Ex... |
[
"def FUNC_59(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not getattr(self.meta, 'track_changes', False\n",
"return\n",
"VAR_70 = frappe.new_doc('Version')\n",
"if not self._doc_before_save:\n",
"VAR_70.for_insert(self)\n",
"if VAR_70.set_diff(self._doc_before_save, self):\n",
"VAR_70.insert(VAR_11=... | [
"def save_version(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not getattr(self.meta, 'track_changes', False\n",
"return\n",
"version = frappe.new_doc('Version')\n",
"if not self._doc_before_save:\n",
"version.for_insert(self)\n",
"if version.set_diff(self._doc_before_save, self):\n",
"version.inser... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"For",
"Expr'",
"For",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def __repr__(self):...\n",
"return '<Shelf %d:%r>' % (self.id, self.name)\n"
] | [
"def __repr__(self):...\n",
"return '<Shelf %d:%r>' % (self.id, self.name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_36(VAR_51):...\n",
"for VAR_105 in VAR_51:\n",
"VAR_16.write(VAR_105)\n",
"yield VAR_105\n"
] | [
"def written_chunks(chunks):...\n",
"for chunk in chunks:\n",
"content_file.write(chunk)\n",
"yield chunk\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2: Text, VAR_3: Text) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"if not os.path.isdir(VAR_2):\n",
"VAR_13, VAR_14 = self._compress(VAR_2, VAR_3)\n",
"self._persist_tar(VAR_13, VAR_14)\n"
] | [
"def persist(self, model_directory: Text, model_name: Text) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"if not os.path.isdir(model_directory):\n",
"file_key, tar_path = self._compress(model_directory, model_name)\n",
"self._persist_tar(file_key, tar_path)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_11=None, VAR_12=None, VAR_13=False, VAR_14=None,...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.in_print:\n",
"return\n",
"self.flags.notifications_executed = []\n",
"if VAR_11 != None:\n",
"self.flags.ignore_permissions = VAR_11\n",
"if VAR_12 != None:\n",
"self.flags.ignore... | [
"def insert(self, ignore_permissions=None, ignore_links=None,...\n",
"\"\"\"docstring\"\"\"\n",
"if self.flags.in_print:\n",
"return\n",
"self.flags.notifications_executed = []\n",
"if ignore_permissions != None:\n",
"self.flags.ignore_permissions = ignore_permissions\n",
"if ignore_links != None:\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr... |
[
"def FUNC_50():...\n",
"return 'works'\n"
] | [
"def my_callable():...\n",
"return 'works'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_52(VAR_2, VAR_39, VAR_40, VAR_8=None, **VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_164 = VAR_8.getQueryService()\n",
"VAR_39 = VAR_39.split('.')\n",
"VAR_66 = omero.sys.ParametersI()\n",
"VAR_66.addId(VAR_40)\n",
"VAR_66.addString('ns', NSBULKANNOTATIONS)\n",
"VAR_66.addString('mt', 'OME... | [
"def _bulk_file_annotations(request, objtype, objid, conn=None, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"q = conn.getQueryService()\n",
"objtype = objtype.split('.')\n",
"params = omero.sys.ParametersI()\n",
"params.addId(objid)\n",
"params.addString('ns', NSBULKANNOTATIONS)\n",
"params.addString... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"For",
"AugAssign'",
"AugAssign'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assi... |
[
"def FUNC_35(VAR_62):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def is_table(doctype):...\n",
"\"\"\"docstring\"\"\"\n",
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, VAR_5):...\n",
"VAR_5.process_response()\n",
"VAR_29 = VAR_5.get_errors()\n",
"if not VAR_29:\n",
"if VAR_5.is_authenticated():\n",
"current_app.logger.error('Error processing %s' % ', '.join(VAR_29))\n",
"return True\n",
"return False\n",
"return False\n"
] | [
"def _consumer(self, auth):...\n",
"auth.process_response()\n",
"errors = auth.get_errors()\n",
"if not errors:\n",
"if auth.is_authenticated():\n",
"current_app.logger.error('Error processing %s' % ', '.join(errors))\n",
"return True\n",
"return False\n",
"return False\n"
] | [
0,
0,
0,
0,
4,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/shelf/edit/<int:shelf_id>', methods=['GET', 'POST'])...\n",
"VAR_0 = ub.session.query(ub.Shelf).filter(ub.Shelf.id == VAR_3).first()\n",
"if not FUNC_0(VAR_0):\n",
"flash(_(u'Sorry you are not allowed to edit this shelf'), category='error')\n",
"return FUNC_7(VAR_0, VAR_5=_(u'Edit a shelf'),... | [
"@shelf.route('/shelf/edit/<int:shelf_id>', methods=['GET', 'POST'])...\n",
"shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()\n",
"if not check_shelf_edit_permissions(shelf):\n",
"flash(_(u'Sorry you are not allowed to edit this shelf'), category='error')\n",
"return create_edit_sh... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_34(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'"
] |
[
"def FUNC_11(self):...\n",
"VAR_24 = 'inputs=[{\"text\":[\"foo\"], \"bytes\":[b\"bar\"]}]'\n",
"VAR_22 = saved_model_cli.preprocess_input_examples_arg_string(VAR_24)\n",
"VAR_25 = example_pb2.Example.FromString(VAR_22['inputs'][0])\n",
"self.assertProtoEquals('string', VAR_25)\n"
] | [
"def testInputPreProcessExamplesWithStrAndBytes(self):...\n",
"input_examples_str = 'inputs=[{\"text\":[\"foo\"], \"bytes\":[b\"bar\"]}]'\n",
"input_dict = saved_model_cli.preprocess_input_examples_arg_string(\n input_examples_str)\n",
"feature = example_pb2.Example.FromString(input_dict['inputs'][0])\n",
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_2.route('/ajax/loaddialogtexts/<element_id>', methods=['POST'])...\n",
"VAR_63 = {'header': '', 'main': '', 'valid': 1}\n",
"if VAR_6 == 'config_delete_kobo_token':\n",
"VAR_63['main'] = _('Do you really want to delete the Kobo Token?')\n",
"if VAR_6 == 'btndeletedomain':\n",
"return json.dumps(VAR_... | [
"@admi.route('/ajax/loaddialogtexts/<element_id>', methods=['POST'])...\n",
"texts = {'header': '', 'main': '', 'valid': 1}\n",
"if element_id == 'config_delete_kobo_token':\n",
"texts['main'] = _('Do you really want to delete the Kobo Token?')\n",
"if element_id == 'btndeletedomain':\n",
"return json.dum... | [
0,
0,
0,
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",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'... |
[
"def FUNC_81(VAR_19):...\n",
"if self.parentfield:\n",
"return '{} {} #{}: {} {}'.format(frappe.bold(_(self.doctype)), _('Row'),\n self.idx, _('Value cannot be negative for'), frappe.bold(_(VAR_19.label)))\n",
"return _('Value cannot be negative for {0}: {1}').format(_(VAR_19.parent),\n frappe.bold(_(VA... | [
"def get_msg(df):...\n",
"if self.parentfield:\n",
"return '{} {} #{}: {} {}'.format(frappe.bold(_(self.doctype)), _('Row'),\n self.idx, _('Value cannot be negative for'), frappe.bold(_(df.label)))\n",
"return _('Value cannot be negative for {0}: {1}').format(_(df.parent),\n frappe.bold(_(df.label)))\n"... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_12(self, VAR_0, VAR_8):...\n",
"VAR_0.get(VAR_8 + self.url)\n",
"VAR_19 = VAR_0.find_element(By.XPATH, '//body[@JSError]')\n",
"pytest.fail(VAR_19.get_attribute('JSError'))\n"
] | [
"def test_no_js_error(self, driver, live_server):...\n",
"driver.get(live_server + self.url)\n",
"error = driver.find_element(By.XPATH, '//body[@JSError]')\n",
"pytest.fail(error.get_attribute('JSError'))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_5, VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"super(CLASS_0, self).on_logged_in(VAR_5, VAR_6)\n",
"self.prepare_session(VAR_5)\n",
"if self.setGroupContext:\n",
"if VAR_5.session.get('active_group'):\n",
"VAR_6.SERVICE_OPTS.setOmeroGroup(VAR_5.session.get('active_group'))\n",
"VA... | [
"def on_logged_in(self, request, conn):...\n",
"\"\"\"docstring\"\"\"\n",
"super(login_required, self).on_logged_in(request, conn)\n",
"self.prepare_session(request)\n",
"if self.setGroupContext:\n",
"if request.session.get('active_group'):\n",
"conn.SERVICE_OPTS.setOmeroGroup(request.session.get('activ... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_46(self, VAR_14, VAR_65, VAR_66=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<h%d>%s</h%d>\\n' % (VAR_65, VAR_14, VAR_65)\n"
] | [
"def header(self, text, level, raw=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return '<h%d>%s</h%d>\\n' % (level, text, level)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"self.assertFormfield(models.Member, 'name', widgets.AdminTextInputWidget)\n"
] | [
"def testCharField(self):...\n",
"self.assertFormfield(models.Member, 'name', widgets.AdminTextInputWidget)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_27(self, VAR_24):...\n",
"self._reader.feed(VAR_24)\n",
"while True:\n",
"VAR_21 = self._reader.gets()\n",
"if VAR_21 is False:\n",
"return\n",
"if not isinstance(VAR_21, list):\n",
"self.handle_command(VAR_21[0], *VAR_21[1:])\n"
] | [
"def dataReceived(self, data):...\n",
"self._reader.feed(data)\n",
"while True:\n",
"msg = self._reader.gets()\n",
"if msg is False:\n",
"return\n",
"if not isinstance(msg, list):\n",
"self.handle_command(msg[0], *msg[1:])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_2():...\n",
"return FUNC_1('README.rst')\n"
] | [
"def desc():...\n",
"return read('README.rst')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(VAR_5, VAR_3, VAR_8, VAR_6, VAR_4):...\n",
"if not isinstance(VAR_5, list):\n",
"VAR_5 = [x for x in VAR_5 if x != '']\n",
"VAR_7 = FUNC_2(VAR_3, VAR_4, VAR_5)\n",
"VAR_9 = FUNC_3(VAR_3, VAR_4, VAR_5)\n",
"VAR_50 = FUNC_4(VAR_3, VAR_6, VAR_7)\n",
"if len(VAR_9) > 0:\n",
"VAR_50 |= FUNC_5(V... | [
"def modify_database_object(input_elements, db_book_object, db_object,...\n",
"if not isinstance(input_elements, list):\n",
"input_elements = [x for x in input_elements if x != '']\n",
"del_elements = search_objects_remove(db_book_object, db_type, input_elements)\n",
"add_elements = search_objects_add(db_bo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"@app.route('/folders/create', methods=['POST'])...\n",
"VAR_9 = forms.NewFolderForm()\n",
"if VAR_9.validate_on_submit():\n",
"VAR_7 = Path(VAR_9.parent_dir.data.strip('/')) / VAR_9.new_dir.data\n",
"flash('Could not create folder.', 'error')\n",
"VAR_33 = data.create_dir(str(VAR_7))\n",
"return redire... | [
"@app.route('/folders/create', methods=['POST'])...\n",
"form = forms.NewFolderForm()\n",
"if form.validate_on_submit():\n",
"path = Path(form.parent_dir.data.strip('/')) / form.new_dir.data\n",
"flash('Could not create folder.', 'error')\n",
"new_path = data.create_dir(str(path))\n",
"return redirect(r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/admin/ajaxdbconfig', methods=['POST'])...\n",
"return FUNC_48()\n"
] | [
"@admi.route('/admin/ajaxdbconfig', methods=['POST'])...\n",
"return _db_configuration_update_helper()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"VAR_5 = {'not_senders': ['@flibble:wibble']}\n",
"VAR_6 = FUNC_0(sender='@challenger:appears', type='com.nom.nom.nom',\n room_id='!foo:bar')\n",
"self.assertTrue(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_not_senders_works_with_unknowns(self):...\n",
"definition = {'not_senders': ['@flibble:wibble']}\n",
"event = MockEvent(sender='@challenger:appears', type='com.nom.nom.nom',\n room_id='!foo:bar')\n",
"self.assertTrue(Filter(definition).check(event))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"__version__ = '2.6.0b0'\n",
"if __name__ == '__main__':\n",
"print(__version__)\n"
] | [
"__version__ = '2.6.0b0'\n",
"if __name__ == '__main__':\n",
"print(__version__)\n"
] | [
2,
0,
0
] | [
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"VAR_6 = Mock()\n",
"VAR_3 = '@foo:bar'\n",
"VAR_7 = 5000000\n",
"VAR_8 = UserPresenceState.default(VAR_3)\n",
"VAR_8 = VAR_8.copy_and_replace(VAR_10=PresenceState.ONLINE, last_active_ts=\n now, currently_active=True)\n",
"VAR_9 = VAR_8.copy_and_replace(VAR_10=PresenceState.... | [
"def test_online_to_idle(self):...\n",
"wheel_timer = Mock()\n",
"user_id = '@foo:bar'\n",
"now = 5000000\n",
"prev_state = UserPresenceState.default(user_id)\n",
"prev_state = prev_state.copy_and_replace(state=PresenceState.ONLINE,\n last_active_ts=now, currently_active=True)\n",
"new_state = prev_s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_80(self):...\n",
"VAR_67 = self.renderer.placeholder()\n",
"while self.pop()['type'] != 'list_item_end':\n",
"VAR_67 += self.tok()\n",
"return self.renderer.list_item(VAR_67)\n"
] | [
"def output_loose_item(self):...\n",
"body = self.renderer.placeholder()\n",
"while self.pop()['type'] != 'list_item_end':\n",
"body += self.tok()\n",
"return self.renderer.list_item(body)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"AugAssign'",
"Return'"
] |
[
"@internationalizeDocstring...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27 = len(str(VAR_8).split('.')[1])\n",
"VAR_27 = 0\n",
"VAR_34 = convertcore.convert(VAR_8, VAR_22, VAR_23)\n",
"VAR_3.error(str(ude))\n",
"if isinstance(VAR_34, float):\n",
"VAR_38 = 0\n",
"VAR_34 = self._floatToString(VAR_34)\n",
... | [
"@internationalizeDocstring...\n",
"\"\"\"docstring\"\"\"\n",
"digits = len(str(number).split('.')[1])\n",
"digits = 0\n",
"newNum = convertcore.convert(number, unit1, unit2)\n",
"irc.error(str(ude))\n",
"if isinstance(newNum, float):\n",
"zeros = 0\n",
"newNum = self._floatToString(newNum)\n",
"f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'",
"Condition",
"Assign'",
"AugAssign'"
] |
[
"@override_settings(LOGIN_URL='http://remote.example.com/login')...\n",
"VAR_25 = urlquote('http://testserver/login_required/')\n",
"VAR_6 = 'http://remote.example.com/login?next=%s' % VAR_25\n",
"self.assertLoginURLEquals(VAR_6)\n"
] | [
"@override_settings(LOGIN_URL='http://remote.example.com/login')...\n",
"quoted_next = urlquote('http://testserver/login_required/')\n",
"expected = 'http://remote.example.com/login?next=%s' % quoted_next\n",
"self.assertLoginURLEquals(expected)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(VAR_4):...\n",
"VAR_21 = [m.upper() for m in VAR_13]\n",
"for r, m, v in itertools.product(VAR_12, VAR_21, [VAR_4.__name__]):\n",
"self.before_acl.append((r, m, v, VAR_3))\n",
"return VAR_4\n"
] | [
"def decorator(view_func):...\n",
"_methods = [m.upper() for m in methods]\n",
"for r, m, v in itertools.product(roles, _methods, [view_func.__name__]):\n",
"self.before_acl.append((r, m, v, with_children))\n",
"return view_func\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"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'"
] |
[
"def FUNC_31(self, VAR_27):...\n",
"self._server.remove_subscriber(self)\n"
] | [
"def connectionLost(self, reason):...\n",
"self._server.remove_subscriber(self)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_14(self, VAR_30, VAR_20):...\n",
"if VAR_30 is self.getDefault() or VAR_30 is None:\n",
"return VAR_30\n",
"if isinstance(VAR_30, str):\n",
"return VAR_30\n",
"if isinstance(VAR_30, bytes):\n",
"VAR_49 = queryUtility(IUnicodeEncodingConflictResolver)\n",
"return str(VAR_30)\n",
"if VAR_49 ... | [
"def _handleText(self, text, expr):...\n",
"if text is self.getDefault() or text is None:\n",
"return text\n",
"if isinstance(text, str):\n",
"return text\n",
"if isinstance(text, bytes):\n",
"resolver = queryUtility(IUnicodeEncodingConflictResolver)\n",
"return str(text)\n",
"if resolver is None:\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'",
"Expr'"
] |
[
"def FUNC_19(VAR_15, VAR_46=os.F_OK | os.X_OK, VAR_14=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_20(VAR_56, VAR_46):...\n",
"return os.path.exists(VAR_56) and os.access(VAR_56, VAR_46\n ) and not os.path.isdir(VAR_56)\n"
] | [
"def which(cmd, mode=os.F_OK | os.X_OK, path=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def _access_check(fn, mode):...\n",
"return os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_4 in self._exempt\n"
] | [
"def is_exempt(self, view_func):...\n",
"\"\"\"docstring\"\"\"\n",
"return view_func in self._exempt\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_20(self, VAR_19):...\n",
"if os.path.exists(VAR_19):\n",
"return f.read()\n"
] | [
"def albumartcache_load(self, imgb64path):...\n",
"if os.path.exists(imgb64path):\n",
"return f.read()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.