lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_6(self):...\n",
"self._record_users()\n",
"VAR_10 = self.get_success(self.handler.get_devices_by_user(VAR_0))\n",
"self.assertEqual(3, len(VAR_10))\n",
"VAR_14 = {d['device_id']: d for d in VAR_10}\n",
"self.assertDictContainsSubset({'user_id': VAR_0, 'device_id': 'xyz',\n 'display_name': 'di... | [
"def test_get_devices_by_user(self):...\n",
"self._record_users()\n",
"res = self.get_success(self.handler.get_devices_by_user(user1))\n",
"self.assertEqual(3, len(res))\n",
"device_map = {d['device_id']: d for d in res}\n",
"self.assertDictContainsSubset({'user_id': user1, 'device_id': 'xyz',\n 'displ... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_26: str, VAR_28: Optional[str]=None) ->Callable[[...\n",
"def FUNC_20(VAR_66: DecoratedCallable) ->DecoratedCallable:...\n",
"self.add_api_websocket_route(VAR_26, VAR_66, VAR_28=name)\n",
"return VAR_66\n"
] | [
"def websocket(self, path: str, name: Optional[str]=None) ->Callable[[...\n",
"def decorator(func: DecoratedCallable) ->DecoratedCallable:...\n",
"self.add_api_websocket_route(path, func, name=name)\n",
"return func\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/ajax/deleteuser', methods=['POST'])...\n",
"VAR_53 = request.form.to_dict(flat=False)\n",
"VAR_54 = None\n",
"if 'userid[]' in VAR_53:\n",
"VAR_54 = ub.session.query(ub.User).filter(ub.User.id.in_(VAR_53['userid[]'])\n ).all()\n",
"if 'userid' in VAR_53:\n",
"VAR_55 = 0\n",
"VAR_54 ... | [
"@admi.route('/ajax/deleteuser', methods=['POST'])...\n",
"user_ids = request.form.to_dict(flat=False)\n",
"users = None\n",
"if 'userid[]' in user_ids:\n",
"users = ub.session.query(ub.User).filter(ub.User.id.in_(user_ids['userid[]'])\n ).all()\n",
"if 'userid' in user_ids:\n",
"count = 0\n",
"use... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"For",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"AugAssign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assi... |
[
"def FUNC_6(VAR_2: Directive, VAR_11: str, VAR_12: list[InsertEntryOption],...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3, VAR_4 = FUNC_8(VAR_2, VAR_12, VAR_11)\n",
"VAR_23 = FUNC_7(VAR_2, VAR_13, VAR_5)\n",
"VAR_28 = file.readlines()\n",
"if VAR_4 is None:\n",
"VAR_28 += '\\n' + VAR_23\n",
"VAR_28.insert(... | [
"def insert_entry(entry: Directive, default_filename: str, insert_options:...\n",
"\"\"\"docstring\"\"\"\n",
"filename, lineno = find_insert_position(entry, insert_options, default_filename\n )\n",
"content = _format_entry(entry, currency_column, indent)\n",
"contents = file.readlines()\n",
"if lineno ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"@FUNC_27(VAR_87=True)...\n",
"return 'pong'\n"
] | [
"@whitelist(allow_guest=True)...\n",
"return 'pong'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@FUNC_0...\n",
"return SimpleHttpClient(self, http_proxy=os.getenvb(b'http_proxy'),\n https_proxy=os.getenvb(b'HTTPS_PROXY'))\n"
] | [
"@cache_in_self...\n",
"return SimpleHttpClient(self, http_proxy=os.getenvb(b'http_proxy'),\n https_proxy=os.getenvb(b'HTTPS_PROXY'))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_0(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = saved_model_utils.get_saved_model_tag_sets(VAR_2)\n",
"print('The given SavedModel contains the following tag-sets:')\n",
"for VAR_3 in sorted(VAR_25):\n",
"print('%r' % ', '.join(sorted(VAR_3)))\n"
] | [
"def _show_tag_sets(saved_model_dir):...\n",
"\"\"\"docstring\"\"\"\n",
"tag_sets = saved_model_utils.get_saved_model_tag_sets(saved_model_dir)\n",
"print('The given SavedModel contains the following tag-sets:')\n",
"for tag_set in sorted(tag_sets):\n",
"print('%r' % ', '.join(sorted(tag_set)))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"For",
"Expr'"
] |
[
"import base64\n",
"import logging\n",
"import pathlib\n",
"import uuid\n",
"from django.conf import settings\n",
"from django.utils.functional import cached_property\n",
"from storages.utils import safe_join\n",
"from s3file.storages import storage\n",
"VAR_0 = logging.getLogger('s3file')\n",
"\"... | [
"import base64\n",
"import logging\n",
"import pathlib\n",
"import uuid\n",
"from django.conf import settings\n",
"from django.utils.functional import cached_property\n",
"from storages.utils import safe_join\n",
"from s3file.storages import storage\n",
"logger = logging.getLogger('s3file')\n",
"\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"@expose('/login/')...\n",
"VAR_47 = request.environ.get('REMOTE_USER')\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"if VAR_47:\n",
"VAR_50 = self.appbuilder.sm.auth_user_remote_user(VAR_47)\n",
"flash(as_unicode(self.invalid_login_... | [
"@expose('/login/')...\n",
"username = request.environ.get('REMOTE_USER')\n",
"if g.user is not None and g.user.is_authenticated:\n",
"return redirect(self.appbuilder.get_url_for_index)\n",
"if username:\n",
"user = self.appbuilder.sm.auth_user_remote_user(username)\n",
"flash(as_unicode(self.invalid_lo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"@VAR_0.filter...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_4:\n",
"return ''\n",
"return mark_safe(FUNC_1(VAR_4)[1:-1] + VAR_5)\n"
] | [
"@register.filter...\n",
"\"\"\"docstring\"\"\"\n",
"if not d:\n",
"return ''\n",
"return mark_safe(json_dumps(d)[1:-1] + append)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"from __future__ import unicode_literals\n",
"import base64\n",
"import calendar\n",
"import datetime\n",
"import re\n",
"import sys\n",
"import unicodedata\n",
"from binascii import Error as BinasciiError\n",
"from email.utils import formatdate\n",
"from django.utils import six\n",
"from django... | [
"from __future__ import unicode_literals\n",
"import base64\n",
"import calendar\n",
"import datetime\n",
"import re\n",
"import sys\n",
"import unicodedata\n",
"from binascii import Error as BinasciiError\n",
"from email.utils import formatdate\n",
"from django.utils import six\n",
"from django... | [
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_29(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_41 = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'regress_x_to_y', '--inpu... | [
"def testRunCommandInputExamplesFeatureValueNotListError(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"output_dir = os.path.join(test.get_temp_dir(), 'new_dir')\n",
"args = self.parser.parse_args(['run', '--dir', base_path, '--tag... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_23=None):...\n",
"\"\"\"docstring\"\"\"\n",
"self.site = VAR_23 or ''\n"
] | [
"def __init__(self, site=None):...\n",
"\"\"\"docstring\"\"\"\n",
"self.site = site or ''\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_12(VAR_2, VAR_17, VAR_18=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_106 = None\n",
"if 'maps' in VAR_2:\n",
"VAR_196 = VAR_2['maps']\n",
"return VAR_106\n",
"VAR_106 = []\n",
"if isinstance(VAR_196, (unicode, str)):\n",
"VAR_1.debug('Invalid json for query ?maps=%s' % VAR_196)\n",
"VAR_1... | [
"def _get_maps_enabled(request, name, sizeC=0):...\n",
"\"\"\"docstring\"\"\"\n",
"codomains = None\n",
"if 'maps' in request:\n",
"map_json = request['maps']\n",
"return codomains\n",
"codomains = []\n",
"if isinstance(map_json, (unicode, str)):\n",
"logger.debug('Invalid json for query ?maps=%s' %... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'"
] |
[
"def FUNC_30(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_62 = '\\n'.join(['Usage example:',\n 'To compile a SavedModel signature via (CPU) XLA AOT:',\n '$saved_model_cli aot_compile_cpu \\\\', ' --dir /tmp/saved_model \\\\',\n ' --tag_set serve \\\\', ' --output_dir /tmp/saved_model_xla_aot',... | [
"def add_aot_compile_cpu_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"compile_msg = '\\n'.join(['Usage example:',\n 'To compile a SavedModel signature via (CPU) XLA AOT:',\n '$saved_model_cli aot_compile_cpu \\\\', ' --dir /tmp/saved_model \\\\',\n ' --tag_set serve \\\\', ' --output... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(self):...\n",
"VAR_24 = 'inputs=[{\"text\":[\"foo\"], \"bytes\":[b\"bar\"]}]'\n",
"VAR_22 = saved_model_cli.preprocess_input_examples_arg_string(VAR_24)\n",
"VAR_25 = example_pb2.Example.FromString(VAR_22['inputs'][0])\n",
"self.assertProtoEquals('string', VAR_25)\n"
] | [
"def testInputPreProcessExamplesWithStrAndBytes(self):...\n",
"input_examples_str = 'inputs=[{\"text\":[\"foo\"], \"bytes\":[b\"bar\"]}]'\n",
"input_dict = saved_model_cli.preprocess_input_examples_arg_string(\n input_examples_str)\n",
"feature = example_pb2.Example.FromString(input_dict['inputs'][0])\n",
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"import itertools\n",
"import os\n",
"import re\n",
"from urllib.parse import urlparse, ParseResult\n",
"from urlparse import urlparse, ParseResult\n",
"from django.conf import global_settings, settings\n",
"from django.contrib.sites.models import Site, RequestSite\n",
"from django.contrib.admin.model... | [
"import itertools\n",
"import os\n",
"import re\n",
"from urllib.parse import urlparse, ParseResult\n",
"from urlparse import urlparse, ParseResult\n",
"from django.conf import global_settings, settings\n",
"from django.contrib.sites.models import Site, RequestSite\n",
"from django.contrib.admin.model... | [
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Impo... |
[
"def FUNC_39(self):...\n",
"VAR_53.lib.sessions.expire()\n"
] | [
"def api_logout(self):...\n",
"cherrypy.lib.sessions.expire()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_75(self, VAR_90=None):...\n",
"if self.settings.enable_tokens is True:\n",
"VAR_141 = None\n",
"return self.requires(True, VAR_90=otherwise)\n",
"VAR_56 = VAR_263.request\n",
"VAR_85 = VAR_56.env.http_web2py_user_token or VAR_56.vars._token\n",
"VAR_277 = self.table_token()\n",
"VAR_254 = se... | [
"def requires_login_or_token(self, otherwise=None):...\n",
"if self.settings.enable_tokens is True:\n",
"user = None\n",
"return self.requires(True, otherwise=otherwise)\n",
"request = current.request\n",
"token = request.env.http_web2py_user_token or request.vars._token\n",
"table_token = self.table_to... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"@login_required()...\n",
""
] | [
"@login_required()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_75(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._set_canonical_alias({'alias': '@unknown:test'}, VAR_17=400)\n",
"self._set_canonical_alias({'alt_aliases': ['@unknown:test']}, VAR_17=400)\n"
] | [
"def test_bad_alias(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._set_canonical_alias({'alias': '@unknown:test'}, expected_code=400)\n",
"self._set_canonical_alias({'alt_aliases': ['@unknown:test']}, expected_code=400\n )\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"from builtins import range, str\n",
"import datetime\n",
"import json\n",
"import os\n",
"import subprocess\n",
"import sys\n",
"from math import ceil\n",
"from flask import Blueprint, Response, request, stream_with_context, url_for\n",
"from opendiamond.dataretriever.util import DiamondTextAttr\n"... | [
"from builtins import range, str\n",
"import datetime\n",
"import json\n",
"import os\n",
"import subprocess\n",
"import sys\n",
"from math import ceil\n",
"from flask import Blueprint, Response, request, stream_with_context, url_for\n",
"from opendiamond.dataretriever.util import DiamondTextAttr\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"FunctionDef'",
"Expr'",
"Condition",
... |
[
"def FUNC_41(self, VAR_5, VAR_7=False):...\n",
"VAR_3 = self.client.get('/login_required/')\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertURLEqual(VAR_3.url, VAR_5, VAR_7=parse_qs)\n"
] | [
"def assertLoginURLEquals(self, url, parse_qs=False):...\n",
"response = self.client.get('/login_required/')\n",
"self.assertEqual(response.status_code, 302)\n",
"self.assertURLEqual(response.url, url, parse_qs=parse_qs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_50(VAR_21):...\n",
"return VAR_21.depth, VAR_21.event_id\n"
] | [
"def sort_fun(ev):...\n",
"return ev.depth, ev.event_id\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0():...\n",
"VAR_0 = {'a': 'clsdict'}\n",
"VAR_4 = 'first'\n",
"VAR_5 = 'first'\n",
"VAR_5 = 'second'\n",
"VAR_6 = 'second'\n",
"VAR_1 = CLASS_6, CLASS_7\n",
"assert deep_getattr(VAR_0, VAR_1, 'a') == 'clsdict'\n",
"assert deep_getattr(VAR_0, VAR_1, 'b') == 'first'\n",
"assert deep_getat... | [
"def test_deep_getattr():...\n",
"clsdict = {'a': 'clsdict'}\n",
"a = 'first'\n",
"b = 'first'\n",
"b = 'second'\n",
"c = 'second'\n",
"bases = First, Second\n",
"assert deep_getattr(clsdict, bases, 'a') == 'clsdict'\n",
"assert deep_getattr(clsdict, bases, 'b') == 'first'\n",
"assert deep_getattr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Expr'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_0(self, VAR_3, VAR_4):...\n",
"VAR_51 = self.default_config()\n",
"VAR_51['allow_per_room_profiles'] = False\n",
"self.hs = self.setup_test_homeserver(VAR_51=config)\n",
"return self.hs\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"config = self.default_config()\n",
"config['allow_per_room_profiles'] = False\n",
"self.hs = self.setup_test_homeserver(config=config)\n",
"return self.hs\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"VAR_3 = '@foo:bar'\n",
"VAR_7 = 5000000\n",
"VAR_10 = UserPresenceState.default(VAR_3)\n",
"VAR_10 = VAR_10.copy_and_replace(VAR_10=PresenceState.ONLINE,\n last_active_ts=0, last_user_sync_ts=now - SYNC_ONLINE_TIMEOUT - 1)\n",
"VAR_9 = handle_timeout(VAR_10, is_mine=True, syn... | [
"def test_sync_timeout(self):...\n",
"user_id = '@foo:bar'\n",
"now = 5000000\n",
"state = UserPresenceState.default(user_id)\n",
"state = state.copy_and_replace(state=PresenceState.ONLINE, last_active_ts=0,\n last_user_sync_ts=now - SYNC_ONLINE_TIMEOUT - 1)\n",
"new_state = handle_timeout(state, is_mi... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1():...\n",
"assert utils.snake_case('HTTPResponse') == 'http_response'\n",
"assert utils.snake_case('APIClientHTTPResponse') == 'api_client_http_response'\n",
"assert utils.snake_case('OAuthClientHTTPResponse'\n ) == 'o_auth_client_http_response'\n"
] | [
"def test_snake_case_from_pascal_with_acronyms():...\n",
"assert utils.snake_case('HTTPResponse') == 'http_response'\n",
"assert utils.snake_case('APIClientHTTPResponse') == 'api_client_http_response'\n",
"assert utils.snake_case('OAuthClientHTTPResponse'\n ) == 'o_auth_client_http_response'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"@app.before_request...\n",
"VAR_6 = request.path.startswith('/login') or request.path.startswith('/static'\n ) or request.path.startswith('/api/login')\n",
"if not current_user.is_authenticated and not VAR_6:\n",
"return redirect(url_for('login', next=request.path))\n",
"return\n"
] | [
"@app.before_request...\n",
"allowed_path = request.path.startswith('/login') or request.path.startswith(\n '/static') or request.path.startswith('/api/login')\n",
"if not current_user.is_authenticated and not allowed_path:\n",
"return redirect(url_for('login', next=request.path))\n",
"return\n"
] | [
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_11):...\n",
"self.creator = self.register_user('creator', 'test')\n",
"self.creator_tok = self.login('creator', 'test')\n",
"self.second_user_id = self.register_user('second', 'test')\n",
"self.second_tok = self.login('second', 'test')\n",
"self.room_id = self.helper.cr... | [
"def prepare(self, reactor, clock, homeserver):...\n",
"self.creator = self.register_user('creator', 'test')\n",
"self.creator_tok = self.login('creator', 'test')\n",
"self.second_user_id = self.register_user('second', 'test')\n",
"self.second_tok = self.login('second', 'test')\n",
"self.room_id = self.he... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_20(self):...\n",
"from zope.tales.expressions import DeferWrapper\n",
"VAR_5 = self._makeContext()\n",
"VAR_7 = VAR_5.evaluate('defer: b')\n",
"self.assertIsInstance(VAR_7, DeferWrapper)\n"
] | [
"def test_defer_expression_returns_wrapper(self):...\n",
"from zope.tales.expressions import DeferWrapper\n",
"ec = self._makeContext()\n",
"defer = ec.evaluate('defer: b')\n",
"self.assertIsInstance(defer, DeferWrapper)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_49(self):...\n",
"self.admin_login(username='super', password='secret', login_url='/')\n",
"self.selenium.get('%s%s' % (self.live_server_url, '/admin_widgets/event/add/'))\n",
"VAR_51 = self.selenium.current_window_handle\n",
"self.assertEqual(self.selenium.find_element_by_id('id_supporting_bands'... | [
"def test_many_to_many(self):...\n",
"self.admin_login(username='super', password='secret', login_url='/')\n",
"self.selenium.get('%s%s' % (self.live_server_url, '/admin_widgets/event/add/'))\n",
"main_window = self.selenium.current_window_handle\n",
"self.assertEqual(self.selenium.find_element_by_id('id_su... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_16(*VAR_8):...\n",
""
] | [
"def _throw(*args):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_7(self):...\n",
"VAR_5 = {'types': ['m.room.message', 'org.matrix.foo.bar']}\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type=\n 'now.for.something.completely.different', room_id='!foo:bar')\n",
"self.assertFalse(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_types_works_with_unknowns(self):...\n",
"definition = {'types': ['m.room.message', 'org.matrix.foo.bar']}\n",
"event = MockEvent(sender='@foo:bar', type=\n 'now.for.something.completely.different', room_id='!foo:bar')\n",
"self.assertFalse(Filter(definition).check(event))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"\"\"\"Our own QNetworkAccessManager.\"\"\"\n",
"import collections\n",
"import html\n",
"import attr\n",
"from PyQt5.QtCore import pyqtSlot, pyqtSignal, QCoreApplication, QUrl, QByteArray\n",
"from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply, QSslSocket\n",
"from qutebrowser.config impo... | [
"\"\"\"Our own QNetworkAccessManager.\"\"\"\n",
"import collections\n",
"import html\n",
"import attr\n",
"from PyQt5.QtCore import pyqtSlot, pyqtSignal, QCoreApplication, QUrl, QByteArray\n",
"from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply, QSslSocket\n",
"from qutebrowser.config impo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",... |
[
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"import zmq\n",
"return True\n",
"VAR_18 = zmq.__version__\n",
"VAR_19 = re.match('^(\\\\d+)\\\\.(\\\\d+)(?:\\\\.(\\\\d+))?', VAR_18)\n",
"if not VAR_19:\n",
"VAR_32 = \"Using untested zmq python bindings version: '{0}'\".format(VAR_18)\n",
"VAR_20, V... | [
"def zmq_version():...\n",
"\"\"\"docstring\"\"\"\n",
"import zmq\n",
"return True\n",
"ver = zmq.__version__\n",
"match = re.match('^(\\\\d+)\\\\.(\\\\d+)(?:\\\\.(\\\\d+))?', ver)\n",
"if not match:\n",
"msg = \"Using untested zmq python bindings version: '{0}'\".format(ver)\n",
"major, minor, poin... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Import'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
... |
[
"def FUNC_25(VAR_36):...\n",
""
] | [
"def url_request(url):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_38(self):...\n",
"if self.flags.ignore_validate_update_after_submit:\n",
"return\n",
"self._validate_update_after_submit()\n",
"for VAR_21 in self.get_all_children():\n",
"if VAR_21.is_new() and self.meta.get_field(VAR_21.parentfield).allow_on_submit:\n",
"VAR_21._validate_update_after_submit(... | [
"def validate_update_after_submit(self):...\n",
"if self.flags.ignore_validate_update_after_submit:\n",
"return\n",
"self._validate_update_after_submit()\n",
"for d in self.get_all_children():\n",
"if d.is_new() and self.meta.get_field(d.parentfield).allow_on_submit:\n",
"d._validate_update_after_submit... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"For",
"Condition",
"Expr'"
] |
[
"async def FUNC_21():...\n",
"context_11.request = 'context_11'\n",
"VAR_52 = VAR_4.verify_json_objects_for_server([('server10', VAR_21, 0,\n 'test10'), ('server11', {}, 0, 'test11')])\n",
"self.assertTrue(VAR_52[1].called)\n",
"await VAR_52[1]\n",
"self.assertFalse(VAR_52[0].called)\n",
"self.assert... | [
"async def first_lookup():...\n",
"context_11.request = 'context_11'\n",
"res_deferreds = kr.verify_json_objects_for_server([('server10', json1, 0,\n 'test10'), ('server11', {}, 0, 'test11')])\n",
"self.assertTrue(res_deferreds[1].called)\n",
"await res_deferreds[1]\n",
"self.assertFalse(res_deferreds[... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return GroupAttestationSigning(self)\n"
] | [
"@cache_in_self...\n",
"return GroupAttestationSigning(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_30(self):...\n",
"self.assert_expected(self.folder.t, 'Default.html')\n"
] | [
"def testDefaultKeywordHandling(self):...\n",
"self.assert_expected(self.folder.t, 'Default.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(VAR_6):...\n",
"VAR_3 = '/srv/diamond/STREAM'\n",
"VAR_4 = VAR_6.dataroot\n"
] | [
"def init(config):...\n",
"INDEXDIR = '/srv/diamond/STREAM'\n",
"DATAROOT = config.dataroot\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for value in [-2 ** 53, 2 ** 53, 1.0, float('inf'), float('-inf'), float('nan')\n",
"event_from_pdu_json({'type': EventTypes.Message, 'content': {'foo': value},\n 'room_id': '!room:test', 'sender': '@user:test', 'depth': 1,\n 'prev_events': [], 'auth... | [
"def test_invalid_numbers(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for value in [-2 ** 53, 2 ** 53, 1.0, float('inf'), float('-inf'), float('nan')\n",
"event_from_pdu_json({'type': EventTypes.Message, 'content': {'foo': value},\n 'room_id': '!room:test', 'sender': '@user:test', 'depth': 1,\n 'prev_even... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._accepted_ssl_errors.clear()\n",
"self._rejected_ssl_errors.clear()\n"
] | [
"def clear_all_ssl_errors(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._accepted_ssl_errors.clear()\n",
"self._rejected_ssl_errors.clear()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(VAR_17, VAR_18, VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = {}\n",
"VAR_47 = FUNC_13(VAR_17)\n",
"VAR_48 = FUNC_14(VAR_18, VAR_19=False)\n",
"VAR_49 = FUNC_15(VAR_20)\n",
"for VAR_74, (filename, variable_name) in VAR_47.items():\n",
"VAR_73 = np.load(file_io.FileIO(filename, mode... | [
"def load_inputs_from_input_arg_string(inputs_str, input_exprs_str,...\n",
"\"\"\"docstring\"\"\"\n",
"tensor_key_feed_dict = {}\n",
"inputs = preprocess_inputs_arg_string(inputs_str)\n",
"input_exprs = preprocess_input_exprs_arg_string(input_exprs_str, safe=False)\n",
"input_examples = preprocess_input_e... | [
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Condition",
"For",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"As... |
[
"def FUNC_5(self, VAR_3, VAR_4):...\n",
"return django.forms.URLField(**options)\n"
] | [
"def create_url_field(self, field, options):...\n",
"return django.forms.URLField(**options)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@FUNC_0...\n",
"return MacaroonGenerator(self)\n"
] | [
"@cache_in_self...\n",
"return MacaroonGenerator(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.get_success(self.inject_room_member(self.room1, self.u_alice,\n Membership.JOIN))\n",
"VAR_13 = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Redaction, 'sender': self.u_alice.to_string(),\n 'room_id': s... | [
"def test_store_redacted_redaction(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.get_success(self.inject_room_member(self.room1, self.u_alice,\n Membership.JOIN))\n",
"builder = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Redaction, 'sender': self.u_alice.to_stri... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_12(VAR_16):...\n",
"return {str(u) for u in self.room_members}\n"
] | [
"async def get_users_in_room(room_id):...\n",
"return {str(u) for u in self.room_members}\n"
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import os\n",
"import json\n",
"import cherrypy\n",
"import codecs\n",
"import sys\n",
"from urllib.parse import unquote\n",
"from backport.urllib.parse import unquote\n",
"from urllib import parse\n",
"from backport.urllib import parse\n",
"import audiotranscode\n",
"... | [
"\"\"\"This class provides the api to talk to the client.\nIt will then call the cherrymodel, to get the\nrequested information\"\"\"\n",
"import os\n",
"import json\n",
"import cherrypy\n",
"import codecs\n",
"import sys\n",
"from urllib.parse import unquote\n",
"from backport.urllib.parse import unq... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",... |
[
"def __post_init__(self, VAR_5: str) ->None:...\n",
"super().__post_init__()\n",
"VAR_11 = Reference.from_ref(VAR_5)\n",
"VAR_12 = 0\n",
"while VAR_11.class_name in VAR_14:\n",
"VAR_17 = VAR_14[VAR_11.class_name]\n",
"self.reference = VAR_11\n",
"if self.values == VAR_17.values:\n",
"VAR_13 = {v: k ... | [
"def __post_init__(self, title: str) ->None:...\n",
"super().__post_init__()\n",
"reference = Reference.from_ref(title)\n",
"dedup_counter = 0\n",
"while reference.class_name in _existing_enums:\n",
"existing = _existing_enums[reference.class_name]\n",
"self.reference = reference\n",
"if self.values =... | [
0,
5,
0,
0,
0,
0,
0,
0,
5,
0,
5,
0,
5,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"AugAssign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_0):...\n",
"self.password = VAR_0\n",
"self.vault = VaultLib(VAR_0)\n"
] | [
"def __init__(self, password):...\n",
"self.password = password\n",
"self.vault = VaultLib(password)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils import has_common\n",
"VAR_17 = [d.role for d in frappe.get_all('Has Role', fields=['role'], VAR_6\n ={'parent': self.name})]\n",
"VAR_18 = get_custom_allowed_roles('report', self.name)\n",
"VAR_17.extend(VAR_18)\n",
"if not VAR... | [
"def is_permitted(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.utils import has_common\n",
"allowed = [d.role for d in frappe.get_all('Has Role', fields=['role'],\n filters={'parent': self.name})]\n",
"custom_roles = get_custom_allowed_roles('report', self.name)\n",
"allowed.extend(custom_role... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_1(VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"return urlutils.file_url(str(VAR_5))\n"
] | [
"def _file_url(path):...\n",
"\"\"\"docstring\"\"\"\n",
"return urlutils.file_url(str(path))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"async def FUNC_2(self, VAR_6: str, VAR_7: str, VAR_8: str, VAR_4: str,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.debug('Proxying threepid bind request for %s to %s', VAR_8, VAR_4)\n",
"if VAR_2 is None:\n",
"VAR_9 = False\n",
"VAR_36 = {}\n",
"VAR_37 = {'sid': VAR_7, 'client_secret': VAR_6, 'mxid': VAR_... | [
"async def bind_threepid(self, client_secret: str, sid: str, mxid: str,...\n",
"\"\"\"docstring\"\"\"\n",
"logger.debug('Proxying threepid bind request for %s to %s', mxid, id_server)\n",
"if id_access_token is None:\n",
"use_v2 = False\n",
"headers = {}\n",
"bind_data = {'sid': sid, 'client_secret': cl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"VAR_2 = self.setup_test_homeserver(http_client=None, homeserver_to_use=\n GenericWorkerServer)\n",
"return VAR_2\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"hs = self.setup_test_homeserver(http_client=None, homeserver_to_use=\n GenericWorkerServer)\n",
"return hs\n"
] | [
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@functools.wraps(VAR_2)...\n",
""
] | [
"@functools.wraps(builder)...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_7(self, VAR_2, VAR_3, VAR_16=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2.is_ajax():\n",
"VAR_0.debug('Request is Ajax, returning HTTP 403.')\n",
"for VAR_1 in settings.LOGIN_REDIRECT['redirect']:\n",
"VAR_0.error('Error while redirection on not logged in.', exc_info=True)\n",
"VAR_23 = ... | [
"def on_not_logged_in(self, request, url, error=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if request.is_ajax():\n",
"logger.debug('Request is Ajax, returning HTTP 403.')\n",
"for lookup_view in settings.LOGIN_REDIRECT['redirect']:\n",
"logger.error('Error while redirection on not logged in.', exc_info=Tru... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"For",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'"
] |
[
"@def_function.function...\n",
"if VAR_55:\n",
"return VAR_53 + VAR_54\n",
"return VAR_53 * VAR_54\n"
] | [
"@def_function.function...\n",
"if c:\n",
"return a + b\n",
"return a * b\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"@login_required()...\n",
"VAR_13 = int(VAR_13)\n",
"VAR_14 = int(VAR_14)\n",
"VAR_65 = VAR_8.getQueryService().findByQuery(\n 'select shape from Roi as roi join roi.shapes as shape where roi.id = %d and shape.id = %d'\n % (VAR_13, VAR_14), None)\n",
"VAR_1.debug('Shape: %r' % VAR_65)\n",
"if VAR_6... | [
"@login_required()...\n",
"roiId = int(roiId)\n",
"shapeId = int(shapeId)\n",
"shape = conn.getQueryService().findByQuery(\n 'select shape from Roi as roi join roi.shapes as shape where roi.id = %d and shape.id = %d'\n % (roiId, shapeId), None)\n",
"logger.debug('Shape: %r' % shape)\n",
"if shape i... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_44 = {}\n",
"VAR_45 = []\n",
"VAR_46 = []\n",
"VAR_44 = FUNC_58('/internal/jobs/statistics', 'get')\n",
"flash(str(err), 'danger')\n",
"return render_template('dashboard.html', title='Dashboard', VAR_44=\n quick_statistics, VAR_45=recent_job... | [
"@gui.route('/')...\n",
"\"\"\"docstring\"\"\"\n",
"quick_statistics = {}\n",
"recent_jobs_info = []\n",
"pinned_jobs_info = []\n",
"quick_statistics = query_internal_api('/internal/jobs/statistics', 'get')\n",
"flash(str(err), 'danger')\n",
"return render_template('dashboard.html', title='Dashboard',... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_27(self):...\n",
"return self._has_role(constants.ROLE_PASSWD)\n"
] | [
"def role_passwd(self):...\n",
"return self._has_role(constants.ROLE_PASSWD)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_33(VAR_19, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_67 = 'identifier-type-'\n",
"VAR_68 = 'identifier-val-'\n",
"VAR_69 = []\n",
"for type_key, type_value in VAR_19.items():\n",
"if not type_key.startswith(VAR_67):\n",
"return VAR_69\n",
"VAR_95 = VAR_68 + type_key[len(VAR_67):]\n",... | [
"def identifier_list(to_save, book):...\n",
"\"\"\"docstring\"\"\"\n",
"id_type_prefix = 'identifier-type-'\n",
"id_val_prefix = 'identifier-val-'\n",
"result = []\n",
"for type_key, type_value in to_save.items():\n",
"if not type_key.startswith(id_type_prefix):\n",
"return result\n",
"val_key = id_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_45(VAR_16):...\n",
"VAR_83 = False\n",
"VAR_83 |= FUNC_41(VAR_16, 'config_ldap_provider_url')\n",
"VAR_83 |= FUNC_38(VAR_16, 'config_ldap_port')\n",
"VAR_83 |= FUNC_38(VAR_16, 'config_ldap_authentication')\n",
"VAR_83 |= FUNC_41(VAR_16, 'config_ldap_dn')\n",
"VAR_83 |= FUNC_41(VAR_16, 'config_... | [
"def _configuration_ldap_helper(to_save):...\n",
"reboot_required = False\n",
"reboot_required |= _config_string(to_save, 'config_ldap_provider_url')\n",
"reboot_required |= _config_int(to_save, 'config_ldap_port')\n",
"reboot_required |= _config_int(to_save, 'config_ldap_authentication')\n",
"reboot_requ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"Expr'",
"Condition",
"AugAssign'",
"Expr'",
"Expr'",... |
[
"def FUNC_33(self):...\n",
"VAR_11 = self.folder.t\n",
"VAR_11.write('<p tal:define=\"p context/__class__\" />')\n",
"VAR_11()\n",
"VAR_11.write('<p tal:define=\"p nocall: random/_itertools/repeat\"/>')\n",
"VAR_11()\n",
"VAR_11.write('<p tal:content=\"random/_itertools/repeat/foobar\"/>')\n",
"VAR_11... | [
"def test_underscore_traversal(self):...\n",
"t = self.folder.t\n",
"t.write('<p tal:define=\"p context/__class__\" />')\n",
"t()\n",
"t.write('<p tal:define=\"p nocall: random/_itertools/repeat\"/>')\n",
"t()\n",
"t.write('<p tal:content=\"random/_itertools/repeat/foobar\"/>')\n",
"t()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"return self.repo\n"
] | [
"def get_repo_url(self):...\n",
"return self.repo\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_16: Optional[Mapping[str, Union[str, List[str]]]]) ->bytes:...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_16 is None:\n",
"return b''\n",
"VAR_38 = {}\n",
"for VAR_50, VAR_57 in VAR_16.items():\n",
"if isinstance(VAR_57, str):\n",
"VAR_39 = urllib.parse.urlencode(VAR_38, True)\n",
"VAR_5... | [
"def encode_query_args(args: Optional[Mapping[str, Union[str, List[str]]]]...\n",
"\"\"\"docstring\"\"\"\n",
"if args is None:\n",
"return b''\n",
"encoded_args = {}\n",
"for k, vs in args.items():\n",
"if isinstance(vs, str):\n",
"query_str = urllib.parse.urlencode(encoded_args, True)\n",
"vs = [vs... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_66(self):...\n",
"VAR_3 = self.client.post('/admin/auth/user/%s/password/' % self.admin.pk, {\n 'password1': 'password1', 'password2': 'password1'})\n",
"self.assertRedirects(VAR_3, '/admin/auth/user/%s/' % self.admin.pk)\n",
"VAR_28 = LogEntry.objects.latest('id')\n",
"self.assertEqual(VAR_28.... | [
"def test_user_change_password(self):...\n",
"response = self.client.post('/admin/auth/user/%s/password/' % self.admin.pk,\n {'password1': 'password1', 'password2': 'password1'})\n",
"self.assertRedirects(response, '/admin/auth/user/%s/' % self.admin.pk)\n",
"row = LogEntry.objects.latest('id')\n",
"self... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(VAR_13, VAR_7):...\n",
"VAR_82 = VAR_1.query(CLASS_14).filter(CLASS_14.user_id == VAR_7).filter(\n CLASS_14.book_id == VAR_13).first()\n",
"if not VAR_82:\n",
"VAR_90 = CLASS_14(VAR_7=user_id, VAR_13=book_id)\n",
"VAR_1.add(VAR_90)\n",
"VAR_1.commit()\n",
"VAR_1.rollback()\n"
] | [
"def update_download(book_id, user_id):...\n",
"check = session.query(Downloads).filter(Downloads.user_id == user_id).filter(\n Downloads.book_id == book_id).first()\n",
"if not check:\n",
"new_download = Downloads(user_id=user_id, book_id=book_id)\n",
"session.add(new_download)\n",
"session.commit()\n... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
""
] | [
""
] | [
0
] | [
"Condition"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>', methods=['DELETE'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_98 = FUNC_58(f'/internal/jobs/{VAR_9}', 'delete')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_98)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>', methods=['DELETE'])...\n",
"\"\"\"docstring\"\"\"\n",
"response_info = query_internal_api(f'/internal/jobs/{job_id}', 'delete')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(response_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_24(VAR_14, VAR_16, VAR_31, VAR_19):...\n",
"VAR_32 = calibre_db.session.query(db.Custom_Columns).filter(db.\n Custom_Columns.datatype.notin_(db.cc_exceptions)).filter(db.\n Custom_Columns.id == VAR_31).all()\n",
"return FUNC_26(VAR_14, VAR_16, VAR_19, VAR_32)\n"
] | [
"def edit_single_cc_data(book_id, book, column_id, to_save):...\n",
"cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.\n datatype.notin_(db.cc_exceptions)).filter(db.Custom_Columns.id == column_id\n ).all()\n",
"return edit_cc_data(book_id, book, to_save, cc)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_14():...\n",
"VAR_47 = f.readline()\n",
"VAR_47 = '/'.join(VAR_47.split('/')[:-2])\n",
"VAR_35 = []\n",
"for c in VAR_34:\n",
"VAR_35.append(FUNC_10(VAR_47 + '/' + c.strip()))\n",
"return VAR_35\n"
] | [
"def get_class_path():...\n",
"dataset_path = f.readline()\n",
"dataset_path = '/'.join(dataset_path.split('/')[:-2])\n",
"class_paths = []\n",
"for c in classes_list:\n",
"class_paths.append(_get_obj_absolute_path(dataset_path + '/' + c.strip()))\n",
"return class_paths\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"VAR_5 = self._makeContext()\n",
"VAR_5.evaluate('nocall:open')\n"
] | [
"def test_open_in_path_expr(self):...\n",
"ec = self._makeContext()\n",
"ec.evaluate('nocall:open')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_17 = VAR_2 / 'home'\n",
"VAR_17.ensure(dir=True)\n",
"VAR_8['HOME'] = str(VAR_17)\n",
"assert VAR_8['XDG_CONFIG_HOME'] == VAR_2 / 'config'\n",
"(VAR_2 / 'config' / 'user-dirs.dirs').write('XDG_DOWNLOAD_DIR=\"relative\"',\n ensure=True)\n",
... | [
"@pytest.mark.linux...\n",
"\"\"\"docstring\"\"\"\n",
"home = tmpdir / 'home'\n",
"home.ensure(dir=True)\n",
"temp_basedir_env['HOME'] = str(home)\n",
"assert temp_basedir_env['XDG_CONFIG_HOME'] == tmpdir / 'config'\n",
"(tmpdir / 'config' / 'user-dirs.dirs').write('XDG_DOWNLOAD_DIR=\"relative\"',\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"@VAR_2.route('/ajax/deleterestriction/<int:res_type>', methods=['POST'])...\n",
"return FUNC_33(VAR_8, 0)\n"
] | [
"@admi.route('/ajax/deleterestriction/<int:res_type>', methods=['POST'])...\n",
"return delete_restriction(res_type, 0)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@VAR_2.route('/ajax/table_settings', methods=['POST'])...\n",
"VAR_87.view_settings['table'] = json.loads(request.data)\n",
"VAR_3.error('Invalid request received: %r ', request)\n",
"return ''\n",
"flag_modified(VAR_87, 'view_settings')\n",
"ub.session.commit()\n",
"return 'Invalid request', 400\n"
] | [
"@web.route('/ajax/table_settings', methods=['POST'])...\n",
"current_user.view_settings['table'] = json.loads(request.data)\n",
"log.error('Invalid request received: %r ', request)\n",
"return ''\n",
"flag_modified(current_user, 'view_settings')\n",
"ub.session.commit()\n",
"return 'Invalid request', 4... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"return [entry.to_dict() for entry in self.model.randomMusicEntries(50)]\n"
] | [
"def api_generaterandomplaylist(self):...\n",
"return [entry.to_dict() for entry in self.model.randomMusicEntries(50)]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self, VAR_8, *VAR_9, **VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.isAuthorized():\n",
"VAR_53.session.release_lock()\n",
"if cherry.config['media.transcode'] and VAR_9:\n",
"VAR_93 = VAR_10.pop('bitrate', None) or None\n",
"if VAR_93:\n",
"VAR_9 = os.path.sep.join(VAR_9)\n",
... | [
"def trans(self, newformat, *path, **params):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.isAuthorized():\n",
"cherrypy.session.release_lock()\n",
"if cherry.config['media.transcode'] and path:\n",
"bitrate = params.pop('bitrate', None) or None\n",
"if bitrate:\n",
"path = os.path.sep.join(path)\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"async def FUNC_6(VAR_6):...\n",
""
] | [
"async def middleware_handler(request):...\n",
""
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Condition"
] |
[
"async def FUNC_22(self, VAR_11: str, VAR_12: str) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = await self.store.get_event(VAR_12, check_room_id=room_id)\n",
"VAR_100 = await self.state_store.get_state_groups_ids(VAR_11, [VAR_12])\n",
"if VAR_100:\n",
"VAR_166, VAR_2 = list(VAR_100.items()).pop... | [
"async def get_state_ids_for_pdu(self, room_id: str, event_id: str) ->List[str]:...\n",
"\"\"\"docstring\"\"\"\n",
"event = await self.store.get_event(event_id, check_room_id=room_id)\n",
"state_groups = await self.state_store.get_state_groups_ids(room_id, [event_id])\n",
"if state_groups:\n",
"_, state =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Assign'"
] |
[
"import json\n",
"from mock import ANY, Mock, call\n",
"from twisted.internet import defer\n",
"from synapse.api.errors import AuthError\n",
"from synapse.types import UserID, create_requester\n",
"from tests import unittest\n",
"from tests.test_utils import make_awaitable\n",
"from tests.unittest imp... | [
"import json\n",
"from mock import ANY, Mock, call\n",
"from twisted.internet import defer\n",
"from synapse.api.errors import AuthError\n",
"from synapse.types import UserID, create_requester\n",
"from tests import unittest\n",
"from tests.test_utils import make_awaitable\n",
"from tests.unittest imp... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_25(VAR_5, VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_78 = {'success': False}\n",
"for VAR_12, VAR_82 in VAR_17.items():\n",
"if VAR_12 == 'orphaned':\n",
"VAR_78['success'] = True\n",
"for VAR_13, children in VAR_82.items():\n",
"return JsonResponse(VAR_78)\n",
"for VAR_14, VAR_15 in ... | [
"def _api_links_DELETE(conn, json_data):...\n",
"\"\"\"docstring\"\"\"\n",
"response = {'success': False}\n",
"for parent_type, parents in json_data.items():\n",
"if parent_type == 'orphaned':\n",
"response['success'] = True\n",
"for parent_id, children in parents.items():\n",
"return JsonResponse(res... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Assign'",
"For",
"Return'",
"For",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'"... |
[
"def FUNC_10():...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_29:\n",
"from frappe.utils.redis_wrapper import RedisWrapper\n",
"return VAR_29\n",
"VAR_29 = RedisWrapper.from_url(VAR_13.get('redis_cache') or\n 'redis://localhost:11311')\n"
] | [
"def cache():...\n",
"\"\"\"docstring\"\"\"\n",
"if not redis_server:\n",
"from frappe.utils.redis_wrapper import RedisWrapper\n",
"return redis_server\n",
"redis_server = RedisWrapper.from_url(conf.get('redis_cache') or\n 'redis://localhost:11311')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"ImportFrom'",
"Return'",
"Assign'"
] |
[
"def FUNC_54(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(self.meta, 'track_seen', False):\n",
"frappe.db.set_value(self.doctype, self.name, '_seen', json.dumps([frappe.\n session.user]), VAR_27=False)\n"
] | [
"def reset_seen(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if getattr(self.meta, 'track_seen', False):\n",
"frappe.db.set_value(self.doctype, self.name, '_seen', json.dumps([frappe.\n session.user]), update_modified=False)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"def FUNC_9():...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.auth.models import User\n",
"return User.objects.filter(is_superuser=True)[0]\n"
] | [
"def get_admin():...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.auth.models import User\n",
"return User.objects.filter(is_superuser=True)[0]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_28(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertIs(VAR_5.evaluate('True'), True)\n",
"self.assertIs(VAR_5.evaluate('False'), False)\n",
"self.assertIs(VAR_5.evaluate('nocall: test'), safe_builtins['test'])\n"
] | [
"def test_builtin_in_path_expr(self):...\n",
"ec = self._makeContext()\n",
"self.assertIs(ec.evaluate('True'), True)\n",
"self.assertIs(ec.evaluate('False'), False)\n",
"self.assertIs(ec.evaluate('nocall: test'), safe_builtins['test'])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"super(CLASS_0, self).setUp()\n",
"if platform.system() == 'Windows':\n",
"self.skipTest('Skipping failing tests on Windows.')\n"
] | [
"def setUp(self):...\n",
"super(SavedModelCLITestCase, self).setUp()\n",
"if platform.system() == 'Windows':\n",
"self.skipTest('Skipping failing tests on Windows.')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"For",
"Expr'"
] |
[
"@VAR_0.route('/ajax/delete/<int:book_id>')...\n",
"return Response(FUNC_13(VAR_14, '', True), mimetype='application/json')\n"
] | [
"@editbook.route('/ajax/delete/<int:book_id>')...\n",
"return Response(delete_book_from_table(book_id, '', True), mimetype=\n 'application/json')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_21(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"from tensorflow.python.compiler.tensorrt import trt_convert as trt\n",
"if not VAR_20.convert_tf1_model:\n",
"VAR_73 = trt.DEFAULT_TRT_CONVERSION_PARAMS._replace(max_workspace_size_bytes\n =args.max_workspace_size_bytes, precision_mode=args.precisi... | [
"def convert_with_tensorrt(args):...\n",
"\"\"\"docstring\"\"\"\n",
"from tensorflow.python.compiler.tensorrt import trt_convert as trt\n",
"if not args.convert_tf1_model:\n",
"params = trt.DEFAULT_TRT_CONVERSION_PARAMS._replace(max_workspace_size_bytes\n =args.max_workspace_size_bytes, precision_mode=ar... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"return 'admin/projects', f'project-{VAR_39.name}'\n"
] | [
"@staticmethod...\n",
"return 'admin/projects', f'project-{field.name}'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_6() ->Optional[Text]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = check_output(['git', 'remote', 'get-url', 'origin'], stderr=DEVNULL)\n",
"return None\n",
"return hashlib.sha256(VAR_66).hexdigest()\n"
] | [
"def project_fingerprint() ->Optional[Text]:...\n",
"\"\"\"docstring\"\"\"\n",
"remote = check_output(['git', 'remote', 'get-url', 'origin'], stderr=DEVNULL)\n",
"return None\n",
"return hashlib.sha256(remote).hexdigest()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"VAR_5 = {'not_types': ['m.room.message', 'org.matrix.*']}\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='org.matrix.custom.event', room_id=\n '!foo:bar')\n",
"self.assertFalse(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_not_types_works_with_wildcards(self):...\n",
"definition = {'not_types': ['m.room.message', 'org.matrix.*']}\n",
"event = MockEvent(sender='@foo:bar', type='org.matrix.custom.event',\n room_id='!foo:bar')\n",
"self.assertFalse(Filter(definition).check(event))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/local/%s/users/%s/invite', VAR_30, VAR_16)\n",
"return self.client.post_json(VAR_5=destination, VAR_2=path, VAR_39=content,\n VAR_15=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/groups/local/%s/users/%s/invite', group_id, user_id)\n",
"return self.client.post_json(destination=destination, path=path, data=\n content, ignore_backoff=True)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return self.force_training or self.nlu\n"
] | [
"def should_retrain_nlu(self) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"return self.force_training or self.nlu\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@login_required(doConnectionCleanup=False)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_176 = VAR_2.GET.get('query', '*')\n",
"VAR_177 = FUNC_0(VAR_2, 'offset', 0)\n",
"VAR_88 = FUNC_0(VAR_2, 'limit', settings.PAGE)\n",
"VAR_178 = None\n",
"VAR_178 = VAR_350('omero_iviewer_index')\n",
"VAR_32 = VAR_241(VAR... | [
"@login_required(doConnectionCleanup=False)...\n",
"\"\"\"docstring\"\"\"\n",
"query = request.GET.get('query', '*')\n",
"offset = get_long_or_default(request, 'offset', 0)\n",
"limit = get_long_or_default(request, 'limit', settings.PAGE)\n",
"iviewer_url = None\n",
"iviewer_url = reverse('omero_iviewer... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For... |
[
"def __getattr__(VAR_59, VAR_60):...\n",
"if VAR_60 == 'nameResolver':\n",
"return VAR_49\n",
"return getattr(VAR_48, VAR_60)\n"
] | [
"def __getattr__(_self, attr):...\n",
"if attr == 'nameResolver':\n",
"return nameResolver\n",
"return getattr(real_reactor, attr)\n"
] | [
0,
4,
4,
4
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"VAR_20 = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"VAR_22 = saved_model_cli.preprocess_inputs_arg_string(VAR_20)\n",
"self.assertTrue(VAR_22['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'))\n",
"self.assertTrue(VAR_22['i... | [
"def testInputPreProcessFileNames(self):...\n",
"input_str = (\n 'inputx=C:\\\\Program Files\\\\data.npz[v:0];input:0=c:\\\\PROGRA~1\\\\data.npy')\n",
"input_dict = saved_model_cli.preprocess_inputs_arg_string(input_str)\n",
"self.assertTrue(input_dict['inputx'] == ('C:\\\\Program Files\\\\data.npz', 'v:0'... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(*VAR_15):...\n",
"return defer.succeed(None)\n"
] | [
"def get_received_txn_response(*args):...\n",
"return defer.succeed(None)\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'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.