lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_1(VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = 'notebook.' + VAR_4\n",
"VAR_11 = __import__(VAR_4, fromlist=['default_handlers'])\n",
"return VAR_11.default_handlers\n"
] | [
"def load_handlers(name):...\n",
"\"\"\"docstring\"\"\"\n",
"name = 'notebook.' + name\n",
"mod = __import__(name, fromlist=['default_handlers'])\n",
"return mod.default_handlers\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_11):...\n",
"self.room_owner = self.register_user('room_owner', 'test')\n",
"self.room_owner_tok = self.login('room_owner', 'test')\n",
"self.room_id = self.helper.create_room_as(self.room_owner, VAR_52=self.\n room_owner_tok)\n",
"self.alias = '#alias:test'\n",
"sel... | [
"def prepare(self, reactor, clock, homeserver):...\n",
"self.room_owner = self.register_user('room_owner', 'test')\n",
"self.room_owner_tok = self.login('room_owner', 'test')\n",
"self.room_id = self.helper.create_room_as(self.room_owner, tok=self.\n room_owner_tok)\n",
"self.alias = '#alias:test'\n",
... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_72(VAR_38, VAR_40, VAR_41):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(CertificateWhitelist.get_certificate_white_list(VAR_38, VAR_40)) > 0:\n",
"VAR_153, VAR_72 = CertificateWhitelist.objects.get_or_create(VAR_19=student,\n VAR_10=course_key, defaults={'whitelist': True, 'notes':\n certificate... | [
"def add_certificate_exception(course_key, student, certificate_exception):...\n",
"\"\"\"docstring\"\"\"\n",
"if len(CertificateWhitelist.get_certificate_white_list(course_key, student)\n",
"certificate_white_list, __ = CertificateWhitelist.objects.get_or_create(user\n =student, course_id=course_key, defa... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"async def FUNC_1(self, VAR_4: str, VAR_5: Dict[str, str]) ->Optional[JsonDict]:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_5.get('client_secret') or VAR_5.get('clientSecret')\n",
"if not VAR_6:\n",
"assert_valid_client_secret(VAR_6)\n",
"VAR_33 = VAR_5.get('sid')\n",
"if not VAR_33:\n",
"VAR_34 =... | [
"async def threepid_from_creds(self, id_server: str, creds: Dict[str, str]...\n",
"\"\"\"docstring\"\"\"\n",
"client_secret = creds.get('client_secret') or creds.get('clientSecret')\n",
"if not client_secret:\n",
"assert_valid_client_secret(client_secret)\n",
"session_id = creds.get('sid')\n",
"if not s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_30(self, VAR_10):...\n",
"VAR_126 = copy.copy(VAR_10)\n",
"if 'discovery' in VAR_126:\n",
"VAR_126.pop('discovery')\n",
"VAR_61 = Component(**params)\n",
"VAR_61.clean_fields(exclude=('filemask', 'file_format', 'license'))\n",
"VAR_61.validate_unique()\n",
"VAR_61.clean_repo()\n",
"self.in... | [
"def clean_instance(self, data):...\n",
"params = copy.copy(data)\n",
"if 'discovery' in params:\n",
"params.pop('discovery')\n",
"instance = Component(**params)\n",
"instance.clean_fields(exclude=('filemask', 'file_format', 'license'))\n",
"instance.validate_unique()\n",
"instance.clean_repo()\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_50():...\n",
"return 'works'\n"
] | [
"def my_callable():...\n",
"return 'works'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self, VAR_3, VAR_4, VAR_6):...\n",
"self.room_id = self.helper.create_room_as(self.user_id)\n",
"self.path = '/rooms/%s/state/m.room.topic' % (self.room_id,)\n"
] | [
"def prepare(self, reactor, clock, hs):...\n",
"self.room_id = self.helper.create_room_as(self.user_id)\n",
"self.path = '/rooms/%s/state/m.room.topic' % (self.room_id,)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_117():...\n",
"return VAR_12.sql_list('select name from tabDocType where istable=1')\n"
] | [
"def get_tables():...\n",
"return db.sql_list('select name from tabDocType where istable=1')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"VAR_7 = self.created_rmid\n",
"self.helper.invite(VAR_7=room, src=self.rmcreator_id, targ=self.user_id)\n",
"self.helper.join(VAR_7=room, user=self.user_id)\n",
"self.helper.invite(VAR_7=room, src=self.user_id, targ=self.user_id, VAR_9=403)\n",
"self.helper.join(VAR_7=room, user... | [
"def test_joined_permissions(self):...\n",
"room = self.created_rmid\n",
"self.helper.invite(room=room, src=self.rmcreator_id, targ=self.user_id)\n",
"self.helper.join(room=room, user=self.user_id)\n",
"self.helper.invite(room=room, src=self.user_id, targ=self.user_id,\n expect_code=403)\n",
"self.help... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_42(self, VAR_36, VAR_37=False, VAR_35=''):...\n",
"VAR_15 = self.getUserId()\n",
"if not VAR_15:\n",
"VAR_35 = (VAR_35.strip().rstrip('/') + cherry.config['server.rootpath']\n ).rstrip('/')\n",
"VAR_36 = VAR_36.lower()\n",
"if VAR_36 == 'm3u':\n",
"VAR_111 = self.playlistdb.createM3U\n",
... | [
"def export_playlists(self, format, all=False, hostaddr=''):...\n",
"userid = self.getUserId()\n",
"if not userid:\n",
"hostaddr = (hostaddr.strip().rstrip('/') + cherry.config['server.rootpath']\n ).rstrip('/')\n",
"format = format.lower()\n",
"if format == 'm3u':\n",
"filemaker = self.playlistdb.cr... | [
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'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Assign'... |
[
"def FUNC_17(self):...\n",
"assert ClearableFileInput().media._js == ['s3file/js/s3file.js']\n"
] | [
"def test_media(self):...\n",
"assert ClearableFileInput().media._js == ['s3file/js/s3file.js']\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_23(self):...\n",
"self.assert_expected(self.folder.t, 'CheckImportOldStyleClass.html')\n"
] | [
"def testImportOldStyleClass(self):...\n",
"self.assert_expected(self.folder.t, 'CheckImportOldStyleClass.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2.method != 'POST':\n",
"VAR_156 = getIntOrDefault(VAR_2, 'rating', 0)\n",
"VAR_154 = FUNC_42(VAR_2, VAR_5)\n",
"for VAR_309, VAR_143 in VAR_154.items():\n",
"for o in VAR_143:\n",
"return JsonResponse({'success': True})\n",
"o.setRating(V... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method != 'POST':\n",
"rating = getIntOrDefault(request, 'rating', 0)\n",
"oids = getObjects(request, conn)\n",
"for otype, objs in oids.items():\n",
"for o in objs:\n",
"return JsonResponse({'success': True})\n",
"o.setRating(rating)\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Expr'"
] |
[
"import logging\n",
"from aiohttp import web\n",
"import os\n",
"VAR_0 = logging.getLogger(__package__)\n",
"def FUNC_0(VAR_1):...\n",
"VAR_9 = FUNC_2({(404): FUNC_4, (500): FUNC_5})\n",
"VAR_1.middlewares.append(VAR_9)\n",
"VAR_1.middlewares.append(FUNC_1)\n",
"VAR_2 = int(os.getenv('CACHE_MAX_AGE'... | [
"import logging\n",
"from aiohttp import web\n",
"import os\n",
"logger = logging.getLogger(__package__)\n",
"def setup_middlewares(app):...\n",
"error_middleware = error_pages({(404): handle_404, (500): handle_500})\n",
"app.middlewares.append(error_middleware)\n",
"app.middlewares.append(cache_contr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"AsyncFunctionDef'",
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(VAR_2, VAR_3, VAR_5, VAR_6=0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = saved_model_utils.get_meta_graph_def(VAR_2, VAR_3)\n",
"VAR_24 = FUNC_2(VAR_4, VAR_5)\n",
"VAR_25 = FUNC_3(VAR_4, VAR_5)\n",
"VAR_26 = ' ' * VAR_6\n",
"def FUNC_30(VAR_27):...\n",
"print(VAR_26 + VAR_27)\n",
"FUNC... | [
"def _show_inputs_outputs(saved_model_dir, tag_set, signature_def_key, indent=0...\n",
"\"\"\"docstring\"\"\"\n",
"meta_graph_def = saved_model_utils.get_meta_graph_def(saved_model_dir, tag_set)\n",
"inputs_tensor_info = _get_inputs_tensor_info_from_meta_graph_def(meta_graph_def\n , signature_def_key)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/author')...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_AUTHOR):\n",
"if VAR_87.get_view_property('author', 'dir') == 'desc':\n",
"abort(404)\n",
"VAR_10 = db.Authors.sort.desc()\n",
"VAR_10 = db.Authors.sort.asc()\n",
"VAR_109 = 0\n",
"VAR_109 = 1\n",
"VAR_63 = calibre_db.sess... | [
"@web.route('/author')...\n",
"if current_user.check_visibility(constants.SIDEBAR_AUTHOR):\n",
"if current_user.get_view_property('author', 'dir') == 'desc':\n",
"abort(404)\n",
"order = db.Authors.sort.desc()\n",
"order = db.Authors.sort.asc()\n",
"order_no = 0\n",
"order_no = 1\n",
"entries = cali... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"@VAR_0.route(...\n",
"VAR_14 = g.conn.session.query(Query).filter(Query.id == VAR_4).one()\n",
"VAR_7 = VAR_14.latest_rev.latest_run_id\n",
"VAR_20 = redirect(url_for('output_result', VAR_7=qrun_id, VAR_5=\n resultset_id, VAR_6=format, _external=True, _scheme='https'))\n",
"VAR_20.headers.add('Access-Co... | [
"@app.route(...\n",
"query = g.conn.session.query(Query).filter(Query.id == query_id).one()\n",
"qrun_id = query.latest_rev.latest_run_id\n",
"resp = redirect(url_for('output_result', qrun_id=qrun_id, resultset_id=\n resultset_id, format=format, _external=True, _scheme='https'))\n",
"resp.headers.add('Ac... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_23(VAR_16, VAR_28, VAR_19, VAR_29, VAR_30):...\n",
"VAR_50 = False\n",
"if VAR_28.datatype == 'rating':\n",
"VAR_19[VAR_30] = str(int(float(VAR_19[VAR_30]) * 2))\n",
"if VAR_19[VAR_30].strip() != VAR_29:\n",
"if VAR_29 is not None:\n",
"return VAR_50, VAR_19\n",
"VAR_104 = getattr(VAR_16, VA... | [
"def edit_cc_data_string(book, c, to_save, cc_db_value, cc_string):...\n",
"changed = False\n",
"if c.datatype == 'rating':\n",
"to_save[cc_string] = str(int(float(to_save[cc_string]) * 2))\n",
"if to_save[cc_string].strip() != cc_db_value:\n",
"if cc_db_value is not None:\n",
"return changed, to_save\n... | [
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",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_1(VAR_2: Directive) ->tuple[datetime.date, int]:...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_2.date, SORT_ORDER.get(type(VAR_2), 0)\n"
] | [
"def incomplete_sortkey(entry: Directive) ->tuple[datetime.date, int]:...\n",
"\"\"\"docstring\"\"\"\n",
"return entry.date, SORT_ORDER.get(type(entry), 0)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"super(CLASS_0, self).close()\n",
"VAR_0.debug('Closing OMERO connection in %r' % self)\n",
"VAR_0.error('Failed to clean up connection.', exc_info=True)\n",
"if self.conn is not None and self.conn.c is not None:\n",
"self.conn.close(hard=False)\n"
] | [
"def close(self):...\n",
"super(ConnCleaningHttpResponse, self).close()\n",
"logger.debug('Closing OMERO connection in %r' % self)\n",
"logger.error('Failed to clean up connection.', exc_info=True)\n",
"if self.conn is not None and self.conn.c is not None:\n",
"self.conn.close(hard=False)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"if not self.should_run():\n",
"print('bower dependencies up to date')\n",
"if self.should_run_npm():\n",
"return\n",
"print('installing build dependencies with npm')\n",
"VAR_48 = os.environ.copy()\n",
"FUNC_7(['npm', 'install'], VAR_22=repo_root)\n",
"VAR_48['PATH'] = VAR... | [
"def run(self):...\n",
"if not self.should_run():\n",
"print('bower dependencies up to date')\n",
"if self.should_run_npm():\n",
"return\n",
"print('installing build dependencies with npm')\n",
"env = os.environ.copy()\n",
"run(['npm', 'install'], cwd=repo_root)\n",
"env['PATH'] = npm_path\n",
"os... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"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_1(self) ->dict:...\n",
"VAR_32 = self.default_config()\n",
"VAR_32['worker_replication_host'] = 'testserv'\n",
"VAR_32['worker_replication_http_port'] = '8765'\n",
"return VAR_32\n"
] | [
"def _get_worker_hs_config(self) ->dict:...\n",
"config = self.default_config()\n",
"config['worker_replication_host'] = 'testserv'\n",
"config['worker_replication_http_port'] = '8765'\n",
"return config\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_52():...\n",
"if not (MULTI_USER_MODE and is_manager()):\n",
"session.flash = T('Not Authorized')\n",
"db.auth_user.registration_key.writable = True\n",
"redirect(URL('site'))\n",
"VAR_115 = SQLFORM.grid(db.auth_user)\n",
"return locals()\n"
] | [
"def manage_students():...\n",
"if not (MULTI_USER_MODE and is_manager()):\n",
"session.flash = T('Not Authorized')\n",
"db.auth_user.registration_key.writable = True\n",
"redirect(URL('site'))\n",
"grid = SQLFORM.grid(db.auth_user)\n",
"return locals()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_66(VAR_124=None, VAR_47=None, VAR_120=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_118(VAR_120=None):...\n",
"VAR_184 = {}\n",
"for VAR_219 in ([VAR_120] if VAR_120 else FUNC_64(VAR_122=True)):\n",
"VAR_219 = 'frappe' if VAR_219 == 'webnotes' else VAR_219\n",
"return VAR_184\n",
"VAR_2... | [
"def get_hooks(hook=None, default=None, app_name=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def load_app_hooks(app_name=None):...\n",
"hooks = {}\n",
"for app in ([app_name] if app_name else get_installed_apps(sort=True)):\n",
"app = 'frappe' if app == 'webnotes' else app\n",
"return hooks\n",
"app_hoo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"For",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/%s/categories', VAR_30)\n",
"return self.client.get_json(VAR_5=destination, VAR_2=path, VAR_3={\n 'requester_user_id': requester_user_id}, VAR_15=True)\n"
] | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"path = _create_v1_path('/groups/%s/categories', group_id)\n",
"return self.client.get_json(destination=destination, path=path, args={\n 'requester_user_id': requester_user_id}, ignore_backoff=True)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_12(VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = VAR_22.encode('utf-8')\n",
"return base64.urlsafe_b64decode(VAR_22.ljust(len(VAR_22) + len(VAR_22) % 4,\n b'='))\n"
] | [
"def urlsafe_base64_decode(s):...\n",
"\"\"\"docstring\"\"\"\n",
"s = s.encode('utf-8')\n",
"return base64.urlsafe_b64decode(s.ljust(len(s) + len(s) % 4, b'='))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_53():...\n",
"if not (MULTI_USER_MODE and is_manager()):\n",
"session.flash = T('Not Authorized')\n",
"VAR_26 = SQLFORM.factory(Field('emails', 'text'))\n",
"redirect(URL('site'))\n",
"if VAR_26.process().accepted:\n",
"VAR_172 = [x.strip() for x in VAR_26.vars.emails.split('\\n') if x.strip()... | [
"def bulk_register():...\n",
"if not (MULTI_USER_MODE and is_manager()):\n",
"session.flash = T('Not Authorized')\n",
"form = SQLFORM.factory(Field('emails', 'text'))\n",
"redirect(URL('site'))\n",
"if form.process().accepted:\n",
"emails = [x.strip() for x in form.vars.emails.split('\\n') if x.strip()]... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"For",
"Condition",
"Assign'",
"AugAssign'",
"Expr'"
] |
[
"def FUNC_3(VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = getattr(VAR_4, 'theme', None) or get_current_theme(VAR_4.shop)\n",
"VAR_7 = FUNC_2(VAR_2, VAR_5)\n",
"if not VAR_7:\n",
"VAR_8 = 'Error! %s/%s: Not found.' % (getattr(VAR_2, 'identifier', None), VAR_5\n )\n",
"return VAR_7(VAR_4)\n... | [
"def extra_view_dispatch(request, view):...\n",
"\"\"\"docstring\"\"\"\n",
"theme = getattr(request, 'theme', None) or get_current_theme(request.shop)\n",
"view_func = get_view_by_name(theme, view)\n",
"if not view_func:\n",
"msg = 'Error! %s/%s: Not found.' % (getattr(theme, 'identifier', None), view)\n"... | [
0,
0,
0,
0,
0,
2,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_151 = VAR_9.POST.getlist('certificate_statuses', [])\n",
"if not VAR_151:\n",
"return JsonResponse({'message': _(\n 'Please select one or more certificate statuses that require certifica... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"certificates_statuses = request.POST.getlist('certificate_statuses', [])\n",
"if not certificates_statuses:\n",
"return JsonResponse({'message': _(\n 'Please select one or more certif... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Return'",
"Assign'",
"Return'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"VAR_25.local.login_manager.logout()\n",
"VAR_25.db.commit()\n"
] | [
"@frappe.whitelist(allow_guest=True)...\n",
"frappe.local.login_manager.logout()\n",
"frappe.db.commit()\n"
] | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/admin/usertable')...\n",
"VAR_39 = VAR_62.view_settings.get('useredit', {})\n",
"VAR_23 = calibre_db.speaking_language()\n",
"VAR_24 = babel.list_translations() + [LC('en')]\n",
"VAR_35 = ub.session.query(ub.User)\n",
"VAR_40 = calibre_db.session.query(db.Tags).join(db.books_tags_link).joi... | [
"@admi.route('/admin/usertable')...\n",
"visibility = current_user.view_settings.get('useredit', {})\n",
"languages = calibre_db.speaking_language()\n",
"translations = babel.list_translations() + [LC('en')]\n",
"allUser = ub.session.query(ub.User)\n",
"tags = calibre_db.session.query(db.Tags).join(db.boo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_3, VAR_4=None, VAR_5=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.translate import get_full_dict\n",
"from frappe.utils import strip_html_tags, is_html\n",
"if not hasattr(VAR_1, 'lang'):\n",
"VAR_1.lang = VAR_4 or 'en'\n",
"if not VAR_4:\n",
"VAR_4 = VAR_1.lang\n",
"VAR_175... | [
"def _(msg, lang=None, context=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.translate import get_full_dict\n",
"from frappe.utils import strip_html_tags, is_html\n",
"if not hasattr(local, 'lang'):\n",
"local.lang = lang or 'en'\n",
"if not lang:\n",
"lang = local.lang\n",
"non_translated_s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@pytest.mark.parametrize('inp,out', [('">alert(1)', '\">alert(1)'),...\n",
"assert escaping.unescape_attributes(VAR_1) == VAR_2\n"
] | [
"@pytest.mark.parametrize('inp,out', [('">alert(1)', '\">alert(1)'),...\n",
"assert escaping.unescape_attributes(inp) == out\n"
] | [
0,
0
] | [
"Condition",
"Assert'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_14.get(VAR_1)\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return _existing_enums.get(name)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_3(VAR_4: datetime.date) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if g.interval is Interval.YEAR:\n",
"return VAR_4.strftime('%Y')\n",
"if g.interval is Interval.QUARTER:\n",
"return f'{VAR_4.year}Q{(VAR_4.month - 1) // 3 + 1}'\n",
"if g.interval is Interval.WEEK:\n",
"return VAR_4.strftime(... | [
"def format_date(date: datetime.date) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"if g.interval is Interval.YEAR:\n",
"return date.strftime('%Y')\n",
"if g.interval is Interval.QUARTER:\n",
"return f'{date.year}Q{(date.month - 1) // 3 + 1}'\n",
"if g.interval is Interval.WEEK:\n",
"return date.strftime(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Assert'",
"Return'"
] |
[
"def FUNC_59(VAR_5, VAR_52):...\n",
"VAR_5 = os.path.join(apath(VAR_3, VAR_122=request), VAR_5)\n",
"if VAR_52 in read_file(VAR_5, 'r'):\n",
"return True\n",
"return False\n"
] | [
"def match(filename, keywords):...\n",
"filename = os.path.join(apath(app, r=request), filename)\n",
"if keywords in read_file(filename, 'r'):\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>/copy', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_98 = FUNC_58(f'/internal/jobs/{VAR_9}/copy', 'put')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_98)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>/copy', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"response_info = query_internal_api(f'/internal/jobs/{job_id}/copy', 'put')\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'"
] |
[
"@VAR_0.route('/storage', defaults={'path': ''}, methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_66 = VAR_0.config['STORAGE_FOLDER']\n",
"VAR_58 = os.path.join(VAR_66, VAR_10)\n",
"if request.method == 'POST':\n",
"if 'storagefile' in request.files:\n",
"VAR_59 = os.path.dirname(VAR_58).... | [
"@gui.route('/storage', defaults={'path': ''}, methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"storage_folder = gui.config['STORAGE_FOLDER']\n",
"abs_path = os.path.join(storage_folder, path)\n",
"if request.method == 'POST':\n",
"if 'storagefile' in request.files:\n",
"back_path = os.path.d... | [
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Return'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Assign... |
[
"def FUNC_28(self, VAR_2, VAR_3):...\n",
"VAR_3.setattr('flask.request.host_url', 'http://example.com')\n",
"VAR_9 = _validate_redirect_url('http://works.com', _external_host='works.com')\n",
"assert VAR_9 is True\n",
"VAR_3.undo()\n"
] | [
"def test_it_works_with_explicit_external_host(self, app, monkeypatch):...\n",
"monkeypatch.setattr('flask.request.host_url', 'http://example.com')\n",
"result = _validate_redirect_url('http://works.com', _external_host='works.com')\n",
"assert result is True\n",
"monkeypatch.undo()\n"
] | [
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assert'",
"Expr'"
] |
[
"def FUNC_11(self) ->None:...\n",
"VAR_24 = self.package_dir / 'client.py'\n",
"VAR_25 = self.env.get_template('client.pyi')\n",
"VAR_24.write_text(VAR_25.render())\n",
"VAR_26 = self.package_dir / 'api'\n",
"VAR_26.mkdir()\n",
"VAR_27 = VAR_26 / '__init__.py'\n",
"VAR_27.write_text('\"\"\" Contains s... | [
"def _build_api(self) ->None:...\n",
"client_path = self.package_dir / 'client.py'\n",
"client_template = self.env.get_template('client.pyi')\n",
"client_path.write_text(client_template.render())\n",
"api_dir = self.package_dir / 'api'\n",
"api_dir.mkdir()\n",
"api_init = api_dir / '__init__.py'\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_0, VAR_1):...\n",
"self._dict[VAR_0] = VAR_1\n"
] | [
"def set(self, name, value):...\n",
"self._dict[name] = value\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_1(self, VAR_8, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_8 == 0:\n",
"return '0'\n",
"if VAR_8 < 0:\n",
"VAR_35 = True\n",
"VAR_35 = False\n",
"VAR_8 = -VAR_8\n",
"VAR_27 = []\n",
"while VAR_8 != 0:\n",
"VAR_32 = VAR_8 % VAR_9\n",
"VAR_27.reverse()\n",
"if VAR_32 >= 10:\n",... | [
"def _convertDecimalToBase(self, number, base):...\n",
"\"\"\"docstring\"\"\"\n",
"if number == 0:\n",
"return '0'\n",
"if number < 0:\n",
"negative = True\n",
"negative = False\n",
"number = -number\n",
"digits = []\n",
"while number != 0:\n",
"digit = number % base\n",
"digits.reverse()\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(self):...\n",
"VAR_10 = self.cleaned_data\n",
"if settings.OFFER_HOSTING:\n",
"VAR_10['contribute_shared_tm'] = VAR_10['use_shared_tm']\n",
"if 'access_control' not in VAR_10 or VAR_10['access_control'\n",
"VAR_10['access_control'] = self.instance.access_control\n",
"VAR_127 = VAR_10['access... | [
"def clean(self):...\n",
"data = self.cleaned_data\n",
"if settings.OFFER_HOSTING:\n",
"data['contribute_shared_tm'] = data['use_shared_tm']\n",
"if 'access_control' not in data or data['access_control'] is None or data[\n",
"data['access_control'] = self.instance.access_control\n",
"access = data['acce... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition"
] |
[
"def FUNC_2(VAR_2: Any) ->Optional[str]:...\n",
"return urlparse(VAR_2).hostname\n"
] | [
"def parse_domain(url: Any) ->Optional[str]:...\n",
"return urlparse(url).hostname\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_69(VAR_15):...\n",
"VAR_54 = {}\n",
"VAR_222 = []\n",
"VAR_223 = []\n",
"for VAR_212, ch in enumerate(VAR_15.getChannels()):\n",
"VAR_287 = '' if ch.isActive() else '-'\n",
"VAR_54['c'] = ','.join(VAR_222)\n",
"VAR_288 = ch.getWindowStart()\n",
"VAR_54['maps'] = VAR_223\n",
"VAR_289 = ch... | [
"def getRenderingSettings(image):...\n",
"rv = {}\n",
"chs = []\n",
"maps = []\n",
"for i, ch in enumerate(image.getChannels()):\n",
"act = '' if ch.isActive() else '-'\n",
"rv['c'] = ','.join(chs)\n",
"start = ch.getWindowStart()\n",
"rv['maps'] = maps\n",
"end = ch.getWindowEnd()\n",
"rv['m'] ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_4, VAR_5, VAR_6='test'):...\n",
"return {'origin': VAR_6, 'origin_server_ts': 1000000, 'pdus': [], 'edus': [\n {'edu_type': VAR_4, 'content': VAR_5}]}\n"
] | [
"def _expect_edu_transaction(edu_type, content, origin='test'):...\n",
"return {'origin': origin, 'origin_server_ts': 1000000, 'pdus': [], 'edus':\n [{'edu_type': edu_type, 'content': content}]}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_167(VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_395 = set(VAR_17.keys())\n",
"VAR_396 = set(['jsonrpc', 'method'])\n",
"VAR_397 = VAR_396 - VAR_395\n",
"if VAR_397:\n",
"if VAR_17['jsonrpc'] != '2.0':\n",
"if 'id' not in VAR_395:\n",
"return False\n",
"return True\n"
] | [
"def validate(data):...\n",
"\"\"\"docstring\"\"\"\n",
"iparms = set(data.keys())\n",
"mandatory_args = set(['jsonrpc', 'method'])\n",
"missing_args = mandatory_args - iparms\n",
"if missing_args:\n",
"if data['jsonrpc'] != '2.0':\n",
"if 'id' not in iparms:\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_4, VAR_5, VAR_6):...\n",
"if not VAR_4:\n",
"return None\n",
"VAR_18 = hmac.new(VAR_4.encode(), msg=path.encode(), digestmod=hashlib.sha1)\n",
"VAR_18.update(str(VAR_6).encode())\n",
"return VAR_18.hexdigest()\n"
] | [
"def sign(key, path, expires):...\n",
"if not key:\n",
"return None\n",
"h = hmac.new(key.encode(), msg=path.encode(), digestmod=hashlib.sha1)\n",
"h.update(str(expires).encode())\n",
"return h.hexdigest()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
""
] | [
"def close(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_4(self):...\n",
""
] | [
"def isAuthorized(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_44(VAR_62, VAR_9, VAR_97, VAR_103=False):...\n",
"VAR_94 = FUNC_41(VAR_62, VAR_9)\n",
"if isinstance(VAR_97, string_types):\n",
"if VAR_103:\n",
"VAR_188 = [VAR_94.get(f) for f in VAR_97]\n",
"VAR_96('Cannot make dict for single fieldname')\n",
"return VAR_94.get(VAR_97)\n",
"if VAR_103:\n",... | [
"def get_cached_value(doctype, name, fieldname, as_dict=False):...\n",
"doc = get_cached_doc(doctype, name)\n",
"if isinstance(fieldname, string_types):\n",
"if as_dict:\n",
"values = [doc.get(f) for f in fieldname]\n",
"throw('Cannot make dict for single fieldname')\n",
"return doc.get(fieldname)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"if self._client_transport:\n",
"self.client.close()\n",
"if self._server_transport:\n",
"self.server.close()\n",
"self._client_transport = FakeTransport(self.server, self.reactor)\n",
"self.client.makeConnection(self._client_transport)\n",
"self._server_transport = FakeTrans... | [
"def reconnect(self):...\n",
"if self._client_transport:\n",
"self.client.close()\n",
"if self._server_transport:\n",
"self.server.close()\n",
"self._client_transport = FakeTransport(self.server, self.reactor)\n",
"self.client.makeConnection(self._client_transport)\n",
"self._server_transport = FakeTr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"if self.cleaned_data.get('confirm') != self.obj.full_slug:\n"
] | [
"def clean(self):...\n",
"if self.cleaned_data.get('confirm') != self.obj.full_slug:\n"
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@FUNC_0...\n",
"return SetPasswordHandler(self)\n"
] | [
"@cache_in_self...\n",
"return SetPasswordHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, *VAR_11: Any, **VAR_12: Any) ->None:...\n",
""
] | [
"def __init__(self, *_: Any, **__: Any) ->None:...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"from django.contrib.auth.decorators import login_required\n",
"from django.http import HttpResponse, JsonResponse\n",
"from django.views.decorators.http import require_POST\n",
"from weblate.lang.models import Language\n",
"from weblate.trans.forms import ReportsForm\n",
"from weblate.trans.models.change... | [
"from django.contrib.auth.decorators import login_required\n",
"from django.http import HttpResponse, JsonResponse\n",
"from django.views.decorators.http import require_POST\n",
"from weblate.lang.models import Language\n",
"from weblate.trans.forms import ReportsForm\n",
"from weblate.trans.models.change... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'"
] |
[
"@FUNC_0...\n",
"return ThirdPartyEventRules(self)\n"
] | [
"@cache_in_self...\n",
"return ThirdPartyEventRules(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_50 = VAR_53.request.remote.ip in ('127.0.0.1', '::1')\n",
"if VAR_50 and cherry.config['server.localhost_auto_login']:\n",
"return True\n",
"return False\n"
] | [
"def autoLoginActive(self):...\n",
"is_loopback = cherrypy.request.remote.ip in ('127.0.0.1', '::1')\n",
"if is_loopback and cherry.config['server.localhost_auto_login']:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_46(VAR_62, VAR_106=None, VAR_107='creation desc'):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_174 = FUNC_83(VAR_62, VAR_106=filters, limit_page_length=1, VAR_107=\n order_by, pluck='name')\n",
"if VAR_174:\n",
"return FUNC_45(VAR_62, VAR_174[0])\n"
] | [
"def get_last_doc(doctype, filters=None, order_by='creation desc'):...\n",
"\"\"\"docstring\"\"\"\n",
"d = get_all(doctype, filters=filters, limit_page_length=1, order_by=\n order_by, pluck='name')\n",
"if d:\n",
"return get_doc(doctype, d[0])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"self.register_user('nonadmin', 'pass', admin=False)\n",
"VAR_22 = self.login('nonadmin', 'pass')\n",
"VAR_0 = '/_synapse/admin/v1/media/quarantine/example.org/abcde12345'\n",
"VAR_12, VAR_13 = self.make_request('POST', VAR_0.encode('ascii'), VAR_7=\n non_admin_user_tok)\n",
"... | [
"def test_quarantine_media_requires_admin(self):...\n",
"self.register_user('nonadmin', 'pass', admin=False)\n",
"non_admin_user_tok = self.login('nonadmin', 'pass')\n",
"url = '/_synapse/admin/v1/media/quarantine/example.org/abcde12345'\n",
"request, channel = self.make_request('POST', url.encode('ascii'),... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_1.route('/nr', methods=['POST'])...\n",
"VAR_6 = request.form['vId']\n",
"VAR_10 = request.form['ip']\n",
"VAR_11 = request.form['red']\n",
"if VAR_6 == '':\n",
"VAR_6 = utils.generateToken(5)\n",
"utils.Go(utils.Color['white'] + '[' + utils.Color['greenBold'] + '+' +\n utils.Color['white'] + '... | [
"@app.route('/nr', methods=['POST'])...\n",
"vId = request.form['vId']\n",
"vIp = request.form['ip']\n",
"vnetwork = request.form['red']\n",
"if vId == '':\n",
"vId = utils.generateToken(5)\n",
"utils.Go(utils.Color['white'] + '[' + utils.Color['greenBold'] + '+' +\n utils.Color['white'] + ']' + util... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/api/jobs/statistics', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_115 = FUNC_58('/internal/jobs/statistics', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_115)\n"
] | [
"@gui.route('/api/jobs/statistics', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"statistics = query_internal_api('/internal/jobs/statistics', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(statistics)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_16(self, VAR_4, VAR_39, VAR_40):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_40:\n",
"self.mathjax_url = u''\n"
] | [
"def _enable_mathjax_changed(self, name, old, new):...\n",
"\"\"\"docstring\"\"\"\n",
"if not new:\n",
"self.mathjax_url = u''\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'"
] |
[
"def __init__(self, VAR_9, VAR_10=None):...\n",
"self._name = VAR_9\n",
"self._backend = VAR_10\n",
"self._function = None\n"
] | [
"def __init__(self, name, backend=None):...\n",
"self._name = name\n",
"self._backend = backend\n",
"self._function = None\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"self.reactor = ThreadedMemoryReactorClock()\n",
"VAR_16 = True\n",
"def FUNC_19(self, VAR_3):...\n",
"return VAR_3.path\n"
] | [
"def setUp(self):...\n",
"self.reactor = ThreadedMemoryReactorClock()\n",
"isLeaf = True\n",
"def render(self, request):...\n",
"return request.path\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0():...\n",
"VAR_10 = VAR_0.get('/openapi.json')\n",
"assert VAR_10.status_code == 200, VAR_10.text\n",
"assert VAR_10.json() == VAR_1\n"
] | [
"def test_openapi_schema():...\n",
"response = client.get('/openapi.json')\n",
"assert response.status_code == 200, response.text\n",
"assert response.json() == openapi_schema\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_36(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for VAR_21 in self.get_all_children():\n",
"VAR_21.parent = self.name\n",
"VAR_21.parenttype = self.doctype\n"
] | [
"def set_parent_in_children(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for d in self.get_all_children():\n",
"d.parent = self.name\n",
"d.parenttype = self.doctype\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assign'",
"Assign'"
] |
[
"def FUNC_67(self, VAR_41: str) ->bool:...\n",
"return check_password_hash(self.password_hash, VAR_41)\n"
] | [
"def verify_password(self, password: str) ->bool:...\n",
"return check_password_hash(self.password_hash, password)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_37():...\n",
"\"\"\"docstring\"\"\"\n",
"if request.vars and not request.vars.token == session.token:\n",
"redirect(URL('logout'))\n",
"VAR_157 = '#' + request.vars.id if request.vars.id else ''\n",
"if not isinstance(VAR_114, HTTP):\n",
"if request.vars.dir:\n",
"if request.vars.app:\n",
... | [
"def create_file():...\n",
"\"\"\"docstring\"\"\"\n",
"if request.vars and not request.vars.token == session.token:\n",
"redirect(URL('logout'))\n",
"anchor = '#' + request.vars.id if request.vars.id else ''\n",
"if not isinstance(e, HTTP):\n",
"if request.vars.dir:\n",
"if request.vars.app:\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Condition",... |
[
"@VAR_2.route('/ajax/addrestriction/<int:res_type>/<int:user_id>', methods=[...\n",
"VAR_10 = request.form.to_dict()\n",
"if VAR_8 == 0:\n",
"if 'submit_allow' in VAR_10:\n",
"if VAR_8 == 1:\n",
"config.config_allowed_tags = FUNC_27(VAR_10, config.list_allowed_tags)\n",
"if 'submit_deny' in VAR_10:\n",
... | [
"@admi.route('/ajax/addrestriction/<int:res_type>/<int:user_id>', methods=[...\n",
"element = request.form.to_dict()\n",
"if res_type == 0:\n",
"if 'submit_allow' in element:\n",
"if res_type == 1:\n",
"config.config_allowed_tags = restriction_addition(element, config.\n list_allowed_tags)\n",
"if 's... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Co... |
[
"\"\"\"Handler functions for file:... pages.\"\"\"\n",
"import os\n",
"from qutebrowser.browser.webkit.network import networkreply\n",
"from qutebrowser.utils import jinja\n",
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = []\n",
"for filename in VAR_1:\n",
"VAR_11 = os... | [
"\"\"\"Handler functions for file:... pages.\"\"\"\n",
"import os\n",
"from qutebrowser.browser.webkit.network import networkreply\n",
"from qutebrowser.utils import jinja\n",
"def get_file_list(basedir, all_files, filterfunc):...\n",
"\"\"\"docstring\"\"\"\n",
"items = []\n",
"for filename in all_fil... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.get(self.meta.get_title_field())\n"
] | [
"def get_title(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.get(self.meta.get_title_field())\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_1():...\n",
"VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' test_kwarg=test_var.nested\"\n )\n",
"VAR_7 = unicorn(None, VAR_6)\n",
"VAR_8 = {'test_var': {'nested': 'variable!'}}\n",
"VAR_9 = VAR_7.render(VAR_8)\n",
"assert '->variable... | [
"def test_unicorn_render_context_variable():...\n",
"token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' test_kwarg=test_var.nested\"\n )\n",
"unicorn_node = unicorn(None, token)\n",
"context = {'test_var': {'nested': 'variable!'}}\n",
"actual = unico... | [
0,
0,
0,
0,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_48():...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def error():...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_43(VAR_3):...\n",
"VAR_102 = apath('%s/private' % VAR_3, VAR_122=request)\n",
"VAR_103 = os.path.join(VAR_102, 'ticket_storage.txt')\n",
"if os.path.exists(VAR_103):\n",
"VAR_166 = FUNC_3(VAR_103)\n",
"if is_gae:\n",
"VAR_166 = VAR_166.strip().replace('\\r', '').replace('\\n', '')\n",
"VAR_1... | [
"def get_ticket_storage(app):...\n",
"private_folder = apath('%s/private' % app, r=request)\n",
"ticket_file = os.path.join(private_folder, 'ticket_storage.txt')\n",
"if os.path.exists(ticket_file):\n",
"db_string = safe_read(ticket_file)\n",
"if is_gae:\n",
"db_string = db_string.strip().replace('\\r',... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_6, VAR_7):...\n",
"VAR_51 = self.userdb.auth(VAR_6, VAR_7)\n",
"VAR_52 = cherry.config['server.permit_remote_admin_login']\n",
"VAR_50 = VAR_53.request.remote.ip in ('127.0.0.1', '::1')\n",
"if not VAR_50 and VAR_51.isadmin and not VAR_52:\n",
"log.i(_('Rejected remote admin login fr... | [
"def session_auth(self, username, password):...\n",
"user = self.userdb.auth(username, password)\n",
"allow_remote = cherry.config['server.permit_remote_admin_login']\n",
"is_loopback = cherrypy.request.remote.ip in ('127.0.0.1', '::1')\n",
"if not is_loopback and user.isadmin and not allow_remote:\n",
"l... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4():...\n",
"return VAR_7\n"
] | [
"def getTrustedEngine():...\n",
"return _trusted_engine\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, VAR_5, VAR_6):...\n",
"return nova.db.api.s3_image_get(VAR_5, VAR_6)['uuid']\n"
] | [
"def get_image_uuid(self, context, image_id):...\n",
"return nova.db.api.s3_image_get(context, image_id)['uuid']\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"self.assertFormfield(models.Event, 'main_band', forms.Select)\n"
] | [
"def testForeignKey(self):...\n",
"self.assertFormfield(models.Event, 'main_band', forms.Select)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"self.assert_expected(self.folder.t, 'CheckBatchIteration.html')\n"
] | [
"def testBatchIteration(self):...\n",
"self.assert_expected(self.folder.t, 'CheckBatchIteration.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_13(VAR_0, VAR_1: FlaskClient):...\n",
"VAR_8 = VAR_1.post('/login', data={'username': 'invalid', 'password':\n 'dasdasd'}, follow_redirects=True)\n",
"assert VAR_8.status_code == 200\n",
"assert request.path == '/login'\n",
"assert b'Invalid credentials' in VAR_8.data\n"
] | [
"def test_logging_in_with_invalid_creds(test_app, client: FlaskClient):...\n",
"resp = client.post('/login', data={'username': 'invalid', 'password':\n 'dasdasd'}, follow_redirects=True)\n",
"assert resp.status_code == 200\n",
"assert request.path == '/login'\n",
"assert b'Invalid credentials' in resp.da... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_14(VAR_3, VAR_11, VAR_12=None):...\n",
"import urllib\n",
"import zipfile\n",
"VAR_38 = 'http://www.web2py.com/examples/static/web2py_win.zip'\n",
"VAR_39 = StringIO()\n",
"VAR_39.write(urlopen(VAR_38).read())\n",
"VAR_40 = zipfile.ZipFile(VAR_39, VAR_4='a')\n",
"VAR_41 = (\n u\"\"\"# -*-... | [
"def pack_exe(app, base, filenames=None):...\n",
"import urllib\n",
"import zipfile\n",
"download_url = 'http://www.web2py.com/examples/static/web2py_win.zip'\n",
"out = StringIO()\n",
"out.write(urlopen(download_url).read())\n",
"web2py_win = zipfile.ZipFile(out, mode='a')\n",
"routes = (\n u\"\"\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_15(self, VAR_1):...\n",
"VAR_5 = VAR_1.MagicMock()\n",
"VAR_26 = VAR_1.MagicMock()\n",
"VAR_23 = oai.Schema(type='array', items={})\n",
"from openapi_python_client.parser.properties import property_from_data\n",
"VAR_4 = property_from_data(VAR_5=name, VAR_26=required, VAR_23=data)\n",
"assert ... | [
"def test_property_from_data_array_invalid_items(self, mocker):...\n",
"name = mocker.MagicMock()\n",
"required = mocker.MagicMock()\n",
"data = oai.Schema(type='array', items={})\n",
"from openapi_python_client.parser.properties import property_from_data\n",
"p = property_from_data(name=name, required=re... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assert'"
] |
[
"def __init__(self, **VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"if 'quote_char' in VAR_22:\n",
"self.use_best_quote_char = False\n",
"for attr in self.options:\n",
"setattr(self, attr, VAR_22.get(attr, getattr(self, attr)))\n",
"self.errors = []\n",
"self.strict = False\n"
] | [
"def __init__(self, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if 'quote_char' in kwargs:\n",
"self.use_best_quote_char = False\n",
"for attr in self.options:\n",
"setattr(self, attr, kwargs.get(attr, getattr(self, attr)))\n",
"self.errors = []\n",
"self.strict = False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"For",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_58, *VAR_6, **VAR_7):...\n",
"self.project = VAR_58\n",
"super().__init__(*VAR_6, **kwargs)\n",
"self.fields['user'].widget = forms.HiddenInput()\n",
"self.fields['groups'].queryset = VAR_58.defined_groups.all()\n"
] | [
"def __init__(self, project, *args, **kwargs):...\n",
"self.project = project\n",
"super().__init__(*args, **kwargs)\n",
"self.fields['user'].widget = forms.HiddenInput()\n",
"self.fields['groups'].queryset = project.defined_groups.all()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_150 = instructor_task.api.generate_certificates_for_students(VAR_9, VAR_38)\n",
"VAR_74 = _('string')\n",
"VAR_63 = {'message': VAR_74, 'task_id': VAR_150.task_id}\n",
"return JsonRespons... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"task = instructor_task.api.generate_certificates_for_students(request,\n course_key)\n",
"message = _(\n 'Certificate generation task for all students of this course has been started... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = self.register_user('user', 'pass')\n",
"VAR_10 = self.login('user', 'pass')\n",
"VAR_11 = self.register_user('otheruser', 'pass')\n",
"VAR_12 = self.login('otheruser', 'pass')\n",
"VAR_18 = self.register_user('yetanotheruser', 'pass')\n",
"... | [
"def test_sends_high_priority_for_mention(self):...\n",
"\"\"\"docstring\"\"\"\n",
"user_id = self.register_user('user', 'pass')\n",
"access_token = self.login('user', 'pass')\n",
"other_user_id = self.register_user('otheruser', 'pass')\n",
"other_access_token = self.login('otheruser', 'pass')\n",
"yet_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"for regex in (VAR_8, VAR_9, VAR_10):\n",
"VAR_38 = regex.match(VAR_21)\n",
"VAR_39 = int(VAR_38.group('year'))\n",
"six.reraise(ValueError, ValueError('%r is not a valid date' % VAR_21), sys.\n exc_info()[2])\n",
"if VAR_38 is not None:\n",
"i... | [
"def parse_http_date(date):...\n",
"\"\"\"docstring\"\"\"\n",
"for regex in (RFC1123_DATE, RFC850_DATE, ASCTIME_DATE):\n",
"m = regex.match(date)\n",
"year = int(m.group('year'))\n",
"six.reraise(ValueError, ValueError('%r is not a valid date' % date), sys.\n exc_info()[2])\n",
"if m is not None:\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"AugAssign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_15(VAR_37):...\n",
"VAR_39, VAR_23 = VAR_37\n",
"VAR_16.write(VAR_39)\n",
"return VAR_23\n"
] | [
"def write_to(r):...\n",
"data, response = r\n",
"output_stream.write(data)\n",
"return response\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@FUNC_0...\n",
"return ModuleApi(self, self.get_auth_handler())\n"
] | [
"@cache_in_self...\n",
"return ModuleApi(self, self.get_auth_handler())\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@ratelimit(rate='2/10s')...\n",
"if VAR_7.user.is_authenticated:\n",
"return redirect(VAR_7.GET.get('next', reverse('spirit:user:update')))\n",
"VAR_17 = VAR_9(data=post_data(request))\n",
"if is_post(VAR_7) and not VAR_7.is_limited() and VAR_17.is_valid():\n",
"VAR_18 = VAR_17.save()\n",
"return rende... | [
"@ratelimit(rate='2/10s')...\n",
"if request.user.is_authenticated:\n",
"return redirect(request.GET.get('next', reverse('spirit:user:update')))\n",
"form = registration_form(data=post_data(request))\n",
"if is_post(request) and not request.is_limited() and form.is_valid():\n",
"user = form.save()\n",
"... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"if self.force:\n",
"return True\n",
"if not os.path.exists(self.bower_dir):\n",
"return True\n",
"return FUNC_6(self.bower_dir) < FUNC_6(VAR_1(VAR_2, 'bower.json'))\n"
] | [
"def should_run(self):...\n",
"if self.force:\n",
"return True\n",
"if not os.path.exists(self.bower_dir):\n",
"return True\n",
"return mtime(self.bower_dir) < mtime(pjoin(repo_root, 'bower.json'))\n"
] | [
0,
0,
0,
0,
0,
2
] | [
"FunctionDef'",
"For",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(VAR_0):...\n",
"VAR_0.DEBUG = True\n",
"VAR_6 = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentParent'\")\n",
"VAR_7 = unicorn(None, VAR_6)\n",
"VAR_8 = {}\n",
"VAR_12 = VAR_7.render(VAR_8)\n",
"assert '<script type=\"module\"' in VAR_12\n",
"ass... | [
"def test_unicorn_render_parent_component_one_script_tag(settings):...\n",
"settings.DEBUG = True\n",
"token = Token(TokenType.TEXT,\n \"unicorn 'tests.templatetags.test_unicorn_render.FakeComponentParent'\")\n",
"unicorn_node = unicorn(None, token)\n",
"context = {}\n",
"html = unicorn_node.render(con... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"@VAR_6.route('/<gididx>')...\n",
"VAR_11 = 'GIDIDX' + VAR_7.upper()\n",
"VAR_11 = FUNC_7(VAR_11)\n",
"def FUNC_9():...\n",
"VAR_16 = 0\n",
"for _ in f.readlines():\n",
"VAR_16 += 1\n",
"yield '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n'\n",
"if VAR_8 is not None and VAR_16 >= VAR_8:\n",
"if V... | [
"@scope_blueprint.route('/<gididx>')...\n",
"index = 'GIDIDX' + gididx.upper()\n",
"index = _get_index_absolute_path(index)\n",
"def generate():...\n",
"num_entries = 0\n",
"for _ in f.readlines():\n",
"num_entries += 1\n",
"yield '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n'\n",
"if limit is not... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"For",
"AugAssign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"AugAssign'",
"Return'",
"Condition"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_41.add_argument('-c', '--config-path', action='append', metavar=\n 'CONFIG_FILE', help=\n 'Specify config file. Can be given multiple times and may specify directories containing *.yaml files.'\n )\n",
"VAR_41.add_argument('--keys-directory', metav... | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"config_parser.add_argument('-c', '--config-path', action='append', metavar=\n 'CONFIG_FILE', help=\n 'Specify config file. Can be given multiple times and may specify directories containing *.yaml files.'\n )\n",
"config_parser.add_argument('--keys-dir... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_47():...\n",
"VAR_4 = request.form.to_dict()\n",
"VAR_16 = {}\n",
"VAR_16['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', VAR_4[\n 'config_calibre_dir'], flags=re.IGNORECASE).strip()\n",
"VAR_84 = config.config_calibre_dir != VAR_16['config_calibre_dir'\n ] and config.confi... | [
"def _db_simulate_change():...\n",
"param = request.form.to_dict()\n",
"to_save = {}\n",
"to_save['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', param[\n 'config_calibre_dir'], flags=re.IGNORECASE).strip()\n",
"db_change = config.config_calibre_dir != to_save['config_calibre_dir'\n ... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_87(self, VAR_153, VAR_112=VAR_3, VAR_134=VAR_3, VAR_135=VAR_3,...\n",
"if VAR_112 is VAR_3:\n",
"VAR_112 = self.settings.create_next\n",
"if VAR_134 is VAR_3:\n",
"VAR_134 = self.settings.create_onvalidation\n",
"if VAR_135 is VAR_3:\n",
"VAR_135 = self.settings.create_onaccept\n",
"if VAR_1... | [
"def create(self, table, next=DEFAULT, onvalidation=DEFAULT, onaccept=...\n",
"if next is DEFAULT:\n",
"next = self.settings.create_next\n",
"if onvalidation is DEFAULT:\n",
"onvalidation = self.settings.create_onvalidation\n",
"if onaccept is DEFAULT:\n",
"onaccept = self.settings.create_onaccept\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/widget_execute/<unique_id>')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = DaemonControl()\n",
"VAR_43 = VAR_42.widget_execute(VAR_9)\n",
"return jsonify(VAR_43)\n"
] | [
"@blueprint.route('/widget_execute/<unique_id>')...\n",
"\"\"\"docstring\"\"\"\n",
"daemon_control = DaemonControl()\n",
"return_value = daemon_control.widget_execute(unique_id)\n",
"return jsonify(return_value)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_30 = yield defer.ensureDeferred(self._base_builder.build(VAR_28, VAR_29))\n",
"VAR_30._event_id = self._event_id\n",
"VAR_30._dict['event_id'] = self._event_id\n",
"assert VAR_30.event_id == self._event_id\n",
"return VAR_30\n"
] | [
"@defer.inlineCallbacks...\n",
"built_event = yield defer.ensureDeferred(self._base_builder.build(\n prev_event_ids, auth_event_ids))\n",
"built_event._event_id = self._event_id\n",
"built_event._dict['event_id'] = self._event_id\n",
"assert built_event.event_id == self._event_id\n",
"return built_even... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.