lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"@FUNC_0...\n",
"return StateHandler(self)\n"
] | [
"@cache_in_self...\n",
"return StateHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(VAR_16, VAR_28=40, VAR_18=VAR_26, VAR_20=VAR_27, VAR_29=VAR_70(8203)...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_16.tag in VAR_26:\n",
"return\n",
"VAR_63 = VAR_16.get('class')\n",
"if VAR_63:\n",
"VAR_91 = False\n",
"if VAR_16.text:\n",
"VAR_63 = VAR_63.split()\n",
"VAR_16.text = FUNC_6... | [
"def word_break(el, max_width=40, avoid_elements=_avoid_word_break_elements,...\n",
"\"\"\"docstring\"\"\"\n",
"if el.tag in _avoid_word_break_elements:\n",
"return\n",
"class_name = el.get('class')\n",
"if class_name:\n",
"dont_break = False\n",
"if el.text:\n",
"class_name = class_name.split()\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"For",
"Expr'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_34(self):...\n",
"if VAR_53.session['admin']:\n",
"VAR_105 = self.userdb.getUserList()\n",
"return json.dumps({'time': 0, 'userlist': []})\n",
"for VAR_51 in VAR_105:\n",
"if VAR_51['id'] == VAR_53.session['userid']:\n",
"VAR_106 = lambda VAR_51: VAR_51['last_time_online']\n",
"VAR_51['delet... | [
"def api_getuserlist(self):...\n",
"if cherrypy.session['admin']:\n",
"userlist = self.userdb.getUserList()\n",
"return json.dumps({'time': 0, 'userlist': []})\n",
"for user in userlist:\n",
"if user['id'] == cherrypy.session['userid']:\n",
"sortfunc = lambda user: user['last_time_online']\n",
"user['... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_25(self, VAR_60, VAR_61):...\n",
"self.footnote_index = 0\n",
"self.links = VAR_60 or {}\n",
"self.footnotes = VAR_61 or {}\n"
] | [
"def setup(self, links, footnotes):...\n",
"self.footnote_index = 0\n",
"self.links = links or {}\n",
"self.footnotes = footnotes or {}\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_4(self) ->str:...\n",
"return os.path.dirname(os.path.abspath(self.sourceName))\n"
] | [
"def directory(self) ->str:...\n",
"return os.path.dirname(os.path.abspath(self.sourceName))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_47(self):...\n",
"self.model.updateLibrary()\n",
"return 'success'\n"
] | [
"def api_updatedb(self):...\n",
"self.model.updateLibrary()\n",
"return 'success'\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"self.register_user('user_admin', 'pass', admin=True)\n",
"VAR_8 = self.login('user_admin', 'pass')\n",
"VAR_27 = self.register_user('user_nonadmin', 'pass', admin=False)\n",
"VAR_22 = self.login('user_nonadmin', 'pass')\n",
"VAR_29 = self.helper.upload_media(self.upload_resourc... | [
"def test_cannot_quarantine_safe_media(self):...\n",
"self.register_user('user_admin', 'pass', admin=True)\n",
"admin_user_tok = self.login('user_admin', 'pass')\n",
"non_admin_user = self.register_user('user_nonadmin', 'pass', admin=False)\n",
"non_admin_user_tok = self.login('user_nonadmin', 'pass')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = self.register_user('user', 'pass')\n",
"VAR_10 = self.login('user', 'pass')\n",
"VAR_11 = self.register_user('other_user', 'pass')\n",
"VAR_12 = self.login('other_user', 'pass')\n",
"VAR_20 = self.helper.create_room_as(VAR_11, tok=other_acces... | [
"def _test_push_unread_count(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('other_user', 'pass')\n",
"other_access_token = self.login('other_user', 'pass')\n",
"room_id = self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
... |
[
"def __post_init__(self) ->None:...\n",
"super().__post_init__()\n",
"if self.default is not None:\n",
"self.default = (\n f'field(default_factory=lambda: cast({self.get_type_string()}, {self.default}))'\n )\n"
] | [
"def __post_init__(self) ->None:...\n",
"super().__post_init__()\n",
"if self.default is not None:\n",
"self.default = (\n f'field(default_factory=lambda: cast({self.get_type_string()}, {self.default}))'\n )\n"
] | [
0,
5,
5,
5
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'"
] |
[
"def FUNC_5(*VAR_8):...\n",
"return scriptPath('boilerplate', *VAR_8)\n"
] | [
"def boilerplatePath(*segs):...\n",
"return scriptPath('boilerplate', *segs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_18(VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_20.all:\n",
"FUNC_8(VAR_20.dir)\n",
"if VAR_20.tag_set is None:\n",
"FUNC_0(VAR_20.dir)\n",
"if VAR_20.signature_def is None:\n",
"FUNC_1(VAR_20.dir, VAR_20.tag_set)\n",
"FUNC_4(VAR_20.dir, VAR_20.tag_set, VAR_20.signature_def)\n"
] | [
"def show(args):...\n",
"\"\"\"docstring\"\"\"\n",
"if args.all:\n",
"_show_all(args.dir)\n",
"if args.tag_set is None:\n",
"_show_tag_sets(args.dir)\n",
"if args.signature_def is None:\n",
"_show_signature_def_map_keys(args.dir, args.tag_set)\n",
"_show_inputs_outputs(args.dir, args.tag_set, args.s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_69(VAR_43, VAR_126=False, VAR_127=True):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils\n",
"VAR_61 = FUNC_71(VAR_43, VAR_126=raise_not_found)\n",
"if VAR_61:\n",
"VAR_61 = frappe.utils.strip(VAR_61)\n",
"return []\n",
"return [p.strip() for p in VAR_61.splitlines() if not VAR_127 or... | [
"def get_file_items(path, raise_not_found=False, ignore_empty_lines=True):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.utils\n",
"content = read_file(path, raise_not_found=raise_not_found)\n",
"if content:\n",
"content = frappe.utils.strip(content)\n",
"return []\n",
"return [p.strip() for p in c... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"VAR_3 = '@foo:bar'\n",
"VAR_7 = 5000000\n",
"VAR_10 = UserPresenceState.default(VAR_3)\n",
"VAR_10 = VAR_10.copy_and_replace(VAR_10=PresenceState.ONLINE,\n last_active_ts=now - SYNC_ONLINE_TIMEOUT - 1, last_user_sync_ts=now -\n SYNC_ONLINE_TIMEOUT - 1)\n",
"VAR_9 = handle_... | [
"def test_sync_online(self):...\n",
"user_id = '@foo:bar'\n",
"now = 5000000\n",
"state = UserPresenceState.default(user_id)\n",
"state = state.copy_and_replace(state=PresenceState.ONLINE, last_active_ts=\n now - SYNC_ONLINE_TIMEOUT - 1, last_user_sync_ts=now -\n SYNC_ONLINE_TIMEOUT - 1)\n",
"new_st... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@login_required()...\n",
""
] | [
"@login_required()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_23(VAR_14, VAR_31):...\n",
"from flask import _request_ctx_stack\n",
"def FUNC_33(VAR_91, VAR_14, VAR_31):...\n",
"return os.path.join(VAR_91, VAR_14, 'LC_MESSAGES', f'{VAR_31}.po')\n"
] | [
"def _get_all_translationfiles(locale, domain):...\n",
"from flask import _request_ctx_stack\n",
"def get_po_path(basedir, locale, domain):...\n",
"return os.path.join(basedir, locale, 'LC_MESSAGES', f'{domain}.po')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_1):...\n",
"self.get_response = VAR_1\n"
] | [
"def __init__(self, get_response):...\n",
"self.get_response = get_response\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __str__(self) ->str:...\n",
"return self.sourceName\n"
] | [
"def __str__(self) ->str:...\n",
"return self.sourceName\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(VAR_10, VAR_11, VAR_20=None, VAR_6=None, VAR_17=None, VAR_18='on'):...\n",
"if VAR_6 is None:\n",
"VAR_56 = None\n",
"if VAR_20:\n",
"VAR_56 = FUNC_19(VAR_10, VAR_20, VAR_17)\n",
"if VAR_56:\n",
"VAR_87 = VAR_56\n",
"VAR_87, VAR_57 = FUNC_18(VAR_10, VAR_6, VAR_22.path, VAR_17, VAR_18)\n",... | [
"def unpack_http_url(link, location, download_dir=None, session=None, hashes...\n",
"if session is None:\n",
"already_downloaded_path = None\n",
"if download_dir:\n",
"already_downloaded_path = _check_download_dir(link, download_dir, hashes)\n",
"if already_downloaded_path:\n",
"from_path = already_down... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_33(self, VAR_44):...\n",
"VAR_13 = FUNC_1(VAR_44.group(2) or VAR_44.group(1))\n",
"if VAR_13 not in self.links:\n",
"return None\n",
"VAR_84 = self.links[VAR_13]\n",
"return self._process_link(VAR_44, VAR_84['link'], VAR_84['title'])\n"
] | [
"def output_reflink(self, m):...\n",
"key = _keyify(m.group(2) or m.group(1))\n",
"if key not in self.links:\n",
"return None\n",
"ret = self.links[key]\n",
"return self._process_link(m, ret['link'], ret['title'])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(VAR_45):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.session.user = VAR_45\n",
"VAR_1.session.sid = VAR_45\n",
"VAR_1.cache = {}\n",
"VAR_1.form_dict = CLASS_0()\n",
"VAR_1.jenv = None\n",
"VAR_1.session.data = CLASS_0()\n",
"VAR_1.role_permissions = {}\n",
"VAR_1.new_doc_templates = {}\... | [
"def set_user(username):...\n",
"\"\"\"docstring\"\"\"\n",
"local.session.user = username\n",
"local.session.sid = username\n",
"local.cache = {}\n",
"local.form_dict = _dict()\n",
"local.jenv = None\n",
"local.session.data = _dict()\n",
"local.role_permissions = {}\n",
"local.new_doc_templates = ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_29(self):...\n",
"return self._has_role(constants.ROLE_EDIT_SHELFS)\n"
] | [
"def role_edit_shelfs(self):...\n",
"return self._has_role(constants.ROLE_EDIT_SHELFS)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __repr__(self) ->str:...\n",
"return '{}({!r})'.format(self.__class__.__name__, str(self))\n"
] | [
"def __repr__(self) ->str:...\n",
"return '{}({!r})'.format(self.__class__.__name__, str(self))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self, VAR_1):...\n",
"from openapi_python_client.parser.properties import ListProperty\n",
"VAR_10 = VAR_1.MagicMock()\n",
"VAR_11 = VAR_1.MagicMock()\n",
"VAR_10.get_type_string.return_value = VAR_11\n",
"VAR_4 = VAR_31(VAR_5='test', VAR_26=True, default=None, VAR_10=inner_property)\n",
"as... | [
"def test_get_type_string(self, mocker):...\n",
"from openapi_python_client.parser.properties import ListProperty\n",
"inner_property = mocker.MagicMock()\n",
"inner_type_string = mocker.MagicMock()\n",
"inner_property.get_type_string.return_value = inner_type_string\n",
"p = ListProperty(name='test', req... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"def FUNC_19(VAR_2, *VAR_23, **VAR_24):...\n",
"VAR_3 = VAR_2.GET.get('url')\n",
"if VAR_3 is None or len(VAR_3) == 0:\n",
"VAR_3 = VAR_2.get_full_path()\n",
"VAR_9 = False\n",
"VAR_14 = VAR_24.get('conn', None)\n",
"VAR_16 = None\n",
"VAR_19 = VAR_24.get('server_id', None)\n",
"if VAR_14 is None:\n... | [
"def wrapped(request, *args, **kwargs):...\n",
"url = request.GET.get('url')\n",
"if url is None or len(url) == 0:\n",
"url = request.get_full_path()\n",
"doConnectionCleanup = False\n",
"conn = kwargs.get('conn', None)\n",
"error = None\n",
"server_id = kwargs.get('server_id', None)\n",
"if conn is... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Expr'",
... |
[
"@VAR_0.route('/api/query/unstar', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Unauthorized access', 403\n",
"VAR_14 = g.conn.session.query(Query).get(request.form['query_id'])\n",
"if VAR_14:\n",
"VAR_34 = g.conn.session.query(Star).filter(Star.query_id == request.form[\n 'query_id']... | [
"@app.route('/api/query/unstar', methods=['POST'])...\n",
"if get_user() is None:\n",
"return 'Unauthorized access', 403\n",
"query = g.conn.session.query(Query).get(request.form['query_id'])\n",
"if query:\n",
"star = g.conn.session.query(Star).filter(Star.query_id == request.form[\n 'query_id']).filt... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(VAR_3: str, VAR_4: Callable, VAR_5: Optional[str]=None...\n",
"\"\"\"docstring\"\"\"\n",
"return re_path(f'^{VAR_3}/?(?:[?#].*)?$', VAR_4, VAR_5=name)\n"
] | [
"def opt_slash_path(route: str, view: Callable, name: Optional[str]=None...\n",
"\"\"\"docstring\"\"\"\n",
"return re_path(f'^{route}/?(?:[?#].*)?$', view, name=name)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_81(self):...\n",
"VAR_14 = self.token['text']\n",
"return self.renderer.block_html(VAR_14)\n"
] | [
"def output_close_html(self):...\n",
"text = self.token['text']\n",
"return self.renderer.block_html(text)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"super().clean()\n",
"VAR_113 = {'target', 'contentsum', 'translationsum'}\n",
"if not VAR_113.issubset(self.cleaned_data):\n",
"return\n",
"VAR_17 = self.unit\n",
"if self.cleaned_data['contentsum'] != VAR_17.content_hash:\n",
"if self.cleaned_data['translationsum'] != VAR_1... | [
"def clean(self):...\n",
"super().clean()\n",
"required = {'target', 'contentsum', 'translationsum'}\n",
"if not required.issubset(self.cleaned_data):\n",
"return\n",
"unit = self.unit\n",
"if self.cleaned_data['contentsum'] != unit.content_hash:\n",
"if self.cleaned_data['translationsum'] != unit.get... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_0(self, VAR_2, **VAR_3):...\n",
"self.federation_domain_whitelist = None\n",
"VAR_6 = VAR_2.get('federation_domain_whitelist', None)\n",
"if VAR_6 is not None:\n",
"self.federation_domain_whitelist = {}\n",
"self.federation_ip_range_blacklist = VAR_2.get('federation_ip_range_blacklist',\n [])... | [
"def read_config(self, config, **kwargs):...\n",
"self.federation_domain_whitelist = None\n",
"federation_domain_whitelist = config.get('federation_domain_whitelist', None)\n",
"if federation_domain_whitelist is not None:\n",
"self.federation_domain_whitelist = {}\n",
"self.federation_ip_range_blacklist =... | [
0,
0,
0,
0,
0,
4,
0,
4,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"@wraps(VAR_0)...\n",
"if VAR_1.user.is_authenticated:\n",
"return redirect(VAR_1.GET.get('next', VAR_1.user.st.get_absolute_url()))\n",
"return VAR_0(VAR_1, *VAR_2, **kwargs)\n"
] | [
"@wraps(view_func)...\n",
"if request.user.is_authenticated:\n",
"return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n",
"return view_func(request, *args, **kwargs)\n"
] | [
0,
0,
4,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_160(self=self, VAR_147=VAR_147, VAR_146=VAR_146):...\n",
"return self.has_membership(VAR_147=group_id, VAR_146=role)\n"
] | [
"def has_membership(self=self, group_id=group_id, role=role):...\n",
"return self.has_membership(group_id=group_id, role=role)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_123(self, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.__in_base(self.normalize_path(VAR_10), self.base)\n"
] | [
"def in_base(self, f):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.__in_base(self.normalize_path(f), self.base)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_13(self, VAR_25: Optional[str], VAR_14: str):...\n",
"\"\"\"docstring\"\"\"\n",
"for VAR_47, val in self._configs.items():\n",
"if VAR_47 == VAR_25:\n",
"if VAR_14 in dir(val):\n",
"return getattr(val, VAR_14)\n"
] | [
"def _get_unclassed_config(self, asking_section: Optional[str], item: str):...\n",
"\"\"\"docstring\"\"\"\n",
"for key, val in self._configs.items():\n",
"if key == asking_section:\n",
"if item in dir(val):\n",
"return getattr(val, item)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Condition",
"Return'"
] |
[
"@default('git_credentials')...\n",
"if self.private_token:\n",
"return 'username=binderhub\\\\npassword={token}'.format(token=self.private_token)\n",
"return ''\n"
] | [
"@default('git_credentials')...\n",
"if self.private_token:\n",
"return 'username=binderhub\\\\npassword={token}'.format(token=self.private_token)\n",
"return ''\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"VAR_27 = np.array([[1], [2]])\n",
"VAR_28 = np.array(range(5))\n",
"VAR_32 = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(VAR_32, VAR_54=x0, VAR_55=x1)\n",
"VAR_21 = 'x=' + VAR_32\n",
"saved_model_cli.load_inputs_from_input_arg_string(VAR_21, '', '')\n"
] | [
"def testInputParserErrorNoName(self):...\n",
"x0 = np.array([[1], [2]])\n",
"x1 = np.array(range(5))\n",
"input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n",
"np.savez(input_path, a=x0, b=x1)\n",
"input_str = 'x=' + input_path\n",
"saved_model_cli.load_inputs_from_input_arg_string(input_str... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"@app.route('/bookmarks/new', methods=['GET', 'POST'])...\n",
"VAR_8 = app.config.get('DEFAULT_BOOKMARKS_DIR', 'root directory')\n",
"VAR_9 = forms.NewBookmarkForm(VAR_7=default_dir)\n",
"VAR_9.path.choices = [('', 'root directory')] + [(pathname, pathname) for\n pathname in data.get_dirs()]\n",
"if VAR_... | [
"@app.route('/bookmarks/new', methods=['GET', 'POST'])...\n",
"default_dir = app.config.get('DEFAULT_BOOKMARKS_DIR', 'root directory')\n",
"form = forms.NewBookmarkForm(path=default_dir)\n",
"form.path.choices = [('', 'root directory')] + [(pathname, pathname) for\n pathname in data.get_dirs()]\n",
"if f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import logging\n",
"import warnings\n",
"import OFS.interfaces\n",
"from AccessControl import safe_builtins\n",
"from Acquisition import aq_base\n",
"from MultiMapping import MultiMapping\n",
"from zExceptions import NotFound\n",
"from zExceptions import Unauthorized\n",
"... | [
"\"\"\"Page Template Expression Engine\n\nPage Template-specific implementation of TALES, with handlers\nfor Python expressions, string literals, and paths.\n\"\"\"\n",
"import logging\n",
"import warnings\n",
"import OFS.interfaces\n",
"from AccessControl import safe_builtins\n",
"from Acquisition import... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
1,
0,
0,
1
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom... |
[
"def __new__(VAR_197, *VAR_9, **VAR_13):...\n",
"VAR_215 = thread.get_ident()\n",
"VAR_323 = thread.allocate_lock()\n",
"VAR_323.acquire()\n",
"VAR_323.release()\n",
"return VAR_197.instances[VAR_215]\n",
"VAR_458 = object.__new__(VAR_197, *VAR_9, **b)\n",
"VAR_197.instances[VAR_215] = VAR_458\n",
"... | [
"def __new__(cls, *a, **b):...\n",
"id = thread.get_ident()\n",
"lock = thread.allocate_lock()\n",
"lock.acquire()\n",
"lock.release()\n",
"return cls.instances[id]\n",
"instance = object.__new__(cls, *a, **b)\n",
"cls.instances[id] = instance\n",
"return instance\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return re.sub('\\\\s+', ' ', VAR_3).strip()\n"
] | [
"def strip_plus(text):...\n",
"\"\"\"docstring\"\"\"\n",
"return re.sub('\\\\s+', ' ', text).strip()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_29():...\n",
"return self.build_perspectives_response(VAR_34, VAR_36, VAR_39)\n"
] | [
"def build_response():...\n",
"return self.build_perspectives_response(SERVER_NAME, testkey, VALID_UNTIL_TS)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_107(self, VAR_11=None):...\n",
"VAR_56 = VAR_263.request\n",
"VAR_244 = VAR_263.response\n",
"VAR_244.headers['Content-Type'] = 'text/xml'\n",
"if not VAR_11:\n",
"VAR_11 = VAR_56.args\n",
"if VAR_11 and VAR_11[0] in self.xml_procedures:\n",
"VAR_278 = self.call_service_function(self.xml_pro... | [
"def serve_xml(self, args=None):...\n",
"request = current.request\n",
"response = current.response\n",
"response.headers['Content-Type'] = 'text/xml'\n",
"if not args:\n",
"args = request.args\n",
"if args and args[0] in self.xml_procedures:\n",
"s = self.call_service_function(self.xml_procedures[arg... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_22():...\n",
"from octoprint.util.jinja import get_all_asset_paths\n",
"return get_all_asset_paths(app.jinja_env.assets_environment, verifyExist=False)\n"
] | [
"def _get_all_assets():...\n",
"from octoprint.util.jinja import get_all_asset_paths\n",
"return get_all_asset_paths(app.jinja_env.assets_environment, verifyExist=False)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Return'"
] |
[
"@VAR_2.route('/get_publishers_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Publishers, request.args.get('q'), ('|',\n ','))\n"
] | [
"@web.route('/get_publishers_json', methods=['GET'])...\n",
"return calibre_db.get_typeahead(db.Publishers, request.args.get('q'), ('|',\n ','))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_19(self):...\n",
"VAR_5, VAR_15 = self._test_confirm_start()\n",
"VAR_3 = self.client.post(VAR_15, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"VAR_16 = User.objects.get(VAR_8='staffmember@example.com')\n",
"self.assertTrue(VAR_16.check_password('anewpassword'))\n"... | [
"def test_confirm_complete(self):...\n",
"url, path = self._test_confirm_start()\n",
"response = self.client.post(path, {'new_password1': 'anewpassword',\n 'new_password2': 'anewpassword'})\n",
"u = User.objects.get(email='staffmember@example.com')\n",
"self.assertTrue(u.check_password('anewpassword'))\n... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_92(*VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.realtime\n",
"return frappe.realtime.publish_progress(*VAR_79, **kwargs)\n"
] | [
"def publish_progress(*args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"import frappe.realtime\n",
"return frappe.realtime.publish_progress(*args, **kwargs)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Return'"
] |
[
"def FUNC_3(VAR_3):...\n",
"@wraps(VAR_3)...\n",
"VAR_12 = FUNC_2()\n",
"if VAR_12 is not None:\n",
"VAR_16 = ub.session.query(ub.User).join(ub.RemoteAuthToken).filter(ub.\n RemoteAuthToken.auth_token == VAR_12).filter(ub.RemoteAuthToken.\n token_type == 1).first()\n",
"return FUNC_7\n",
"if VAR_1... | [
"def requires_kobo_auth(f):...\n",
"@wraps(f)...\n",
"auth_token = get_auth_token()\n",
"if auth_token is not None:\n",
"user = ub.session.query(ub.User).join(ub.RemoteAuthToken).filter(ub.\n RemoteAuthToken.auth_token == auth_token).filter(ub.RemoteAuthToken.\n token_type == 1).first()\n",
"return ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_11(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"if '.' in VAR_1:\n",
"VAR_3 = VAR_25.get_attr(VAR_1)\n",
"VAR_3 = globals()[VAR_1]\n",
"VAR_25.log('method:' + VAR_1)\n",
"return VAR_3\n"
] | [
"def get_attr(cmd):...\n",
"\"\"\"docstring\"\"\"\n",
"if '.' in cmd:\n",
"method = frappe.get_attr(cmd)\n",
"method = globals()[cmd]\n",
"frappe.log('method:' + cmd)\n",
"return method\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_1, VAR_2, VAR_4):...\n",
"self.store = VAR_4.get_datastore()\n",
"self.room_creator = VAR_4.get_room_creation_handler()\n"
] | [
"def prepare(self, reactor, clock, homeserver):...\n",
"self.store = homeserver.get_datastore()\n",
"self.room_creator = homeserver.get_room_creation_handler()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_31(self):...\n",
"return self._has_role(constants.ROLE_VIEWER)\n"
] | [
"def role_viewer(self):...\n",
"return self._has_role(constants.ROLE_VIEWER)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"return os.path.abspath(VAR_4) if VAR_4 else VAR_4\n"
] | [
"@staticmethod...\n",
"return os.path.abspath(file_path) if file_path else file_path\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, *VAR_0, **VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"self.doctype = self.name = None\n",
"self._default_new_docs = {}\n",
"self.flags = frappe._dict()\n",
"if VAR_0 and VAR_0[0] and isinstance(VAR_0[0], string_types):\n",
"if len(VAR_0) == 1:\n",
"if VAR_0 and VAR_0[0] and isinstan... | [
"def __init__(self, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"self.doctype = self.name = None\n",
"self._default_new_docs = {}\n",
"self.flags = frappe._dict()\n",
"if args and args[0] and isinstance(args[0], string_types):\n",
"if len(args) == 1:\n",
"if args and args[0] and isinstance(arg... | [
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'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"For",
"Expr'",
"Assign'"
] |
[
"def FUNC_64(self, VAR_32, VAR_35=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_35:\n",
"VAR_35 = (VAR_19.fieldname for VAR_19 in VAR_32.meta.get('fields', {\n 'fieldtype': ['in', ['Currency', 'Float', 'Percent']]}))\n",
"for VAR_18 in VAR_35:\n",
"VAR_32.set(VAR_18, flt(VAR_32.get(VAR_18), self... | [
"def round_floats_in(self, doc, fieldnames=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if not fieldnames:\n",
"fieldnames = (df.fieldname for df in doc.meta.get('fields', {'fieldtype': [\n 'in', ['Currency', 'Float', 'Percent']]}))\n",
"for fieldname in fieldnames:\n",
"doc.set(fieldname, flt(doc.get(fie... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_19(self, VAR_82, VAR_83, VAR_84):...\n",
"VAR_238 = hmac.new(VAR_199=secret, msg=body, digestmod=self.digestmod)\n",
"return compare(self.jwt_b64e(VAR_238.digest()), VAR_83)\n"
] | [
"def verify_signature(self, body, signature, secret):...\n",
"mauth = hmac.new(key=secret, msg=body, digestmod=self.digestmod)\n",
"return compare(self.jwt_b64e(mauth.digest()), signature)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = saved_model_utils.get_saved_model_tag_sets(VAR_2)\n",
"print('The given SavedModel contains the following tag-sets:')\n",
"for VAR_3 in sorted(VAR_22):\n",
"print('%r' % ', '.join(sorted(VAR_3)))\n"
] | [
"def _show_tag_sets(saved_model_dir):...\n",
"\"\"\"docstring\"\"\"\n",
"tag_sets = saved_model_utils.get_saved_model_tag_sets(saved_model_dir)\n",
"print('The given SavedModel contains the following tag-sets:')\n",
"for tag_set in sorted(tag_sets):\n",
"print('%r' % ', '.join(sorted(tag_set)))\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2):...\n",
"return parse.urlparse(VAR_2).scheme == 'https'\n"
] | [
"def issecure(self, url):...\n",
"return parse.urlparse(url).scheme == 'https'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_18, VAR_14=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = FUNC_11('GIDIDX' + VAR_18.upper())\n",
"VAR_33 = '*.jpg', '*.JPG', '*.jpeg', '.png'\n",
"VAR_34 = []\n",
"if VAR_14:\n",
"VAR_14.replace('%2C', ',')\n",
"def FUNC_14():...\n",
"VAR_14.replace('%20', ' ')\n",
"VAR_47 = f.... | [
"def get_mixer_list(idx, classes=None):...\n",
"\"\"\"docstring\"\"\"\n",
"mixer_index = _get_index_absolute_path('GIDIDX' + idx.upper())\n",
"image_types = '*.jpg', '*.JPG', '*.jpeg', '.png'\n",
"classes_list = []\n",
"if classes:\n",
"classes.replace('%2C', ',')\n",
"def get_class_path():...\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_8(VAR_13, VAR_14, VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_48 = False\n",
"VAR_49 = False\n",
"VAR_50 = dict([(identifier.type.lower(), identifier) for identifier in VAR_13])\n",
"if len(VAR_13) != len(VAR_50):\n",
"VAR_49 = True\n",
"VAR_51 = dict([(identifier.type.lower(), identifier... | [
"def modify_identifiers(input_identifiers, db_identifiers, db_session):...\n",
"\"\"\"docstring\"\"\"\n",
"changed = False\n",
"error = False\n",
"input_dict = dict([(identifier.type.lower(), identifier) for identifier in\n input_identifiers])\n",
"if len(input_identifiers) != len(input_dict):\n",
"e... | [
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'",
"Condition",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_36():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_5()\n",
"VAR_96 = request.args(1)\n",
"if not VAR_43.flash and VAR_3 == request.application:\n",
"VAR_155 = T('ATTENTION: you cannot edit the running application!')\n",
"if os.path.exists(apath('%s/compiled' % VAR_3, VAR_122=request)):\n",
... | [
"def plugin():...\n",
"\"\"\"docstring\"\"\"\n",
"app = get_app()\n",
"plugin = request.args(1)\n",
"if not response.flash and app == request.application:\n",
"msg = T('ATTENTION: you cannot edit the running application!')\n",
"if os.path.exists(apath('%s/compiled' % app, r=request)):\n",
"response.fl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assi... |
[
"def FUNC_37(self):...\n",
"VAR_32 = models.Honeycomb.objects.create(location='Old tree')\n",
"VAR_32.bee_set.create()\n",
"VAR_29 = models.Bee._meta.get_field('honeycomb').rel\n",
"VAR_27 = widgets.ForeignKeyRawIdWidget(VAR_29, widget_admin_site)\n",
"self.assertHTMLEqual(conditional_escape(VAR_27.render... | [
"def test_fk_related_model_not_in_admin(self):...\n",
"big_honeycomb = models.Honeycomb.objects.create(location='Old tree')\n",
"big_honeycomb.bee_set.create()\n",
"rel = models.Bee._meta.get_field('honeycomb').rel\n",
"w = widgets.ForeignKeyRawIdWidget(rel, widget_admin_site)\n",
"self.assertHTMLEqual(co... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_29(VAR_12, VAR_13, VAR_14, VAR_15):...\n",
"if 'tags' in VAR_14:\n",
"VAR_40 = calibre_db.session.query(db.Tags).filter(db.Tags.id.in_(VAR_15)).all()\n",
"VAR_40 = calibre_db.session.query(db.cc_classes[config.\n config_restricted_column]).filter(db.cc_classes[config.\n config_restricted_colum... | [
"def prepare_tags(user, action, tags_name, id_list):...\n",
"if 'tags' in tags_name:\n",
"tags = calibre_db.session.query(db.Tags).filter(db.Tags.id.in_(id_list)).all()\n",
"tags = calibre_db.session.query(db.cc_classes[config.config_restricted_column]\n ).filter(db.cc_classes[config.config_restricted_colu... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_16(self):...\n",
"VAR_115 = []\n",
"VAR_116 = {'offset', 'checksum'}\n",
"for param in sorted(self.cleaned_data):\n",
"VAR_13 = self.cleaned_data[param]\n",
"return VAR_115\n",
"if VAR_13 is None or param in VAR_116:\n",
"if isinstance(VAR_13, bool):\n",
"if VAR_13:\n",
"if isinstance(VA... | [
"def items(self):...\n",
"items = []\n",
"ignored = {'offset', 'checksum'}\n",
"for param in sorted(self.cleaned_data):\n",
"value = self.cleaned_data[param]\n",
"return items\n",
"if value is None or param in ignored:\n",
"if isinstance(value, bool):\n",
"if value:\n",
"if isinstance(value, int):... | [
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'",
"For",
"Assign'",
"Return'",
"Condition",
"Condition",
"Condition",
"Condition",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Condition",
"For",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"@FUNC_0...\n",
"return FederationClient(self)\n"
] | [
"@cache_in_self...\n",
"return FederationClient(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_13(self, VAR_5, VAR_6, VAR_7, VAR_8=None, VAR_9=None):...\n",
"VAR_6 = self.get_success(self.handler.check_device_registered(VAR_5=user_id,\n VAR_6=device_id, initial_device_display_name=display_name))\n",
"if VAR_9 is not None:\n",
"self.get_success(self.store.insert_client_ip(VAR_5, VAR_8, VAR_... | [
"def _record_user(self, user_id, device_id, display_name, access_token=None,...\n",
"device_id = self.get_success(self.handler.check_device_registered(user_id=\n user_id, device_id=device_id, initial_device_display_name=display_name))\n",
"if ip is not None:\n",
"self.get_success(self.store.insert_client_i... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(VAR_10):...\n",
"VAR_10 = VAR_10.strip().lower()\n",
"VAR_10 = re.sub('\\\\(\\\\)', '', VAR_10)\n",
"VAR_10 = re.sub('[\\\\s/(,]+', '-', VAR_10)\n",
"VAR_10 = re.sub('[^a-z0-9_-]', '', VAR_10)\n",
"VAR_10 = VAR_10.rstrip('-')\n",
"return VAR_10\n"
] | [
"def simplifyText(text):...\n",
"text = text.strip().lower()\n",
"text = re.sub('\\\\(\\\\)', '', text)\n",
"text = re.sub('[\\\\s/(,]+', '-', text)\n",
"text = re.sub('[^a-z0-9_-]', '', text)\n",
"text = text.rstrip('-')\n",
"return text\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = VAR_2.session['connector'].server_id\n",
"VAR_115 = []\n",
"if VAR_24 == 'p':\n",
"VAR_202 = VAR_8.getObject('Project', VAR_25)\n",
"if VAR_24 == 'd':\n",
"if VAR_202 is None:\n",
"VAR_202 = VAR_8.getObject('Dataset', VAR_25)\n",
"if V... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"server_id = request.session['connector'].server_id\n",
"imgs = []\n",
"if ctx == 'p':\n",
"obj = conn.getObject('Project', cid)\n",
"if ctx == 'd':\n",
"if obj is None:\n",
"obj = conn.getObject('Dataset', cid)\n",
"if ctx == 'w':\n",
"for 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,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"For",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition"... |
[
"@staticmethod...\n",
"return '`tab{0}`.`{1}`'.format(*VAR_11)\n"
] | [
"@staticmethod...\n",
"return '`tab{0}`.`{1}`'.format(*parts)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_7(VAR_19):...\n",
"VAR_34 = FUNC_10(VAR_19)\n",
"VAR_36 = '/'.join(VAR_34.split('/')[:-2]) + '/classes.txt'\n",
"if os.path.isfile(VAR_36):\n",
"return '<object id={} src={} meta={} />'.format(quoteattr(url_for(\n '.get_object_id', VAR_19=object_path)), quoteattr(FUNC_8(VAR_19)),\n quoteattr... | [
"def _get_object_element(object_path):...\n",
"path = _get_obj_absolute_path(object_path)\n",
"class_text = '/'.join(path.split('/')[:-2]) + '/classes.txt'\n",
"if os.path.isfile(class_text):\n",
"return '<object id={} src={} meta={} />'.format(quoteattr(url_for(\n '.get_object_id', object_path=object_pa... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@moderator_required...\n",
"VAR_8 = get_object_or_404(Comment, VAR_2=pk)\n",
"if is_post(VAR_0):\n",
"Comment.objects.filter(VAR_2=pk).update(is_removed=remove)\n",
"return render(VAR_0=request, template_name='spirit/comment/moderate.html',\n context={'comment': comment})\n",
"return redirect(VAR_0.GE... | [
"@moderator_required...\n",
"comment = get_object_or_404(Comment, pk=pk)\n",
"if is_post(request):\n",
"Comment.objects.filter(pk=pk).update(is_removed=remove)\n",
"return render(request=request, template_name='spirit/comment/moderate.html',\n context={'comment': comment})\n",
"return redirect(request.... | [
0,
0,
0,
0,
0,
4
] | [
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_49(self, VAR_38, VAR_39):...\n",
"VAR_87 = 'attachment; filename=\"' + VAR_39 + '\"'\n",
"VAR_53.response.headers['Content-Type'] = 'application/x-download'\n",
"VAR_53.response.headers['Content-Disposition'] = VAR_87\n",
"return codecs.encode(VAR_38, 'UTF-8')\n"
] | [
"def serve_string_as_file(self, string, filename):...\n",
"content_disposition = 'attachment; filename=\"' + filename + '\"'\n",
"cherrypy.response.headers['Content-Type'] = 'application/x-download'\n",
"cherrypy.response.headers['Content-Disposition'] = content_disposition\n",
"return codecs.encode(string,... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_7, VAR_8):...\n",
"self.user_id = VAR_7\n",
"self.session_key = VAR_8\n"
] | [
"def __init__(self, user_id, session_key):...\n",
"self.user_id = user_id\n",
"self.session_key = session_key\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_87():...\n",
"VAR_364 = ','.join(VAR_301.get('columns'))\n",
"yield VAR_364\n",
"for rows in VAR_301.get('lazy_rows'):\n",
"yield '\\n' + '\\n'.join([','.join([VAR_345(VAR_362) for VAR_362 in VAR_378]) for\n VAR_378 in rows])\n"
] | [
"def csv_gen():...\n",
"csv_cols = ','.join(table_data.get('columns'))\n",
"yield csv_cols\n",
"for rows in table_data.get('lazy_rows'):\n",
"yield '\\n' + '\\n'.join([','.join([str(d) for d in row]) for row in rows])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"For",
"Expr'"
] |
[
"def FUNC_42(VAR_16):...\n",
"VAR_21 = None\n",
"if VAR_16.get('config_use_google_drive'):\n",
"VAR_106 = {}\n",
"VAR_81 = not VAR_21 and 'config_use_google_drive' in VAR_16\n",
"if not os.path.isfile(gdriveutils.SETTINGS_YAML):\n",
"if config.config_use_google_drive and not VAR_81:\n",
"config.config... | [
"def _configuration_gdrive_helper(to_save):...\n",
"gdrive_error = None\n",
"if to_save.get('config_use_google_drive'):\n",
"gdrive_secrets = {}\n",
"new_gdrive_value = not gdrive_error and 'config_use_google_drive' in to_save\n",
"if not os.path.isfile(gdriveutils.SETTINGS_YAML):\n",
"if config.config_... | [
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",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_43(self, VAR_25, *VAR_0, **VAR_1):...\n",
"return self.run_method(VAR_25, *VAR_0, **kwargs)\n"
] | [
"def run_trigger(self, method, *args, **kwargs):...\n",
"return self.run_method(method, *args, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.filter...\n",
"if getattr(VAR_17, 'is_hyperlink', False):\n",
"VAR_55 = six.text_type(VAR_17.obj)\n",
"if VAR_17 is None or isinstance(VAR_17, bool):\n",
"return mark_safe('<a href=%s>%s</a>' % (VAR_17, escape(VAR_55)))\n",
"return mark_safe('<code>%s</code>' % {(True): 'true', (False): 'false',\n... | [
"@register.filter...\n",
"if getattr(value, 'is_hyperlink', False):\n",
"name = six.text_type(value.obj)\n",
"if value is None or isinstance(value, bool):\n",
"return mark_safe('<a href=%s>%s</a>' % (value, escape(name)))\n",
"return mark_safe('<code>%s</code>' % {(True): 'true', (False): 'false',\n No... | [
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",
"Assign'",
"Condition",
"Return'",
"Return'",
"Condition",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'",
"Return'",
"Return'",
"Condition",
"Return'",
"Condition",
"Re... |
[
"def FUNC_71(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.is_logged_in():\n",
"redirect(self.settings.login_url)\n",
"VAR_282 = self.table_membership()\n",
"VAR_283 = self.db(VAR_282.user_id == self.user.id).select()\n",
"VAR_153 = TABLE()\n",
"for VAR_284 in VAR_283:\n",
"VAR_381 = self.ta... | [
"def groups(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.is_logged_in():\n",
"redirect(self.settings.login_url)\n",
"table_membership = self.table_membership()\n",
"memberships = self.db(table_membership.user_id == self.user.id).select()\n",
"table = TABLE()\n",
"for membership in memberships... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return self._instance_name\n"
] | [
"def get_instance_name(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"return self._instance_name\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@classmethod...\n",
"return FUNC_0(VAR_4)\n"
] | [
"@classmethod...\n",
"return path_exists(file_path)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"return '{user}-{repo}'.format(user=self.user, repo=self.repo)\n"
] | [
"def get_build_slug(self):...\n",
"return '{user}-{repo}'.format(user=self.user, repo=self.repo)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_84(VAR_72, *VAR_73):...\n",
"def FUNC_86(self, VAR_25, *VAR_0, **VAR_1):...\n",
"FUNC_83(self, VAR_72(self, *VAR_0, **kwargs))\n",
"for VAR_6 in VAR_73:\n",
"FUNC_83(self, VAR_6(self, VAR_25, *VAR_0, **kwargs))\n",
"return self._return_value\n"
] | [
"def compose(fn, *hooks):...\n",
"def runner(self, method, *args, **kwargs):...\n",
"add_to_return_value(self, fn(self, *args, **kwargs))\n",
"for f in hooks:\n",
"add_to_return_value(self, f(self, method, *args, **kwargs))\n",
"return self._return_value\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self, VAR_3, VAR_4):...\n",
"return django.forms.DateField(**options)\n"
] | [
"def create_date_field(self, field, options):...\n",
"return django.forms.DateField(**options)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_12(self, VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_30 = super().evaluateStructure(VAR_20)\n",
"return self._handleText(VAR_30, VAR_20)\n"
] | [
"def evaluateStructure(self, expr):...\n",
"\"\"\"docstring\"\"\"\n",
"text = super().evaluateStructure(expr)\n",
"return self._handleText(text, expr)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>/<action>', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_71 = request.json\n",
"VAR_98 = FUNC_58(f'/internal/jobs/{VAR_9}/{VAR_17}', 'put', json=request_data)\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_98)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>/<action>', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"request_data = request.json\n",
"response_info = query_internal_api(f'/internal/jobs/{job_id}/{action}',\n 'put', json=request_data)\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_82(VAR_46, VAR_38):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = VAR_46.get('user')\n",
"if not VAR_19:\n",
"VAR_40 = FUNC_76(VAR_19, VAR_38)\n",
"VAR_163 = GeneratedCertificate.certificate_for_student(VAR_40, VAR_38)\n",
"if not VAR_163:\n",
"return VAR_163\n"
] | [
"def validate_request_data_and_get_certificate(certificate_invalidation,...\n",
"\"\"\"docstring\"\"\"\n",
"user = certificate_invalidation.get('user')\n",
"if not user:\n",
"student = get_student(user, course_key)\n",
"certificate = GeneratedCertificate.certificate_for_student(student, course_key)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"@VAR_2.route('/ajax/togglearchived/<int:book_id>', methods=['POST'])...\n",
"VAR_54 = ub.session.query(ub.ArchivedBook).filter(and_(ub.ArchivedBook.\n user_id == int(VAR_87.id), ub.ArchivedBook.book_id == VAR_5)).first()\n",
"if VAR_54:\n",
"VAR_54.is_archived = not VAR_54.is_archived\n",
"VAR_54 = ub.A... | [
"@web.route('/ajax/togglearchived/<int:book_id>', methods=['POST'])...\n",
"archived_book = ub.session.query(ub.ArchivedBook).filter(and_(ub.\n ArchivedBook.user_id == int(current_user.id), ub.ArchivedBook.book_id ==\n book_id)).first()\n",
"if archived_book:\n",
"archived_book.is_archived = not archive... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_7(VAR_22):...\n",
""
] | [
"def geocode(address):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_18() ->None:...\n",
"VAR_41.resolutionBegan(None)\n",
"VAR_51 = False\n",
"for i in VAR_42:\n",
"VAR_7 = IPAddress(i.host)\n",
"if not VAR_51:\n",
"if FUNC_0(VAR_7, self._ip_whitelist, self._ip_blacklist):\n",
"for i in VAR_42:\n",
"VAR_41.resolutionComplete()\n",
"VAR_0.info('Dropped %s... | [
"def _callback() ->None:...\n",
"r.resolutionBegan(None)\n",
"has_bad_ip = False\n",
"for i in addresses:\n",
"ip_address = IPAddress(i.host)\n",
"if not has_bad_ip:\n",
"if check_against_blacklist(ip_address, self._ip_whitelist, self._ip_blacklist):\n",
"for i in addresses:\n",
"r.resolutionComplet... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"For",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_18() ->None:...\n",
"VAR_41.resolutionBegan(None)\n",
"VAR_51 = False\n",
"for i in VAR_42:\n",
"VAR_7 = IPAddress(i.host)\n",
"if not VAR_51:\n",
"if FUNC_0(VAR_7, self._ip_whitelist, self._ip_blacklist):\n",
"for i in VAR_42:\n",
"VAR_41.resolutionComplete()\n",
"VAR_0.info('Dropped %s... | [
"def _callback() ->None:...\n",
"r.resolutionBegan(None)\n",
"has_bad_ip = False\n",
"for i in addresses:\n",
"ip_address = IPAddress(i.host)\n",
"if not has_bad_ip:\n",
"if check_against_blacklist(ip_address, self._ip_whitelist, self._ip_blacklist):\n",
"for i in addresses:\n",
"r.resolutionComplet... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"For",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"return self.post()\n"
] | [
"def get(self):...\n",
"return self.post()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_22(VAR_9, VAR_5, VAR_10):...\n",
"VAR_13 = calibre_db.session.query(db.Series).filter(db.Series.id == VAR_5\n ).first()\n",
"if VAR_13:\n",
"VAR_63, VAR_68, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, db.\n Books.series.any(db.Series.id == VAR_5), [VAR_10[0][0]])\n",
"abort(404)\n... | [
"def render_series_books(page, book_id, order):...\n",
"name = calibre_db.session.query(db.Series).filter(db.Series.id == book_id\n ).first()\n",
"if name:\n",
"entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books,\n db.Books.series.any(db.Series.id == book_id), [order[0][0]])\n",
... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_17: Unit, *VAR_6, **VAR_7):...\n",
"self.unit = VAR_17\n",
"super().__init__(*VAR_6, **kwargs)\n"
] | [
"def __init__(self, unit: Unit, *args, **kwargs):...\n",
"self.unit = unit\n",
"super().__init__(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"from mock import Mock\n",
"import synapse\n",
"import synapse.api.errors\n",
"from synapse.api.constants import EventTypes\n",
"from synapse.config.room_directory import RoomDirectoryConfig\n",
"from synapse.rest.client.v1 import directory, login, room\n",
"from synapse.types import RoomAlias, create_r... | [
"from mock import Mock\n",
"import synapse\n",
"import synapse.api.errors\n",
"from synapse.api.constants import EventTypes\n",
"from synapse.config.room_directory import RoomDirectoryConfig\n",
"from synapse.rest.client.v1 import directory, login, room\n",
"from synapse.types import RoomAlias, create_r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign... |
[
"def FUNC_26(VAR_66):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_81 = StringIO()\n",
"VAR_82 = csv.writer(VAR_81)\n",
"VAR_82.writerow([VAR_63, VAR_64])\n",
"for csv_line in VAR_66:\n",
"VAR_82.writerow([str(csv_line[0][:-4]).replace('T', ' '), csv_line[1]])\n",
"VAR_81.seek(0)\n",
"yield VAR_81.read()\... | [
"def iter_csv(data):...\n",
"\"\"\"docstring\"\"\"\n",
"line = StringIO()\n",
"writer = csv.writer(line)\n",
"writer.writerow([col_1, col_2])\n",
"for csv_line in data:\n",
"writer.writerow([str(csv_line[0][:-4]).replace('T', ' '), csv_line[1]])\n",
"line.seek(0)\n",
"yield line.read()\n",
"line.t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_107(VAR_169, VAR_7='utf-8'):...\n",
""
] | [
"def safe_encode(param, encoding='utf-8'):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"import os\n",
"from django.core.files.base import ContentFile\n",
"from django.core.files.uploadedfile import SimpleUploadedFile\n",
"from s3file.middleware import S3FileMiddleware\n",
"from s3file.storages import storage\n",
"def FUNC_0(self):...\n",
"VAR_3 = b'test_get_files_from_storage'\n",
"VAR_... | [
"import os\n",
"from django.core.files.base import ContentFile\n",
"from django.core.files.uploadedfile import SimpleUploadedFile\n",
"from s3file.middleware import S3FileMiddleware\n",
"from s3file.storages import storage\n",
"def test_get_files_from_storage(self):...\n",
"content = b'test_get_files_fr... | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
1
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assert'",
"Assert'",
"Expr'",
"Assign'",
"Expr'",
"Assert'",
"Assert'",
"FunctionD... |
[
"@parameterized.named_parameters(('non_tfrt', False))...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_10 = test.test_src_dir_path(VAR_0)\n",
"VAR_45 = np.array([[1], [2]])\n",
"VAR_46 = np.zeros((6, 3))\n",
"VAR_32 = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutOverwrite_inputs.... | [
"@parameterized.named_parameters(('non_tfrt', False))...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"x = np.array([[1], [2]])\n",
"x_notused = np.zeros((6, 3))\n",
"input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandOutO... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(VAR_7, VAR_9, VAR_8='w'):...\n",
"VAR_22 = FUNC_2(VAR_7, VAR_8)\n",
"VAR_22.write(VAR_9)\n",
"VAR_22.close()\n"
] | [
"def safe_write(a, value, b='w'):...\n",
"safe_file = safe_open(a, b)\n",
"safe_file.write(value)\n",
"safe_file.close()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_61(self, VAR_25):...\n",
"VAR_72 = getattr(self, VAR_25, None)\n",
"if not VAR_72:\n",
"if not getattr(VAR_72, 'whitelisted', False):\n"
] | [
"def is_whitelisted(self, method):...\n",
"fn = getattr(self, method, None)\n",
"if not fn:\n",
"if not getattr(fn, 'whitelisted', False):\n"
] | [
0,
2,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition"
] |
[
"@app.route('/robots.txt')...\n",
"return send_from_directory(app.static_folder, 'robots.txt')\n"
] | [
"@app.route('/robots.txt')...\n",
"return send_from_directory(app.static_folder, 'robots.txt')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_22(self, VAR_19):...\n",
"return constants.has_flag(self.role, VAR_19)\n"
] | [
"def _has_role(self, role_flag):...\n",
"return constants.has_flag(self.role, role_flag)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(self, VAR_11, VAR_12, VAR_13):...\n",
"if VAR_13:\n",
"if VAR_12:\n",
"return ''\n",
"return io.StringIO('')\n"
] | [
"def _fail(self, location, str, okayToFail):...\n",
"if okayToFail:\n",
"if str:\n",
"return ''\n",
"return io.StringIO('')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.