lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_26(VAR_0, VAR_1):...\n",
"create_dir('random')\n",
"VAR_8 = VAR_1.post('/folders/rename', data={'current_path': 'random',\n 'new_name': 'renamed_random'}, follow_redirects=True)\n",
"assert VAR_8.status_code == 200\n",
"assert b'Renamed successfully' in VAR_8.data\n"
] | [
"def test_rename_dir(test_app, client):...\n",
"create_dir('random')\n",
"resp = client.post('/folders/rename', data={'current_path': 'random',\n 'new_name': 'renamed_random'}, follow_redirects=True)\n",
"assert resp.status_code == 200\n",
"assert b'Renamed successfully' in resp.data\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_59(VAR_120, *VAR_119):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_61(VAR_120, *VAR_119)\n"
] | [
"def get_app_path(app_name, *joins):...\n",
"\"\"\"docstring\"\"\"\n",
"return get_pymodule_path(app_name, *joins)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_17(self, VAR_40):...\n",
"VAR_51 = VAR_40[-5:]\n",
"FUNC_7([VAR_1('node_modules', '.bin', 'po2json'), '-p', '-F', '-f',\n 'jed1.x', '-d', 'nbjs', VAR_1('notebook', 'i18n', VAR_51, 'LC_MESSAGES',\n 'nbjs.po'), VAR_1('notebook', 'i18n', VAR_51, 'LC_MESSAGES', 'nbjs.json')])\n"
] | [
"def build_jstranslation(self, trd):...\n",
"lang = trd[-5:]\n",
"run([pjoin('node_modules', '.bin', 'po2json'), '-p', '-F', '-f', 'jed1.x',\n '-d', 'nbjs', pjoin('notebook', 'i18n', lang, 'LC_MESSAGES', 'nbjs.po'),\n pjoin('notebook', 'i18n', lang, 'LC_MESSAGES', 'nbjs.json')])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(VAR_16):...\n",
"for VAR_11 in VAR_16:\n",
"if isinstance(VAR_11, collections.Iterable) and not isinstance(VAR_11, str\n",
"yield from FUNC_9(VAR_11)\n",
"yield VAR_11\n"
] | [
"def flatten(arr):...\n",
"for el in arr:\n",
"if isinstance(el, collections.Iterable) and not isinstance(el, str\n",
"yield from flatten(el)\n",
"yield el\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_19(VAR_9, VAR_10, VAR_11):...\n",
"if VAR_87.role_admin():\n",
"VAR_11 = int(VAR_11)\n",
"VAR_11 = VAR_87.id\n",
"if VAR_87.check_visibility(constants.SIDEBAR_DOWNLOAD):\n",
"if VAR_87.show_detail_random():\n",
"abort(404)\n",
"VAR_68 = calibre_db.session.query(db.Books).filter(calibre_db.co... | [
"def render_downloaded_books(page, order, user_id):...\n",
"if current_user.role_admin():\n",
"user_id = int(user_id)\n",
"user_id = current_user.id\n",
"if current_user.check_visibility(constants.SIDEBAR_DOWNLOAD):\n",
"if current_user.show_detail_random():\n",
"abort(404)\n",
"random = calibre_db.se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_35(VAR_40, VAR_37):...\n",
"VAR_38 = VAR_37.title\n",
"VAR_39 = VAR_37.author\n",
"VAR_66, VAR_63, VAR_70 = FUNC_34(VAR_38, VAR_39)\n",
"VAR_71 = helper.get_valid_filename(VAR_38)\n",
"VAR_72 = helper.get_valid_filename(VAR_70.name)\n",
"VAR_73 = os.path.join(VAR_72, VAR_71).replace('\\\\', '/... | [
"def create_book_on_upload(modif_date, meta):...\n",
"title = meta.title\n",
"authr = meta.author\n",
"sort_authors, input_authors, db_author = prepare_authors_on_upload(title, authr\n )\n",
"title_dir = helper.get_valid_filename(title)\n",
"author_dir = helper.get_valid_filename(db_author.name)\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
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"AugAssign'",
"Assign'",
"AugAssign'",
"Condition",
"For",
"AugAssign'",
"Expr'",
"AugAssign'",
"AugAssign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Ret... |
[
"def FUNC_1(self):...\n",
"self.normativeRefs = {}\n",
"self.informativeRefs = {}\n",
"self.refs = ReferenceManager(VAR_10=self.dataFile, VAR_11=self.testing)\n",
"self.externalRefsUsed = defaultdict(lambda : defaultdict(dict))\n",
"self.md = None\n",
"self.mdBaseline = metadata.MetadataManager()\n",
... | [
"def initializeState(self):...\n",
"self.normativeRefs = {}\n",
"self.informativeRefs = {}\n",
"self.refs = ReferenceManager(fileRequester=self.dataFile, testing=self.testing)\n",
"self.externalRefsUsed = defaultdict(lambda : defaultdict(dict))\n",
"self.md = None\n",
"self.mdBaseline = metadata.Metadat... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_21(self):...\n",
"VAR_5 = {'not_rooms': ['!secretbase:unknown'], 'rooms': ['!secretbase:unknown']\n }\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='m.room.message', room_id=\n '!secretbase:unknown')\n",
"self.assertFalse(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_not_rooms_takes_priority_over_rooms(self):...\n",
"definition = {'not_rooms': ['!secretbase:unknown'], 'rooms': [\n '!secretbase:unknown']}\n",
"event = MockEvent(sender='@foo:bar', type='m.room.message', room_id=\n '!secretbase:unknown')\n",
"self.assertFalse(Filter(definition).che... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(VAR_0):...\n",
"VAR_9 = GeneratorError()\n",
"VAR_10 = VAR_0.patch('openapi_python_client._get_project_for_url_or_path',\n return_value=error)\n",
"VAR_6 = VAR_0.MagicMock()\n",
"VAR_7 = VAR_0.MagicMock()\n",
"from openapi_python_client import update_existing_client\n",
"VAR_11 = update_e... | [
"def test_update_existing_client_project_error(mocker):...\n",
"error = GeneratorError()\n",
"_get_project_for_url_or_path = mocker.patch(\n 'openapi_python_client._get_project_for_url_or_path', return_value=error)\n",
"url = mocker.MagicMock()\n",
"path = mocker.MagicMock()\n",
"from openapi_python_cl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"def FUNC_108(VAR_169, VAR_7='utf-8'):...\n",
""
] | [
"def safe_decode(param, encoding='utf-8'):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_16(self, VAR_44):...\n",
"VAR_13 = FUNC_1(VAR_44.group(1))\n",
"self.def_links[VAR_13] = {'link': VAR_44.group(2), 'title': VAR_44.group(3)}\n"
] | [
"def parse_def_links(self, m):...\n",
"key = _keyify(m.group(1))\n",
"self.def_links[key] = {'link': m.group(2), 'title': m.group(3)}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(VAR_15, VAR_16=VAR_11, VAR_17=VAR_12, VAR_18=VAR_13, VAR_19=VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_15.tag in VAR_17:\n",
"return\n",
"VAR_62 = VAR_15.get('class')\n",
"if VAR_62:\n",
"VAR_62 = VAR_62.split()\n",
"for child in list(VAR_15):\n",
"for match_class in VAR_19:\n",
... | [
"def autolink(el, link_regexes=_link_regexes, avoid_elements=_avoid_elements,...\n",
"\"\"\"docstring\"\"\"\n",
"if el.tag in avoid_elements:\n",
"return\n",
"class_name = el.get('class')\n",
"if class_name:\n",
"class_name = class_name.split()\n",
"for child in list(el):\n",
"for match_class in avo... | [
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",
"Return'",
"Assign'",
"Condition",
"Assign'",
"For",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_15(self, VAR_13, VAR_14):...\n",
"VAR_62 = self.useroptions.forUser(self.getUserId())\n",
"VAR_62.setOption(VAR_13, VAR_14)\n",
"return 'success'\n"
] | [
"def api_setuseroption(self, optionkey, optionval):...\n",
"uo = self.useroptions.forUser(self.getUserId())\n",
"uo.setOption(optionkey, optionval)\n",
"return 'success'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"from __future__ import unicode_literals\n",
"import frappe, json\n",
"from frappe.utils import cstr, unique, cint\n",
"from frappe.permissions import has_permission\n",
"from frappe.handler import is_whitelisted\n",
"from frappe import _\n",
"from six import string_types\n",
"import re\n",
"import ... | [
"from __future__ import unicode_literals\n",
"import frappe, json\n",
"from frappe.utils import cstr, unique, cint\n",
"from frappe.permissions import has_permission\n",
"from frappe.handler import is_whitelisted\n",
"from frappe import _\n",
"from six import string_types\n",
"import re\n",
"import ... | [
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Expr'",
"Ex... |
[
"def FUNC_59(VAR_36):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_16 = getattr(VAR_36, 'display_name', None)\n",
"if VAR_16:\n",
"return u'{0} ({1})'.format(VAR_16, VAR_36.location.to_deprecated_string())\n",
"return VAR_36.location.to_deprecated_string()\n"
] | [
"def _display_unit(unit):...\n",
"\"\"\"docstring\"\"\"\n",
"name = getattr(unit, 'display_name', None)\n",
"if name:\n",
"return u'{0} ({1})'.format(name, unit.location.to_deprecated_string())\n",
"return unit.location.to_deprecated_string()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@classmethod...\n",
"if not VAR_21._temp_dir:\n",
"VAR_21._temp_dir = tempfile.mkdtemp(dir=click_web.OUTPUT_FOLDER)\n",
"VAR_0.info(f'Temp dir: {VAR_21._temp_dir}')\n",
"return VAR_21._temp_dir\n"
] | [
"@classmethod...\n",
"if not cls._temp_dir:\n",
"cls._temp_dir = tempfile.mkdtemp(dir=click_web.OUTPUT_FOLDER)\n",
"logger.info(f'Temp dir: {cls._temp_dir}')\n",
"return cls._temp_dir\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"\"\"\"A cleanup tool for HTML.\n\nRemoves unwanted tags and content. See the `Cleaner` class for\ndetails.\n\"\"\"\n",
"import re\n",
"import copy\n",
"from urlparse import urlsplit\n",
"from urllib.parse import urlsplit\n",
"from lxml import etree\n",
"from lxml.html import defs\n",
"from lxml.html... | [
"\"\"\"A cleanup tool for HTML.\n\nRemoves unwanted tags and content. See the `Cleaner` class for\ndetails.\n\"\"\"\n",
"import re\n",
"import copy\n",
"from urlparse import urlsplit\n",
"from urllib.parse import urlsplit\n",
"from lxml import etree\n",
"from lxml.html import defs\n",
"from lxml.html... | [
0,
0,
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'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
... |
[
"def FUNC_6():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = request.vars.send\n",
"if DEMO_MODE:\n",
"session.authorized = True\n",
"if not VAR_23:\n",
"session.last_time = t0\n",
"VAR_23 = URL('site')\n",
"if session.authorized:\n",
"redirect(VAR_23)\n",
"if failed_login_count() >= allowed_numbe... | [
"def index():...\n",
"\"\"\"docstring\"\"\"\n",
"send = request.vars.send\n",
"if DEMO_MODE:\n",
"session.authorized = True\n",
"if not send:\n",
"session.last_time = t0\n",
"send = URL('site')\n",
"if session.authorized:\n",
"redirect(send)\n",
"if failed_login_count() >= allowed_number_of_atte... | [
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,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
... |
[
"@parameterized.named_parameters(('VariablesToFeedNone', '', 'func2', None),...\n",
"if not test.is_built_with_xla():\n",
"self.skipTest('Skipping test because XLA is not compiled in.')\n",
"VAR_13 = os.path.join(test.get_temp_dir(), 'dummy_model')\n",
"VAR_14 = self.AOTCompileDummyModel()\n",
"VAR_6 = ge... | [
"@parameterized.named_parameters(('VariablesToFeedNone', '', 'func2', None),...\n",
"if not test.is_built_with_xla():\n",
"self.skipTest('Skipping test because XLA is not compiled in.')\n",
"saved_model_dir = os.path.join(test.get_temp_dir(), 'dummy_model')\n",
"dummy_model = self.AOTCompileDummyModel()\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
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"C... |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not getattr(self, '_metaclass', False) and self.meta.issingle:\n",
"VAR_80 = frappe.db.get_singles_dict(self.doctype)\n",
"VAR_21 = frappe.db.get_value(self.doctype, self.name, '*', as_dict=1,\n for_update=self.flags.for_update)\n",
"if not VAR_8... | [
"def load_from_db(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not getattr(self, '_metaclass', False) and self.meta.issingle:\n",
"single_doc = frappe.db.get_singles_dict(self.doctype)\n",
"d = frappe.db.get_value(self.doctype, self.name, '*', as_dict=1, for_update\n =self.flags.for_update)\n",
"if not... | [
0,
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",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"ImportFrom'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
... |
[
"def FUNC_5(self):...\n",
"VAR_19 = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8')\n",
"VAR_20 = bs4.BeautifulSoup(VAR_19, 'html.parser')\n",
"print(VAR_20.prettify())\n",
"VAR_21 = VAR_20.div\n",
"assert VAR_21['id'] == 'dirbrowserContainer'\n",
"VAR_22 = VAR_21('div', id='dirbrowserTitle')[0]... | [
"def test_basic(self):...\n",
"html = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8')\n",
"soup = bs4.BeautifulSoup(html, 'html.parser')\n",
"print(soup.prettify())\n",
"container = soup.div\n",
"assert container['id'] == 'dirbrowserContainer'\n",
"title_elem = container('div', id='dirbrowserTit... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_79(VAR_325):...\n",
"VAR_30, VAR_29 = VAR_325\n",
"return int((VAR_30 - VAR_84 + VAR_88) * VAR_95), int((VAR_29 - VAR_85 +\n VAR_90) * VAR_95)\n"
] | [
"def resizeXY(xy):...\n",
"x, y = xy\n",
"return int((x - newX + left_xs) * factor), int((y - newY + top_xs) * factor)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(VAR_0):...\n",
"VAR_9 = GeneratorError()\n",
"VAR_10 = VAR_0.patch('openapi_python_client._get_project_for_url_or_path',\n return_value=error)\n",
"VAR_6 = VAR_0.MagicMock()\n",
"VAR_7 = VAR_0.MagicMock()\n",
"from openapi_python_client import create_new_client\n",
"VAR_11 = create_new_cl... | [
"def test_create_new_client_project_error(mocker):...\n",
"error = GeneratorError()\n",
"_get_project_for_url_or_path = mocker.patch(\n 'openapi_python_client._get_project_for_url_or_path', return_value=error)\n",
"url = mocker.MagicMock()\n",
"path = mocker.MagicMock()\n",
"from openapi_python_client ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"def FUNC_44(self):...\n",
"return json.dumps(audiotranscode.getEncoders())\n"
] | [
"def api_getencoders(self):...\n",
"return json.dumps(audiotranscode.getEncoders())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"assert method_name_to_url('fooBar') == '/foo-bar'\n",
"assert method_name_to_url('foo_bar') == '/foo-bar'\n",
"assert method_name_to_url('fooBar_baz') == '/foo-bar-baz'\n",
"assert method_name_to_url('_FooBar_baz-booFoo_') == '/foo-bar-baz-boo-foo'\n"
] | [
"def test_it_works(self):...\n",
"assert method_name_to_url('fooBar') == '/foo-bar'\n",
"assert method_name_to_url('foo_bar') == '/foo-bar'\n",
"assert method_name_to_url('fooBar_baz') == '/foo-bar-baz'\n",
"assert method_name_to_url('_FooBar_baz-booFoo_') == '/foo-bar-baz-boo-foo'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_26():...\n",
"VAR_52 = request.vars.keywords or ''\n",
"VAR_3 = FUNC_5()\n",
"def FUNC_59(VAR_5, VAR_52):...\n",
"VAR_5 = os.path.join(apath(VAR_3, VAR_122=request), VAR_5)\n",
"if VAR_52 in read_file(VAR_5, 'r'):\n",
"return True\n",
"return False\n"
] | [
"def search():...\n",
"keywords = request.vars.keywords or ''\n",
"app = get_app()\n",
"def match(filename, keywords):...\n",
"filename = os.path.join(apath(app, r=request), filename)\n",
"if keywords in read_file(filename, 'r'):\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_1.url_value_preprocessor...\n",
"g.auth_token = VAR_7.pop('auth_token')\n"
] | [
"@kobo.url_value_preprocessor...\n",
"g.auth_token = values.pop('auth_token')\n"
] | [
0,
0
] | [
"Condition",
"Assign'"
] |
[
"@FUNC_0...\n",
"return Distributor()\n"
] | [
"@cache_in_self...\n",
"return Distributor()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@abc.abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"@abc.abstractmethod...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"Condition",
"Docstring"
] |
[
"def FUNC_36(self):...\n",
"return helpdesk_settings.HELPDESK_KBITEM_TEAM_GETTER(self)\n"
] | [
"def get_team(self):...\n",
"return helpdesk_settings.HELPDESK_KBITEM_TEAM_GETTER(self)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@FUNC_0...\n",
"return E2eRoomKeysHandler(self)\n"
] | [
"@cache_in_self...\n",
"return E2eRoomKeysHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@log_function...\n",
"VAR_101 = await self.auth.check_host_in_room(VAR_11, VAR_5)\n",
"if not VAR_101:\n",
"VAR_17 = min(VAR_17, 100)\n",
"VAR_20 = await self.store.get_backfill_events(VAR_11, VAR_31, VAR_17)\n",
"VAR_20 = await filter_events_for_server(self.storage, VAR_5, VAR_20)\n",
"return VAR_20\n... | [
"@log_function...\n",
"in_room = await self.auth.check_host_in_room(room_id, origin)\n",
"if not in_room:\n",
"limit = min(limit, 100)\n",
"events = await self.store.get_backfill_events(room_id, pdu_list, limit)\n",
"events = await filter_events_for_server(self.storage, origin, events)\n",
"return event... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_36(self, VAR_44):...\n",
"VAR_14 = VAR_44.group(2) or VAR_44.group(1)\n",
"VAR_14 = self.output(VAR_14)\n",
"return self.renderer.double_emphasis(VAR_14)\n"
] | [
"def output_double_emphasis(self, m):...\n",
"text = m.group(2) or m.group(1)\n",
"text = self.output(text)\n",
"return self.renderer.double_emphasis(text)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_8.route('/file/<path:path>', methods=['GET'])...\n",
"VAR_17 = secure_filename(VAR_17)\n",
"if VAR_8.interface.encrypt and isinstance(VAR_8.interface.examples, str\n",
"VAR_95 = encrypted_file.read()\n",
"return send_file(os.path.join(VAR_8.cwd, VAR_17))\n",
"VAR_87 = encryptor.decrypt(VAR_8.interfa... | [
"@app.route('/file/<path:path>', methods=['GET'])...\n",
"path = secure_filename(path)\n",
"if app.interface.encrypt and isinstance(app.interface.examples, str\n",
"encrypted_data = encrypted_file.read()\n",
"return send_file(os.path.join(app.cwd, path))\n",
"file_data = encryptor.decrypt(app.interface.en... | [
0,
1,
0,
0,
1,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_1, VAR_2=None):...\n",
"\"\"\"docstring\"\"\"\n",
"self.request = VAR_1\n",
"self.ajax = self.request.is_ajax()\n",
"self.basket = VAR_2 or VAR_1.basket\n"
] | [
"def __init__(self, request, basket=None):...\n",
"\"\"\"docstring\"\"\"\n",
"self.request = request\n",
"self.ajax = self.request.is_ajax()\n",
"self.basket = basket or request.basket\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_63(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.s\n"
] | [
"def xml(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.s\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_32(self):...\n",
"provideUtility(PreferredCharsetResolver)\n",
"VAR_11 = PageTemplate()\n",
"self.assert_expected(VAR_11, 'UnicodeResolution.html')\n"
] | [
"def test_unicode_conflict_resolution(self):...\n",
"provideUtility(PreferredCharsetResolver)\n",
"t = PageTemplate()\n",
"self.assert_expected(t, 'UnicodeResolution.html')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"from datetime import timedelta\n",
"from django.urls import reverse\n",
"from django.utils import timezone\n",
"from weblate.trans.tests.test_views import ViewTestCase\n",
"from weblate.trans.views.reports import generate_counts, generate_credits\n",
"VAR_0 = [{'count': 1, 'count_edit': 0, 'count_new': 1... | [
"from datetime import timedelta\n",
"from django.urls import reverse\n",
"from django.utils import timezone\n",
"from weblate.trans.tests.test_views import ViewTestCase\n",
"from weblate.trans.views.reports import generate_counts, generate_credits\n",
"COUNTS_DATA = [{'count': 1, 'count_edit': 0, 'count_n... | [
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"... |
[
"from builtins import next\n",
"from builtins import range\n",
"import os\n",
"import datetime\n",
"from xml.sax.saxutils import quoteattr\n",
"import sys\n",
"import logging\n",
"import random\n",
"import glob\n",
"from itertools import cycle\n",
"from flask import Blueprint, url_for, Response,... | [
"from builtins import next\n",
"from builtins import range\n",
"import os\n",
"import datetime\n",
"from xml.sax.saxutils import quoteattr\n",
"import sys\n",
"import logging\n",
"import random\n",
"import glob\n",
"from itertools import cycle\n",
"from flask import Blueprint, url_for, Response,... | [
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
... |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self.path is None:\n",
"return None\n",
"return os.path.abspath(self.path)\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self.path is None:\n",
"return None\n",
"return os.path.abspath(self.path)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_15(self, VAR_3):...\n",
"VAR_4 = {}\n",
"VAR_4['label'] = VAR_3.label\n",
"VAR_4['help_text'] = VAR_3.help_text\n",
"VAR_4['required'] = VAR_3.required\n",
"VAR_4['initial'] = VAR_3.default_value\n",
"return VAR_4\n"
] | [
"def get_field_options(self, field):...\n",
"options = {}\n",
"options['label'] = field.label\n",
"options['help_text'] = field.help_text\n",
"options['required'] = field.required\n",
"options['initial'] = field.default_value\n",
"return options\n"
] | [
0,
0,
0,
2,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.debug('get_room_state_ids dest=%s, room=%s', VAR_5, VAR_6)\n",
"VAR_2 = FUNC_1('/state_ids/%s', VAR_6)\n",
"return self.client.get_json(VAR_5, VAR_2=path, VAR_3={'event_id': event_id},\n try_trailing_slash_on_400=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"logger.debug('get_room_state_ids dest=%s, room=%s', destination, room_id)\n",
"path = _create_v1_path('/state_ids/%s', room_id)\n",
"return self.client.get_json(destination, path=path, args={'event_id':\n event_id}, try_trailing_slash_on_400=True)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = VAR_2.split('/', 2)\n",
"if len(VAR_5) != 3:\n",
"VAR_31 = 'Spec is not of the form \"user/repo/ref\", provided: \"{spec}\".'.format(\n VAR_2=spec)\n",
"return VAR_5\n",
"if len(VAR_5) == 2 and VAR_5[-1] != 'master':\n",
"VAR_31 += ' Di... | [
"def tokenize_spec(spec):...\n",
"\"\"\"docstring\"\"\"\n",
"spec_parts = spec.split('/', 2)\n",
"if len(spec_parts) != 3:\n",
"msg = 'Spec is not of the form \"user/repo/ref\", provided: \"{spec}\".'.format(\n spec=spec)\n",
"return spec_parts\n",
"if len(spec_parts) == 2 and spec_parts[-1] != 'mast... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"AugAssign'"
] |
[
"def FUNC_21(VAR_23, VAR_24, VAR_25):...\n",
"if VAR_23 != 'SECRET_KEY':\n",
"if type(VAR_24) is dict:\n",
"for k, v in VAR_24.items():\n",
"VAR_25[VAR_23] = VAR_24\n",
"FUNC_21(k, v, VAR_25[VAR_23])\n"
] | [
"def update_config_value(key, val, dictionary):...\n",
"if key != 'SECRET_KEY':\n",
"if type(val) is dict:\n",
"for k, v in val.items():\n",
"dictionary[key] = val\n",
"update_config_value(k, v, dictionary[key])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"For",
"Assign'",
"Expr'"
] |
[
"def FUNC_22(VAR_45):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.session.user = VAR_45\n",
"VAR_1.session.sid = VAR_45\n",
"VAR_1.cache = {}\n",
"VAR_1.form_dict = CLASS_0()\n",
"VAR_1.jenv = None\n",
"VAR_1.session.data = CLASS_0()\n",
"VAR_1.role_permissions = {}\n",
"VAR_1.new_doc_templates = {}\... | [
"def set_user(username):...\n",
"\"\"\"docstring\"\"\"\n",
"local.session.user = username\n",
"local.session.sid = username\n",
"local.cache = {}\n",
"local.form_dict = _dict()\n",
"local.jenv = None\n",
"local.session.data = _dict()\n",
"local.role_permissions = {}\n",
"local.new_doc_templates = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_11(VAR_0, VAR_1: FlaskClient):...\n",
"VAR_12 = {'title': 'Testing the create route', 'tags': 'testing,note',\n 'path': '', 'submit': 'true'}\n",
"VAR_8 = VAR_1.post('/notes/new', data=note_data)\n",
"assert VAR_8.status_code == 302\n",
"assert not b'invalid' in VAR_8.data\n",
"VAR_8 = VAR_1.... | [
"def test_create_note(test_app, client: FlaskClient):...\n",
"note_data = {'title': 'Testing the create route', 'tags': 'testing,note',\n 'path': '', 'submit': 'true'}\n",
"resp = client.post('/notes/new', data=note_data)\n",
"assert resp.status_code == 302\n",
"assert not b'invalid' in resp.data\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_101(VAR_6):...\n",
"return '<b>{0}</b>'.format(VAR_6)\n"
] | [
"def bold(text):...\n",
"return '<b>{0}</b>'.format(text)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, **VAR_28):...\n",
"VAR_28['appbuilder'] = current_app.appbuilder\n",
"super().__init__(**kwargs)\n"
] | [
"def __init__(self, **kwargs):...\n",
"kwargs['appbuilder'] = current_app.appbuilder\n",
"super().__init__(**kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@staticmethod...\n",
"VAR_148 = VAR_72.split('-')\n",
"VAR_48 = '-'.join(VAR_148[0:-1])\n",
"return VAR_48, VAR_148[-1]\n"
] | [
"@staticmethod...\n",
"parts = query.split('-')\n",
"queue = '-'.join(parts[0:-1])\n",
"return queue, parts[-1]\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"import abc\n",
"import functools\n",
"import logging\n",
"import os\n",
"from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, TypeVar, cast\n",
"import twisted.internet.base\n",
"import twisted.internet.tcp\n",
"from twisted.mail.smtp import sendmail\n",
"from twisted.web.iweb imp... | [
"import abc\n",
"import functools\n",
"import logging\n",
"import os\n",
"from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, TypeVar, cast\n",
"import twisted.internet.base\n",
"import twisted.internet.tcp\n",
"from twisted.mail.smtp import sendmail\n",
"from twisted.web.iweb imp... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
... |
[
"def FUNC_4(VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if ':' not in VAR_9:\n",
"return False\n",
"VAR_42 = VAR_9.split(':', 1)[0].lower()\n",
"return VAR_42 in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes\n"
] | [
"def is_url(name):...\n",
"\"\"\"docstring\"\"\"\n",
"if ':' not in name:\n",
"return False\n",
"scheme = name.split(':', 1)[0].lower()\n",
"return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53 = reverse('rest_framework:logout')\n",
"VAR_41 = format_html('<li class=\"navbar-text\">{user}</li>', VAR_14=escape(user)\n )\n",
"VAR_41 = 'string'\n",
"return mark_safe(VAR_41)\n",
"VAR_41 = format_html(VAR_41, VAR_14=escape(user), href=l... | [
"@register.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"logout_url = reverse('rest_framework:logout')\n",
"snippet = format_html('<li class=\"navbar-text\">{user}</li>', user=escape(user))\n",
"snippet = \"\"\"<li class=\"dropdown\">\n <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_9(self, VAR_15: str) ->tuple[str, str]:...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_15 not in self.ledger.options['include']:\n",
"VAR_28 = file.read()\n",
"VAR_10 = sha256(VAR_28).hexdigest()\n",
"VAR_16 = decode(VAR_28)\n",
"return VAR_16, VAR_10\n"
] | [
"def get_source(self, path: str) ->tuple[str, str]:...\n",
"\"\"\"docstring\"\"\"\n",
"if path not in self.ledger.options['include']:\n",
"contents = file.read()\n",
"sha256sum = sha256(contents).hexdigest()\n",
"source = decode(contents)\n",
"return source, sha256sum\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_29(self, VAR_44):...\n",
"VAR_49 = VAR_44.group(1)\n",
"if self._in_link:\n",
"return self.renderer.text(VAR_49)\n",
"return self.renderer.autolink(VAR_49, False)\n"
] | [
"def output_url(self, m):...\n",
"link = m.group(1)\n",
"if self._in_link:\n",
"return self.renderer.text(link)\n",
"return self.renderer.autolink(link, False)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def __eq__(self, VAR_8) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return isinstance(VAR_8, CLASS_1\n ) and self.name == VAR_8.name and self.path == VAR_8.path and self.url == VAR_8.url\n"
] | [
"def __eq__(self, other) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return isinstance(other, CustomComponent\n ) and self.name == other.name and self.path == other.path and self.url == other.url\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_16 = 'some_media_id'\n",
"VAR_17 = 'Test\\n'\n",
"VAR_18 = self.filepaths.local_media_filepath_rel(VAR_16)\n",
"VAR_19 = os.path.join(self.secondary_base_path, VAR_18)\n",
"os.makedirs(os.path.dirname(VAR_19))\n",
"f.write(VAR_17)\n",
"VAR_20 = FileInfo(None, VAR_16)\n",... | [
"def test_ensure_media_is_in_local_cache(self):...\n",
"media_id = 'some_media_id'\n",
"test_body = 'Test\\n'\n",
"rel_path = self.filepaths.local_media_filepath_rel(media_id)\n",
"secondary_path = os.path.join(self.secondary_base_path, rel_path)\n",
"os.makedirs(os.path.dirname(secondary_path))\n",
"f.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_17(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = '#test2:test'\n",
"VAR_16 = self._add_alias(VAR_15)\n",
"self._set_canonical_alias({'alias': self.test_alias, 'alt_aliases': [self.\n test_alias, VAR_15]})\n",
"VAR_14 = self._get_canonical_alias()\n",
"self.assertEqual(VAR_14['content']... | [
"def test_remove_other_alias(self):...\n",
"\"\"\"docstring\"\"\"\n",
"other_test_alias = '#test2:test'\n",
"other_room_alias = self._add_alias(other_test_alias)\n",
"self._set_canonical_alias({'alias': self.test_alias, 'alt_aliases': [self.\n test_alias, other_test_alias]})\n",
"data = self._get_canon... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"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_6(self, VAR_0, VAR_1, VAR_11=None):...\n",
"def FUNC_12(VAR_4):...\n",
"if not self._check_permission([VAR_0], VAR_1, VAR_4):\n",
"if callable(VAR_11):\n",
"return VAR_4\n",
"VAR_11()\n",
"self._deny_hook()\n"
] | [
"def check_perm(self, role, method, callback=None):...\n",
"def decorator(view_func):...\n",
"if not self._check_permission([role], method, view_func):\n",
"if callable(callback):\n",
"return view_func\n",
"callback()\n",
"self._deny_hook()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(VAR_3, **VAR_4):...\n",
"return 200, {'result': True}\n"
] | [
"def _callback(request, **kwargs):...\n",
"return 200, {'result': True}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_66(VAR_6):...\n",
"if VAR_122 is not None:\n",
"return reverse(VAR_120, VAR_116=(iid, thumbsize))\n",
"return reverse(VAR_120, VAR_116=(iid,))\n"
] | [
"def get_thumb_url(iid):...\n",
"if thumbsize is not None:\n",
"return reverse(prefix, args=(iid, thumbsize))\n",
"return reverse(prefix, args=(iid,))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_24(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = 'string'\n",
"VAR_50 = VAR_21.add_parser('run', description=run_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_50.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to execute')\... | [
"def add_run_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"run_msg = \"\"\"Usage example:\nTo run input tensors from files through a MetaGraphDef and save the output tensors to files:\n$saved_model_cli show --dir /tmp/saved_model --tag_set serve \\\\\n --signature_def serving_default \\\\\n --in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_28():...\n",
"def FUNC_116(VAR_129):...\n",
"def FUNC_121(*VAR_79, **VAR_42):...\n",
"if VAR_13.read_from_replica:\n",
"FUNC_6()\n",
"VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n",
"if VAR_1 and hasattr(VAR_1, 'primary_db'):\n",
"return VAR_225\n",
"VAR_1.db.close()\n",
"VAR_1... | [
"def read_only():...\n",
"def innfn(fn):...\n",
"def wrapper_fn(*args, **kwargs):...\n",
"if conf.read_from_replica:\n",
"connect_replica()\n",
"retval = fn(*args, **get_newargs(fn, kwargs))\n",
"if local and hasattr(local, 'primary_db'):\n",
"return retval\n",
"local.db.close()\n",
"local.db = lo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'"
] |
[
"@VAR_1.route('/get_requests', methods=['POST'])...\n",
"VAR_4 = VAR_2.sentences_stats('get_requests')\n",
"return json.dumps({'status': 'OK', 'd': VAR_4})\n"
] | [
"@app.route('/get_requests', methods=['POST'])...\n",
"d = db.sentences_stats('get_requests')\n",
"return json.dumps({'status': 'OK', 'd': d})\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self, VAR_19=None):...\n",
"if self.end:\n",
"return True\n",
"return not self.same_part(VAR_19, self.item, self._next)\n"
] | [
"def last(self, name=None):...\n",
"if self.end:\n",
"return True\n",
"return not self.same_part(name, self.item, self._next)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(VAR_7, VAR_8='Argument', VAR_6=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_26 = ' ' * VAR_6\n",
"def FUNC_31(VAR_31):...\n",
"VAR_63 = \"'\" * isinstance(VAR_31, str)\n",
"return VAR_63 + str(VAR_31) + VAR_63\n"
] | [
"def _print_args(arguments, argument_type='Argument', indent=0):...\n",
"\"\"\"docstring\"\"\"\n",
"indent_str = ' ' * indent\n",
"def _maybe_add_quotes(value):...\n",
"is_quotes = \"'\" * isinstance(value, str)\n",
"return is_quotes + str(value) + is_quotes\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_82(VAR_67):...\n",
"if not VAR_67.name in self.flags.notifications_executed:\n",
"evaluate_alert(self, VAR_67.name, VAR_67.event)\n",
"self.flags.notifications_executed.append(VAR_67.name)\n"
] | [
"def _evaluate_alert(alert):...\n",
"if not alert.name in self.flags.notifications_executed:\n",
"evaluate_alert(self, alert.name, alert.event)\n",
"self.flags.notifications_executed.append(alert.name)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_169(VAR_212, VAR_215, VAR_101=VAR_101):...\n",
"for VAR_440 in (VAR_212.tags or []):\n",
"VAR_440 = VAR_440.strip().lower()\n",
"if VAR_440:\n",
"VAR_101.wiki_tag.insert(VAR_148=tag, wiki_page=id)\n"
] | [
"def update_tags_insert(page, id, db=db):...\n",
"for tag in (page.tags or []):\n",
"tag = tag.strip().lower()\n",
"if tag:\n",
"db.wiki_tag.insert(name=tag, wiki_page=id)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Condition",
"Expr'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_41, VAR_40 = FUNC_74(VAR_9, VAR_38)\n",
"return JsonResponse({'success': False, 'message': VAR_169.message}, status=400)\n",
"if VAR_9.method == 'POST':\n",
"if VAR_9.method == 'DELETE':\... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"certificate_exception, student = parse_request_data_and_get_user(request,\n course_key)\n",
"return JsonResponse({'success': False, 'message': error.message}, status=400)\n",
"if requ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_48(self, VAR_67, VAR_68=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_82 = 'ul'\n",
"if VAR_68:\n",
"VAR_82 = 'ol'\n",
"return '<%s>\\n%s</%s>\\n' % (VAR_82, VAR_67, VAR_82)\n"
] | [
"def list(self, body, ordered=True):...\n",
"\"\"\"docstring\"\"\"\n",
"tag = 'ul'\n",
"if ordered:\n",
"tag = 'ol'\n",
"return '<%s>\\n%s</%s>\\n' % (tag, body, tag)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@VAR_2.route('/show/<int:book_id>/<book_format>', defaults={'anyname': 'None'})...\n",
"VAR_6 = VAR_6.split('.')[0]\n",
"VAR_95 = calibre_db.get_book(VAR_5)\n",
"VAR_8 = calibre_db.get_book_format(VAR_5, VAR_6.upper())\n",
"if not VAR_8:\n",
"return 'File not in Database'\n",
"VAR_3.info('Serving book:... | [
"@web.route('/show/<int:book_id>/<book_format>', defaults={'anyname': 'None'})...\n",
"book_format = book_format.split('.')[0]\n",
"book = calibre_db.get_book(book_id)\n",
"data = calibre_db.get_book_format(book_id, book_format.upper())\n",
"if not data:\n",
"return 'File not in Database'\n",
"log.info(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"self.hs = VAR_2\n",
"self.auth = VAR_2.get_auth()\n",
"self.client = VAR_2.get_http_client()\n",
"self.clock = VAR_2.get_clock()\n",
"self.server_name = VAR_2.hostname\n",
"self.store = VAR_2.get_datastore()\n",
"self.max_upload_size = VAR_2.config.max_upload_size\n... | [
"def __init__(self, hs):...\n",
"self.hs = hs\n",
"self.auth = hs.get_auth()\n",
"self.client = hs.get_http_client()\n",
"self.clock = hs.get_clock()\n",
"self.server_name = hs.hostname\n",
"self.store = hs.get_datastore()\n",
"self.max_upload_size = hs.config.max_upload_size\n",
"self.max_image_pix... | [
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_8, VAR_10, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = minisix.long(str(VAR_8), VAR_11)\n",
"if VAR_10 == 10:\n",
"return str(VAR_8)\n",
"return self._convertDecimalToBase(VAR_8, VAR_10)\n"
] | [
"def _convertBaseToBase(self, number, toBase, fromBase):...\n",
"\"\"\"docstring\"\"\"\n",
"number = minisix.long(str(number), fromBase)\n",
"if toBase == 10:\n",
"return str(number)\n",
"return self._convertDecimalToBase(number, toBase)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_39(VAR_62, VAR_101=None, VAR_102=None, VAR_103=False):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.model.create_new import get_new_doc\n",
"return get_new_doc(VAR_62, VAR_101, VAR_102, VAR_103=as_dict)\n"
] | [
"def new_doc(doctype, parent_doc=None, parentfield=None, as_dict=False):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.model.create_new import get_new_doc\n",
"return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Return'"
] |
[
"@property...\n",
"return True\n"
] | [
"@property...\n",
"return True\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_24(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = 'string'\n",
"VAR_50 = VAR_21.add_parser('run', description=run_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_50.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to execute')\... | [
"def add_run_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"run_msg = \"\"\"Usage example:\nTo run input tensors from files through a MetaGraphDef and save the output tensors to files:\n$saved_model_cli show --dir /tmp/saved_model --tag_set serve \\\\\n --signature_def serving_default \\\\\n --in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_29(self, VAR_10=None, VAR_11=None, VAR_96=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_11 is None:\n",
"VAR_11 = []\n",
"if VAR_96 is None:\n",
"VAR_96 = {}\n",
"return URL(VAR_14=self.settings.controller, VAR_10=f, VAR_11=args, VAR_96=vars)\n"
] | [
"def url(self, f=None, args=None, vars=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if args is None:\n",
"args = []\n",
"if vars is None:\n",
"vars = {}\n",
"return URL(c=self.settings.controller, f=f, args=args, vars=vars)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return u'%s-%s' % (self.queue.slug, self.id)\n"
] | [
"def _get_ticket_for_url(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return u'%s-%s' % (self.queue.slug, self.id)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_4(self, VAR_13):...\n",
"if not VAR_13:\n",
"if self.required:\n",
"parse_query(VAR_13)\n",
"report_error()\n",
"return ''\n",
"return VAR_13\n"
] | [
"def clean(self, value):...\n",
"if not value:\n",
"if self.required:\n",
"parse_query(value)\n",
"report_error()\n",
"return ''\n",
"return value\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"from django.contrib.auth.models import Permission\n",
"from django.contrib.auth import get_user_model\n",
"from django.contrib.contenttypes.models import ContentType\n",
"from django.core.exceptions import ObjectDoesNotExist, ValidationError\n",
"from django.db import models\n",
... | [
"\"\"\"\ndjango-helpdesk - A Django powered ticket tracker for small enterprise.\n\n(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.\n\nmodels.py - Model (and hence database) definitions. This is the core of the\n helpdesk structure.\n\"\"\"\n",
"from django.contrib.auth.models i... | [
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"I... |
[
"def FUNC_2(VAR_3, VAR_4, VAR_5):...\n",
"VAR_7 = []\n",
"for c_elements in VAR_3:\n",
"VAR_83 = False\n",
"return VAR_7\n",
"if VAR_4 == 'languages':\n",
"VAR_100 = c_elements.lang_code\n",
"if VAR_4 == 'custom':\n",
"for inp_element in VAR_5:\n",
"VAR_100 = c_elements.value\n",
"VAR_100 = c_el... | [
"def search_objects_remove(db_book_object, db_type, input_elements):...\n",
"del_elements = []\n",
"for c_elements in db_book_object:\n",
"found = False\n",
"return del_elements\n",
"if db_type == 'languages':\n",
"type_elements = c_elements.lang_code\n",
"if db_type == 'custom':\n",
"for inp_elemen... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
"return os.path.join(self.runtime_dir, 'notebook_cookie_secret')\n"
] | [
"def _cookie_secret_file_default(self):...\n",
"return os.path.join(self.runtime_dir, 'notebook_cookie_secret')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_15, VAR_27=40, VAR_17=VAR_25, VAR_19=VAR_26, VAR_28=VAR_69(8203)...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_15.tag in VAR_25:\n",
"return\n",
"VAR_62 = VAR_15.get('class')\n",
"if VAR_62:\n",
"VAR_89 = False\n",
"if VAR_15.text:\n",
"VAR_62 = VAR_62.split()\n",
"VAR_15.text = FUNC_6... | [
"def word_break(el, max_width=40, avoid_elements=_avoid_word_break_elements,...\n",
"\"\"\"docstring\"\"\"\n",
"if el.tag in _avoid_word_break_elements:\n",
"return\n",
"class_name = el.get('class')\n",
"if class_name:\n",
"dont_break = False\n",
"if el.text:\n",
"class_name = class_name.split()\n",... | [
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'",
"Assign'",
"For",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertTrue('_known_servers_count' not in self.store.__dict__.keys())\n",
"self.room = self.helper.create_room_as(self.u_alice, tok=self.t_alice)\n",
"self.inject_room_member(self.room, self.u_bob, Membership.JOIN)\n",
"self.inject_room_member(self... | [
"def test_count_known_servers_stat_counter_disabled(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.assertTrue('_known_servers_count' not in self.store.__dict__.keys())\n",
"self.room = self.helper.create_room_as(self.u_alice, tok=self.t_alice)\n",
"self.inject_room_member(self.room, self.u_bob, Membership.J... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_113(self):...\n",
"return CLASS_0(dict(self).copy())\n"
] | [
"def copy(self):...\n",
"return _dict(dict(self).copy())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_108(self, VAR_11=None):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"if not VAR_11:\n",
"VAR_11 = VAR_56.args\n",
"if VAR_11 and VAR_11[0] in self.rss_procedures:\n",
"VAR_392 = self.call_service_function(self.rss_procedures[VAR_11[0]], *\n VAR_11[1:], **dict(reques... | [
"def serve_rss(self, args=None):...\n",
"request = current.request\n",
"response = current.response\n",
"if not args:\n",
"args = request.args\n",
"if args and args[0] in self.rss_procedures:\n",
"feed = self.call_service_function(self.rss_procedures[args[0]], *args[1:],\n **dict(request.vars))\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def __call__(self, VAR_10, VAR_13, VAR_14, VAR_12):...\n",
"VAR_11 = VAR_13.get('request')\n",
"VAR_10 = self.traverse(VAR_10, VAR_11, VAR_12)\n",
"if VAR_14 is False:\n",
"return VAR_10\n",
"if getattr(VAR_10, '__call__', VAR_0) is not VAR_0 or isinstance(VAR_10, type):\n",
"return VAR_10()\n",
"ret... | [
"def __call__(self, base, econtext, call, path_items):...\n",
"request = econtext.get('request')\n",
"base = self.traverse(base, request, path_items)\n",
"if call is False:\n",
"return base\n",
"if getattr(base, '__call__', _marker) is not _marker or isinstance(base, type):\n",
"return base()\n",
"ret... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(self, VAR_1, VAR_2=None):...\n",
""
] | [
"def get(self, arg, word=None):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"\"\"\"string\"\"\"\n",
"import StringIO\n",
"import json\n",
"import logging\n",
"import re\n",
"import time\n",
"from django.conf import settings\n",
"from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt\n",
"from django.views.decorators.http import require_POST, require_http_m... | [
"\"\"\"\nInstructor Dashboard API views\n\nJSON views which the instructor dashboard requests.\n\nMany of these GETs may become PUTs in the future.\n\"\"\"\n",
"import StringIO\n",
"import json\n",
"import logging\n",
"import re\n",
"import time\n",
"from django.conf import settings\n",
"from django.v... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"I... |
[
"@VAR_2.route('/me', methods=['GET', 'POST'])...\n",
"VAR_48 = calibre_db.speaking_language()\n",
"VAR_47 = babel.list_translations() + [LC('en')]\n",
"VAR_44 = VAR_0['kobo'] and config.config_kobo_sync\n",
"if VAR_0['oauth'] and config.config_login_type == 2:\n",
"VAR_46 = get_oauth_status()\n",
"VAR_4... | [
"@web.route('/me', methods=['GET', 'POST'])...\n",
"languages = calibre_db.speaking_language()\n",
"translations = babel.list_translations() + [LC('en')]\n",
"kobo_support = feature_support['kobo'] and config.config_kobo_sync\n",
"if feature_support['oauth'] and config.config_login_type == 2:\n",
"oauth_s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"import os\n",
"import shutil\n",
"import tempfile\n",
"from binascii import unhexlify\n",
"from io import BytesIO\n",
"from typing import Optional\n",
"from urllib import parse\n",
"from mock import Mock\n",
"import attr\n",
"from parameterized import parameterized_class\n",
"from PIL import Im... | [
"import os\n",
"import shutil\n",
"import tempfile\n",
"from binascii import unhexlify\n",
"from io import BytesIO\n",
"from typing import Optional\n",
"from urllib import parse\n",
"from mock import Mock\n",
"import attr\n",
"from parameterized import parameterized_class\n",
"from PIL import 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,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
[
"@VAR_2.route('/ajax/view', methods=['POST'])...\n",
"VAR_55 = request.get_json()\n",
"for VAR_113 in VAR_55:\n",
"VAR_3.error('Could not save view_settings: %r %r: %e', request, VAR_55, ex)\n",
"return '1', 200\n",
"for VAR_111 in VAR_55[VAR_113]:\n",
"return 'Invalid request', 400\n",
"VAR_87.set_vi... | [
"@web.route('/ajax/view', methods=['POST'])...\n",
"to_save = request.get_json()\n",
"for element in to_save:\n",
"log.error('Could not save view_settings: %r %r: %e', request, to_save, ex)\n",
"return '1', 200\n",
"for param in to_save[element]:\n",
"return 'Invalid request', 400\n",
"current_user.se... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"For",
"Expr'",
"Return'",
"For",
"Return'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"return FUNC_1(self.answer)\n"
] | [
"def get_markdown(self):...\n",
"return get_markdown(self.answer)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"VAR_25.local.login_manager.logout()\n",
"VAR_25.db.commit()\n"
] | [
"@frappe.whitelist(allow_guest=True)...\n",
"frappe.local.login_manager.logout()\n",
"frappe.db.commit()\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_83(*VAR_2, **VAR_3):...\n",
"VAR_9 = VAR_2[0]\n",
"VAR_65 = get_course_by_id(CourseKey.from_string(VAR_3['course_id']))\n",
"if has_access(VAR_9.user, VAR_4, VAR_65):\n",
"return VAR_1(*VAR_2, **kwargs)\n",
"return HttpResponseForbidden()\n"
] | [
"def wrapped(*args, **kwargs):...\n",
"request = args[0]\n",
"course = get_course_by_id(CourseKey.from_string(kwargs['course_id']))\n",
"if has_access(request.user, level, course):\n",
"return func(*args, **kwargs)\n",
"return HttpResponseForbidden()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@CLASS_4('version')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('version.html', title='Version info', version=version\n .version(), copyright=qutebrowser.__copyright__)\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('version')...\n",
"\"\"\"docstring\"\"\"\n",
"html = jinja.render('version.html', title='Version info', version=version.\n version(), copyright=qutebrowser.__copyright__)\n",
"return 'text/html', html\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_20():...\n",
"VAR_14 = request.view_args['locale']\n",
"VAR_31 = request.view_args['domain']\n",
"VAR_89 = util.flask.check_etag(FUNC_17(request.view_args['locale'], request\n .view_args['domain']))\n",
"VAR_34 = FUNC_18(VAR_14, VAR_31)\n",
"VAR_90 = VAR_34 is None or util.flask.check_lastmod... | [
"def _check_etag_and_lastmodified_for_i18n():...\n",
"locale = request.view_args['locale']\n",
"domain = request.view_args['domain']\n",
"etag_ok = util.flask.check_etag(_compute_etag_for_i18n(request.view_args[\n 'locale'], request.view_args['domain']))\n",
"lastmodified = _compute_date_for_i18n(locale,... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_27, VAR_9):...\n",
"self._base_builder = VAR_27\n",
"self._event_id = VAR_9\n"
] | [
"def __init__(self, base_builder, event_id):...\n",
"self._base_builder = base_builder\n",
"self._event_id = event_id\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_8(VAR_9: Union[int, float, str]) ->Union[int, float]:...\n",
"if '.' in str(VAR_9):\n",
"return float(VAR_9)\n",
"return int(VAR_9)\n"
] | [
"def _int_or_float_type(x: Union[int, float, str]) ->Union[int, float]:...\n",
"if '.' in str(x):\n",
"return float(x)\n",
"return int(x)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3():...\n",
"assert utils.snake_case('httpResponseLowerCamel'\n ) == 'http_response_lower_camel'\n"
] | [
"def test_snake_case_from_camel():...\n",
"assert utils.snake_case('httpResponseLowerCamel'\n ) == 'http_response_lower_camel'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.