lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_77(VAR_233, VAR_234, VAR_235):...\n",
"VAR_17 = os.path.basename(VAR_233)\n",
"VAR_293 = '%s.%s' % (VAR_17, VAR_234)\n",
"VAR_293 = os.path.join(VAR_235, VAR_293)\n",
"VAR_212 = 1\n",
"VAR_17 = VAR_293[:-(len(VAR_234) + 1)]\n",
"while os.path.exists(VAR_293):\n",
"VAR_293 = '%s_(%d).%s' % (V... | [
"def makeImageName(originalName, extension, folder_name):...\n",
"name = os.path.basename(originalName)\n",
"imgName = '%s.%s' % (name, extension)\n",
"imgName = os.path.join(folder_name, imgName)\n",
"i = 1\n",
"name = imgName[:-(len(extension) + 1)]\n",
"while os.path.exists(imgName):\n",
"imgName =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"AugAssign'"
] |
[
"def 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.db = VAR_1.primary_db\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 = local.primary_db\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_1(VAR_0, VAR_1):...\n",
"return FUNC_0(VAR_0=request, VAR_1=pk, VAR_2='is_removed', VAR_3=True,\n VAR_5=_('The topic has been deleted'))\n"
] | [
"def delete(request, pk):...\n",
"return _moderate(request=request, pk=pk, field_name='is_removed', to_value=\n True, message=_('The topic has been deleted'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@app.route('/notes/new', methods=['GET', 'POST'])...\n",
"VAR_9 = forms.NewNoteForm()\n",
"VAR_8 = 'root directory'\n",
"VAR_9.path.choices = [('', VAR_8)] + [(pathname, pathname) for pathname in\n data.get_dirs()]\n",
"if VAR_9.validate_on_submit():\n",
"VAR_7 = VAR_9.path.data\n",
"VAR_7 = request... | [
"@app.route('/notes/new', methods=['GET', 'POST'])...\n",
"form = forms.NewNoteForm()\n",
"default_dir = 'root directory'\n",
"form.path.choices = [('', default_dir)] + [(pathname, pathname) for\n pathname in data.get_dirs()]\n",
"if form.validate_on_submit():\n",
"path = form.path.data\n",
"path = r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_57(VAR_17, VAR_18=None, VAR_10=None, VAR_19=None):...\n",
"VAR_10 = VAR_10 or [db.Books.sort]\n",
"VAR_65 = None\n",
"VAR_16 = get_cc_columns(filter_config_custom_read=True)\n",
"calibre_db.session.connection().connection.connection.create_function('lower',\n 1, db.lcase)\n",
"VAR_21 = calibr... | [
"def render_adv_search_results(term, offset=None, order=None, limit=None):...\n",
"order = order or [db.Books.sort]\n",
"pagination = None\n",
"cc = get_cc_columns(filter_config_custom_read=True)\n",
"calibre_db.session.connection().connection.connection.create_function('lower',\n 1, db.lcase)\n",
"q =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"... |
[
"def FUNC_7(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"for regex in (VAR_8, VAR_9, VAR_10):\n",
"VAR_33 = regex.match(VAR_20)\n",
"VAR_34 = int(VAR_33.group('year'))\n",
"six.reraise(ValueError, ValueError('%r is not a valid date' % VAR_20), sys.\n exc_info()[2])\n",
"if VAR_33 is not None:\n",
"i... | [
"def parse_http_date(date):...\n",
"\"\"\"docstring\"\"\"\n",
"for regex in (RFC1123_DATE, RFC850_DATE, ASCTIME_DATE):\n",
"m = regex.match(date)\n",
"year = int(m.group('year'))\n",
"six.reraise(ValueError, ValueError('%r is not a valid date' % date), sys.\n exc_info()[2])\n",
"if m is not None:\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"AugAssign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"import unittest\n",
"from chameleon.exc import ExpressionError\n",
"import zope.component.testing\n",
"from AccessControl import SecurityManager\n",
"from AccessControl.SecurityManagement import noSecurityManager\n",
"from Acquisition import Implicit\n",
"from Products.PageTemplates.interfaces import I... | [
"import unittest\n",
"from chameleon.exc import ExpressionError\n",
"import zope.component.testing\n",
"from AccessControl import SecurityManager\n",
"from AccessControl.SecurityManagement import noSecurityManager\n",
"from Acquisition import Implicit\n",
"from Products.PageTemplates.interfaces import I... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Condition",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"VAR_15 = self._makeOne()\n",
"VAR_16 = CLASS_1()\n",
"VAR_17 = CLASS_0(__ac_name='foo', __ac_password='b:ar', RESPONSE=response)\n",
"self.assertEqual(len(VAR_16.cookies), 0)\n",
"self.assertEqual(VAR_15.extractCredentials(VAR_17), {'login': 'foo',\n 'password': 'b:ar', 'remo... | [
"def test_extractCredentials_with_form_creds(self):...\n",
"helper = self._makeOne()\n",
"response = FauxCookieResponse()\n",
"request = FauxSettableRequest(__ac_name='foo', __ac_password='b:ar',\n RESPONSE=response)\n",
"self.assertEqual(len(response.cookies), 0)\n",
"self.assertEqual(helper.extractCr... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_163(VAR_10):...\n",
"self.soap_procedures[VAR_148 or VAR_10.__name__\n ] = VAR_10, VAR_188, VAR_11, VAR_189, VAR_190\n",
"return VAR_10\n"
] | [
"def _soap(f):...\n",
"self.soap_procedures[name or f.__name__\n ] = f, returns, args, doc, response_element_name\n",
"return f\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_3(VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_4.signature_def[VAR_5].outputs\n"
] | [
"def _get_outputs_tensor_info_from_meta_graph_def(meta_graph_def,...\n",
"\"\"\"docstring\"\"\"\n",
"return meta_graph_def.signature_def[signature_def_key].outputs\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@log_function...\n",
"VAR_2 = FUNC_1('/query/%s', VAR_13)\n",
"VAR_19 = await self.client.get_json(VAR_5=destination, VAR_2=path, VAR_3=\n args, VAR_14=retry_on_dns_fail, VAR_8=10000, VAR_15=ignore_backoff)\n",
"return VAR_19\n"
] | [
"@log_function...\n",
"path = _create_v1_path('/query/%s', query_type)\n",
"content = await self.client.get_json(destination=destination, path=path,\n args=args, retry_on_dns_fail=retry_on_dns_fail, timeout=10000,\n ignore_backoff=ignore_backoff)\n",
"return content\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.form.load import get_attachments\n",
"for attach_item in get_attachments(self.doctype, self.amended_from):\n",
"VAR_82 = frappe.get_doc({'doctype': 'File', 'file_url': attach_item.\n file_url, 'file_name': attach_item.file_name, 'att... | [
"def copy_attachments_from_amended_from(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.form.load import get_attachments\n",
"for attach_item in get_attachments(self.doctype, self.amended_from):\n",
"_file = frappe.get_doc({'doctype': 'File', 'file_url': attach_item.file_url,\n 'file_name': at... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"For",
"Assign'",
"Expr'"
] |
[
"@VAR_2.route('/publisher')...\n",
"if VAR_87.get_view_property('publisher', 'dir') == 'desc':\n",
"VAR_10 = db.Publishers.name.desc()\n",
"VAR_10 = db.Publishers.name.asc()\n",
"VAR_109 = 0\n",
"VAR_109 = 1\n",
"if VAR_87.check_visibility(constants.SIDEBAR_PUBLISHER):\n",
"VAR_63 = calibre_db.session... | [
"@web.route('/publisher')...\n",
"if current_user.get_view_property('publisher', 'dir') == 'desc':\n",
"order = db.Publishers.name.desc()\n",
"order = db.Publishers.name.asc()\n",
"order_no = 0\n",
"order_no = 1\n",
"if current_user.check_visibility(constants.SIDEBAR_PUBLISHER):\n",
"entries = calibre... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_4, VAR_5):...\n",
"return json.dumps(FUNC_0(VAR_4, VAR_5)).encode('utf8')\n"
] | [
"def _make_edu_transaction_json(edu_type, content):...\n",
"return json.dumps(_expect_edu_transaction(edu_type, content)).encode('utf8')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_17(self, VAR_23: Iterable[str], VAR_11: str, VAR_27: str,...\n",
"VAR_5, VAR_1, VAR_28 = await self._make_and_verify_event(VAR_23, VAR_11,\n VAR_27, 'leave', VAR_25=content)\n",
"VAR_1.internal_metadata.outlier = True\n",
"VAR_1.internal_metadata.out_of_band_membership = True\n",
"VAR_98 ... | [
"async def do_remotely_reject_invite(self, target_hosts: Iterable[str],...\n",
"origin, event, room_version = await self._make_and_verify_event(target_hosts,\n room_id, user_id, 'leave', content=content)\n",
"event.internal_metadata.outlier = True\n",
"event.internal_metadata.out_of_band_membership = True\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"return 'https://example.com/fake/repo.git'\n"
] | [
"def get_repo_url(self):...\n",
"return 'https://example.com/fake/repo.git'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(VAR_20=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = formatdate(VAR_20)\n",
"return '%s-%s-%s GMT' % (VAR_29[:7], VAR_29[8:11], VAR_29[12:25])\n"
] | [
"def cookie_date(epoch_seconds=None):...\n",
"\"\"\"docstring\"\"\"\n",
"rfcdate = formatdate(epoch_seconds)\n",
"return '%s-%s-%s GMT' % (rfcdate[:7], rfcdate[8:11], rfcdate[12:25])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"from __future__ import unicode_literals\n",
"import base64\n",
"import calendar\n",
"import datetime\n",
"import re\n",
"import sys\n",
"from urllib import parse as urllib_parse\n",
"import urllib as urllib_parse\n",
"from binascii import Error as BinasciiError\n",
"import urlparse\n",
"from em... | [
"from __future__ import unicode_literals\n",
"import base64\n",
"import calendar\n",
"import datetime\n",
"import re\n",
"import sys\n",
"from urllib import parse as urllib_parse\n",
"import urllib as urllib_parse\n",
"from binascii import Error as BinasciiError\n",
"import urlparse\n",
"from em... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"@property...\n",
"return storage.bucket.name\n"
] | [
"@property...\n",
"return storage.bucket.name\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_50(VAR_62=None, VAR_9=None, VAR_109=0, VAR_110=None, VAR_111=False,...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.delete_doc\n",
"frappe.model.delete_doc.delete_doc(VAR_62, VAR_9, VAR_109, VAR_110, VAR_111,\n VAR_92, VAR_19, VAR_112, VAR_113, VAR_114)\n"
] | [
"def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None,...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.model.delete_doc\n",
"frappe.model.delete_doc.delete_doc(doctype, name, force, ignore_doctypes,\n for_reload, ignore_permissions, flags, ignore_on_trash, ignore_missing,\n delete_perm... | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Import'",
"Expr'"
] |
[
"def FUNC_34(self):...\n",
"VAR_35 = self.hs.get_datastore()\n",
"VAR_40 = self.hs.get_pagination_handler()\n",
"VAR_41 = self.helper.send(self.room_id, 'message 1')['event_id']\n",
"VAR_42 = self.get_success(VAR_35.get_topological_token_for_event(VAR_41))\n",
"VAR_43 = self.get_success(VAR_42.to_string(V... | [
"def test_room_messages_purge(self):...\n",
"store = self.hs.get_datastore()\n",
"pagination_handler = self.hs.get_pagination_handler()\n",
"first_event_id = self.helper.send(self.room_id, 'message 1')['event_id']\n",
"first_token = self.get_success(store.get_topological_token_for_event(\n first_event_id... | [
0,
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'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_3, VAR_4):...\n",
"VAR_4['max_length'] = 255\n",
"return django.forms.CharField(**options)\n"
] | [
"def create_singleline_field(self, field, options):...\n",
"options['max_length'] = 255\n",
"return django.forms.CharField(**options)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@administrator_required...\n",
"VAR_5 = get_object_or_404(VAR_0, pk=user_id)\n",
"VAR_6 = UserForm(data=post_data(request), instance=user)\n",
"VAR_7 = UserProfileForm(data=post_data(request), instance=user.st)\n",
"if is_post(VAR_1) and all([VAR_6.is_valid(), VAR_7.is_valid()]):\n",
"VAR_6.save()\n",
... | [
"@administrator_required...\n",
"user = get_object_or_404(User, pk=user_id)\n",
"uform = UserForm(data=post_data(request), instance=user)\n",
"form = UserProfileForm(data=post_data(request), instance=user.st)\n",
"if is_post(request) and all([uform.is_valid(), form.is_valid()]):\n",
"uform.save()\n",
"r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_36():...\n",
"return FUNC_2(VAR_8, VAR_15=additional_key_data)\n"
] | [
"def cache_key():...\n",
"return _cache_key(key, additional_key_data=additional_key_data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(VAR_13):...\n",
"VAR_23 = ['ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format',\n VAR_13]\n",
"VAR_17 = subprocess.Popen(VAR_23, stdout=subprocess.PIPE, bufsize=-1)\n",
"VAR_24 = json.load(VAR_17.stdout)\n",
"return VAR_24\n"
] | [
"def _ffprobe(video_path):...\n",
"cmd_l = ['ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format',\n video_path]\n",
"proc = subprocess.Popen(cmd_l, stdout=subprocess.PIPE, bufsize=-1)\n",
"data = json.load(proc.stdout)\n",
"return data\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"if isinstance(VAR_5, int):\n",
"return VAR_5\n",
"VAR_48 = {'K': 1024, 'M': 1024 * 1024}\n",
"VAR_49 = 1\n",
"VAR_50 = VAR_5[-1]\n",
"if VAR_50 in VAR_48:\n",
"VAR_5 = VAR_5[:-1]\n",
"return int(VAR_5) * VAR_49\n",
"VAR_49 = VAR_48[VAR_50]\n"
] | [
"@staticmethod...\n",
"if isinstance(value, int):\n",
"return value\n",
"sizes = {'K': 1024, 'M': 1024 * 1024}\n",
"size = 1\n",
"suffix = value[-1]\n",
"if suffix in sizes:\n",
"value = value[:-1]\n",
"return int(value) * size\n",
"size = sizes[suffix]\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = VAR_8.getObject('Image', VAR_6)\n",
"if VAR_15 is None:\n",
"VAR_156 = VAR_15.getImportedImageFilePaths()\n",
"return {'repo': VAR_156['server_paths'], 'client': VAR_156['client_paths']}\n"
] | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"image = conn.getObject('Image', iid)\n",
"if image is None:\n",
"paths = image.getImportedImageFilePaths()\n",
"return {'repo': paths['server_paths'], 'client': paths['client_paths']}\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self, VAR_2: str) ->None:...\n",
"VAR_29 = VAR_2.split('/')\n",
"VAR_13 = VAR_29[0]\n",
"VAR_30 = self._registry.get_component_path(VAR_13)\n",
"if VAR_30 is None:\n",
"self.write('not found')\n",
"VAR_27 = '/'.join(VAR_29[1:])\n",
"self.set_status(404)\n",
"VAR_16 = os.path.join(VAR_30,... | [
"def get(self, path: str) ->None:...\n",
"parts = path.split('/')\n",
"component_name = parts[0]\n",
"component_root = self._registry.get_component_path(component_name)\n",
"if component_root is None:\n",
"self.write('not found')\n",
"filename = '/'.join(parts[1:])\n",
"self.set_status(404)\n",
"abs... | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_65 = get_course_by_id(VAR_10)\n",
"VAR_136 = has_access(VAR_9.user, 'instructor', VAR_65)\n",
"VAR_137 = has_forum_access(VAR_9.user, VAR_10, FORUM_ROLE_ADMINISTRATOR)\n",
"VA... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"course = get_course_by_id(course_id)\n",
"has_instructor_access = has_access(request.user, 'instructor', course)\n",
"has_forum_admin = has_forum_access(request.user, course_i... | [
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Docstring",
"Return'"
] |
[
"def FUNC_114():...\n",
"if VAR_32:\n",
"if VAR_19.rollback_on_exception:\n",
"VAR_12.rollback()\n",
"import inspect\n",
"if inspect.isclass(VAR_32) and issubclass(VAR_32, Exception):\n"
] | [
"def _raise_exception():...\n",
"if raise_exception:\n",
"if flags.rollback_on_exception:\n",
"db.rollback()\n",
"import inspect\n",
"if inspect.isclass(raise_exception) and issubclass(raise_exception, Exception):\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Import'",
"Condition"
] |
[
"def FUNC_0(VAR_0: Text) ->None:...\n",
"import coloredlogs\n",
"VAR_0 = VAR_0 or os.environ.get(rasa.shared.constants.ENV_LOG_LEVEL, rasa.\n shared.constants.DEFAULT_LOG_LEVEL)\n",
"VAR_15 = coloredlogs.DEFAULT_FIELD_STYLES.copy()\n",
"VAR_15['asctime'] = {}\n",
"VAR_16 = coloredlogs.DEFAULT_LEVEL_STY... | [
"def configure_colored_logging(loglevel: Text) ->None:...\n",
"import coloredlogs\n",
"loglevel = loglevel or os.environ.get(rasa.shared.constants.ENV_LOG_LEVEL,\n rasa.shared.constants.DEFAULT_LOG_LEVEL)\n",
"field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()\n",
"field_styles['asctime'] = {}\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_2.route('/ajax/log/<int:logtype>')...\n",
"if VAR_26 == 1:\n",
"VAR_112 = logger.get_accesslogfile(config.config_access_logfile)\n",
"if VAR_26 == 0:\n",
"return send_from_directory(os.path.dirname(VAR_112), os.path.basename(VAR_112))\n",
"VAR_112 = logger.get_logfile(config.config_logfile)\n",
"r... | [
"@admi.route('/ajax/log/<int:logtype>')...\n",
"if logtype == 1:\n",
"logfile = logger.get_accesslogfile(config.config_access_logfile)\n",
"if logtype == 0:\n",
"return send_from_directory(os.path.dirname(logfile), os.path.basename(logfile))\n",
"logfile = logger.get_logfile(config.config_logfile)\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'"
] |
[
"@VAR_2.route('/ajax/bookmark/<int:book_id>/<book_format>', methods=['POST'])...\n",
"VAR_52 = request.form['bookmark']\n",
"ub.session.query(ub.Bookmark).filter(and_(ub.Bookmark.user_id == int(VAR_87\n .id), ub.Bookmark.book_id == VAR_5, ub.Bookmark.format == VAR_6)).delete()\n",
"if not VAR_52:\n",
"ub... | [
"@web.route('/ajax/bookmark/<int:book_id>/<book_format>', methods=['POST'])...\n",
"bookmark_key = request.form['bookmark']\n",
"ub.session.query(ub.Bookmark).filter(and_(ub.Bookmark.user_id == int(\n current_user.id), ub.Bookmark.book_id == book_id, ub.Bookmark.format ==\n book_format)).delete()\n",
"i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def __call__(self):...\n",
"return 'dummy'\n"
] | [
"def __call__(self):...\n",
"return 'dummy'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_13(self, VAR_61):...\n",
"VAR_84 = VAR_6('', unquote_plus(VAR_61))\n",
"if FUNC_0(VAR_84):\n",
"return ''\n",
"return VAR_61\n"
] | [
"def _remove_javascript_link(self, link):...\n",
"new = _substitute_whitespace('', unquote_plus(link))\n",
"if _is_javascript_scheme(new):\n",
"return ''\n",
"return link\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_6):...\n",
"VAR_13 = UploadForm(data={'file': ''}, instance=filemodel)\n",
"assert VAR_13.is_valid(), VAR_13.errors\n",
"assert not VAR_13.has_changed()\n",
"assert VAR_13.cleaned_data['file'] == VAR_6.file\n"
] | [
"def test_initial_no_file_uploaded(self, filemodel):...\n",
"form = UploadForm(data={'file': ''}, instance=filemodel)\n",
"assert form.is_valid(), form.errors\n",
"assert not form.has_changed()\n",
"assert form.cleaned_data['file'] == filemodel.file\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_9(VAR_10, *VAR_9, **VAR_13):...\n",
"VAR_14 = VAR_10.__code__.co_argcount\n",
"VAR_181 = VAR_10.__code__.co_varnames[:VAR_14]\n",
"VAR_182 = VAR_10.__defaults__ or []\n",
"VAR_183 = VAR_181[0:-len(VAR_182)]\n",
"VAR_184 = VAR_181[-len(VAR_182):]\n",
"VAR_185 = {}\n",
"for VAR_308, pos_val in... | [
"def universal_caller(f, *a, **b):...\n",
"c = f.__code__.co_argcount\n",
"n = f.__code__.co_varnames[:c]\n",
"defaults = f.__defaults__ or []\n",
"pos_args = n[0:-len(defaults)]\n",
"named_args = n[-len(defaults):]\n",
"arg_dict = {}\n",
"for pos_index, pos_val in enumerate(a[:c]):\n",
"arg_dict[n[... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def __init__(self, VAR_21, VAR_26):...\n",
"super().__init__(VAR_21, VAR_26)\n",
"self.setContext('repeat', CLASS_5(self.repeat_vars))\n",
"self.vars = VAR_41 = VAR_26.copy()\n",
"self._vars_stack = [VAR_41]\n"
] | [
"def __init__(self, engine, contexts):...\n",
"super().__init__(engine, contexts)\n",
"self.setContext('repeat', SafeMapping(self.repeat_vars))\n",
"self.vars = vars = contexts.copy()\n",
"self._vars_stack = [vars]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_127 = strip_if_string(VAR_9.GET.get('problem_to_reset'))\n",
"VAR_128 = VAR_9.GET.get('unique_student_identifier', None)\n",
"VAR_40 = None\n",
"if VAR_128 is not... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"problem_to_reset = strip_if_string(request.GET.get('problem_to_reset'))\n",
"student_identifier = request.GET.get('unique_student_identifier', None)\n",
"student ... | [
0,
0,
0,
3,
3,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Assign... |
[
"def FUNC_7(VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"while True:\n",
"VAR_75 = VAR_8.get_frame()\n",
"yield b'--frame\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n' + VAR_75 + b'\\r\\n'\n"
] | [
"def gen(camera):...\n",
"\"\"\"docstring\"\"\"\n",
"while True:\n",
"frame = camera.get_frame()\n",
"yield b'--frame\\r\\nContent-Type: image/jpeg\\r\\n\\r\\n' + frame + b'\\r\\n'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_49(self, VAR_11=False):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.delete_doc(self.doctype, self.name, VAR_11=ignore_permissions, flags\n =self.flags)\n"
] | [
"def delete(self, ignore_permissions=False):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.delete_doc(self.doctype, self.name, ignore_permissions=\n ignore_permissions, flags=self.flags)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def __init__(self):...\n",
"self.var = variables.Variable(1.0, name='my_var')\n",
"self.write_var = variables.Variable(1.0, name='write_var')\n"
] | [
"def __init__(self):...\n",
"self.var = variables.Variable(1.0, name='my_var')\n",
"self.write_var = variables.Variable(1.0, name='write_var')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"async def FUNC_0(VAR_8: IReactorTime, VAR_9: float, VAR_10:...\n",
"\"\"\"docstring\"\"\"\n",
"FUNC_2(VAR_11.headers)\n",
"VAR_0.warning('{%s} [%s] Timed out reading response - %s %s', VAR_10.txn_id,\n VAR_10.destination, VAR_10.method, VAR_10.uri.decode('ascii'))\n",
"VAR_23 = VAR_8.seconds() - VAR_12 ... | [
"async def _handle_json_response(reactor: IReactorTime, timeout_sec: float,...\n",
"\"\"\"docstring\"\"\"\n",
"check_content_type_is_json(response.headers)\n",
"logger.warning('{%s} [%s] Timed out reading response - %s %s', request.\n txn_id, request.destination, request.method, request.uri.decode('ascii')... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_18(self):...\n",
"VAR_26 = np.array([[1], [2]])\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_31, VAR_53=x0)\n",
"VAR_27 = np.ones([2, 10])\n",
"VAR_20 = 'x0=' + VAR_31 + '[a]'\n",
"VAR_21 = 'x1=np.ones([2,10])'\n",
"VAR_30 = saved_model_cli.load_inputs_from_... | [
"def testInputParserBoth(self):...\n",
"x0 = np.array([[1], [2]])\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0)\n",
"x1 = np.ones([2, 10])\n",
"input_str = 'x0=' + input_path + '[a]'\n",
"input_expr_str = 'x1=np.ones([2,10])'\n",
"feed_dict = saved_mo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(VAR_26, VAR_27):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_35, VAR_36 = urllib_parse.urlparse(VAR_26), urllib_parse.urlparse(VAR_27)\n",
"return (VAR_35.scheme, VAR_35.hostname, VAR_35.port) == (VAR_36.scheme,\n VAR_36.hostname, VAR_36.port)\n",
"return False\n"
] | [
"def same_origin(url1, url2):...\n",
"\"\"\"docstring\"\"\"\n",
"p1, p2 = urllib_parse.urlparse(url1), urllib_parse.urlparse(url2)\n",
"return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)\n",
"return False\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_36():...\n",
"return FUNC_2(VAR_8, VAR_15=additional_key_data)\n"
] | [
"def cache_key():...\n",
"return _cache_key(key, additional_key_data=additional_key_data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"return self.gist_id\n"
] | [
"def get_build_slug(self):...\n",
"return self.gist_id\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@login_required...\n",
"return VAR_13(*VAR_41, **kwargs)\n"
] | [
"@login_required...\n",
"return func(*args, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"self.room_members = [VAR_0, VAR_2]\n",
"self.assertEquals(self.event_source.get_current_key(), 0)\n",
"VAR_20, VAR_21 = self.make_request('PUT',\n '/_matrix/federation/v1/send/1000000', FUNC_1('m.typing', VAR_5={\n 'room_id': ROOM_ID, 'user_id': U_ONION.to_string(), 'typing': ... | [
"def test_started_typing_remote_recv(self):...\n",
"self.room_members = [U_APPLE, U_ONION]\n",
"self.assertEquals(self.event_source.get_current_key(), 0)\n",
"request, channel = self.make_request('PUT',\n '/_matrix/federation/v1/send/1000000', _make_edu_transaction_json(\n 'm.typing', content={'room_id'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"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_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_26(self):...\n",
"self.other_id = '@zzsid1:red'\n",
"VAR_32 = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.other_id)\n",
"VAR_19 = '{\"membership\":\"%s\",\"invite_text\":\"%s\"}' % (Membership.INVITE,\n 'Join us!')\n",
"VAR_22, VAR_23 = self.make_request('PUT',... | [
"def test_rooms_members_other_custom_keys(self):...\n",
"self.other_id = '@zzsid1:red'\n",
"path = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.other_id)\n",
"content = '{\"membership\":\"%s\",\"invite_text\":\"%s\"}' % (Membership.INVITE,\n 'Join us!')\n",
"request, chan... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_16(self, VAR_5: str, VAR_1: EventBase, VAR_28: RoomVersion):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1.state_key is None:\n",
"VAR_96 = await self.store.is_room_blocked(VAR_1.room_id)\n",
"if VAR_96:\n",
"if self.hs.config.block_non_admin_invites:\n",
"if not self.spam_checker.user_may... | [
"async def on_invite_request(self, origin: str, event: EventBase,...\n",
"\"\"\"docstring\"\"\"\n",
"if event.state_key is None:\n",
"is_blocked = await self.store.is_room_blocked(event.room_id)\n",
"if is_blocked:\n",
"if self.hs.config.block_non_admin_invites:\n",
"if not self.spam_checker.user_may_in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_70(VAR_43):...\n",
"\"\"\"docstring\"\"\"\n",
"return json.load(f)\n"
] | [
"def get_file_json(path):...\n",
"\"\"\"docstring\"\"\"\n",
"return json.load(f)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0(VAR_1: bytes) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = VAR_1.decode('ascii')\n",
"IPAddress(VAR_14)\n",
"return False\n",
"return True\n"
] | [
"def _is_ip_literal(host: bytes) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"host_str = host.decode('ascii')\n",
"IPAddress(host_str)\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"async def FUNC_15(VAR_20):...\n",
""
] | [
"async def get_key(key_server):...\n",
""
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Condition"
] |
[
"@VAR_0.route('/cli')...\n",
"return render_template('cli.html')\n"
] | [
"@gui.route('/cli')...\n",
"return render_template('cli.html')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"from __future__ import absolute_import, division, unicode_literals\n",
"from six import text_type\n",
"import re\n",
"from ..constants import voidElements, booleanAttributes, spaceCharacters\n",
"from ..constants import rcdataElements, entities, xmlEntities\n",
"from .. import utils\n",
"from xml.sax.s... | [
"from __future__ import absolute_import, division, unicode_literals\n",
"from six import text_type\n",
"import re\n",
"from ..constants import voidElements, booleanAttributes, spaceCharacters\n",
"from ..constants import rcdataElements, entities, xmlEntities\n",
"from .. import utils\n",
"from xml.sax.s... | [
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"FunctionDef'",
"Assign'",
... |
[
"@staticmethod...\n",
"if VAR_112:\n",
"VAR_350 = VAR_112.split('/')\n",
"return None\n",
"if ':' not in VAR_350[0] and VAR_350[:2] != ['', '']:\n",
"return VAR_112\n",
"if len(VAR_350) > 2 and VAR_350[0].endswith(':') and VAR_350[1:3] == ['',\n",
"return VAR_112\n"
] | [
"@staticmethod...\n",
"if next:\n",
"parts = next.split('/')\n",
"return None\n",
"if ':' not in parts[0] and parts[:2] != ['', '']:\n",
"return next\n",
"if len(parts) > 2 and parts[0].endswith(':') and parts[1:3] == ['', host]:\n",
"return next\n"
] | [
4,
4,
4,
4,
4,
4,
4,
4
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"async def FUNC_23():...\n",
"context_12.request = 'context_12'\n",
"VAR_53 = VAR_4.verify_json_objects_for_server([('server10', VAR_21, 0, 'test')]\n )\n",
"VAR_53[0].addBoth(self.check_context, None)\n",
"VAR_25[0] = 1\n",
"await make_deferred_yieldable(VAR_53[0])\n",
"VAR_25[0] = 2\n"
] | [
"async def second_lookup():...\n",
"context_12.request = 'context_12'\n",
"res_deferreds_2 = kr.verify_json_objects_for_server([('server10', json1, 0,\n 'test')])\n",
"res_deferreds_2[0].addBoth(self.check_context, None)\n",
"second_lookup_state[0] = 1\n",
"await make_deferred_yieldable(res_deferreds_2... | [
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_57(VAR_20):...\n",
"return '.' in VAR_20 and VAR_20.rsplit('.', 1)[1].lower() in VAR_6\n"
] | [
"def allowed_file(filename):...\n",
"return '.' in filename and filename.rsplit('.', 1)[1].lower(\n ) in ALLOWED_EXTENSIONS\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@FUNC_0...\n",
"return ApplicationServiceApi(self)\n"
] | [
"@cache_in_self...\n",
"return ApplicationServiceApi(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_3(VAR_3: Union[Text, Path]) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"return pickle.load(VAR_18)\n"
] | [
"def pickle_load(filename: Union[Text, Path]) ->Any:...\n",
"\"\"\"docstring\"\"\"\n",
"return pickle.load(f)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"\"\"\"\nDefines helper methods useful for setting up ports, launching servers, and handling `ngrok`\n\"\"\"\n",
"import os\n",
"import socket\n",
"import threading\n",
"from flask import Flask, request, session, jsonify, abort, send_file, render_template, redirect\n",
"from flask_cachebuster import Cache... | [
"\"\"\"\nDefines helper methods useful for setting up ports, launching servers, and handling `ngrok`\n\"\"\"\n",
"import os\n",
"import socket\n",
"import threading\n",
"from flask import Flask, request, session, jsonify, abort, send_file, render_template, redirect\n",
"from flask_cachebuster import Cache... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
... |
[
"def FUNC_11(self, VAR_3, VAR_4):...\n",
"return django.forms.BooleanField(**options)\n"
] | [
"def create_checkbox_field(self, field, options):...\n",
"return django.forms.BooleanField(**options)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_168(*VAR_9, **VAR_13):...\n",
"VAR_27 = None\n",
"VAR_27 = VAR_10(*VAR_9, **b)\n",
"thread.start_new_thread(VAR_26, (VAR_27,))\n",
"return VAR_27\n"
] | [
"def __completion(*a, **b):...\n",
"d = None\n",
"d = f(*a, **b)\n",
"thread.start_new_thread(callback, (d,))\n",
"return d\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/ajax/togglearchived/<int:book_id>', methods=['POST'])...\n",
"VAR_54 = change_archived_books(VAR_5, message='Book {} archivebit toggled'.\n format(book_id))\n",
"if VAR_54:\n",
"remove_synced_book(VAR_5)\n",
"return ''\n"
] | [
"@web.route('/ajax/togglearchived/<int:book_id>', methods=['POST'])...\n",
"is_archived = change_archived_books(book_id, message=\n 'Book {} archivebit toggled'.format(book_id))\n",
"if is_archived:\n",
"remove_synced_book(book_id)\n",
"return ''\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_100(VAR_62, VAR_9):...\n",
"VAR_136 = (\n '<a href=\"/app/Form/{doctype}/{name}\" style=\"font-weight: bold;\">{doctype_local} {name}</a>'\n )\n",
"return VAR_136.format(VAR_62=doctype, VAR_9=name, doctype_local=_(doctype))\n"
] | [
"def get_desk_link(doctype, name):...\n",
"html = (\n '<a href=\"/app/Form/{doctype}/{name}\" style=\"font-weight: bold;\">{doctype_local} {name}</a>'\n )\n",
"return html.format(doctype=doctype, name=name, doctype_local=_(doctype))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"\"\"\"Tests REST events for /rooms paths.\"\"\"\n",
"import json\n",
"from urllib import parse as urlparse\n",
"from mock import Mock\n",
"import synapse.rest.admin\n",
"from synapse.api.constants import EventContentFields, EventTypes, Membership\n",
"from synapse.handlers.pagination import PurgeStatus... | [
"\"\"\"Tests REST events for /rooms paths.\"\"\"\n",
"import json\n",
"from urllib import parse as urlparse\n",
"from mock import Mock\n",
"import synapse.rest.admin\n",
"from synapse.api.constants import EventContentFields, EventTypes, Membership\n",
"from synapse.handlers.pagination import PurgeStatus... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"AsyncFunctio... |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"super(CLASS_3, self).start()\n",
"VAR_93 = self.log.info\n",
"for VAR_104 in self.notebook_info().split('\\n'):\n",
"VAR_93(VAR_104)\n",
"VAR_93(\n 'Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).'\n )\... | [
"def start(self):...\n",
"\"\"\"docstring\"\"\"\n",
"super(NotebookApp, self).start()\n",
"info = self.log.info\n",
"for line in self.notebook_info().split('\\n'):\n",
"info(line)\n",
"info(\n 'Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).'\n )\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"For",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Exp... |
[
"def FUNC_24(VAR_40):...\n",
"return VAR_39[VAR_40]\n"
] | [
"def models_dir_get(x):...\n",
"return module_paths[x]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(*, VAR_0: Optional[str], VAR_1: Optional[Path]) ->Sequence[...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = FUNC_0(VAR_0=url, VAR_1=path)\n",
"if isinstance(VAR_4, GeneratorError):\n",
"return [VAR_4]\n",
"return VAR_4.build()\n"
] | [
"def create_new_client(*, url: Optional[str], path: Optional[Path]) ->Sequence[...\n",
"\"\"\"docstring\"\"\"\n",
"project = _get_project_for_url_or_path(url=url, path=path)\n",
"if isinstance(project, GeneratorError):\n",
"return [project]\n",
"return project.build()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_43(self, VAR_53, VAR_54):...\n",
"return VAR_53 * VAR_54\n"
] | [
"def multiply(self, a, b):...\n",
"return a * b\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_114():...\n",
"if VAR_32:\n",
"if VAR_19.rollback_on_exception:\n",
"VAR_12.rollback()\n",
"import inspect\n",
"if inspect.isclass(VAR_32) and issubclass(VAR_32, Exception):\n"
] | [
"def _raise_exception():...\n",
"if raise_exception:\n",
"if flags.rollback_on_exception:\n",
"db.rollback()\n",
"import inspect\n",
"if inspect.isclass(raise_exception) and issubclass(raise_exception, Exception):\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Import'",
"Condition"
] |
[
"def FUNC_139(self):...\n",
"if self.auth.user:\n",
"if self.settings.menu_groups is None:\n",
"return False\n",
"return True\n",
"VAR_167 = self.settings.groups\n",
"if any(VAR_445 in self.settings.menu_groups for VAR_445 in VAR_167):\n",
"return True\n"
] | [
"def can_see_menu(self):...\n",
"if self.auth.user:\n",
"if self.settings.menu_groups is None:\n",
"return False\n",
"return True\n",
"groups = self.settings.groups\n",
"if any(t in self.settings.menu_groups for t in groups):\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'",
"Assign'",
"For",
"Return'"
] |
[
"def FUNC_14():...\n",
"VAR_23.component_instance.json_args = VAR_34\n",
"VAR_23.component_instance.special_args.extend(VAR_21)\n"
] | [
"def marshall_element_args():...\n",
"element.component_instance.json_args = serialized_json_args\n",
"element.component_instance.special_args.extend(special_args)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_46(VAR_134):...\n",
"def FUNC_47(VAR_136, VAR_38):...\n",
"return VAR_134(VAR_136, VAR_38)\n",
"VAR_0.exception('Error while extracting sorting keys for template {}'.\n format(VAR_117))\n",
"return FUNC_47\n",
"return None\n"
] | [
"def create_safe_extractor(extractor):...\n",
"def f(x, k):...\n",
"return extractor(x, k)\n",
"_logger.exception('Error while extracting sorting keys for template {}'.\n format(t))\n",
"return f\n",
"return None\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Return'",
"Expr'",
"Return'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_87 = self.extra_nbextensions_path + jupyter_path('nbextensions')\n",
"VAR_87.append(os.path.join(get_ipython_dir(), 'nbextensions'))\n",
"return VAR_87\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"path = self.extra_nbextensions_path + jupyter_path('nbextensions')\n",
"path.append(os.path.join(get_ipython_dir(), 'nbextensions'))\n",
"return path\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_60(self):...\n",
"if not self.user:\n",
"redirect(self.settings.login_url)\n",
"VAR_277 = self.table_token()\n",
"VAR_277.user_id.writable = False\n",
"VAR_277.user_id.default = self.user.id\n",
"VAR_277.token.writable = False\n",
"if VAR_263.request.args(1) == 'new':\n",
"VAR_277.token.re... | [
"def manage_tokens(self):...\n",
"if not self.user:\n",
"redirect(self.settings.login_url)\n",
"table_token = self.table_token()\n",
"table_token.user_id.writable = False\n",
"table_token.user_id.default = self.user.id\n",
"table_token.token.writable = False\n",
"if current.request.args(1) == 'new':\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"from __future__ import division, print_function, unicode_literals\n",
"import sys\n",
"import platform\n",
"import sqlite3\n",
"from collections import OrderedDict\n",
"import babel, pytz, requests, sqlalchemy\n",
"import werkzeug, flask, flask_login, flask_principal, jinja2\n",
"from flask_babel imp... | [
"from __future__ import division, print_function, unicode_literals\n",
"import sys\n",
"import platform\n",
"import sqlite3\n",
"from collections import OrderedDict\n",
"import babel, pytz, requests, sqlalchemy\n",
"import werkzeug, flask, flask_login, flask_principal, jinja2\n",
"from flask_babel 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,
3,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
... |
[
"\"\"\"string\"\"\"\n",
"from __future__ import annotations\n",
"import datetime\n",
"import os\n",
"import re\n",
"import unicodedata\n",
"from typing import Any\n",
"from typing import MutableMapping\n",
"from typing import TypeVar\n",
"import flask\n",
"from beancount.core import compare\n",
... | [
"\"\"\"Template filters for Fava.\n\nAll functions in this module will be automatically added as template filters.\n\"\"\"\n",
"from __future__ import annotations\n",
"import datetime\n",
"import os\n",
"import re\n",
"import unicodedata\n",
"from typing import Any\n",
"from typing import MutableMappi... | [
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"I... |
[
"def FUNC_4(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.default:\n",
"VAR_16 = self.default\n",
"if not self.required:\n",
"if VAR_16 is not None:\n",
"VAR_16 = 'None'\n",
"VAR_16 = None\n",
"return f'{self.python_name}: {self.get_type_string()} = {self.default}'\n",
"return f'{self.py... | [
"def to_string(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if self.default:\n",
"default = self.default\n",
"if not self.required:\n",
"if default is not None:\n",
"default = 'None'\n",
"default = None\n",
"return f'{self.python_name}: {self.get_type_string()} = {self.default}'\n",
"return f'{... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_15(VAR_3, VAR_31=None, VAR_32=0, VAR_33=False, VAR_34=False,...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils import strip_html_tags\n",
"VAR_3 = FUNC_108(VAR_3)\n",
"VAR_179 = CLASS_0(VAR_51=msg)\n",
"def FUNC_114():...\n",
"if VAR_32:\n",
"if VAR_19.rollback_on_exception:\n",
"if VAR... | [
"def msgprint(msg, title=None, raise_exception=0, as_table=False, as_list=...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils import strip_html_tags\n",
"msg = safe_decode(msg)\n",
"out = _dict(message=msg)\n",
"def _raise_exception():...\n",
"if raise_exception:\n",
"if flags.rollback_on_exception:... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Import'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condit... |
[
"from __future__ import unicode_literals\n",
"from django.conf.urls import url\n",
"from django.contrib.auth.decorators import login_required\n",
"from django.http.response import HttpResponse\n",
"from django.views.decorators.csrf import csrf_exempt\n",
"from django.views.i18n import set_language\n",
"... | [
"from __future__ import unicode_literals\n",
"from django.conf.urls import url\n",
"from django.contrib.auth.decorators import login_required\n",
"from django.http.response import HttpResponse\n",
"from django.views.decorators.csrf import csrf_exempt\n",
"from django.views.i18n import set_language\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionD... |
[
"def FUNC_3(VAR_9: str) ->int:...\n",
"VAR_35 = 0\n",
"for c in VAR_9:\n",
"VAR_35 += ord(c)\n",
"return VAR_35\n"
] | [
"def string_ordinal_total(s: str) ->int:...\n",
"tot = 0\n",
"for c in s:\n",
"tot += ord(c)\n",
"return tot\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"AugAssign'",
"Return'"
] |
[
"def FUNC_10(self, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.isAdmin and not VAR_14.isAdmin():\n"
] | [
"def verify_is_admin(self, conn):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.isAdmin and not conn.isAdmin():\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition"
] |
[
"def FUNC_12(self):...\n",
"VAR_17 = self.assertFormfield(models.Event, 'main_band', widgets.\n AdminRadioSelect, radio_fields={'main_band': admin.VERTICAL})\n",
"self.assertEqual(VAR_17.empty_label, None)\n"
] | [
"def testRadioFieldsForeignKey(self):...\n",
"ff = self.assertFormfield(models.Event, 'main_band', widgets.\n AdminRadioSelect, radio_fields={'main_band': admin.VERTICAL})\n",
"self.assertEqual(ff.empty_label, None)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_12):...\n",
"return CLASS_2(self._reactor, self._tls_client_options_factory, self.\n _srv_resolver, VAR_12)\n"
] | [
"def endpointForURI(self, parsed_uri):...\n",
"return MatrixHostnameEndpoint(self._reactor, self.\n _tls_client_options_factory, self._srv_resolver, parsed_uri)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@def_function.function...\n",
"return VAR_49 + 2 * VAR_55\n"
] | [
"@def_function.function...\n",
"return y + 2 * c\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self, VAR_6):...\n",
"VAR_13 = UploadForm(instance=filemodel)\n",
"assert VAR_6.file.name in VAR_13.as_p(), VAR_13.as_p()\n",
"assert not VAR_13.is_valid()\n"
] | [
"def test_value_from_datadict_initial_data(self, filemodel):...\n",
"form = UploadForm(instance=filemodel)\n",
"assert filemodel.file.name in form.as_p(), form.as_p()\n",
"assert not form.is_valid()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_51(VAR_21, VAR_26):...\n",
"if VAR_26:\n",
"if config.config_read_column:\n",
"return VAR_21\n",
"if VAR_26 == 'True':\n",
"if VAR_26 == 'True':\n",
"VAR_3.error(u'Custom Column No.%d is not existing in calibre database',\n config.config_read_column)\n",
"VAR_21 = VAR_21.join(ub.ReadBook,... | [
"def adv_search_read_status(q, read_status):...\n",
"if read_status:\n",
"if config.config_read_column:\n",
"return q\n",
"if read_status == 'True':\n",
"if read_status == 'True':\n",
"log.error(u'Custom Column No.%d is not existing in calibre database',\n config.config_read_column)\n",
"q = q.join... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"assert controller_name(CLASS_10) == 'some'\n"
] | [
"def test_it_strips_view(self):...\n",
"assert controller_name(SomeView) == 'some'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_91(VAR_62, VAR_9, VAR_152=None, VAR_146=None, VAR_147=None,...\n",
"from frappe.utils import scrub_urls\n",
"if not VAR_152:\n",
"VAR_152 = VAR_9\n",
"VAR_152 = VAR_152.replace(' ', '').replace('/', '-')\n",
"VAR_199 = VAR_12.get_singles_dict('Print Settings')\n",
"VAR_200 = VAR_1.lang\n",
"... | [
"def attach_print(doctype, name, file_name=None, print_format=None, style=...\n",
"from frappe.utils import scrub_urls\n",
"if not file_name:\n",
"file_name = name\n",
"file_name = file_name.replace(' ', '').replace('/', '-')\n",
"print_settings = db.get_singles_dict('Print Settings')\n",
"_lang = local... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"return [d.as_dict(no_default_fields=True) for d in self.columns]\n"
] | [
"def get_columns(self):...\n",
"return [d.as_dict(no_default_fields=True) for d in self.columns]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"self.mock_federation = Mock()\n",
"self.mock_registry = Mock()\n",
"self.query_handlers = {}\n",
"def FUNC_21(VAR_8, VAR_9):...\n",
"self.query_handlers[VAR_8] = VAR_9\n",
"self.mock_registry.register_query_handler = FUNC_21\n",
"VAR_3 = self.setup_test_homeser... | [
"def make_homeserver(self, reactor, clock):...\n",
"self.mock_federation = Mock()\n",
"self.mock_registry = Mock()\n",
"self.query_handlers = {}\n",
"def register_query_handler(query_type, handler):...\n",
"self.query_handlers[query_type] = handler\n",
"self.mock_registry.register_query_handler = regist... | [
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_0: str) ->str:...\n",
"VAR_0 = re.sub('([A-Z]{2,})([A-Z][a-z]|[ -_]|$)', lambda m: m.group(1).\n title() + m.group(2), VAR_0.strip())\n",
"VAR_0 = re.sub('(^|[ _-])([A-Z])', lambda m: m.group(1) + m.group(2).lower(\n ), VAR_0)\n",
"return VAR_0\n"
] | [
"def group_title(value: str) ->str:...\n",
"value = re.sub('([A-Z]{2,})([A-Z][a-z]|[ -_]|$)', lambda m: m.group(1).\n title() + m.group(2), value.strip())\n",
"value = re.sub('(^|[ _-])([A-Z])', lambda m: m.group(1) + m.group(2).lower(\n ), value)\n",
"return value\n"
] | [
0,
5,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/systemctl/<action>')...\n",
"\"\"\"docstring\"\"\"\n",
"if not utils_general.user_has_permission('edit_settings'):\n",
"return redirect(url_for('routes_general.home'))\n",
"if VAR_27 not in ['restart', 'shutdown', 'daemon_restart', 'frontend_reload']:\n",
"VAR_1.error(\"System command '{cm... | [
"@blueprint.route('/systemctl/<action>')...\n",
"\"\"\"docstring\"\"\"\n",
"if not utils_general.user_has_permission('edit_settings'):\n",
"return redirect(url_for('routes_general.home'))\n",
"if action not in ['restart', 'shutdown', 'daemon_restart', 'frontend_reload']:\n",
"logger.error(\"System command... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Exp... |
[
"def FUNC_2(self, *VAR_8, **VAR_9):...\n",
"VAR_10 = VAR_9.get('type', self.type)\n",
"for _, _, files in os.walk(self._buildPath(VAR_8, VAR_10=fileType)):\n",
"yield from files\n"
] | [
"def walkFiles(self, *segs, **kwargs):...\n",
"fileType = kwargs.get('type', self.type)\n",
"for _, _, files in os.walk(self._buildPath(segs, fileType=fileType)):\n",
"yield from files\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_19(VAR_10, VAR_20, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_67 = os.path.join(VAR_20, VAR_10.filename)\n",
"if os.path.exists(VAR_67):\n",
"VAR_1.info('File was already downloaded %s', VAR_67)\n",
"return None\n",
"if VAR_17:\n",
"return VAR_67\n",
"VAR_17.check_against_path(VAR_67)... | [
"def _check_download_dir(link, download_dir, hashes):...\n",
"\"\"\"docstring\"\"\"\n",
"download_path = os.path.join(download_dir, link.filename)\n",
"if os.path.exists(download_path):\n",
"logger.info('File was already downloaded %s', download_path)\n",
"return None\n",
"if hashes:\n",
"return downl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(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_online(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... | [
0,
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'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.