lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_20(VAR_56, VAR_46):...\n",
"return os.path.exists(VAR_56) and os.access(VAR_56, VAR_46\n ) and not os.path.isdir(VAR_56)\n"
] | [
"def _access_check(fn, mode):...\n",
"return os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_35():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = request.args(0)\n",
"VAR_96 = request.args(1)\n",
"VAR_97 = 'plugin_' + VAR_96\n",
"VAR_46 = FORM.confirm(T('Delete'), {T('Cancel'): URL('design', VAR_98=app)})\n",
"if VAR_46.accepted:\n",
"return dict(VAR_46=dialog, VAR_96=plugin)\n",
"for... | [
"def delete_plugin():...\n",
"\"\"\"docstring\"\"\"\n",
"app = request.args(0)\n",
"plugin = request.args(1)\n",
"plugin_name = 'plugin_' + plugin\n",
"dialog = FORM.confirm(T('Delete'), {T('Cancel'): URL('design', args=app)})\n",
"if dialog.accepted:\n",
"return dict(dialog=dialog, plugin=plugin)\n",... | [
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'",
"Condition",
"Return'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_61(VAR_70):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_137 = {' ': 'normal', '+': 'plus', '-': 'minus'}\n",
"return VAR_137[VAR_70[0]]\n"
] | [
"def getclass(item):...\n",
"\"\"\"docstring\"\"\"\n",
"operators = {' ': 'normal', '+': 'plus', '-': 'minus'}\n",
"return operators[item[0]]\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_31=None, VAR_32=None, VAR_33=None, VAR_34=True):...\n",
"VAR_222 = self.settings = Settings()\n",
"VAR_222.server = VAR_31\n",
"VAR_222.sender = VAR_32\n",
"VAR_222.login = VAR_33\n",
"VAR_222.tls = VAR_34\n",
"VAR_222.timeout = 5\n",
"VAR_222.hostname = None\n",
"VAR_222.ssl... | [
"def __init__(self, server=None, sender=None, login=None, tls=True):...\n",
"settings = self.settings = Settings()\n",
"settings.server = server\n",
"settings.sender = sender\n",
"settings.login = login\n",
"settings.tls = tls\n",
"settings.timeout = 5\n",
"settings.hostname = None\n",
"settings.ssl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.handler.set_displayname(self.frank, synapse\n .types.create_requester(self.frank), 'Frank Jr.'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_displayname(self.frank.localpart))), 'Frank Jr.')\n",
"yield defer... | [
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.handler.set_displayname(self.frank, synapse\n .types.create_requester(self.frank), 'Frank Jr.'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_displayname(self.frank.localpart))), 'Frank Jr.')\n",
"yield defer... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@app.route('/')...\n",
"from octoprint.server import connectivityChecker, printer\n",
"VAR_46 = settings().getBoolean(['devel', 'cache', 'preemptive'])\n",
"VAR_14 = g.locale.language if g.locale else 'en'\n",
"def FUNC_25(VAR_18):...\n",
"return VAR_18 is not None and bool(VAR_18['wizard']['order'])\n"
... | [
"@app.route('/')...\n",
"from octoprint.server import connectivityChecker, printer\n",
"preemptive_cache_enabled = settings().getBoolean(['devel', 'cache',\n 'preemptive'])\n",
"locale = g.locale.language if g.locale else 'en'\n",
"def wizard_active(templates):...\n",
"return templates is not None and ... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_84(VAR_72, *VAR_73):...\n",
"def FUNC_86(self, VAR_25, *VAR_0, **VAR_1):...\n",
"FUNC_83(self, VAR_72(self, *VAR_0, **kwargs))\n",
"for VAR_6 in VAR_73:\n",
"FUNC_83(self, VAR_6(self, VAR_25, *VAR_0, **kwargs))\n",
"return self._return_value\n"
] | [
"def compose(fn, *hooks):...\n",
"def runner(self, method, *args, **kwargs):...\n",
"add_to_return_value(self, fn(self, *args, **kwargs))\n",
"for f in hooks:\n",
"add_to_return_value(self, f(self, method, *args, **kwargs))\n",
"return self._return_value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_28(self):...\n",
"VAR_25 = widgets.url_params_from_lookup_dict({'color__in': ('red', 'blue')})\n",
"VAR_26 = widgets.url_params_from_lookup_dict({'color__in': ['red', 'blue']})\n",
"self.assertEqual(VAR_25, {'color__in': 'red,blue'})\n",
"self.assertEqual(VAR_25, VAR_26)\n"
] | [
"def test_url_params_from_lookup_dict_any_iterable(self):...\n",
"lookup1 = widgets.url_params_from_lookup_dict({'color__in': ('red', 'blue')})\n",
"lookup2 = widgets.url_params_from_lookup_dict({'color__in': ['red', 'blue']})\n",
"self.assertEqual(lookup1, {'color__in': 'red,blue'})\n",
"self.assertEqual(l... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_10: str, VAR_11: Optional[Iterable[str]]=None):...\n",
"self.msg = VAR_10\n",
"self.path = VAR_11\n"
] | [
"def __init__(self, msg: str, path: Optional[Iterable[str]]=None):...\n",
"self.msg = msg\n",
"self.path = path\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(VAR_0, VAR_1):...\n",
"return FUNC_0(VAR_0=request, VAR_1=pk, VAR_2='is_globally_pinned', VAR_3=\n True, VAR_4=Comment.PINNED, VAR_5=_('The topic has been globally pinned'))\n"
] | [
"def global_pin(request, pk):...\n",
"return _moderate(request=request, pk=pk, field_name='is_globally_pinned',\n to_value=True, action=Comment.PINNED, message=_(\n 'The topic has been globally pinned'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_22(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = VAR_20.checkpoint_path or os.path.join(VAR_20.dir,\n 'variables/variables')\n",
"if not VAR_20.variables_to_feed:\n",
"VAR_75 = []\n",
"if VAR_20.variables_to_feed.lower() == 'all':\n",
"saved_model_aot_compile.aot_compile_cpu_meta_gra... | [
"def aot_compile_cpu(args):...\n",
"\"\"\"docstring\"\"\"\n",
"checkpoint_path = args.checkpoint_path or os.path.join(args.dir,\n 'variables/variables')\n",
"if not args.variables_to_feed:\n",
"variables_to_feed = []\n",
"if args.variables_to_feed.lower() == 'all':\n",
"saved_model_aot_compile.aot_co... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(self, VAR_3, VAR_4, VAR_5):...\n",
"self.owner = self.register_user('owner', 'pass')\n",
"self.owner_tok = self.login('owner', 'pass')\n",
"self.profile_url = '/profile/%s' % self.owner\n",
"self.requester = self.register_user('requester', 'pass')\n",
"self.requester_tok = self.login('requeste... | [
"def prepare(self, reactor, clock, hs):...\n",
"self.owner = self.register_user('owner', 'pass')\n",
"self.owner_tok = self.login('owner', 'pass')\n",
"self.profile_url = '/profile/%s' % self.owner\n",
"self.requester = self.register_user('requester', 'pass')\n",
"self.requester_tok = self.login('requeste... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_24(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_44 = np.array([[1], [2]])\n",
"VAR_45 = np.zeros((6, 3))\n",
"VAR_31 = os.path.join(test.get_temp_dir(), 'testRunCommandNewOutdir_inputs.npz'\n )\n",
"VAR_41 = os.path.join(te... | [
"def testRunCommandNewOutdir(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"x = np.array([[1], [2]])\n",
"x_notused = np.zeros((6, 3))\n",
"input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandNewOutdir_inputs.npz')... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"if 'onelogin' not in current_app.config.get('ACTIVE_PROVIDERS'):\n",
"return 'Onelogin is not enabled in the config. See the ACTIVE_PROVIDERS section.', 404\n",
"VAR_5 = OneLogin_Saml2_Auth(self.req, current_app.config.get(\n 'ONELOGIN_SETTINGS'))\n",
"self.reqparse.add_argume... | [
"def post(self):...\n",
"if 'onelogin' not in current_app.config.get('ACTIVE_PROVIDERS'):\n",
"return 'Onelogin is not enabled in the config. See the ACTIVE_PROVIDERS section.', 404\n",
"auth = OneLogin_Saml2_Auth(self.req, current_app.config.get(\n 'ONELOGIN_SETTINGS'))\n",
"self.reqparse.add_argument(... | [
0,
0,
0,
0,
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'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Ex... |
[
"@VAR_0.user_loader...\n",
"VAR_12 = FUNC_7(VAR_8)\n",
"if VAR_12:\n",
"return VAR_12\n",
"VAR_13 = current_org._get_current_object()\n",
"VAR_20, VAR_26 = VAR_7.split('-')\n",
"return None\n",
"VAR_12 = models.User.get_by_id_and_org(VAR_20, VAR_13)\n",
"if VAR_12.is_disabled or VAR_12.get_id() != V... | [
"@login_manager.user_loader...\n",
"user = api_key_load_user_from_request(request)\n",
"if user:\n",
"return user\n",
"org = current_org._get_current_object()\n",
"user_id, _ = user_id_with_identity.split('-')\n",
"return None\n",
"user = models.User.get_by_id_and_org(user_id, org)\n",
"if user.is_d... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"async def FUNC_4(VAR_6, VAR_7):...\n",
"if 'json' not in VAR_7.headers['Content-Type']:\n",
"if VAR_6.path.endswith('/'):\n",
"return VAR_7\n",
"return web.HTTPFound(VAR_6.path.rstrip('/'))\n",
"return web.json_response({'status': 404, 'message': \"Page '{}' not found\".\n format(VAR_6.path)}, status=... | [
"async def handle_404(request, response):...\n",
"if 'json' not in response.headers['Content-Type']:\n",
"if request.path.endswith('/'):\n",
"return response\n",
"return web.HTTPFound(request.path.rstrip('/'))\n",
"return web.json_response({'status': 404, 'message': \"Page '{}' not found\".\n format(re... | [
0,
0,
0,
0,
4,
0
] | [
"AsyncFunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_4(self, VAR_0, VAR_1, VAR_3):...\n",
"self.store = VAR_3.get_datastore()\n",
"self.handler = VAR_3.get_directory_handler()\n",
"self.state_handler = VAR_3.get_state_handler()\n",
"self.admin_user = self.register_user('admin', 'pass', admin=True)\n",
"self.admin_user_tok = self.login('admin', 'pa... | [
"def prepare(self, reactor, clock, hs):...\n",
"self.store = hs.get_datastore()\n",
"self.handler = hs.get_directory_handler()\n",
"self.state_handler = hs.get_state_handler()\n",
"self.admin_user = self.register_user('admin', 'pass', admin=True)\n",
"self.admin_user_tok = self.login('admin', 'pass')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_23(self, VAR_19, VAR_36, VAR_37):...\n",
"if VAR_19 is None:\n",
"return VAR_36 == VAR_37\n",
"VAR_44 = VAR_3()\n",
"return getattr(VAR_36, VAR_19, VAR_44) == getattr(VAR_37, VAR_19, VAR_44\n ) is not VAR_44\n"
] | [
"def same_part(self, name, ob1, ob2):...\n",
"if name is None:\n",
"return ob1 == ob2\n",
"no = object()\n",
"return getattr(ob1, name, no) == getattr(ob2, name, no) is not no\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_20(VAR_24, VAR_16, VAR_25=False, VAR_26=None):...\n",
"VAR_60 = VAR_24.split(',')\n",
"VAR_61 = []\n",
"if not VAR_25:\n",
"VAR_62 = isoLanguages.get_language_codes(get_locale(), VAR_60, VAR_61)\n",
"VAR_62 = isoLanguages.get_valid_language_codes(get_locale(), VAR_60, VAR_61)\n",
"for l in VAR... | [
"def edit_book_languages(languages, book, upload=False, invalid=None):...\n",
"input_languages = languages.split(',')\n",
"unknown_languages = []\n",
"if not upload:\n",
"input_l = isoLanguages.get_language_codes(get_locale(), input_languages,\n unknown_languages)\n",
"input_l = isoLanguages.get_valid_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self, VAR_18: List[str], VAR_19: Optional[str]=None, VAR_20:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_57 = []\n",
"VAR_58 = [self.default_template_dir]\n",
"if VAR_19:\n",
"if not self.path_exists(VAR_19):\n",
"VAR_59 = jinja2.FileSystemLoader(VAR_58)\n",
"VAR_58.insert(0, VAR_19)\n",
"VA... | [
"def read_templates(self, filenames: List[str], custom_template_directory:...\n",
"\"\"\"docstring\"\"\"\n",
"templates = []\n",
"search_directories = [self.default_template_dir]\n",
"if custom_template_directory:\n",
"if not self.path_exists(custom_template_directory):\n",
"loader = jinja2.FileSystemLo... | [
0,
0,
2,
0,
0,
0,
0,
0,
2,
0,
2,
2,
2,
2
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"VAR_62 = self.useroptions.forUser(self.getUserId())\n",
"VAR_62.setOption('last_time_online', int(time.time()))\n"
] | [
"def api_heartbeat(self):...\n",
"uo = self.useroptions.forUser(self.getUserId())\n",
"uo.setOption('last_time_online', int(time.time()))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_27(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_58 = 'string'\n",
"VAR_59 = VAR_23.add_parser('convert', description=convert_msg,\n formatter_class=argparse.RawTextHelpFormatter)\n",
"VAR_59.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to con... | [
"def add_convert_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"convert_msg = \"\"\"Usage example:\nTo convert the SavedModel to one that have TensorRT ops:\n$saved_model_cli convert \\\\\n --dir /tmp/saved_model \\\\\n --tag_set serve \\\\\n --output_dir /tmp/saved_model_trt \\\\\n tensorrt ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(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=now)\n",
"VAR_9 = VAR_8.copy_and_replace(VAR_10=PresenceState.ONLINE)\n",
"VAR_10, VAR_11... | [
"def test_remote_ping_timer(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)\n",
"new_state = prev_state.copy_and_replac... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_56(self, VAR_18, VAR_26=None, VAR_27=True, VAR_28=False, VAR_29=False...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_18, dict):\n",
"self.update(VAR_18)\n",
"self.set(VAR_18, VAR_26)\n",
"if VAR_27 and (self.doctype, self.name) not in frappe.flags.currently_saving:\n",
"self.set('modifie... | [
"def db_set(self, fieldname, value=None, update_modified=True, notify=False,...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(fieldname, dict):\n",
"self.update(fieldname)\n",
"self.set(fieldname, value)\n",
"if update_modified and (self.doctype, self.name\n",
"self.set('modified', now())\n",
"self.lo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = self.client.get('/password_reset/')\n",
"self.assertEqual(VAR_3.status_code, 200)\n",
"VAR_3 = self.client.post('/password_reset/', {'email':\n 'not_a_real_email@email.com'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.assertEq... | [
"def test_email_not_found(self):...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.get('/password_reset/')\n",
"self.assertEqual(response.status_code, 200)\n",
"response = self.client.post('/password_reset/', {'email':\n 'not_a_real_email@email.com'})\n",
"self.assertEqual(response.status_code,... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(self, **VAR_4):...\n",
"self.view_config.revert()\n",
"return HttpResponse(\n '<html><script>parent.location.reload()</script>%s.</html>' % _('Reverted')\n )\n"
] | [
"def dispatch_revert(self, **kwargs):...\n",
"self.view_config.revert()\n",
"return HttpResponse(\n '<html><script>parent.location.reload()</script>%s.</html>' % _('Reverted')\n )\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(VAR_19: Text, VAR_20: Optional[Union[Path, Text]]=None...\n",
"\"\"\"docstring\"\"\"\n",
"import tarfile\n",
"if VAR_20 is None:\n",
"VAR_20 = tempfile.mkdtemp()\n",
"tar.extractall(VAR_20)\n",
"VAR_0.error(f'Failed to extract model at {VAR_19}. Error: {e}')\n",
"return TempDirectoryPath(V... | [
"def unpack_model(model_file: Text, working_directory: Optional[Union[Path,...\n",
"\"\"\"docstring\"\"\"\n",
"import tarfile\n",
"if working_directory is None:\n",
"working_directory = tempfile.mkdtemp()\n",
"tar.extractall(working_directory)\n",
"logger.error(f'Failed to extract model at {model_file}.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Import'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"VAR_11 = JsonResource(self.hs)\n",
"VersionServlet(self.hs).register(VAR_11)\n",
"return VAR_11\n"
] | [
"def create_test_resource(self):...\n",
"resource = JsonResource(self.hs)\n",
"VersionServlet(self.hs).register(resource)\n",
"return resource\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@CLASS_4('javascript')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_15 = VAR_3.path()\n",
"if VAR_15:\n",
"VAR_15 = 'javascript' + os.sep.join(VAR_15.split('/'))\n",
"return 'text/html', utils.read_file(VAR_15, binary=False)\n"
] | [
"@add_handler('javascript')...\n",
"\"\"\"docstring\"\"\"\n",
"path = url.path()\n",
"if path:\n",
"path = 'javascript' + os.sep.join(path.split('/'))\n",
"return 'text/html', utils.read_file(path, binary=False)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_76(self, VAR_146=None, VAR_147=None, VAR_90=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_160(self=self, VAR_147=VAR_147, VAR_146=VAR_146):...\n",
"return self.has_membership(VAR_147=group_id, VAR_146=role)\n"
] | [
"def requires_membership(self, role=None, group_id=None, otherwise=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def has_membership(self=self, group_id=group_id, role=role):...\n",
"return self.has_membership(group_id=group_id, role=role)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = signedjson.key.generate_signing_key('abc')\n",
"self.expect_outgoing_key_request('targetserver', VAR_14)\n",
"VAR_21 = 'ed25519:%s' % (VAR_14.version,)\n",
"VAR_22 = PerspectivesKeyFetcher(self.hs2)\n",
"VAR_23 = VAR_22.get_keys({'targetserv... | [
"def test_get_key(self):...\n",
"\"\"\"docstring\"\"\"\n",
"testkey = signedjson.key.generate_signing_key('abc')\n",
"self.expect_outgoing_key_request('targetserver', testkey)\n",
"keyid = 'ed25519:%s' % (testkey.version,)\n",
"fetcher = PerspectivesKeyFetcher(self.hs2)\n",
"d = fetcher.get_keys({'targe... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Expr'"
] |
[
"def FUNC_15(VAR_20, VAR_17):...\n",
"VAR_48 = False\n",
"if VAR_20['rating'].strip():\n",
"VAR_84 = False\n",
"if len(VAR_17.ratings) > 0:\n",
"if len(VAR_17.ratings) > 0:\n",
"VAR_17.ratings.remove(VAR_17.ratings[0])\n",
"return VAR_48\n",
"VAR_84 = VAR_17.ratings[0].rating\n",
"VAR_85 = int(flo... | [
"def edit_book_ratings(to_save, book):...\n",
"changed = False\n",
"if to_save['rating'].strip():\n",
"old_rating = False\n",
"if len(book.ratings) > 0:\n",
"if len(book.ratings) > 0:\n",
"book.ratings.remove(book.ratings[0])\n",
"return changed\n",
"old_rating = book.ratings[0].rating\n",
"rating... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"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 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
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_33(VAR_62=None, VAR_93='read', VAR_94=None, VAR_10=None, VAR_95=...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_62 and VAR_94:\n",
"VAR_62 = VAR_94.doctype\n",
"import frappe.permissions\n",
"VAR_179 = frappe.permissions.has_permission(VAR_62, VAR_93, VAR_94=doc,\n VAR_95=verbose, VAR_10=user,... | [
"def has_permission(doctype=None, ptype='read', doc=None, user=None, verbose...\n",
"\"\"\"docstring\"\"\"\n",
"if not doctype and doc:\n",
"doctype = doc.doctype\n",
"import frappe.permissions\n",
"out = frappe.permissions.has_permission(doctype, ptype, doc=doc, verbose=\n verbose, user=user, raise_ex... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Import'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'"
] |
[
"@wraps(VAR_2)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return VAR_2(*VAR_48, **kwargs)\n",
"abort(403)\n"
] | [
"@wraps(f)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return f(*args, **kwargs)\n",
"abort(403)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_11(self, VAR_0):...\n",
"VAR_13 = VAR_0.patch('httpx.get', side_effect=httpcore.NetworkError)\n",
"VAR_14 = VAR_0.patch('openapi_python_client.Path')\n",
"VAR_15 = VAR_0.patch('yaml.safe_load')\n",
"from openapi_python_client import _get_document\n",
"VAR_6 = VAR_0.MagicMock()\n",
"VAR_11 = VA... | [
"def test__get_document_bad_url(self, mocker):...\n",
"get = mocker.patch('httpx.get', side_effect=httpcore.NetworkError)\n",
"Path = mocker.patch('openapi_python_client.Path')\n",
"loads = mocker.patch('yaml.safe_load')\n",
"from openapi_python_client import _get_document\n",
"url = mocker.MagicMock()\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assert'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"async def FUNC_15(VAR_41):...\n",
"VAR_2, VAR_6 = VAR_41\n",
"VAR_31 = await self.get_server_verify_key_v2_direct(VAR_2, VAR_6)\n",
"VAR_0.warning('Error looking up keys %s from %s: %s', VAR_6, VAR_2, e)\n",
"VAR_26[VAR_2] = VAR_31\n",
"VAR_0.exception('Error getting keys %s from %s', VAR_6, VAR_2)\n"
] | [
"async def get_key(key_to_fetch_item):...\n",
"server_name, key_ids = key_to_fetch_item\n",
"keys = await self.get_server_verify_key_v2_direct(server_name, key_ids)\n",
"logger.warning('Error looking up keys %s from %s: %s', key_ids, server_name, e)\n",
"results[server_name] = keys\n",
"logger.exception('... | [
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"from Products.PageTemplates.Expressions import createZopeEngine\n",
"return createZopeEngine()\n"
] | [
"def _makeEngine(self):...\n",
"from Products.PageTemplates.Expressions import createZopeEngine\n",
"return createZopeEngine()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_30(VAR_2, VAR_5=None, **VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_267 = FUNC_2(VAR_2, 'id')\n",
"return HttpResponseBadRequest('Invalid parameter value')\n",
"VAR_83 = list()\n",
"VAR_84 = None\n",
"for VAR_260 in VAR_267:\n",
"return HttpResponseBadRequest(e.message)\n",
"return Json... | [
"def api_tags_and_tagged_list_DELETE(request, conn=None, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"tag_ids = get_longs(request, 'id')\n",
"return HttpResponseBadRequest('Invalid parameter value')\n",
"dcs = list()\n",
"handle = None\n",
"for tag_id in tag_ids:\n",
"return HttpResponseBadRequest(e.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"For",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_26(VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_56 = 'string'\n",
"VAR_57 = VAR_23.add_parser('scan', description=scan_msg, formatter_class=\n argparse.RawTextHelpFormatter)\n",
"VAR_57.add_argument('--dir', type=str, required=True, help=\n 'directory containing the SavedModel to execute'... | [
"def add_scan_subparser(subparsers):...\n",
"\"\"\"docstring\"\"\"\n",
"scan_msg = \"\"\"Usage example:\nTo scan for denylisted ops in SavedModel:\n$saved_model_cli scan --dir /tmp/saved_model\nTo scan a specific MetaGraph, pass in --tag_set\n\"\"\"\n",
"parser_scan = subparsers.add_parser('scan', description... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_64(self, VAR_16: str, VAR_17: int=200) ->JsonDict:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22, VAR_23 = self.make_request('GET', \n '/_matrix/client/unstable/org.matrix.msc2432/rooms/%s/aliases' % (self.\n room_id,), VAR_16=access_token)\n",
"self.assertEqual(VAR_23.code, VAR_17, VAR_23.result)... | [
"def _get_aliases(self, access_token: str, expected_code: int=200) ->JsonDict:...\n",
"\"\"\"docstring\"\"\"\n",
"request, channel = self.make_request('GET', \n '/_matrix/client/unstable/org.matrix.msc2432/rooms/%s/aliases' % (self.\n room_id,), access_token=access_token)\n",
"self.assertEqual(channel.c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_86(self, VAR_25, *VAR_0, **VAR_1):...\n",
"FUNC_83(self, VAR_72(self, *VAR_0, **kwargs))\n",
"for VAR_6 in VAR_73:\n",
"FUNC_83(self, VAR_6(self, VAR_25, *VAR_0, **kwargs))\n",
"return self._return_value\n"
] | [
"def runner(self, method, *args, **kwargs):...\n",
"add_to_return_value(self, fn(self, *args, **kwargs))\n",
"for f in hooks:\n",
"add_to_return_value(self, f(self, method, *args, **kwargs))\n",
"return self._return_value\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def __init__(self):...\n",
"self.called = False\n"
] | [
"def __init__(self):...\n",
"self.called = False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"async def FUNC_8(self, VAR_17: str, VAR_16: str, VAR_37: Optional[JsonDict]...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = CLASS_0(VAR_15='POST', VAR_17=destination, VAR_16=path, VAR_20=\n args, VAR_18=data)\n",
"VAR_12 = self.clock.time_msec()\n",
"VAR_11 = await self._send_request(VAR_10, VAR_30=long_ret... | [
"async def post_json(self, destination: str, path: str, data: Optional[...\n",
"\"\"\"docstring\"\"\"\n",
"request = MatrixFederationRequest(method='POST', destination=destination,\n path=path, query=args, json=data)\n",
"start_ms = self.clock.time_msec()\n",
"response = await self._send_request(request,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@login_required...\n",
"VAR_3 = get_object_or_404(Comment.objects.exclude(user=request.user), VAR_2\n =comment_id)\n",
"VAR_4 = LikeForm(user=request.user, VAR_3=comment, data=post_data(request))\n",
"if is_post(VAR_0) and VAR_4.is_valid():\n",
"VAR_5 = VAR_4.save()\n",
"return render(VAR_0=request, t... | [
"@login_required...\n",
"comment = get_object_or_404(Comment.objects.exclude(user=request.user), pk=\n comment_id)\n",
"form = LikeForm(user=request.user, comment=comment, data=post_data(request))\n",
"if is_post(request) and form.is_valid():\n",
"like = form.save()\n",
"return render(request=request, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_17(self):...\n",
"VAR_5 = self.get_counts('json', period='this-year')\n",
"self.assertEqual(VAR_5.status_code, 200)\n",
"self.assertJSONEqual(VAR_5.content.decode(), VAR_0)\n"
] | [
"def test_counts_view_this_year(self):...\n",
"response = self.get_counts('json', period='this-year')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertJSONEqual(response.content.decode(), COUNTS_DATA)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_41(self):...\n",
"VAR_85 = self.allowed_column_value or ''\n",
"return [t.strip() for t in VAR_85.split(',')]\n"
] | [
"def list_allowed_column_values(self):...\n",
"mct = self.allowed_column_value or ''\n",
"return [t.strip() for t in mct.split(',')]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertEqual(VAR_5.evaluate('dummy'), 'dummy')\n"
] | [
"def test_evaluate_with_render_simple_callable(self):...\n",
"ec = self._makeContext()\n",
"self.assertEqual(ec.evaluate('dummy'), 'dummy')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_15(VAR_19, VAR_16):...\n",
"VAR_50 = False\n",
"if VAR_19['rating'].strip():\n",
"VAR_85 = False\n",
"if len(VAR_16.ratings) > 0:\n",
"if len(VAR_16.ratings) > 0:\n",
"VAR_16.ratings.remove(VAR_16.ratings[0])\n",
"return VAR_50\n",
"VAR_85 = VAR_16.ratings[0].rating\n",
"VAR_86 = int(flo... | [
"def edit_book_ratings(to_save, book):...\n",
"changed = False\n",
"if to_save['rating'].strip():\n",
"old_rating = False\n",
"if len(book.ratings) > 0:\n",
"if len(book.ratings) > 0:\n",
"book.ratings.remove(book.ratings[0])\n",
"return changed\n",
"old_rating = book.ratings[0].rating\n",
"rating... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(self):...\n",
"VAR_5 = {'not_types': ['m.*', 'org.*'], 'types': ['m.room.message',\n 'm.room.topic']}\n",
"VAR_6 = FUNC_0(sender='@foo:bar', type='m.room.topic', room_id='!foo:bar')\n",
"self.assertFalse(Filter(VAR_5).check(VAR_6))\n"
] | [
"def test_definition_not_types_takes_priority_over_types(self):...\n",
"definition = {'not_types': ['m.*', 'org.*'], 'types': ['m.room.message',\n 'm.room.topic']}\n",
"event = MockEvent(sender='@foo:bar', type='m.room.topic', room_id='!foo:bar')\n",
"self.assertFalse(Filter(definition).check(event))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2.method not in ['POST', 'DELETE']:\n",
"return JsonResponse({'Error':\n 'Need to POST or DELETE JSON data to update links'}, VAR_313=405)\n",
"VAR_17 = json.loads(VAR_2.body)\n",
"VAR_17 = json.loads(bytes_to_native_str(VAR_2.body))\n",
"i... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method not in ['POST', 'DELETE']:\n",
"return JsonResponse({'Error':\n 'Need to POST or DELETE JSON data to update links'}, status=405)\n",
"json_data = json.loads(request.body)\n",
"json_data = json.loads(bytes_to_native_str(request.body... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"@app.route('/dataobj/move/<int:dataobj_id>', methods=['POST'])...\n",
"VAR_9 = forms.MoveItemForm()\n",
"VAR_22 = VAR_9.path.data if VAR_9.path.data != '' else 'root directory'\n",
"if VAR_9.path.data == None:\n",
"flash('No path specified.')\n",
"if data.move_item(VAR_1, VAR_9.path.data):\n",
"flash('... | [
"@app.route('/dataobj/move/<int:dataobj_id>', methods=['POST'])...\n",
"form = forms.MoveItemForm()\n",
"out_dir = form.path.data if form.path.data != '' else 'root directory'\n",
"if form.path.data == None:\n",
"flash('No path specified.')\n",
"if data.move_item(dataobj_id, form.path.data):\n",
"flash(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"async def FUNC_1(self, VAR_5, VAR_6, VAR_8, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = VAR_6.room_id\n",
"VAR_12 = VAR_6.event_id\n",
"VAR_54 = await self.store.have_events_in_timeline(VAR_8)\n",
"if not VAR_8 - VAR_54:\n",
"return\n",
"VAR_55 = await self.store.get_latest_event_ids_in_room(... | [
"async def _get_missing_events_for_pdu(self, origin, pdu, prevs, min_depth):...\n",
"\"\"\"docstring\"\"\"\n",
"room_id = pdu.room_id\n",
"event_id = pdu.event_id\n",
"seen = await self.store.have_events_in_timeline(prevs)\n",
"if not prevs - seen:\n",
"return\n",
"latest_list = await self.store.get_l... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"AugAssign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"@VAR_0.route('/fork/<int:id>')...\n",
"if get_user() is None:\n",
"return redirect('/login?next=fork/{id}'.format(VAR_3=id))\n",
"VAR_14 = Query()\n",
"VAR_14.user = get_user()\n",
"VAR_15 = g.conn.session.query(Query).filter(Query.id == VAR_3).one()\n",
"VAR_14.title = VAR_15.title\n",
"VAR_14.paren... | [
"@app.route('/fork/<int:id>')...\n",
"if get_user() is None:\n",
"return redirect('/login?next=fork/{id}'.format(id=id))\n",
"query = Query()\n",
"query.user = get_user()\n",
"parent_query = g.conn.session.query(Query).filter(Query.id == id).one()\n",
"query.title = parent_query.title\n",
"query.paren... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_101(self, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"self.xmlrpc_procedures[VAR_10.__name__] = VAR_10\n",
"return VAR_10\n"
] | [
"def xmlrpc(self, f):...\n",
"\"\"\"docstring\"\"\"\n",
"self.xmlrpc_procedures[f.__name__] = f\n",
"return f\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_1, VAR_2):...\n",
"return frappe.local.module_app[scrub(VAR_1)] + '.' + scrub(VAR_1\n ) + '.report.' + scrub(VAR_2) + '.' + scrub(VAR_2)\n"
] | [
"def get_report_module_dotted_path(module, report_name):...\n",
"return frappe.local.module_app[scrub(module)] + '.' + scrub(module\n ) + '.report.' + scrub(report_name) + '.' + scrub(report_name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@FUNC_0...\n",
"return AccountValidityHandler(self)\n"
] | [
"@cache_in_self...\n",
"return AccountValidityHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_26(self):...\n",
"VAR_13 = self.cleaned_data['agreement']\n",
"self.spam_check(VAR_13)\n",
"return VAR_13\n"
] | [
"def clean_agreement(self):...\n",
"value = self.cleaned_data['agreement']\n",
"self.spam_check(value)\n",
"return value\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"assert join('/', trailing_slash=True) == '/'\n",
"assert join('/foo', 'baz', None, trailing_slash=True) == '/foo/baz/'\n",
"assert join('/foo', 'baz/', trailing_slash=True) == '/foo/baz/'\n"
] | [
"def test_trailing_slash(self):...\n",
"assert join('/', trailing_slash=True) == '/'\n",
"assert join('/foo', 'baz', None, trailing_slash=True) == '/foo/baz/'\n",
"assert join('/foo', 'baz/', trailing_slash=True) == '/foo/baz/'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_5(VAR_4, VAR_9, VAR_7, VAR_5, VAR_10):...\n",
"VAR_48 = False\n",
"if VAR_5 == 'languages':\n",
"VAR_83 = VAR_9.lang_code\n",
"if VAR_5 == 'custom':\n",
"for VAR_12 in VAR_10:\n",
"VAR_83 = VAR_9.value\n",
"VAR_83 = VAR_9.name\n",
"VAR_11 = VAR_7.query(VAR_9).filter(VAR_83 == VAR_12).first... | [
"def add_objects(db_book_object, db_object, db_session, db_type, add_elements):...\n",
"changed = False\n",
"if db_type == 'languages':\n",
"db_filter = db_object.lang_code\n",
"if db_type == 'custom':\n",
"for add_element in add_elements:\n",
"db_filter = db_object.value\n",
"db_filter = db_object.na... | [
0,
0,
0,
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'",
"Condition",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Ass... |
[
"from __future__ import division, print_function, unicode_literals\n",
"import os\n",
"from datetime import datetime\n",
"import json\n",
"from shutil import copyfile\n",
"from uuid import uuid4\n",
"VAR_0 = True\n",
"from scholarly import scholarly\n",
"VAR_0 = False\n",
"from babel import Locale... | [
"from __future__ import division, print_function, unicode_literals\n",
"import os\n",
"from datetime import datetime\n",
"import json\n",
"from shutil import copyfile\n",
"from uuid import uuid4\n",
"have_scholar = True\n",
"from scholarly import scholarly\n",
"have_scholar = False\n",
"from babel... | [
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFr... |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_114 = VAR_2.GET.get('format', 'png')\n",
"if VAR_114 not in ('jpeg', 'png', 'tif'):\n",
"VAR_114 = 'png'\n",
"VAR_150 = []\n",
"VAR_151 = []\n",
"if VAR_6 is None:\n",
"VAR_150 = VAR_2.GET.getlist('image')\n",
"VAR_150 = [VAR_6]\n",
"if l... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"format = request.GET.get('format', 'png')\n",
"if format not in ('jpeg', 'png', 'tif'):\n",
"format = 'png'\n",
"imgIds = []\n",
"wellIds = []\n",
"if iid is None:\n",
"imgIds = request.GET.getlist('image')\n",
"imgIds = [iid]\n",
"if len(img... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"Co... |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_101 = FUNC_0(VAR_2, 'group', -1)\n",
"VAR_5.SERVICE_OPTS.setOmeroGroup(VAR_345(VAR_101))\n",
"VAR_177 = int(VAR_2.GET.get('offset'))\n",
"VAR_177 = VAR_88 = None\n",
"VAR_160 = VAR_2.GET.get('jsonmode')\n",
"VAR_88 = int(VAR_2.GET.get('limit', ... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"group = get_long_or_default(request, 'group', -1)\n",
"conn.SERVICE_OPTS.setOmeroGroup(str(group))\n",
"offset = int(request.GET.get('offset'))\n",
"offset = limit = None\n",
"jsonmode = request.GET.get('jsonmode')\n",
"limit = int(request.GET.get(... | [
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'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"@app.route('/config', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_20(VAR_22, VAR_23, VAR_24):...\n",
"if VAR_22 != 'SECRET_KEY':\n",
"if type(VAR_23) is dict:\n",
"VAR_9 = forms.config_form(app.config)\n",
"for k, v in VAR_23.items():\n",
"VAR_24[VAR_22] = VAR_23\n",
"VAR_2... | [
"@app.route('/config', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"def update_config_value(key, val, dictionary):...\n",
"if key != 'SECRET_KEY':\n",
"if type(val) is dict:\n",
"form = forms.config_form(app.config)\n",
"for k, v in val.items():\n",
"dictionary[key] = val\n",
"default... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_12(self):...\n",
""
] | [
"def finalize_options(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_23(self, VAR_19, VAR_36, VAR_37):...\n",
"if VAR_19 is None:\n",
"return VAR_36 == VAR_37\n",
"if isinstance(VAR_19, str):\n",
"VAR_19 = VAR_19.split('/')\n",
"if isinstance(VAR_19, bytes):\n",
"VAR_36 = FUNC_0(VAR_36, VAR_19, None)\n",
"return False\n",
"return VAR_36 == VAR_37\n",
"VAR... | [
"def same_part(self, name, ob1, ob2):...\n",
"if name is None:\n",
"return ob1 == ob2\n",
"if isinstance(name, str):\n",
"name = name.split('/')\n",
"if isinstance(name, bytes):\n",
"ob1 = boboAwareZopeTraverse(ob1, name, None)\n",
"return False\n",
"return ob1 == ob2\n",
"name = name.split(b'/')\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_52(VAR_62, VAR_109=False, VAR_115=False):...\n",
"\"\"\"docstring\"\"\"\n",
"FUNC_53(FUNC_56(VAR_12.get_value('DocType', VAR_62, 'module')), 'doctype',\n FUNC_56(VAR_62), VAR_109=force, VAR_115=reset_permissions)\n"
] | [
"def reload_doctype(doctype, force=False, reset_permissions=False):...\n",
"\"\"\"docstring\"\"\"\n",
"reload_doc(scrub(db.get_value('DocType', doctype, 'module')), 'doctype',\n scrub(doctype), force=force, reset_permissions=reset_permissions)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_53(VAR_21, VAR_29, VAR_30):...\n",
"for tag in VAR_29:\n",
"VAR_21 = VAR_21.filter(db.Books.tags.any(db.Tags.id == tag))\n",
"for tag in VAR_30:\n",
"VAR_21 = VAR_21.filter(not_(db.Books.tags.any(db.Tags.id == tag)))\n",
"return VAR_21\n"
] | [
"def adv_search_tag(q, include_tag_inputs, exclude_tag_inputs):...\n",
"for tag in include_tag_inputs:\n",
"q = q.filter(db.Books.tags.any(db.Tags.id == tag))\n",
"for tag in exclude_tag_inputs:\n",
"q = q.filter(not_(db.Books.tags.any(db.Tags.id == tag)))\n",
"return q\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_43(VAR_110, VAR_111):...\n",
"if 'firstrunstart' in VAR_111:\n",
"VAR_111.remove('firstrunstart')\n",
"if 'firstrunend' in VAR_111:\n",
"VAR_111.remove('firstrunend')\n",
"return ['firstrunstart'] + VAR_110 + VAR_111 + ['firstrunend']\n"
] | [
"def custom_insert_order(existing, missing):...\n",
"if 'firstrunstart' in missing:\n",
"missing.remove('firstrunstart')\n",
"if 'firstrunend' in missing:\n",
"missing.remove('firstrunend')\n",
"return ['firstrunstart'] + existing + missing + ['firstrunend']\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(VAR_2, VAR_3):...\n",
"VAR_51 = VAR_2.GET.getlist(VAR_3)\n",
"return [VAR_318 for VAR_318 in VAR_51 if VAR_318 != '']\n"
] | [
"def get_list(request, name):...\n",
"val = request.GET.getlist(name)\n",
"return [i for i in val if i != '']\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"async def FUNC_26(VAR_23):...\n",
"self.assertEqual(VAR_23, {'server1': {FUNC_0(VAR_20): 1500}})\n",
"return {'server1': {FUNC_0(VAR_20): FetchKeyResult(get_verify_key(VAR_20), \n 1200)}}\n"
] | [
"async def get_keys2(keys_to_fetch):...\n",
"self.assertEqual(keys_to_fetch, {'server1': {get_key_id(key1): 1500}})\n",
"return {'server1': {get_key_id(key1): FetchKeyResult(get_verify_key(key1), \n 1200)}}\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_2: IReactorCore, VAR_3: Optional[...\n",
"self._reactor = VAR_2\n",
"self._clock = Clock(VAR_2)\n",
"self._pool = HTTPConnectionPool(VAR_2)\n",
"self._pool.retryAutomatically = False\n",
"self._pool.maxPersistentPerHost = 5\n",
"self._pool.cachedConnectionTimeout = 2 * 60\n",
"... | [
"def __init__(self, reactor: IReactorCore, tls_client_options_factory:...\n",
"self._reactor = reactor\n",
"self._clock = Clock(reactor)\n",
"self._pool = HTTPConnectionPool(reactor)\n",
"self._pool.retryAutomatically = False\n",
"self._pool.maxPersistentPerHost = 5\n",
"self._pool.cachedConnectionTimeo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_26(self):...\n",
"VAR_5, VAR_15 = self._test_confirm_start()\n",
"VAR_15 = VAR_15.replace('/reset/', '/reset/custom/named/')\n",
"VAR_3 = self.client.post(VAR_15, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"self.assertEqual(VAR_3.status_code, 302)\n",
"self.asse... | [
"def test_confirm_redirect_custom_named(self):...\n",
"url, path = self._test_confirm_start()\n",
"path = path.replace('/reset/', '/reset/custom/named/')\n",
"response = self.client.post(path, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"self.assertEqual(response.status_code... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_56(VAR_35, VAR_36, VAR_37, VAR_38, VAR_39, VAR_40, VAR_41, VAR_24,...\n",
"VAR_35.extend((VAR_36.replace('|', ','), VAR_37, VAR_38))\n",
"if VAR_39:\n",
"if VAR_40:\n",
"VAR_35.extend([_(u'Published after ') + format_date(datetime.strptime(\n VAR_39, '%Y-%m-%d'), format='medium', locale=get_loc... | [
"def extend_search_term(searchterm, author_name, book_title, publisher,...\n",
"searchterm.extend((author_name.replace('|', ','), book_title, publisher))\n",
"if pub_start:\n",
"if pub_end:\n",
"searchterm.extend([_(u'Published after ') + format_date(datetime.strptime(\n pub_start, '%Y-%m-%d'), format='m... | [
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",... |
[
"@VAR_2.route('/get_authors_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Authors, request.args.get('q'), ('|', ','))\n"
] | [
"@web.route('/get_authors_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Authors, request.args.get('q'), ('|', ','))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@def_function.function...\n",
"return VAR_50 + 2 * VAR_56\n"
] | [
"@def_function.function...\n",
"return y + 2 * c\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_19(self, VAR_17):...\n",
"FUNC_0()\n",
"VAR_68 = '../res/img/folder.png'\n",
"log.i('Fetching album art for: %s' % VAR_17)\n",
"VAR_69 = os.path.join(cherry.config['media.basedir'], VAR_17)\n",
"if os.path.isfile(VAR_69):\n",
"VAR_99 = TinyTag.get(VAR_69, image=True)\n",
"VAR_66 = albumArtFi... | [
"def api_fetchalbumart(self, directory):...\n",
"_save_and_release_session()\n",
"default_folder_image = '../res/img/folder.png'\n",
"log.i('Fetching album art for: %s' % directory)\n",
"filepath = os.path.join(cherry.config['media.basedir'], directory)\n",
"if os.path.isfile(filepath):\n",
"tag = TinyT... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Condition",... |
[
"def __eq__(self, VAR_2):...\n",
"return str(self) == str(VAR_2)\n"
] | [
"def __eq__(self, other):...\n",
"return str(self) == str(other)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_72(self, VAR_212=None):...\n",
""
] | [
"def not_authorized(self, page=None):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(VAR_0):...\n",
"from MoinMoin import macro\n",
"VAR_3 = macro.getNames(VAR_0.cfg)\n",
"VAR_3.sort()\n",
"return VAR_3\n"
] | [
"def macro_list(request):...\n",
"from MoinMoin import macro\n",
"macros = macro.getNames(request.cfg)\n",
"macros.sort()\n",
"return macros\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self):...\n",
"self._subscribers = set()\n"
] | [
"def __init__(self):...\n",
"self._subscribers = set()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_8(self):...\n",
"VAR_10 = test.test_src_dir_path(VAR_0)\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_11 = self.parser.parse_args(['show', '--dir', VAR_10, '--tag_set',\n 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.show(VAR_11)\n",
"VAR_12 = out.getvalue... | [
"def testShowCommandInputsOutputs(self):...\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"self.parser = saved_model_cli.create_parser()\n",
"args = self.parser.parse_args(['show', '--dir', base_path, '--tag_set',\n 'serve', '--signature_def', 'serving_default'])\n",
"saved_model_cli.show... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@FUNC_2.__func__...\n",
"\"\"\"docstring\"\"\"\n",
"self._submit()\n"
] | [
"@whitelist.__func__...\n",
"\"\"\"docstring\"\"\"\n",
"self._submit()\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"VAR_62 = self.useroptions.forUser(self.getUserId())\n",
"VAR_62.setOption('last_time_online', int(time.time()))\n"
] | [
"def api_heartbeat(self):...\n",
"uo = self.useroptions.forUser(self.getUserId())\n",
"uo.setOption('last_time_online', int(time.time()))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@VAR_0.route('/api/jobs', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_73 = {'ids': request.args.get('ids'), 'status': request.args.get(\n 'status'), 'application': request.args.get('application'), 'backend':\n request.args.get('backend'), 'recent': request.args.get('recent'),\n 'length': r... | [
"@gui.route('/api/jobs', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"params = {'ids': request.args.get('ids'), 'status': request.args.get(\n 'status'), 'application': request.args.get('application'), 'backend':\n request.args.get('backend'), 'recent': request.args.get('recent'),\n 'length': req... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import ast\n",
"import sys\n",
"from datetime import datetime\n",
"from bson import ObjectId\n",
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = CLASS_1()\n",
"VAR_1.visit(ast.parse(VAR_0))\n",
"VAR_8 = CLASS_0(VAR_8)\n",
"return VAR_1.mongo_query\n",
"V... | [
"\"\"\"\n eve.io.mongo.parser\n ~~~~~~~~~~~~~~~~~~~\n\n This module implements a Python-to-Mongo syntax parser. Allows the MongoDB\n data-layer to seamlessly respond to a Python-like query.\n\n :copyright: (c) 2017 by Nicola Iarocci.\n :license: BSD, see LICENSE for more details.\n\"\"\"\n",
"im... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_2(self, VAR_2: str, VAR_3: SigningKey) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"async def FUNC_10(VAR_6, VAR_7, VAR_8=False, **VAR_9):...\n",
"self.assertTrue(VAR_8)\n",
"self.assertEqual(VAR_6, VAR_2)\n",
"VAR_4 = '%s:%s' % (VAR_3.alg, VAR_3.version)\n",
"self.assertEqual(VAR_7, '/_matrix/k... | [
"def expect_outgoing_key_request(self, server_name: str, signing_key: SigningKey...\n",
"\"\"\"docstring\"\"\"\n",
"async def get_json(destination, path, ignore_backoff=False, **kwargs):...\n",
"self.assertTrue(ignore_backoff)\n",
"self.assertEqual(destination, server_name)\n",
"key_id = '%s:%s' % (signin... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"AsyncFunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self, VAR_3, VAR_4):...\n",
"return django.forms.EmailField(**options)\n"
] | [
"def create_email_field(self, field, options):...\n",
"return django.forms.EmailField(**options)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_19(VAR_43):...\n",
"VAR_54 = json.loads(VAR_43)\n",
"VAR_55 = next(item for item in VAR_54['dates'] if item['type'] == 'modified')[\n 'start_date']\n",
"VAR_55 = VAR_55.split('.')[0]\n",
"VAR_56 = datetime.strptime(VAR_55, '%Y-%m-%dT%H:%M:%S')\n",
"VAR_57 = VAR_56.replace(tzinfo=timezone(time... | [
"def parse_date(json_body):...\n",
"json_response = json.loads(json_body)\n",
"date = next(item for item in json_response['dates'] if item['type'] ==\n 'modified')['start_date']\n",
"date = date.split('.')[0]\n",
"parsed_date = datetime.strptime(date, '%Y-%m-%dT%H:%M:%S')\n",
"epoch = parsed_date.repla... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_27(self):...\n",
"VAR_29 = coreapi.Document(VAR_5='', title='Example API', content={'animals':\n {'dog': {'vet': {'list': coreapi.Link(url='/animals/dog/{id}/vet',\n action='get', fields=[coreapi.Field('id', required=True, location=\n 'path', schema=coreschema.String())])}, 'read': coreapi.Link... | [
"def test_multiple_resources_with_multiple_nested_routes(self):...\n",
"schema = coreapi.Document(url='', title='Example API', content={'animals':\n {'dog': {'vet': {'list': coreapi.Link(url='/animals/dog/{id}/vet',\n action='get', fields=[coreapi.Field('id', required=True, location=\n 'path', schema=cor... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_35(self):...\n",
"VAR_128 = Flags()\n",
"VAR_128.merge(self.get_glossary_flags())\n",
"VAR_86 = self.cleaned_data.get('variant')\n",
"if VAR_86:\n",
"VAR_128.set_value('variant', VAR_86.source)\n",
"return {'context': self.cleaned_data.get('context', ''), 'source': self.\n cleaned_data['sou... | [
"def as_kwargs(self):...\n",
"flags = Flags()\n",
"flags.merge(self.get_glossary_flags())\n",
"variant = self.cleaned_data.get('variant')\n",
"if variant:\n",
"flags.set_value('variant', variant.source)\n",
"return {'context': self.cleaned_data.get('context', ''), 'source': self.\n cleaned_data['sour... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"@VAR_0.teardown_request...\n",
"g.conn.close_all()\n"
] | [
"@app.teardown_request...\n",
"g.conn.close_all()\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"@CLASS_4('back')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('back.html', title='Suspended: ' + urllib.parse.\n unquote(url.fragment()))\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('back')...\n",
"\"\"\"docstring\"\"\"\n",
"src = jinja.render('back.html', title='Suspended: ' + urllib.parse.unquote(\n url.fragment()))\n",
"return 'text/html', src\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_22():...\n",
"if not URL.verify(request, hmac_key=session.hmac_key):\n",
"VAR_3 = FUNC_5()\n",
"VAR_5 = os.path.join(apath(VAR_3, VAR_122=request), 'DISABLED')\n",
"if is_gae:\n",
"return SPAN(T('Not supported'), _style='color:yellow')\n",
"if os.path.exists(VAR_5):\n",
"os.unlink(VAR_5)\n",... | [
"def enable():...\n",
"if not URL.verify(request, hmac_key=session.hmac_key):\n",
"app = get_app()\n",
"filename = os.path.join(apath(app, r=request), 'DISABLED')\n",
"if is_gae:\n",
"return SPAN(T('Not supported'), _style='color:yellow')\n",
"if os.path.exists(filename):\n",
"os.unlink(filename)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Return'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return AcmeHandler(self)\n"
] | [
"@cache_in_self...\n",
"return AcmeHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_77(VAR_94, VAR_132=True):...\n",
"\"\"\"docstring\"\"\"\n",
"import copy\n",
"def FUNC_119(VAR_174):...\n",
"for df in VAR_174.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(VAR_174, df.fieldname):\n",
"VAR_195 = ['name', 'owner', 'creation', 'modified', 'modified_by']\n",
"VAR_174.set(... | [
"def copy_doc(doc, ignore_no_copy=True):...\n",
"\"\"\"docstring\"\"\"\n",
"import copy\n",
"def remove_no_copy_fields(d):...\n",
"for df in d.meta.get('fields', {'no_copy': 1}):\n",
"if hasattr(d, df.fieldname):\n",
"fields_to_clear = ['name', 'owner', 'creation', 'modified', 'modified_by']\n",
"d.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
] | [
"FunctionDef'",
"Docstring",
"Import'",
"FunctionDef'",
"For",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Condition",
"Expr'",
"For",
"Expr'",
"Return'",
"For",
"Expr'",
"Condition",
... |
[
"def FUNC_8(VAR_5):...\n",
"import os\n",
"VAR_28 = os.path.dirname(__file__)\n",
"VAR_29 = VAR_5\n",
"VAR_30 = os.path.join(VAR_28, VAR_29)\n",
"return VAR_30\n"
] | [
"def get_absolute_path(path):...\n",
"import os\n",
"script_dir = os.path.dirname(__file__)\n",
"rel_path = path\n",
"abs_file_path = os.path.join(script_dir, rel_path)\n",
"return abs_file_path\n"
] | [
0,
0,
0,
0,
1,
0
] | [
"FunctionDef'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_30(self):...\n",
"return self._has_role(constants.ROLE_DELETE_BOOKS)\n"
] | [
"def role_delete_books(self):...\n",
"return self._has_role(constants.ROLE_DELETE_BOOKS)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_7(self, VAR_17: str, VAR_16: str, VAR_36: Optional[QueryArgs...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = CLASS_0(VAR_15='PUT', VAR_17=destination, VAR_16=path, VAR_20=args,\n VAR_19=json_data_callback, VAR_18=data)\n",
"VAR_12 = self.clock.time_msec()\n",
"VAR_11 = await self._send_reques... | [
"async def put_json(self, destination: str, path: str, args: Optional[...\n",
"\"\"\"docstring\"\"\"\n",
"request = MatrixFederationRequest(method='PUT', destination=destination,\n path=path, query=args, json_callback=json_data_callback, json=data)\n",
"start_ms = self.clock.time_msec()\n",
"response = a... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"self.assert_expected_unicode(self.folder.t, 'CheckUnicodeInserts.html')\n"
] | [
"def testUnicodeInserts(self):...\n",
"self.assert_expected_unicode(self.folder.t, 'CheckUnicodeInserts.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.