lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"def FUNC_6(VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.stat(VAR_14).st_mtime\n"
] | [
"def mtime(path):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.stat(path).st_mtime\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@internationalizeDocstring...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_8:\n",
"VAR_8 = str(VAR_7)\n",
"VAR_3.reply(self._convertBaseToBase(VAR_8, VAR_7, VAR_6))\n",
"VAR_3.error(VAR_0('Invalid <number> for base %s: %s') % (VAR_6, VAR_8))\n",
"VAR_7 = 10\n"
] | [
"@internationalizeDocstring...\n",
"\"\"\"docstring\"\"\"\n",
"if not number:\n",
"number = str(to)\n",
"irc.reply(self._convertBaseToBase(number, to, frm))\n",
"irc.error(_('Invalid <number> for base %s: %s') % (frm, number))\n",
"to = 10\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"@frappe.whitelist()...\n",
"return frappe.db.get_value('Report', VAR_0, 'disable_prepared_report') or 0\n"
] | [
"@frappe.whitelist()...\n",
"return frappe.db.get_value('Report', report, 'disable_prepared_report') or 0\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_32(self, *VAR_13, **VAR_14):...\n",
"if self.directory is None:\n",
"return\n",
"return super(CLASS_2, self).delete(*VAR_13, **kwargs)\n"
] | [
"def delete(self, *args, **kwargs):...\n",
"if self.directory is None:\n",
"return\n",
"return super(SafeFileCache, self).delete(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_8, VAR_9):...\n",
"self.assertEquals(getattr(current_context(), 'request', None), VAR_9)\n",
"return VAR_8\n"
] | [
"def check_context(self, val, expected):...\n",
"self.assertEquals(getattr(current_context(), 'request', None), expected)\n",
"return val\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"@staticmethod...\n",
""
] | [
"@staticmethod...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_49(VAR_62):...\n",
"import frappe.modules\n",
"return frappe.modules.load_doctype_module(VAR_62)\n"
] | [
"def get_meta_module(doctype):...\n",
"import frappe.modules\n",
"return frappe.modules.load_doctype_module(doctype)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6.whitelisted = True\n",
"return VAR_6\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"f.whitelisted = True\n",
"return f\n"
] | [
2,
0,
2,
2
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"@FUNC_0...\n",
"return ActionGenerator(self)\n"
] | [
"@cache_in_self...\n",
"return ActionGenerator(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@FUNC_0...\n",
"return RoomCreationHandler(self)\n"
] | [
"@cache_in_self...\n",
"return RoomCreationHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@staticmethod...\n",
"return 'admin/projects', f'component-{VAR_39.name}'\n"
] | [
"@staticmethod...\n",
"return 'admin/projects', f'component-{field.name}'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_24(self):...\n",
"self.assert_expected(self.folder.t, 'RepeatVariable.html')\n"
] | [
"def testRepeatVariable(self):...\n",
"self.assert_expected(self.folder.t, 'RepeatVariable.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_5(VAR_5, VAR_0):...\n",
"if VAR_0 == VAR_12:\n",
"self.resync_attempts += 1\n"
] | [
"def query_user_devices(destination, user_id):...\n",
"if user_id == remote_user_id:\n",
"self.resync_attempts += 1\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"AugAssign'"
] |
[
"def __repr__(self):...\n",
"return '<Token %r>' % self.id\n"
] | [
"def __repr__(self):...\n",
"return '<Token %r>' % self.id\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = getattr(VAR_5, 'request', None)\n",
"VAR_4 = list(VAR_4)\n",
"VAR_4.reverse()\n",
"while VAR_4:\n",
"VAR_19 = VAR_4.pop()\n",
"return VAR_3\n",
"if VAR_19 == '_':\n",
"warnings.warn(\n 'Traversing to the name `_` is d... | [
"def boboAwareZopeTraverse(object, path_items, econtext):...\n",
"\"\"\"docstring\"\"\"\n",
"request = getattr(econtext, 'request', None)\n",
"path_items = list(path_items)\n",
"path_items.reverse()\n",
"while path_items:\n",
"name = path_items.pop()\n",
"return object\n",
"if name == '_':\n",
"wa... | [
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
1,
0,
0,
1
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'"
] |
[
"@keep_lazy_text...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(unquote_plus(force_str(VAR_16)))\n"
] | [
"@keep_lazy_text...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(unquote_plus(force_str(quoted_url)))\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@CLASS_4('help')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_23 = VAR_3.path()\n",
"if not VAR_23 or VAR_23 == '/':\n",
"VAR_23 = 'index.html'\n",
"VAR_23 = VAR_23.lstrip('/')\n",
"if not docutils.docs_up_to_date(VAR_23):\n",
"message.error(\n 'Your documentation is outdated! Please re-run scripts/asci... | [
"@add_handler('help')...\n",
"\"\"\"docstring\"\"\"\n",
"urlpath = url.path()\n",
"if not urlpath or urlpath == '/':\n",
"urlpath = 'index.html'\n",
"urlpath = urlpath.lstrip('/')\n",
"if not docutils.docs_up_to_date(urlpath):\n",
"message.error(\n 'Your documentation is outdated! Please re-run scr... | [
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'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assert'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Retu... |
[
"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_24(self, VAR_13):...\n",
"VAR_13 = super().format_value(VAR_13)\n",
"if isinstance(VAR_13, str):\n",
"return VAR_13\n",
"return json.dumps(VAR_13)\n"
] | [
"def format_value(self, value):...\n",
"value = super().format_value(value)\n",
"if isinstance(value, str):\n",
"return value\n",
"return json.dumps(value)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_83(self, VAR_71):...\n",
"if isinstance(VAR_71, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = VAR_71 or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._return_value.update(VAR_71)\n",
"def FUNC_84(... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"def add_to_return_value(self, new_return_value):...\n",
"if isinstance(new_return_value, dict):\n",
"if not self.get('_return_value'):\n",
"self._return_value = new_return_value or self.get('_return_value')\n",
"self._return_value = {}\n",
"self._retur... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_1: Type[ParseArgparserDataType], VAR_2: Union[Namespace,...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_2, ArgumentParser):\n",
"VAR_2 = VAR_1.parse_argparser(VAR_2)\n",
"VAR_13 = vars(VAR_2)\n",
"VAR_14 = inspect.signature(VAR_1.__init__).parameters\n",
"VAR_15 = {name: VAR_13[nam... | [
"def from_argparse_args(cls: Type[ParseArgparserDataType], args: Union[...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(args, ArgumentParser):\n",
"args = cls.parse_argparser(args)\n",
"params = vars(args)\n",
"valid_kwargs = inspect.signature(cls.__init__).parameters\n",
"trainer_kwargs = {name: param... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(VAR_0: str) ->str:...\n",
"return stringcase.spinalcase(FUNC_1(FUNC_0(VAR_0)))\n"
] | [
"def kebab_case(value: str) ->str:...\n",
"return stringcase.spinalcase(group_title(_sanitize(value)))\n"
] | [
0,
5
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(**VAR_5):...\n",
"VAR_27 = dict(python=expressions.PythonExpr, path=TrustedPathExpr)\n",
"VAR_27.update(VAR_5)\n",
"return FUNC_1(VAR_4=False, **ovr)\n"
] | [
"def createTrustedChameleonEngine(**overrides):...\n",
"ovr = dict(python=expressions.PythonExpr, path=TrustedPathExpr)\n",
"ovr.update(overrides)\n",
"return createChameleonEngine(untrusted=False, **ovr)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/api/query/meta', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Authentication required', 401\n",
"VAR_14 = g.conn.session.query(Query).filter(Query.id == request.form[\n 'query_id']).one()\n",
"if VAR_14.user_id != get_user().id:\n",
"return 'Authorization denied', 403\n... | [
"@app.route('/api/query/meta', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Authentication required', 401\n",
"query = g.conn.session.query(Query).filter(Query.id == request.form['query_id']\n ).one()\n",
"if query.user_id != get_user().id:\n",
"return 'Authorization denied', 403\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"For",
"Assign'",
"For",
"Assign'",
"For",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_18(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertTrue(VAR_5.evaluate('x | not:exists:x'))\n"
] | [
"def test_hybrid_with_compound_expression_int_value(self):...\n",
"ec = self._makeContext()\n",
"self.assertTrue(ec.evaluate('x | not:exists:x'))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(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.invite(VAR_7=room, src=self.user_id, targ=self.rmcreator_id,\n VAR_9=403)\n",
"self.helper.change_membership(VAR_7=room, src=self.user_id, targ=self.\n rm... | [
"def test_invited_permissions(self):...\n",
"room = self.created_rmid\n",
"self.helper.invite(room=room, src=self.rmcreator_id, targ=self.user_id)\n",
"self.helper.invite(room=room, src=self.user_id, targ=self.rmcreator_id,\n expect_code=403)\n",
"self.helper.change_membership(room=room, src=self.user_id... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/oauth/google', endpoint='authorize')...\n",
"VAR_12 = url_for('.callback', _external=True)\n",
"VAR_13 = request.args.get('next', url_for('redash.index', VAR_6=session.get\n ('org_slug')))\n",
"VAR_0.debug('Callback url: %s', VAR_12)\n",
"VAR_0.debug('Next is: %s', VAR_13)\n",
"return F... | [
"@blueprint.route('/oauth/google', endpoint='authorize')...\n",
"callback = url_for('.callback', _external=True)\n",
"next_path = request.args.get('next', url_for('redash.index', org_slug=\n session.get('org_slug')))\n",
"logger.debug('Callback url: %s', callback)\n",
"logger.debug('Next is: %s', next_pa... | [
4,
4,
4,
4,
4,
4
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_2.route('/login', methods=['GET', 'POST'])...\n",
"if VAR_87 is not None and VAR_87.is_authenticated:\n",
"return redirect(url_for('web.index'))\n",
"if config.config_login_type == constants.LOGIN_LDAP and not services.ldap:\n",
"VAR_3.error(u'Cannot activate LDAP authentication')\n",
"if request.me... | [
"@web.route('/login', methods=['GET', 'POST'])...\n",
"if current_user is not None and current_user.is_authenticated:\n",
"return redirect(url_for('web.index'))\n",
"if config.config_login_type == constants.LOGIN_LDAP and not services.ldap:\n",
"log.error(u'Cannot activate LDAP authentication')\n",
"if re... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Con... |
[
"def FUNC_10(VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = '0123456789abcdefghijklmnopqrstuvwxyz'\n",
"if VAR_22 < 0:\n",
"if six.PY2:\n",
"if not isinstance(VAR_22, six.integer_types):\n",
"if VAR_22 < 36:\n",
"if VAR_22 > sys.maxint:\n",
"return VAR_29[VAR_22]\n",
"VAR_30 = ''\n",
"whil... | [
"def int_to_base36(i):...\n",
"\"\"\"docstring\"\"\"\n",
"char_set = '0123456789abcdefghijklmnopqrstuvwxyz'\n",
"if i < 0:\n",
"if six.PY2:\n",
"if not isinstance(i, six.integer_types):\n",
"if i < 36:\n",
"if i > sys.maxint:\n",
"return char_set[i]\n",
"b36 = ''\n",
"while i != 0:\n",
"i, n =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"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_6(VAR_19=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return formatdate(VAR_19, usegmt=True)\n"
] | [
"def http_date(epoch_seconds=None):...\n",
"\"\"\"docstring\"\"\"\n",
"return formatdate(epoch_seconds, usegmt=True)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_9(VAR_0, VAR_1: FlaskClient, VAR_3: RequestsMock):...\n",
"VAR_3.add(GET, 'https://example.com/', body=\n \"\"\"<html>\n <head><title>Random</title></head><body><p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit\n </p></body></html>\n \"\"\"\n )\n",
"VAR_9 ... | [
"def test_create_new_bookmark(test_app, client: FlaskClient,...\n",
"mocked_responses.add(GET, 'https://example.com/', body=\n \"\"\"<html>\n <head><title>Random</title></head><body><p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit\n </p></body></html>\n \"\"\"\n )\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_6(VAR_10: realization.RealAccount, VAR_11: str...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_10.account == VAR_11:\n",
"return VAR_10\n",
"return realization.get_or_create(VAR_10, VAR_11)\n"
] | [
"def get_or_create(account: realization.RealAccount, account_name: str...\n",
"\"\"\"docstring\"\"\"\n",
"if account.account == account_name:\n",
"return account\n",
"return realization.get_or_create(account, account_name)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_4(VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = Path(VAR_5.file_path).relative_to(click_web.OUTPUT_FOLDER)\n",
"VAR_14 = f'/static/results/{VAR_13.as_posix()}'\n",
"return f'<a href=\"{VAR_14}\">{VAR_5.link_name}</a>'\n"
] | [
"def _get_download_link(field_info):...\n",
"\"\"\"docstring\"\"\"\n",
"rel_file_path = Path(field_info.file_path).relative_to(click_web.OUTPUT_FOLDER)\n",
"uri = f'/static/results/{rel_file_path.as_posix()}'\n",
"return f'<a href=\"{uri}\">{field_info.link_name}</a>'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_5 not in VAR_4.signature_def:\n",
"return VAR_4.signature_def[VAR_5].inputs\n"
] | [
"def _get_inputs_tensor_info_from_meta_graph_def(meta_graph_def,...\n",
"\"\"\"docstring\"\"\"\n",
"if signature_def_key not in meta_graph_def.signature_def:\n",
"return meta_graph_def.signature_def[signature_def_key].inputs\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'"
] |
[
"def FUNC_15(VAR_3, **VAR_4):...\n",
""
] | [
"def _callback(request, **kwargs):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_44(self):...\n",
"if self.user:\n",
"return self.user\n",
"return self.email\n"
] | [
"def _display(self):...\n",
"if self.user:\n",
"return self.user\n",
"return self.email\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_34(self):...\n",
"return ''\n"
] | [
"def get_glossary_flags(self):...\n",
"return ''\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __exit__(self, VAR_171, VAR_105, VAR_178):...\n",
"FUNC_9()\n"
] | [
"def __exit__(self, type, value, traceback):...\n",
"destroy()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_78(self, VAR_47):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.doctype.tag.tag import DocTags\n",
"DocTags(self.doctype).add(self.name, VAR_47)\n"
] | [
"def add_tag(self, tag):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.desk.doctype.tag.tag import DocTags\n",
"DocTags(self.doctype).add(self.name, tag)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Expr'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"if not microsite.get_value('ALLOW_AUTOMATED_SIGNUPS', settings.FEATURES.get\n",
"return HttpResponseForbidden()\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_48 = []\n",
"VAR_49 = []\n",
"VAR_50 = []\n",
"if Cour... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"if not microsite.get_value('ALLOW_AUTOMATED_SIGNUPS', settings.FEATURES.get\n",
"return HttpResponseForbidden()\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"warnings = []\n",
"row_errors = []\n",
"general_errors... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'",
... |
[
"def FUNC_14(self):...\n",
"VAR_5, VAR_15 = self._test_confirm_start()\n",
"VAR_3 = self.client.get(VAR_15)\n",
"self.assertContains(VAR_3, 'Please enter your new password')\n"
] | [
"def test_confirm_valid(self):...\n",
"url, path = self._test_confirm_start()\n",
"response = self.client.get(path)\n",
"self.assertContains(response, 'Please enter your new password')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(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_13 = self.get_success(self.hs.get_datastore().get_user_by... | [
"def test_sends_http(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",
"user_tuple = self.get_suc... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'... |
[
"def FUNC_7(self, VAR_14, VAR_15):...\n",
"for m in self.mappings:\n",
"VAR_43 = m.get(VAR_14, self)\n",
"return VAR_15\n",
"if VAR_43 is not self:\n",
"return VAR_43\n"
] | [
"def get(self, key, default):...\n",
"for m in self.mappings:\n",
"value = m.get(key, self)\n",
"return default\n",
"if value is not self:\n",
"return value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Return'",
"Condition",
"Return'"
] |
[
"@property...\n",
"VAR_15 = CLASS_10.get_enum(self.reference.class_name)\n",
"if VAR_15:\n",
"return 'enum_property.pyi'\n",
"return 'ref_property.pyi'\n"
] | [
"@property...\n",
"enum = EnumProperty.get_enum(self.reference.class_name)\n",
"if enum:\n",
"return 'enum_property.pyi'\n",
"return 'ref_property.pyi'\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_25.whitelist(allow_guest=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = VAR_25.get_doc(VAR_9, VAR_10)\n",
"if getattr(VAR_14, VAR_11, VAR_25._dict()).is_whitelisted:\n",
"VAR_25.call(getattr(VAR_14, VAR_11), **frappe.local.form_dict)\n",
"VAR_25.throw(_('Not permitted'), VAR_25.PermissionError)\n... | [
"@frappe.whitelist(allow_guest=True)...\n",
"\"\"\"docstring\"\"\"\n",
"doc = frappe.get_doc(doctype, name)\n",
"if getattr(doc, custom_method, frappe._dict()).is_whitelisted:\n",
"frappe.call(getattr(doc, custom_method), **frappe.local.form_dict)\n",
"frappe.throw(_('Not permitted'), frappe.PermissionErr... | [
2,
0,
2,
2,
2,
2
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@VAR_0.route('/outputstate_unique_id/<unique_id>/<channel_id>')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = OutputChannel.query.filter(OutputChannel.unique_id == VAR_10).first()\n",
"VAR_42 = DaemonControl()\n",
"VAR_24 = VAR_42.output_state(VAR_9, VAR_22.channel)\n",
"return jsonify(VAR_24)\n"
] | [
"@blueprint.route('/outputstate_unique_id/<unique_id>/<channel_id>')...\n",
"\"\"\"docstring\"\"\"\n",
"channel = OutputChannel.query.filter(OutputChannel.unique_id == channel_id\n ).first()\n",
"daemon_control = DaemonControl()\n",
"state = daemon_control.output_state(unique_id, channel.channel)\n",
"... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@FUNC_3('staff')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_173 = VAR_9.POST['invoice_number']\n",
"return HttpResponseBadRequest('Missing required invoice_number parameter')\n",
"VAR_173 = int(VAR_173)\n",
"return HttpResponseBadRequest(\n 'invoice_number must be an integer, {value} provided'.format(valu... | [
"@require_level('staff')...\n",
"\"\"\"docstring\"\"\"\n",
"invoice_number = request.POST['invoice_number']\n",
"return HttpResponseBadRequest('Missing required invoice_number parameter')\n",
"invoice_number = int(invoice_number)\n",
"return HttpResponseBadRequest(\n 'invoice_number must be an integer,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"async def FUNC_14():...\n",
""
] | [
"async def do_iterations():...\n",
""
] | [
0,
0
] | [
"AsyncFunctionDef'",
"Condition"
] |
[
"@action('resetpasswords', lazy_gettext('Reset Password'), '', 'fa-lock',...\n",
"return redirect(url_for(self.appbuilder.sm.resetpasswordview.__name__ +\n '.this_form_get', VAR_23=item.id))\n"
] | [
"@action('resetpasswords', lazy_gettext('Reset Password'), '', 'fa-lock',...\n",
"return redirect(url_for(self.appbuilder.sm.resetpasswordview.__name__ +\n '.this_form_get', pk=item.id))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@CLASS_4('pyeval')...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = jinja.render('pre.html', title='pyeval', content=pyeval_output)\n",
"return 'text/html', VAR_20\n"
] | [
"@add_handler('pyeval')...\n",
"\"\"\"docstring\"\"\"\n",
"html = jinja.render('pre.html', title='pyeval', content=pyeval_output)\n",
"return 'text/html', html\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'"
] |
[
"@override_settings(LOGIN_URL='login')...\n",
"self.assertLoginURLEquals('/login/?next=/login_required/')\n"
] | [
"@override_settings(LOGIN_URL='login')...\n",
"self.assertLoginURLEquals('/login/?next=/login_required/')\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def __call__(self):...\n",
"return 'dummy'\n"
] | [
"def __call__(self):...\n",
"return 'dummy'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_13(self) ->HomeServerConfig:...\n",
"return self.config\n"
] | [
"def get_config(self) ->HomeServerConfig:...\n",
"return self.config\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, VAR_2, VAR_3):...\n",
"VAR_7 = self.setup_test_homeserver(http_client=None)\n",
"self.handler = VAR_7.get_federation_handler()\n",
"self.store = VAR_7.get_datastore()\n",
"return VAR_7\n"
] | [
"def make_homeserver(self, reactor, clock):...\n",
"hs = self.setup_test_homeserver(http_client=None)\n",
"self.handler = hs.get_federation_handler()\n",
"self.store = hs.get_datastore()\n",
"return hs\n"
] | [
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_28(VAR_9, VAR_10):...\n",
"VAR_10 = VAR_10 or []\n",
"VAR_69 = ub.session.query(ub.ArchivedBook).filter(ub.ArchivedBook.user_id ==\n int(VAR_87.id)).filter(ub.ArchivedBook.is_archived == True).all()\n",
"VAR_70 = [VAR_54.book_id for VAR_54 in VAR_69]\n",
"VAR_71 = db.Books.id.in_(VAR_70)\n",
... | [
"def render_archived_books(page, order):...\n",
"order = order or []\n",
"archived_books = ub.session.query(ub.ArchivedBook).filter(ub.ArchivedBook.\n user_id == int(current_user.id)).filter(ub.ArchivedBook.is_archived == True\n ).all()\n",
"archived_book_ids = [archived_book.book_id for archived_book i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_62(VAR_26, VAR_27, VAR_28, VAR_29=0, VAR_30=0):...\n",
"VAR_80 = struct.pack('HHHH', VAR_27, VAR_28, VAR_29, VAR_30)\n",
"fcntl.ioctl(VAR_26, termios.TIOCSWINSZ, VAR_80)\n"
] | [
"def set_windowsize(fd, row, col, xpix=0, ypix=0):...\n",
"winsize = struct.pack('HHHH', row, col, xpix, ypix)\n",
"fcntl.ioctl(fd, termios.TIOCSWINSZ, winsize)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_40(self, VAR_28, VAR_35):...\n",
"VAR_15 = self.getUserId()\n",
"VAR_80 = self.playlistdb.createPLS(VAR_28=plid, VAR_15=userid, addrstr=hostaddr\n )\n",
"VAR_81 = self.playlistdb.getName(VAR_28, VAR_15)\n",
"if VAR_80 and VAR_81:\n",
"return self.serve_string_as_file(VAR_80, VAR_81 + '.pls')\... | [
"def api_downloadpls(self, plid, hostaddr):...\n",
"userid = self.getUserId()\n",
"pls = self.playlistdb.createPLS(plid=plid, userid=userid, addrstr=hostaddr)\n",
"name = self.playlistdb.getName(plid, userid)\n",
"if pls and name:\n",
"return self.serve_string_as_file(pls, name + '.pls')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_11(VAR_15, VAR_17):...\n",
"ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == VAR_15).delete()\n",
"ub.session.query(ub.ReadBook).filter(ub.ReadBook.book_id == VAR_15).delete()\n",
"ub.delete_download(VAR_15)\n",
"ub.session_commit()\n",
"FUNC_7([u''], VAR_17.authors, db.Authors, cal... | [
"def delete_whole_book(book_id, book):...\n",
"ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book_id).delete()\n",
"ub.session.query(ub.ReadBook).filter(ub.ReadBook.book_id == book_id).delete()\n",
"ub.delete_download(book_id)\n",
"ub.session_commit()\n",
"modify_database_object([u''], boo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = FUNC_1('/groups/%s/profile', 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/profile', 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_6(self):...\n",
"self.export_doc()\n"
] | [
"def on_update(self):...\n",
"self.export_doc()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __setstate__(self, VAR_174):...\n",
"self.update(VAR_174)\n"
] | [
"def __setstate__(self, d):...\n",
"self.update(d)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_84(VAR_206):...\n",
"VAR_317 = []\n",
"for VAR_3, VAR_375 in VAR_206.items():\n",
"if isinstance(VAR_375, dict):\n",
"VAR_317.sort(VAR_310=lambda x: x['name'].lower())\n",
"VAR_317.append({'name': VAR_3, 'ul': FUNC_84(VAR_375)})\n",
"VAR_317.append({'name': VAR_3, 'id': VAR_375})\n",
"return... | [
"def ul_to_list(ul):...\n",
"dir_list = []\n",
"for name, value in ul.items():\n",
"if isinstance(value, dict):\n",
"dir_list.sort(key=lambda x: x['name'].lower())\n",
"dir_list.append({'name': name, 'ul': ul_to_list(value)})\n",
"dir_list.append({'name': name, 'id': value})\n",
"return dir_list\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/api/plugins/<plugin_name>', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_111 = FUNC_58(f'/internal/plugins/{VAR_12}', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_111)\n"
] | [
"@gui.route('/api/plugins/<plugin_name>', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"plugin_info = query_internal_api(f'/internal/plugins/{plugin_name}', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(plugin_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"@property...\n",
"VAR_26 = ['calendar.js', 'admin/DateTimeShortcuts.js']\n",
"return forms.Media(VAR_26=[static('admin/js/%s' % path) for path in js])\n"
] | [
"@property...\n",
"js = ['calendar.js', 'admin/DateTimeShortcuts.js']\n",
"return forms.Media(js=[static('admin/js/%s' % path) for path in js])\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_3):...\n",
"VAR_7 = {'Authorization': 'OAuth {}'.format(VAR_3)}\n",
"VAR_8 = requests.get('https://www.googleapis.com/oauth2/v1/userinfo', VAR_7\n =headers)\n",
"if VAR_8.status_code == 401:\n",
"VAR_0.warning('Failed getting user profile (response code 401).')\n",
"return VAR_8.json()\... | [
"def get_user_profile(access_token):...\n",
"headers = {'Authorization': 'OAuth {}'.format(access_token)}\n",
"response = requests.get('https://www.googleapis.com/oauth2/v1/userinfo',\n headers=headers)\n",
"if response.status_code == 401:\n",
"logger.warning('Failed getting user profile (response code 4... | [
0,
4,
4,
4,
4,
4,
4
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_60 = FUNC_5(VAR_2=request, VAR_6=iid, VAR_10=w, VAR_11=h, VAR_8=conn,\n VAR_12=_defcb, **kwargs)\n",
"VAR_61 = HttpResponse(VAR_60, content_type='image/jpeg')\n",
"return VAR_61\n"
] | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"jpeg_data = _render_thumbnail(request=request, iid=iid, w=w, h=h, conn=conn,\n _defcb=_defcb, **kwargs)\n",
"rsp = HttpResponse(jpeg_data, content_type='image/jpeg')\n",
"return rsp\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return VAR_44 + 2\n"
] | [
"@def_function.function(input_signature=[tensor_spec.TensorSpec(shape=(2, 2),...\n",
"return x + 2\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_29(self, VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_48 = self.encode(VAR_21).encode('utf-8')\n",
"self.transport.write(VAR_48)\n",
"self.transport.flush()\n"
] | [
"def send(self, msg):...\n",
"\"\"\"docstring\"\"\"\n",
"raw = self.encode(msg).encode('utf-8')\n",
"self.transport.write(raw)\n",
"self.transport.flush()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@log_function...\n",
"VAR_2 = FUNC_1('/exchange_third_party_invite/%s', VAR_6)\n",
"VAR_37 = await self.client.put_json(VAR_5=destination, VAR_2=path, VAR_39=\n event_dict)\n",
"return VAR_37\n"
] | [
"@log_function...\n",
"path = _create_v1_path('/exchange_third_party_invite/%s', room_id)\n",
"response = await self.client.put_json(destination=destination, path=path,\n data=event_dict)\n",
"return response\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_2.route('/show/<int:book_id>/<book_format>', defaults={'anyname': 'None'})...\n",
"VAR_6 = VAR_6.split('.')[0]\n",
"VAR_95 = calibre_db.get_book(VAR_5)\n",
"VAR_8 = calibre_db.get_book_format(VAR_5, VAR_6.upper())\n",
"if not VAR_8:\n",
"return 'File not in Database'\n",
"VAR_3.info('Serving book:... | [
"@web.route('/show/<int:book_id>/<book_format>', defaults={'anyname': 'None'})...\n",
"book_format = book_format.split('.')[0]\n",
"book = calibre_db.get_book(book_id)\n",
"data = calibre_db.get_book_format(book_id, book_format.upper())\n",
"if not data:\n",
"return 'File not in Database'\n",
"log.info(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Return'",
"Return'"
] |
[
"@pytest.mark.not_frozen...\n",
"VAR_6.start(VAR_11=['--temp-basedir'] + _base_args(request.config), VAR_16=\n {'PYTHONOPTIMIZE': level})\n",
"if VAR_10 == '2':\n",
"VAR_23 = (\n 'Running on optimize level higher than 1, unexpected behavior may occur.')\n",
"VAR_6.send_cmd(':quit')\n",
"VAR_18 = VAR... | [
"@pytest.mark.not_frozen...\n",
"quteproc_new.start(args=['--temp-basedir'] + _base_args(request.config),\n env={'PYTHONOPTIMIZE': level})\n",
"if level == '2':\n",
"msg = 'Running on optimize level higher than 1, unexpected behavior may occur.'\n",
"quteproc_new.send_cmd(':quit')\n",
"line = quteproc_... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"import logging\n",
"import pathlib\n",
"from s3file.storages import local_dev, storage\n",
"from . import views\n",
"VAR_0 = logging.getLogger('s3file')\n",
"def __init__(self, VAR_1):...\n",
"self.get_response = VAR_1\n",
"def __call__(self, VAR_2):...\n",
"VAR_4 = VAR_2.POST.getlist('s3file')\n",... | [
"import logging\n",
"import pathlib\n",
"from s3file.storages import local_dev, storage\n",
"from . import views\n",
"logger = logging.getLogger('s3file')\n",
"def __init__(self, get_response):...\n",
"self.get_response = get_response\n",
"def __call__(self, request):...\n",
"file_fields = request.P... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_79(VAR_325):...\n",
"VAR_30, VAR_29 = VAR_325\n",
"return int((VAR_30 - VAR_84 + VAR_88) * VAR_95), int((VAR_29 - VAR_85 +\n VAR_90) * VAR_95)\n"
] | [
"def resizeXY(xy):...\n",
"x, y = xy\n",
"return int((x - newX + left_xs) * factor), int((y - newY + top_xs) * factor)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.handler.set_avatar_url(self.frank, synapse.\n types.create_requester(self.frank), 'http://my.server/pic.gif'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_avatar_url(self.frank.localpart))), 'http://my.server/... | [
"@defer.inlineCallbacks...\n",
"yield defer.ensureDeferred(self.handler.set_avatar_url(self.frank, synapse.\n types.create_requester(self.frank), 'http://my.server/pic.gif'))\n",
"self.assertEquals((yield defer.ensureDeferred(self.store.\n get_profile_avatar_url(self.frank.localpart))), 'http://my.server/... | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(VAR_0):...\n",
"VAR_9 = GeneratorError()\n",
"VAR_2 = VAR_0.patch('openapi_python_client._get_document', return_value=error)\n",
"VAR_4 = VAR_0.patch('openapi_python_client.parser.GeneratorData.from_dict')\n",
"VAR_6 = VAR_0.MagicMock()\n",
"VAR_7 = VAR_0.MagicMock()\n",
"from openapi_python... | [
"def test__get_project_for_url_or_path_document_error(mocker):...\n",
"error = GeneratorError()\n",
"_get_document = mocker.patch('openapi_python_client._get_document',\n return_value=error)\n",
"from_dict = mocker.patch('openapi_python_client.parser.GeneratorData.from_dict'\n )\n",
"url = mocker.Magi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"Assign'",
"Expr'",
"Expr'",
"Assert'"
] |
[
"async def FUNC_5(self):...\n",
"VAR_33 = AsyncHTTPClient()\n",
"VAR_34 = HTTPRequest('https://doi.org/{}'.format(self.spec), user_agent=\n 'BinderHub')\n",
"VAR_35 = await VAR_33.fetch(VAR_34)\n",
"self.record_id = VAR_35.effective_url.rsplit('/', maxsplit=1)[1]\n",
"return self.record_id\n"
] | [
"async def get_resolved_ref(self):...\n",
"client = AsyncHTTPClient()\n",
"req = HTTPRequest('https://doi.org/{}'.format(self.spec), user_agent=\n 'BinderHub')\n",
"r = await client.fetch(req)\n",
"self.record_id = r.effective_url.rsplit('/', maxsplit=1)[1]\n",
"return self.record_id\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_28(VAR_9, VAR_7):...\n",
"VAR_10 = VAR_7[0] or []\n",
"VAR_69 = ub.session.query(ub.ArchivedBook).filter(ub.ArchivedBook.user_id ==\n int(VAR_87.id)).filter(ub.ArchivedBook.is_archived == True).all()\n",
"VAR_70 = [VAR_142.book_id for VAR_142 in VAR_69]\n",
"VAR_71 = db.Books.id.in_(VAR_70)\n",... | [
"def render_archived_books(page, sort):...\n",
"order = sort[0] or []\n",
"archived_books = ub.session.query(ub.ArchivedBook).filter(ub.ArchivedBook.\n user_id == int(current_user.id)).filter(ub.ArchivedBook.is_archived == True\n ).all()\n",
"archived_book_ids = [archived_book.book_id for archived_book ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_18(VAR_23, VAR_17):...\n",
"VAR_39 = False\n",
"VAR_23 = VAR_23 or '1'\n",
"if not VAR_23.replace('.', '', 1).isdigit():\n",
"flash(_('%(seriesindex)s is not a valid number, skipping', seriesindex=\n series_index), category='warning')\n",
"if VAR_17.series_index != VAR_23:\n",
"return False... | [
"def edit_book_series_index(series_index, book):...\n",
"modif_date = False\n",
"series_index = series_index or '1'\n",
"if not series_index.replace('.', '', 1).isdigit():\n",
"flash(_('%(seriesindex)s is not a valid number, skipping', seriesindex=\n series_index), category='warning')\n",
"if book.seri... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Assign'"
] |
[
"import pytest\n",
"import openapi_python_client.schema as oai\n",
"from openapi_python_client.parser.errors import PropertyError\n",
"VAR_0 = 'openapi_python_client.parser.properties'\n",
"def FUNC_0(self):...\n",
"from openapi_python_client.parser.properties import Property\n",
"VAR_4 = Property(VAR_5... | [
"import pytest\n",
"import openapi_python_client.schema as oai\n",
"from openapi_python_client.parser.errors import PropertyError\n",
"MODULE_NAME = 'openapi_python_client.parser.properties'\n",
"def test_get_type_string(self):...\n",
"from openapi_python_client.parser.properties import Property\n",
"p ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"Import'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Functio... |
[
"def __init__(self, VAR_13=None):...\n",
"self.root = VAR_13\n",
"self.default_template_dir = pkg_resources.resource_filename('synapse',\n 'res/templates')\n"
] | [
"def __init__(self, root_config=None):...\n",
"self.root = root_config\n",
"self.default_template_dir = pkg_resources.resource_filename('synapse',\n 'res/templates')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_27(self, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_26 = self.get(VAR_18)\n",
"VAR_53 = self._doc_before_save.get(VAR_18)\n",
"VAR_54 = True\n",
"if len(VAR_53) != len(VAR_26):\n",
"VAR_54 = False\n",
"for i, VAR_21 in enumerate(VAR_53):\n",
"return VAR_54\n",
"VAR_98 = VAR_26[i].as... | [
"def is_child_table_same(self, fieldname):...\n",
"\"\"\"docstring\"\"\"\n",
"value = self.get(fieldname)\n",
"original_value = self._doc_before_save.get(fieldname)\n",
"same = True\n",
"if len(original_value) != len(value):\n",
"same = False\n",
"for i, d in enumerate(original_value):\n",
"return s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"For",
"Return'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'"
] |
[
"def FUNC_2(*VAR_2, **VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_47 = []\n",
"VAR_47 += [(arg, None) for arg in VAR_2]\n",
"VAR_47 += [(VAR_160, VAR_3[VAR_160]) for VAR_160 in VAR_3]\n",
"def FUNC_84(VAR_1):...\n",
"def FUNC_83(*VAR_2, **VAR_3):...\n",
"VAR_9 = VAR_2[0]\n",
"VAR_193 = {'error': ... | [
"def require_post_params(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"required_params = []\n",
"required_params += [(arg, None) for arg in args]\n",
"required_params += [(key, kwargs[key]) for key in kwargs]\n",
"def decorator(func):...\n",
"def wrapped(*args, **kwargs):...\n",
"request = args... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AugAssign'",
"AugAssign'",
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_5(VAR_3, VAR_8, VAR_6, VAR_4, VAR_9):...\n",
"VAR_50 = False\n",
"if VAR_4 == 'languages':\n",
"VAR_84 = VAR_8.lang_code\n",
"if VAR_4 == 'custom':\n",
"for VAR_11 in VAR_9:\n",
"VAR_84 = VAR_8.value\n",
"VAR_84 = VAR_8.name\n",
"VAR_10 = VAR_6.query(VAR_8).filter(VAR_84 == VAR_11).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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.