lines
sequence
raw_lines
sequence
label
sequence
type
sequence
[ "def __call__(self, VAR_2, VAR_3, VAR_4=None):...\n", "if VAR_3.strip():\n", "return\n", "print('disconnecting for respawn')\n", "self.XMPP.disconnect(reconnect=False, wait=True)\n", "print('preparing and running execv')\n", "os.chdir(self.cwd)\n", "os.execv(self.argv[0], self.argv)\n" ]
[ "def __call__(self, msg, arguments, errorSink=None):...\n", "if arguments.strip():\n", "return\n", "print('disconnecting for respawn')\n", "self.XMPP.disconnect(reconnect=False, wait=True)\n", "print('preparing and running execv')\n", "os.chdir(self.cwd)\n", "os.execv(self.argv[0], self.argv)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_42, VAR_43):...\n", "if not VAR_101.user_is_loggedin or VAR_101.user.needs_captcha():\n", "if not captcha.valid_solution(VAR_42, VAR_43):\n", "VAR_101.errors.add(errors.BAD_CAPTCHA)\n" ]
[ "def run(self, iden, solution):...\n", "if not c.user_is_loggedin or c.user.needs_captcha():\n", "if not captcha.valid_solution(iden, solution):\n", "c.errors.add(errors.BAD_CAPTCHA)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'" ]
[ "def FUNC_16(self, VAR_15, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "VAR_32 = self.cursor.execute(\n 'select listid from lists where listhash = \"%s\"' % VAR_15).fetchall()[0]\n", "print('removing itemind, listid: %s, %s' % (VAR_16, VAR_32[0]))\n", "VAR_30 = self.cursor.execute(\n 'delete from listitems where (itemid = \"%s\" and listid = \"%s\")' % (\n VAR_16, VAR_32[0]))\n", "self.connection.commit()\n" ]
[ "def removefromlist(self, listhash, itemind):...\n", "\"\"\"docstring\"\"\"\n", "listid = self.cursor.execute(\n 'select listid from lists where listhash = \"%s\"' % listhash).fetchall()[0]\n", "print('removing itemind, listid: %s, %s' % (itemind, listid[0]))\n", "r = self.cursor.execute(\n 'delete from listitems where (itemid = \"%s\" and listid = \"%s\")' % (\n itemind, listid[0]))\n", "self.connection.commit()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "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_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" ]
[ "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, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "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'" ]
[ "@api.public...\n", "VAR_6.fail('Handler code should not be called')\n" ]
[ "@api.public...\n", "test.fail('Handler code should not be called')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_8(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['volumeName'] = VAR_10['name']\n", "VAR_5['prompt'] = 'false'\n", "VAR_27 = self._cliq_get_volume_info(VAR_10['name'])\n", "VAR_0.error('Volume did not exist. It will not be deleted')\n", "self._cliq_run_xml('deleteVolume', VAR_5)\n", "return\n" ]
[ "def delete_volume(self, volume):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['volumeName'] = volume['name']\n", "cliq_args['prompt'] = 'false'\n", "volume_info = self._cliq_get_volume_info(volume['name'])\n", "LOG.error('Volume did not exist. It will not be deleted')\n", "self._cliq_run_xml('deleteVolume', cliq_args)\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1=',', VAR_2=None):...\n", "\"\"\"docstring\"\"\"\n", "return [chunk.strip(VAR_2) for chunk in VAR_0.split(VAR_1)]\n" ]
[ "def getlist(option, sep=',', chars=None):...\n", "\"\"\"docstring\"\"\"\n", "return [chunk.strip(chars) for chunk in option.split(sep)]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_3 = VAR_0.lower()\n", "if VAR_3 in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if VAR_3 in ('no', 'false', 'f', 'n', '0'):\n", "return False\n" ]
[ "def str2bool(value):...\n", "v = value.lower()\n", "if v in ('yes', 'true', 't', '1', 'y'):\n", "return True\n", "if v in ('no', 'false', 'f', 'n', '0'):\n", "return False\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_0 = MySQLdb.connect(host='localhost', port=3306, user=sys.argv[1],\n passwd=sys.argv[2], VAR_0=sys.argv[3])\n", "return VAR_0\n" ]
[ "def init_db():...\n", "\"\"\"docstring\"\"\"\n", "db = MySQLdb.connect(host='localhost', port=3306, user=sys.argv[1], passwd=\n sys.argv[2], db=sys.argv[3])\n", "return db\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "@property...\n", "VAR_14 = '' if self.version == 'custom' else '-synthetic'\n", "return {'scalac': ['//:scalac{}'.format(VAR_14)], 'scala-library': [\n '//:scala-library{}'.format(VAR_14)]}\n" ]
[ "@property...\n", "maybe_suffix = '' if self.version == 'custom' else '-synthetic'\n", "return {'scalac': ['//:scalac{}'.format(maybe_suffix)], 'scala-library': [\n '//:scala-library{}'.format(maybe_suffix)]}\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "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.assertEqual(True, VAR_50)\n", "self.assertEqual(False, VAR_51)\n", "self.assertEqual({'pool': 'default'}, VAR_5)\n", "self.assertEqual(VAR_22, VAR_52)\n" ]
[ "def call_hook(_botobj, name, *args):...\n", "if name == 'on_after_task':\n", "failure, internal_failure, dimensions, summary = args\n", "self.assertEqual(True, failure)\n", "self.assertEqual(False, internal_failure)\n", "self.assertEqual({'pool': 'default'}, dimensions)\n", "self.assertEqual(result, summary)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self\n", "VAR_12 = []\n", "VAR_5 = model.Identity(model.IDENTITY_USER, 'joe@example.com')\n", "def FUNC_27(VAR_13):...\n", "self.assertEqual('/request', VAR_13.path)\n", "VAR_12.append('not_applicable')\n", "return None\n" ]
[ "def test_auth_method_order(self):...\n", "\"\"\"docstring\"\"\"\n", "test = self\n", "calls = []\n", "ident = model.Identity(model.IDENTITY_USER, 'joe@example.com')\n", "def not_applicable(request):...\n", "self.assertEqual('/request', request.path)\n", "calls.append('not_applicable')\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "Return'" ]
[ "def __iter__(self):...\n", "return self\n" ]
[ "def __iter__(self):...\n", "return self\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self):...\n", "" ]
[ "def run(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "\"\"\"string\"\"\"\n", "VAR_0 = {}\n", "\"\"\"Configuration of remote applications.\"\"\"\n", "VAR_1 = 'oauth_token'\n", "\"\"\"Session key prefix used when storing the access token for a remote app.\"\"\"\n" ]
[ "\"\"\" Configuration variables for defining remote applications.\n\n================================ ==============================================\n`OAUTHCLIENT_REMOTE_APPS` Dictionary of remote applications. See example\n below. **Default:** ``{}``.\n`OAUTHCLIENT_SESSION_KEY_PREFIX` Prefix for the session key used to store the\n an access token. **Default:** ``oauth_token``.\n================================ ==============================================\n\nEach remote application must be defined in the ``OAUTHCLIENT_REMOTE_APPS``\ndictionary, where the keys are the application names and the values the\nconfiguration parameters for the application.\n\n.. code-block:: python\n\n OAUTHCLIENT_REMOTE_APPS = dict(\n myapp=dict(\n # configuration values for myapp ...\n ),\n )\n\nThe application name is used in the login, authorized, sign-up and disconnect\nendpoints:\n\n- Login endpoint: ``/oauth/login/<REMOTE APP>/``.\n- Authorized endpoint: ``/oauth/authorized/<REMOTE APP>/``.\n- Disconnect endpoint: ``/oauth/disconnect/<REMOTE APP>/``.\n- Sign up endpoint: ``/oauth/login/<REMOTE APP>/``.\n\n\nRemote application\n^^^^^^^^^^^^^^^^^^\nConfiguration of a single remote application is a dictionary with the following\nkeys:\n\n- ``title`` - Title of remote application. Displayed to end-users under Account\n > Linked accounts.\n- ``description`` - Short description of remote application. Displayed to\n end-users under Account > Linked accounts.\n- ``icon`` - CSS class for icon of service (e.g. ``fa fa-github`` for using the\n Font-Awesome GitHub icon). Displayed to end-users.\n- ``params`` - Flask-OAuthlib remote application parameters..\n- ``authorized_handler`` - Import path to authorized callback handler.\n- ``disconnect_handler`` - Import path to disconnect callback handler.\n- ``signup_handler`` - A dictionary of import path to sign up callback handler.\n- ``remember`` - Boolean indicating if the session should be permament.\n\n.. code-block:: python\n\n OAUTHCLIENT_REMOTE_APPS = dict(\n myapp=dict(\n title='...',\n description='...',\n icon='...',\n authorized_handler=\"...\",\n disconnect_handler=\"...\",\n signup_handler=dict(\n info=\"...\",\n setup=\"...\",\n view=\"...\",\n ),\n params=dict(...),\n remember=True\n )\n )\n )\n\n\nFlask-OAuthlib parameters\n^^^^^^^^^^^^^^^^^^^^^^^^^\nThe Flask-OAuthlib parameters defines the remote application OAuth endpoints as\nwell as the client id and secret. Full description of these parameters are\ngiven in the `Flask-OAuthlib documentation <https://flask-oauthlib.readthedocs.org/en/latest/client.html>`_.\n\nNormally you will have to browse the remote application's API documentation to\nfind which URLs and scopes to use.\n\nBelow is an example for GitHub:\n\n.. code-block:: python\n\n OAUTHCLIENT_REMOTE_APPS = dict(\n github=dict(\n # ...\n params=dict(\n request_token_params={'scope': 'user:email'},\n base_url='https://api.github.com/',\n request_token_url=None,\n access_token_url=\"https://github.com/login/oauth/access_token\",\n access_token_method='POST',\n authorize_url=\"https://github.com/login/oauth/authorize\",\n app_key=\"GITHUB_APP_CREDENTIALS\",\n )\n )\n )\n\n GITHUB_APP_CREDENTIALS=dict(\n consumer_key=\"changeme\"\n consumer_secret=\"changeme\"\n )\n\nThe ``app_key`` parameter allows you to put your sensitive client id and secret\nin your instance configuration (``var/invenio.base-instance/invenio.cfg``).\n\nHandlers\n^^^^^^^^\nHandlers allow customizing oauthclient endpoints for each remote\napplication:\n\n- Authorized endpoint: ``/oauth/authorized/<REMOTE APP>/``.\n- Disconnect endpoint: ``/oauth/disconnect/<REMOTE APP>/``.\n- Sign up endpoint: ``/oauth/login/<REMOTE APP>/``.\n\nBy default only authorized and disconnect handlers are required, and Invenio\nprovide default implementation that stores the access token in the user session\nas well as to the database if the user is authenticated:\n\n\n.. code-block:: python\n\n OAUTHCLIENT_REMOTE_APPS = dict(\n myapp=dict(\n # ...\n authorized_handler=\"invenio.modules.oauthclient.handlers\"\n \":authorized_default_handler\",\n disconnect_handler=\"invenio.modules.oauthclient.handlers\"\n \":disconnect_handler\",\n )\n # ...\n )\n )\n\nIf you want to provide sign in/up functionality using oauthclient, Invenio\ncomes with a default handler that will try to find a matching local user for\na given authorize request.\n\n.. code-block:: python\n\n OAUTHCLIENT_REMOTE_APPS = dict(\n orcid=dict(\n # ...\n authorized_handler=\"invenio.modules.oauthclient.handlers\"\n \":authorized_signup_handler\",\n disconnect_handler=\"invenio.modules.oauthclient.handlers\"\n \":disconnect_handler\",\n )\n signup_handler=dict(\n info=\"invenio.modules.oauthclient.contrib.orcid:account_info\",\n setup=\"invenio.modules.oauthclient.contrib.orcid:account_setup\",\n view=\"invenio.modules.oauthclient.handlers:signup_handler\",\n ),\n # ...\n )\n )\n\"\"\"\n", "OAUTHCLIENT_REMOTE_APPS = {}\n", "\"\"\"Configuration of remote applications.\"\"\"\n", "OAUTHCLIENT_SESSION_KEY_PREFIX = 'oauth_token'\n", "\"\"\"Session key prefix used when storing the access token for a remote app.\"\"\"\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "" ]
[ "def run(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self):...\n", "VAR_3 = self._normalConnection()\n", "VAR_3.autocommit(True)\n", "return VAR_3\n" ]
[ "def newConnection(self):...\n", "conn = self._normalConnection()\n", "conn.autocommit(True)\n", "return conn\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import mock\n", "import requests\n", "from django.test import TransactionTestCase\n", "from api.models import Release\n", "def FUNC_0(*VAR_0, **VAR_1):...\n", "VAR_2 = requests.Response()\n", "VAR_2.status_code = 200\n", "VAR_2._content_consumed = True\n", "return VAR_2\n" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import mock\n", "import requests\n", "from django.test import TransactionTestCase\n", "from api.models import Release\n", "def mock_import_repository_task(*args, **kwargs):...\n", "resp = requests.Response()\n", "resp.status_code = 200\n", "resp._content_consumed = True\n", "return resp\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_17(self, VAR_10='_cores _nodes'.split()):...\n", "VAR_23 = {name: res for name, res in self.resources.items() if name not in\n VAR_10}\n", "VAR_24 = {name: value for name, value in self.params.items()}\n", "VAR_25 = {'rule': self.rule.name, 'local': self.dag.workflow.is_local(self.\n rule), 'input': self.input, 'output': self.output, 'params': VAR_24,\n 'threads': self.threads, 'resources': VAR_23}\n", "return VAR_25\n" ]
[ "def properties(self, omit_resources='_cores _nodes'.split()):...\n", "resources = {name: res for name, res in self.resources.items() if name not in\n omit_resources}\n", "params = {name: value for name, value in self.params.items()}\n", "properties = {'rule': self.rule.name, 'local': self.dag.workflow.is_local(\n self.rule), 'input': self.input, 'output': self.output, 'params':\n params, 'threads': self.threads, 'resources': resources}\n", "return properties\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_14(VAR_32, VAR_5=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_52 = {}\n", "for VAR_81, info in VAR_32:\n", "VAR_52[VAR_81.output(VAR_5)] = len(info[0])\n", "return VAR_52\n" ]
[ "def _get_singlekws(skw_matches, spires=False):...\n", "\"\"\"docstring\"\"\"\n", "output = {}\n", "for single_keyword, info in skw_matches:\n", "output[single_keyword.output(spires)] = len(info[0])\n", "return output\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Return'" ]
[ "def FUNC_36(VAR_11, VAR_13, VAR_14):...\n", "for c in VAR_14:\n", "if c.check.name == VAR_11 and c.environ.name == VAR_13:\n", "return c\n" ]
[ "def find_case(cname, ename, cases):...\n", "for c in cases:\n", "if c.check.name == cname and c.environ.name == ename:\n", "return c\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Return'" ]
[ "@classmethod...\n", "return [lambda _request: VAR_22]\n" ]
[ "@classmethod...\n", "return [lambda _request: peer_ident]\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_7(self, VAR_2):...\n", "VAR_8 = self._find_breakpoints(VAR_2)\n", "VAR_9 = [0] + VAR_8 + [len(VAR_2)]\n", "VAR_7 = []\n", "for i in range(len(VAR_8) + 1):\n", "VAR_14 = VAR_9[i]\n", "return VAR_7\n", "VAR_15 = VAR_9[i + 1]\n", "VAR_16 = VAR_2[VAR_14:VAR_15]\n", "if VAR_16 and VAR_16[0] == ';':\n", "VAR_16 = VAR_16[1:]\n", "if VAR_16:\n", "VAR_7.append(VAR_16.strip())\n" ]
[ "def _decompose(self, line):...\n", "breakpoints = self._find_breakpoints(line)\n", "inclusive_breakpoints = [0] + breakpoints + [len(line)]\n", "cmds = []\n", "for i in range(len(breakpoints) + 1):\n", "start = inclusive_breakpoints[i]\n", "return cmds\n", "end = inclusive_breakpoints[i + 1]\n", "cmd = line[start:end]\n", "if cmd and cmd[0] == ';':\n", "cmd = cmd[1:]\n", "if cmd:\n", "cmds.append(cmd.strip())\n" ]
[ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'" ]
[ "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "def FUNC_0(self):...\n", "VAR_1, VAR_2 = 'firstuser', 'password'\n", "VAR_3 = 'autotest@deis.io'\n", "VAR_4 = {'username': VAR_1, 'password': VAR_2, 'email': VAR_3}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertTrue(VAR_6.data['is_superuser'])\n", "VAR_1, VAR_2 = 'seconduser', 'password'\n", "VAR_3 = 'autotest@deis.io'\n", "VAR_4 = {'username': VAR_1, 'password': VAR_2, 'email': VAR_3}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertFalse(VAR_6.data['is_superuser'])\n", "def FUNC_1(self):...\n", "VAR_4 = {'username': 'firstuser', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertTrue(VAR_6.data['is_superuser'])\n", "self.assertTrue(self.client.login(VAR_1='firstuser', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/admin/perms', content_type='application/json')\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "self.assertEqual(VAR_6.data['results'][0]['username'], 'firstuser')\n", "self.assertTrue(VAR_6.data['results'][0]['is_superuser'])\n", "VAR_4 = {'username': 'seconduser', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertFalse(VAR_6.data['is_superuser'])\n", "self.assertTrue(self.client.login(VAR_1='seconduser', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/admin/perms', content_type='application/json')\n", "self.assertEqual(VAR_6.status_code, 403)\n", "self.assertIn('You do not have permission', VAR_6.data['detail'])\n", "def FUNC_2(self):...\n", "VAR_4 = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertTrue(VAR_6.data['is_superuser'])\n", "VAR_4 = {'username': 'second', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertFalse(VAR_6.data['is_superuser'])\n", "self.assertTrue(self.client.login(VAR_1='first', VAR_2='password'))\n", "VAR_5 = '/api/admin/perms'\n", "VAR_7 = {'username': 'second'}\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(VAR_5)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 2)\n", "self.assertIn('second', str(VAR_6.data['results']))\n", "def FUNC_3(self):...\n", "VAR_4 = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertTrue(VAR_6.data['is_superuser'])\n", "VAR_4 = {'username': 'second', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "VAR_5 = '/api/auth/register'\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertFalse(VAR_6.data['is_superuser'])\n", "self.assertTrue(self.client.login(VAR_1='first', VAR_2='password'))\n", "VAR_5 = '/api/admin/perms'\n", "VAR_7 = {'username': 'second'}\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.delete(VAR_5 + '/second')\n", "self.assertEqual(VAR_6.status_code, 204)\n", "VAR_6 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "self.assertNotIn('two', str(VAR_6.data['results']))\n", "VAR_0 = ['test_sharing.json']\n", "def FUNC_4(self):...\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "def FUNC_2(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", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps')\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "for model in ['builds', 'config', 'containers', 'limits', 'releases']:\n", "VAR_6 = self.client.get('/api/apps/{}/{}/'.format(VAR_8, model))\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "self.assertEqual(VAR_6.data['detail'], 'Not found')\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", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\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", "for model in ['builds', 'containers', 'releases']:\n", "VAR_6 = self.client.get('/api/apps/{}/{}/'.format(VAR_8, model))\n", "def FUNC_5(self):...\n", "self.assertEqual(len(VAR_6.data['results']), 0)\n", "VAR_6 = self.client.get('/api/apps')\n", "VAR_8 = VAR_6.data['results'][0]['id']\n", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\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, 403)\n", "def FUNC_3(self):...\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps')\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", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\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_5 = '/api/apps/{}/perms/{}'.format(VAR_8, 'autotest-2')\n", "VAR_6 = self.client.delete(VAR_5, content_type='application/json')\n", "self.assertEqual(VAR_6.status_code, 403)\n", "self.assertIsNone(VAR_6.data)\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "VAR_6 = self.client.delete(VAR_5, content_type='application/json')\n", "self.assertEqual(VAR_6.status_code, 204)\n", "self.assertIsNone(VAR_6.data)\n", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps')\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "VAR_6 = self.client.delete(VAR_5, content_type='application/json')\n", "self.assertEqual(VAR_6.status_code, 404)\n", "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 FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\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", "def FUNC_7(self):...\n", "VAR_6 = self.client.get('/api/apps')\n", "VAR_8 = VAR_6.data['results'][0]['id']\n", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps/{}/perms'.format(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 403)\n" ]
[ "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "def test_first_signup(self):...\n", "username, password = 'firstuser', 'password'\n", "email = 'autotest@deis.io'\n", "submit = {'username': username, 'password': password, 'email': email}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertTrue(response.data['is_superuser'])\n", "username, password = 'seconduser', 'password'\n", "email = 'autotest@deis.io'\n", "submit = {'username': username, 'password': password, 'email': email}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertFalse(response.data['is_superuser'])\n", "def test_list(self):...\n", "submit = {'username': 'firstuser', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertTrue(response.data['is_superuser'])\n", "self.assertTrue(self.client.login(username='firstuser', password='password'))\n", "response = self.client.get('/api/admin/perms', content_type='application/json')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "self.assertEqual(response.data['results'][0]['username'], 'firstuser')\n", "self.assertTrue(response.data['results'][0]['is_superuser'])\n", "submit = {'username': 'seconduser', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertFalse(response.data['is_superuser'])\n", "self.assertTrue(self.client.login(username='seconduser', password='password'))\n", "response = self.client.get('/api/admin/perms', content_type='application/json')\n", "self.assertEqual(response.status_code, 403)\n", "self.assertIn('You do not have permission', response.data['detail'])\n", "def test_create(self):...\n", "submit = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertTrue(response.data['is_superuser'])\n", "submit = {'username': 'second', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertFalse(response.data['is_superuser'])\n", "self.assertTrue(self.client.login(username='first', password='password'))\n", "url = '/api/admin/perms'\n", "body = {'username': 'second'}\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(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "self.assertIn('second', str(response.data['results']))\n", "def test_delete(self):...\n", "submit = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertTrue(response.data['is_superuser'])\n", "submit = {'username': 'second', 'password': 'password', 'email':\n 'autotest@deis.io'}\n", "url = '/api/auth/register'\n", "response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertFalse(response.data['is_superuser'])\n", "self.assertTrue(self.client.login(username='first', password='password'))\n", "url = '/api/admin/perms'\n", "body = {'username': 'second'}\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.delete(url + '/second')\n", "self.assertEqual(response.status_code, 204)\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "self.assertNotIn('two', str(response.data['results']))\n", "fixtures = ['test_sharing.json']\n", "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "def test_create(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", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(len(response.data['results']), 1)\n", "for model in ['builds', 'config', 'containers', 'limits', 'releases']:\n", "response = self.client.get('/api/apps/{}/{}/'.format(app_id, model))\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "self.assertEqual(response.data['detail'], 'Not found')\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", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "for model in ['builds', 'containers', 'releases']:\n", "response = self.client.get('/api/apps/{}/{}/'.format(app_id, model))\n", "def test_create_errors(self):...\n", "self.assertEqual(len(response.data['results']), 0)\n", "response = self.client.get('/api/apps')\n", "app_id = response.data['results'][0]['id']\n", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\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, 403)\n", "def test_delete(self):...\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "response = self.client.get('/api/apps')\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", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "url = '/api/apps/{}/perms/{}'.format(app_id, 'autotest-2')\n", "response = self.client.delete(url, content_type='application/json')\n", "self.assertEqual(response.status_code, 403)\n", "self.assertIsNone(response.data)\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "response = self.client.delete(url, content_type='application/json')\n", "self.assertEqual(response.status_code, 204)\n", "self.assertIsNone(response.data)\n", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(len(response.data['results']), 1)\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "response = self.client.delete(url, content_type='application/json')\n", "self.assertEqual(response.status_code, 404)\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", "def test_admin_can_list(self):...\n", "\"\"\"docstring\"\"\"\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "def test_list_errors(self):...\n", "response = self.client.get('/api/apps')\n", "app_id = response.data['results'][0]['id']\n", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps/{}/perms'.format(app_id),\n content_type='application/json')\n", "self.assertEqual(response.status_code, 403)\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, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "For", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_2 = self.client.get('/datadocument/179486/')\n", "VAR_3 = VAR_2.content.decode('utf-8')\n", "VAR_4 = VAR_3.index('<h4>Extracted Text')\n", "VAR_5 = VAR_3.index('<h4 class=\"d-inline\">Products')\n", "self.assertTrue(VAR_5 > VAR_4,\n 'Product card should come after Extracted Text card')\n" ]
[ "def test_product_card_location(self):...\n", "response = self.client.get('/datadocument/179486/')\n", "html = response.content.decode('utf-8')\n", "e_idx = html.index('<h4>Extracted Text')\n", "p_idx = html.index('<h4 class=\"d-inline\">Products')\n", "self.assertTrue(p_idx > e_idx,\n 'Product card should come after Extracted Text card')\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_34(self):...\n", "" ]
[ "def get(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "from osv import fields, osv\n", "from tools.translate import _\n", "VAR_0 = 'product.product'\n", "def FUNC_0(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_17 = self.pool.get('product.product').browse(VAR_1, VAR_2, VAR_3, VAR_4\n =context)\n", "VAR_18 = (VAR_17.property_stock_account_input and VAR_17.\n property_stock_account_input.id or False)\n", "if not VAR_18:\n", "VAR_18 = (VAR_17.categ_id.property_stock_account_input_categ and VAR_17.\n categ_id.property_stock_account_input_categ.id or False)\n", "VAR_19 = (VAR_17.property_stock_account_output and VAR_17.\n property_stock_account_output.id or False)\n", "if not VAR_19:\n", "VAR_19 = (VAR_17.categ_id.property_stock_account_output_categ and VAR_17.\n categ_id.property_stock_account_output_categ.id or False)\n", "VAR_20 = (VAR_17.categ_id.property_stock_journal and VAR_17.categ_id.\n property_stock_journal.id or False)\n", "VAR_21 = (VAR_17.categ_id.property_stock_variation and VAR_17.categ_id.\n property_stock_variation.id or False)\n", "return {'stock_account_input': VAR_18, 'stock_account_output': VAR_19,\n 'stock_journal': VAR_20, 'property_stock_variation': VAR_21}\n" ]
[ "from osv import fields, osv\n", "from tools.translate import _\n", "_inherit = 'product.product'\n", "def get_product_accounts(self, cr, uid, product_id, context=None):...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "product_obj = self.pool.get('product.product').browse(cr, uid, product_id,\n context=context)\n", "stock_input_acc = (product_obj.property_stock_account_input and product_obj\n .property_stock_account_input.id or False)\n", "if not stock_input_acc:\n", "stock_input_acc = (product_obj.categ_id.property_stock_account_input_categ and\n product_obj.categ_id.property_stock_account_input_categ.id or False)\n", "stock_output_acc = (product_obj.property_stock_account_output and\n product_obj.property_stock_account_output.id or False)\n", "if not stock_output_acc:\n", "stock_output_acc = (product_obj.categ_id.\n property_stock_account_output_categ and product_obj.categ_id.\n property_stock_account_output_categ.id or False)\n", "journal_id = (product_obj.categ_id.property_stock_journal and product_obj.\n categ_id.property_stock_journal.id or False)\n", "account_variation = (product_obj.categ_id.property_stock_variation and\n product_obj.categ_id.property_stock_variation.id or False)\n", "return {'stock_account_input': stock_input_acc, 'stock_account_output':\n stock_output_acc, 'stock_journal': journal_id,\n 'property_stock_variation': account_variation}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_4(self):...\n", "self.assertEqual('123', bot_main.generate_version())\n" ]
[ "def test_generate_version(self):...\n", "self.assertEqual('123', bot_main.generate_version())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_25(self):...\n", "VAR_31 = json.loads(get_user_settings(self.doctype))\n", "if hasattr(self, 'user_settings'):\n", "VAR_31.update(self.user_settings)\n", "if self.save_user_settings_fields:\n", "VAR_31['fields'] = self.user_settings_fields\n", "FUNC_25(self.doctype, VAR_31)\n" ]
[ "def update_user_settings(self):...\n", "user_settings = json.loads(get_user_settings(self.doctype))\n", "if hasattr(self, 'user_settings'):\n", "user_settings.update(self.user_settings)\n", "if self.save_user_settings_fields:\n", "user_settings['fields'] = self.user_settings_fields\n", "update_user_settings(self.doctype, user_settings)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_1(self, VAR_8, VAR_9, VAR_4, VAR_10=None):...\n", "return super(VAR_51, self).check_recursion(VAR_8, VAR_9, VAR_4, VAR_10=parent)\n" ]
[ "def check_recursion(self, cursor, user, ids, parent=None):...\n", "return super(project, self).check_recursion(cursor, user, ids, parent=parent)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self, **VAR_3):...\n", "VAR_13 = super().get_context_data(**kwargs)\n", "VAR_13['comments'] = self.object.comment_set.all().order_by('-time')\n", "VAR_13['form'] = self.get_form()\n", "VAR_13['md'] = markdown(self.object.content, extensions=[\n 'markdown.extensions.extra', 'markdown.extensions.codehilite',\n 'markdown.extensions.toc'])\n", "return VAR_13\n" ]
[ "def get_context_data(self, **kwargs):...\n", "context = super().get_context_data(**kwargs)\n", "context['comments'] = self.object.comment_set.all().order_by('-time')\n", "context['form'] = self.get_form()\n", "context['md'] = markdown(self.object.content, extensions=[\n 'markdown.extensions.extra', 'markdown.extensions.codehilite',\n 'markdown.extensions.toc'])\n", "return context\n" ]
[ 0, 0, 0, 0, 3, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_1, VAR_2):...\n", "VAR_6 = FUNC_3(VAR_1)\n", "VAR_7 = VAR_6.cursor(MySQLdb.cursors.DictCursor)\n", "VAR_8 = 'SELECT * FROM questions WHERE id=' + VAR_2\n", "VAR_7.execute(VAR_8)\n", "VAR_10 = VAR_7.fetchone()\n", "if VAR_10:\n", "VAR_13 = '<p>Question: {q}<br><br>'.format(q=row['question'])\n", "return \"ERROR: couldn't find selected question in the database\"\n", "VAR_13 += \"DO NOT CHANGE: <input type=text name='id' value={id}>\".format(VAR_2\n =row['id'])\n", "VAR_13 += \"<label for='answer'>Answer:</label><br>\"\n", "if VAR_10['status'] == 'in-progress':\n", "VAR_13 += (\"<textarea name='answer' cols='40' rows='5'>{ans}</textarea><br>\"\n .format(ans=row['answer']))\n", "VAR_13 += \"<textarea name='answer' cols='40' rows='5'></textarea><br>\"\n", "VAR_13 += (\n \"<input type='submit' name='save' value='Save'><input type='submit' name='publish' value='Publish'>\"\n )\n", "return VAR_13\n" ]
[ "def makeAnswerForm(database, id):...\n", "conn = dbConnect(database)\n", "curs = conn.cursor(MySQLdb.cursors.DictCursor)\n", "statement = 'SELECT * FROM questions WHERE id=' + id\n", "curs.execute(statement)\n", "row = curs.fetchone()\n", "if row:\n", "s = '<p>Question: {q}<br><br>'.format(q=row['question'])\n", "return \"ERROR: couldn't find selected question in the database\"\n", "s += \"DO NOT CHANGE: <input type=text name='id' value={id}>\".format(id=row[\n 'id'])\n", "s += \"<label for='answer'>Answer:</label><br>\"\n", "if row['status'] == 'in-progress':\n", "s += \"<textarea name='answer' cols='40' rows='5'>{ans}</textarea><br>\".format(\n ans=row['answer'])\n", "s += \"<textarea name='answer' cols='40' rows='5'></textarea><br>\"\n", "s += (\n \"<input type='submit' name='save' value='Save'><input type='submit' name='publish' value='Publish'>\"\n )\n", "return s\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Return'", "AugAssign'", "AugAssign'", "Condition", "AugAssign'", "AugAssign'", "AugAssign'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_46 = MappingLevel[VAR_19.upper()]\n", "VAR_22 = CLASS_1.get_user_by_username(VAR_4)\n", "VAR_22.set_mapping_level(VAR_46)\n", "return VAR_22\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "requested_level = MappingLevel[level.upper()]\n", "user = UserService.get_user_by_username(username)\n", "user.set_mapping_level(requested_level)\n", "return user\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.dimensions.get('id', ['unknown'])[0]\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.dimensions.get('id', ['unknown'])[0]\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_8():...\n", "\"\"\"docstring\"\"\"\n", "return FUNC_3('select * from player_static_view order by wins')\n" ]
[ "def playerStandings():...\n", "\"\"\"docstring\"\"\"\n", "return fetchall('select * from player_static_view order by wins')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "from datetime import datetime, timedelta\n", "from time import localtime, strftime\n", "import sqlite3\n", "def FUNC_0(VAR_0):...\n", "VAR_11 = datetime.now()\n", "if ',' in VAR_0:\n", "VAR_12 = VAR_0.split(',')\n", "VAR_13 = VAR_0\n", "for t in VAR_12:\n", "if 's' in VAR_13:\n", "VAR_13 = t\n", "return VAR_11\n", "VAR_13 = VAR_13.replace('s', '')\n", "if 'm' in VAR_13:\n", "if 's' in VAR_13:\n", "VAR_11 += timedelta(seconds=int(val))\n", "VAR_13 = VAR_13.replace('m', '')\n", "if 'h' in VAR_13:\n", "VAR_13 = VAR_13.replace('s', '')\n", "if 'm' in VAR_13:\n", "VAR_11 += timedelta(minutes=int(val))\n", "VAR_13 = VAR_13.replace('h', '')\n", "if 'd' in VAR_13:\n", "VAR_11 += timedelta(seconds=int(val))\n", "VAR_13 = VAR_13.replace('m', '')\n", "if 'h' in VAR_13:\n", "VAR_11 += timedelta(hours=int(val))\n", "VAR_13 = VAR_13.replace('d', '')\n", "VAR_11 += timedelta(minutes=int(val))\n", "VAR_13 = VAR_13.replace('h', '')\n", "if 'd' in VAR_13:\n", "VAR_11 += timedelta(days=int(val))\n", "VAR_11 += timedelta(hours=int(val))\n", "VAR_13 = VAR_13.replace('d', '')\n", "VAR_11 += timedelta(days=int(val))\n" ]
[ "from datetime import datetime, timedelta\n", "from time import localtime, strftime\n", "import sqlite3\n", "def get_date(time):...\n", "now = datetime.now()\n", "if ',' in time:\n", "times = time.split(',')\n", "val = time\n", "for t in times:\n", "if 's' in val:\n", "val = t\n", "return now\n", "val = val.replace('s', '')\n", "if 'm' in val:\n", "if 's' in val:\n", "now += timedelta(seconds=int(val))\n", "val = val.replace('m', '')\n", "if 'h' in val:\n", "val = val.replace('s', '')\n", "if 'm' in val:\n", "now += timedelta(minutes=int(val))\n", "val = val.replace('h', '')\n", "if 'd' in val:\n", "now += timedelta(seconds=int(val))\n", "val = val.replace('m', '')\n", "if 'h' in val:\n", "now += timedelta(hours=int(val))\n", "val = val.replace('d', '')\n", "now += timedelta(minutes=int(val))\n", "val = val.replace('h', '')\n", "if 'd' in val:\n", "now += timedelta(days=int(val))\n", "now += timedelta(hours=int(val))\n", "val = val.replace('d', '')\n", "now += timedelta(days=int(val))\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 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "For", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Condition", "AugAssign'", "Assign'", "Condition", "Assign'", "Condition", "AugAssign'", "Assign'", "Condition", "AugAssign'", "Assign'", "Condition", "AugAssign'", "Assign'", "AugAssign'", "Assign'", "Condition", "AugAssign'", "AugAssign'", "Assign'", "AugAssign'" ]
[ "def FUNC_15(self, VAR_34):...\n", "\"\"\"docstring\"\"\"\n", "VAR_34 = get_filter(self.doctype, VAR_34)\n", "VAR_52 = '`tab' + VAR_34.doctype + '`'\n", "if not VAR_52 in self.tables:\n", "self.append_table(VAR_52)\n", "if 'ifnull(' in VAR_34.fieldname:\n", "VAR_59 = VAR_34.fieldname\n", "VAR_59 = '{tname}.{fname}'.format(VAR_52=tname, fname=f.fieldname)\n", "VAR_53 = True\n", "if VAR_34.operator.lower() in ('in', 'not in'):\n", "VAR_60 = VAR_34.value or ''\n", "VAR_6 = frappe.get_meta(VAR_34.doctype).get('fields', {'fieldname': VAR_34.\n fieldname})\n", "if not isinstance(VAR_60, (list, tuple)):\n", "VAR_6 = VAR_6[0] if VAR_6 else None\n", "VAR_60 = VAR_60.split(',')\n", "VAR_61 = \"''\"\n", "if VAR_6 and VAR_6.fieldtype in ('Check', 'Float', 'Int', 'Currency', 'Percent'\n", "VAR_5 = (frappe.db.escape((v or '').strip(), percent=False) for v in VAR_60)\n", "VAR_53 = False\n", "if VAR_34.operator.lower() == 'between' and (VAR_34.fieldname in (\n", "VAR_5 = '(\"{0}\")'.format('\", \"'.join(VAR_5))\n", "VAR_5 = FUNC_3(VAR_34.value, VAR_6)\n", "if VAR_6 and VAR_6.fieldtype == 'Date':\n", "if self.ignore_ifnull or not VAR_53 or VAR_34.value and VAR_34.operator.lower(\n", "VAR_61 = \"'0000-00-00 00:00:00'\"\n", "VAR_5 = getdate(VAR_34.value).strftime('%Y-%m-%d')\n", "if VAR_6 and VAR_6.fieldtype == 'Datetime' or isinstance(VAR_34.value, datetime\n", "VAR_62 = '{column_name} {operator} {value}'.format(VAR_59=column_name,\n operator=f.operator, VAR_5=value)\n", "VAR_62 = 'ifnull({column_name}, {fallback}) {operator} {value}'.format(VAR_59\n =column_name, VAR_61=fallback, operator=f.operator, VAR_5=value)\n", "if isinstance(VAR_5, string_types) and not VAR_34.operator.lower(\n", "VAR_61 = \"'0000-00-00'\"\n", "VAR_5 = get_datetime(VAR_34.value).strftime('%Y-%m-%d %H:%M:%S.%f')\n", "if VAR_6 and VAR_6.fieldtype == 'Time':\n", "return VAR_62\n", "VAR_5 = '\"{0}\"'.format(frappe.db.escape(VAR_5, percent=False))\n", "VAR_61 = \"'0000-00-00 00:00:00'\"\n", "VAR_5 = get_time(VAR_34.value).strftime('%H:%M:%S.%f')\n", "if VAR_34.operator.lower() in ('like', 'not like') or isinstance(VAR_34.\n", "VAR_61 = \"'00:00:00'\"\n", "VAR_5 = '' if VAR_34.value == None else VAR_34.value\n", "VAR_5 = VAR_72(VAR_34.value)\n", "VAR_61 = '\"\"'\n", "VAR_61 = 0\n", "if VAR_34.operator.lower() in ('like', 'not like') and isinstance(VAR_5,\n", "VAR_5 = VAR_5.replace('\\\\', '\\\\\\\\').replace('%', '%%')\n" ]
[ "def prepare_filter_condition(self, f):...\n", "\"\"\"docstring\"\"\"\n", "f = get_filter(self.doctype, f)\n", "tname = '`tab' + f.doctype + '`'\n", "if not tname in self.tables:\n", "self.append_table(tname)\n", "if 'ifnull(' in f.fieldname:\n", "column_name = f.fieldname\n", "column_name = '{tname}.{fname}'.format(tname=tname, fname=f.fieldname)\n", "can_be_null = True\n", "if f.operator.lower() in ('in', 'not in'):\n", "values = f.value or ''\n", "df = frappe.get_meta(f.doctype).get('fields', {'fieldname': f.fieldname})\n", "if not isinstance(values, (list, tuple)):\n", "df = df[0] if df else None\n", "values = values.split(',')\n", "fallback = \"''\"\n", "if df and df.fieldtype in ('Check', 'Float', 'Int', 'Currency', 'Percent'):\n", "value = (frappe.db.escape((v or '').strip(), percent=False) for v in values)\n", "can_be_null = False\n", "if f.operator.lower() == 'between' and (f.fieldname in ('creation',\n", "value = '(\"{0}\")'.format('\", \"'.join(value))\n", "value = get_between_date_filter(f.value, df)\n", "if df and df.fieldtype == 'Date':\n", "if self.ignore_ifnull or not can_be_null or f.value and f.operator.lower() in (\n", "fallback = \"'0000-00-00 00:00:00'\"\n", "value = getdate(f.value).strftime('%Y-%m-%d')\n", "if df and df.fieldtype == 'Datetime' or isinstance(f.value, datetime):\n", "condition = '{column_name} {operator} {value}'.format(column_name=\n column_name, operator=f.operator, value=value)\n", "condition = 'ifnull({column_name}, {fallback}) {operator} {value}'.format(\n column_name=column_name, fallback=fallback, operator=f.operator, value=\n value)\n", "if isinstance(value, string_types) and not f.operator.lower() == 'between':\n", "fallback = \"'0000-00-00'\"\n", "value = get_datetime(f.value).strftime('%Y-%m-%d %H:%M:%S.%f')\n", "if df and df.fieldtype == 'Time':\n", "return condition\n", "value = '\"{0}\"'.format(frappe.db.escape(value, percent=False))\n", "fallback = \"'0000-00-00 00:00:00'\"\n", "value = get_time(f.value).strftime('%H:%M:%S.%f')\n", "if f.operator.lower() in ('like', 'not like') or isinstance(f.value,\n", "fallback = \"'00:00:00'\"\n", "value = '' if f.value == None else f.value\n", "value = flt(f.value)\n", "fallback = '\"\"'\n", "fallback = 0\n", "if f.operator.lower() in ('like', 'not like') and isinstance(value,\n", "value = value.replace('\\\\', '\\\\\\\\').replace('%', '%%')\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 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_14(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = os.path.join(block.sys_block_path(VAR_1), 'partition')\n", "return os.path.exists(VAR_15)\n" ]
[ "def identify_partition(device):...\n", "\"\"\"docstring\"\"\"\n", "path = os.path.join(block.sys_block_path(device), 'partition')\n", "return os.path.exists(path)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_6(VAR_13):...\n", "return os.path.isfile(VAR_13) and os.access(VAR_13, os.X_OK)\n" ]
[ "def is_executable(path):...\n", "return os.path.isfile(path) and os.access(path, os.X_OK)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "VAR_19 = self.common.create_cloned_volume(VAR_6, VAR_7)\n", "self.common.client_logout()\n", "return {'metadata': VAR_19}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "new_vol = self.common.create_cloned_volume(volume, src_vref)\n", "self.common.client_logout()\n", "return {'metadata': new_vol}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@abc.abstractproperty...\n", "\"\"\"docstring\"\"\"\n" ]
[ "@abc.abstractproperty...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "Condition", "Docstring" ]
[ "def FUNC_20(self):...\n", "VAR_7 = webapp2.WSGIApplication([webapp2.Route('/authenticated', CLASS_8),\n webapp2.Route('/not-authenticated', CLASS_9)])\n", "VAR_19 = handler.get_authenticated_routes(VAR_7)\n", "self.assertEqual(1, len(VAR_19))\n", "self.assertEqual(CLASS_8, VAR_19[0].handler)\n" ]
[ "def test_get_authenticated_routes(self):...\n", "app = webapp2.WSGIApplication([webapp2.Route('/authenticated',\n Authenticated), webapp2.Route('/not-authenticated', NotAuthenticated)])\n", "routes = handler.get_authenticated_routes(app)\n", "self.assertEqual(1, len(routes))\n", "self.assertEqual(Authenticated, routes[0].handler)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_4(self, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Start caching last active users from the DB...')\n", "VAR_13 = self.get_last_active_users(VAR_6)\n", "log.error('Cannot cache users!')\n", "for VAR_22 in VAR_13:\n", "return\n", "if VAR_22[0] not in self.users:\n", "log.info('Users have been cached.')\n", "self.users[VAR_22[0]] = CLASS_0(*VAR_22)\n", "log.debug('Caching user: %s', self.users[VAR_22[0]])\n" ]
[ "def cache(self, limit):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Start caching last active users from the DB...')\n", "last_active_users = self.get_last_active_users(limit)\n", "log.error('Cannot cache users!')\n", "for items in last_active_users:\n", "return\n", "if items[0] not in self.users:\n", "log.info('Users have been cached.')\n", "self.users[items[0]] = User(*items)\n", "log.debug('Caching user: %s', self.users[items[0]])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Expr'", "For", "Return'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_15(VAR_22, VAR_23):...\n", "\"\"\"docstring\"\"\"\n", "VAR_42 = logging.getLogger('ray')\n", "if type(VAR_22) is str:\n", "VAR_22 = logging.getLevelName(VAR_22.upper())\n", "VAR_42.setLevel(VAR_22)\n", "VAR_21 = logging.StreamHandler()\n", "VAR_21.setFormatter(logging.Formatter(VAR_23))\n", "VAR_42.addHandler(VAR_21)\n", "VAR_42.propagate = False\n" ]
[ "def setup_logger(logging_level, logging_format):...\n", "\"\"\"docstring\"\"\"\n", "logger = logging.getLogger('ray')\n", "if type(logging_level) is str:\n", "logging_level = logging.getLevelName(logging_level.upper())\n", "logger.setLevel(logging_level)\n", "_default_handler = logging.StreamHandler()\n", "_default_handler.setFormatter(logging.Formatter(logging_format))\n", "logger.addHandler(_default_handler)\n", "logger.propagate = False\n" ]
[ 0, 0, 6, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_9(VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = bleach.clean(str(VAR_3))\n", "VAR_4 = bleach.clean(str(VAR_4))\n", "FUNC_1('insert into Match(winner, loser) values(%s, %s)', (VAR_3, VAR_4))\n" ]
[ "def reportMatch(winner, loser):...\n", "\"\"\"docstring\"\"\"\n", "winner = bleach.clean(str(winner))\n", "loser = bleach.clean(str(loser))\n", "execute('insert into Match(winner, loser) values(%s, %s)', (winner, loser))\n" ]
[ 0, 0, 4, 4, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "from flask import jsonify, Response, send_from_directory, request\n", "from api_decorators import *\n", "from api_utils import *\n", "from models import Server, Sequence, SequenceItem, NotFoundError, Property, Device, INDIProfile, ImagesDatabase, camera_images_db, main_images_db, commands\n", "import os\n", "from controller import controller\n", "from app import app\n", "import logging\n", "import io\n", "VAR_0 = {}\n", "VAR_1 = logging.getLogger('gunicorn.error')\n", "app.logger.handlers = VAR_1.handlers\n", "VAR_2 = int(os.environ.get('DEV_MODE', '0')) == 1\n", "app.logger.setLevel(os.environ.get('LOG_LEVEL', 'DEBUG' if VAR_2 else 'INFO'))\n", "@app.route('/api/version')...\n", "return app.config['version']\n" ]
[ "from flask import jsonify, Response, send_from_directory, request\n", "from api_decorators import *\n", "from api_utils import *\n", "from models import Server, Sequence, SequenceItem, NotFoundError, Property, Device, INDIProfile, ImagesDatabase, camera_images_db, main_images_db, commands\n", "import os\n", "from controller import controller\n", "from app import app\n", "import logging\n", "import io\n", "default_settings = {}\n", "gunicorn_logger = logging.getLogger('gunicorn.error')\n", "app.logger.handlers = gunicorn_logger.handlers\n", "is_debug_mode = int(os.environ.get('DEV_MODE', '0')) == 1\n", "app.logger.setLevel(os.environ.get('LOG_LEVEL', 'DEBUG' if is_debug_mode else\n 'INFO'))\n", "@app.route('/api/version')...\n", "return app.config['version']\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'" ]
[ "def FUNC_5(self, VAR_3):...\n", "if VAR_3 is not None:\n", "VAR_7 = [injection_.register for injection_ in injection.objects.filter(\n result=record.id)]\n", "VAR_7 = []\n", "for VAR_21 in range(len(VAR_7)):\n", "if VAR_7[VAR_21] is None:\n", "if len(VAR_7) > 0:\n", "VAR_7[VAR_21] = '-'\n", "return ', '.join(VAR_7)\n", "return '-'\n" ]
[ "def render_registers(self, record):...\n", "if record is not None:\n", "registers = [injection_.register for injection_ in injection.objects.filter\n (result=record.id)]\n", "registers = []\n", "for index in range(len(registers)):\n", "if registers[index] is None:\n", "if len(registers) > 0:\n", "registers[index] = '-'\n", "return ', '.join(registers)\n", "return '-'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "For", "Condition", "Condition", "Assign'", "Return'", "Return'" ]
[ "def FUNC_3(VAR_1: HttpRequest):...\n", "" ]
[ "def action_add_multiple_media(request: HttpRequest):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "async def FUNC_11(VAR_6):...\n", "VAR_10 = {'Authorization': f'Bearer {VAR_1}'}\n", "VAR_8 = await VAR_6.get(\"/results?page=0&count=2&filter=date eq '2019-07-15'\",\n VAR_10=headers)\n", "VAR_9 = await VAR_8.json()\n", "assert VAR_8.status == 200\n", "assert len(VAR_9) == 1\n", "VAR_8 = await VAR_6.get(\n \"/results?filter=(date lt '2018-01-01') AND (time lt 500)\", VAR_10=headers)\n", "VAR_9 = await VAR_8.json()\n", "assert VAR_8.status == 200\n", "assert len(VAR_9) == 4\n", "VAR_8 = await VAR_6.get('/results?filter=distance ne 2000', VAR_10=headers)\n", "VAR_9 = await VAR_8.json()\n", "assert VAR_8.status == 200\n", "assert len(VAR_9) == 8\n", "VAR_8 = await VAR_6.get(\n '/results?filter=distance ne 2000 and ((time lt 400) and (time gt 390))',\n VAR_10=headers)\n", "VAR_9 = await VAR_8.json()\n", "assert VAR_8.status == 200\n", "assert len(VAR_9) == 0\n" ]
[ "async def test_positive_check_filters(test_cli):...\n", "headers = {'Authorization': f'Bearer {access_token}'}\n", "resp = await test_cli.get(\"/results?page=0&count=2&filter=date eq '2019-07-15'\"\n , headers=headers)\n", "resp_json = await resp.json()\n", "assert resp.status == 200\n", "assert len(resp_json) == 1\n", "resp = await test_cli.get(\n \"/results?filter=(date lt '2018-01-01') AND (time lt 500)\", headers=headers\n )\n", "resp_json = await resp.json()\n", "assert resp.status == 200\n", "assert len(resp_json) == 4\n", "resp = await test_cli.get('/results?filter=distance ne 2000', headers=headers)\n", "resp_json = await resp.json()\n", "assert resp.status == 200\n", "assert len(resp_json) == 8\n", "resp = await test_cli.get(\n '/results?filter=distance ne 2000 and ((time lt 400) and (time gt 390))',\n headers=headers)\n", "resp_json = await resp.json()\n", "assert resp.status == 200\n", "assert len(resp_json) == 0\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Assign'", "Assign'", "Assert'", "Assert'", "Assign'", "Assign'", "Assert'", "Assert'", "Assign'", "Assign'", "Assert'", "Assert'" ]
[ "@auth.require_xsrf_token_request...\n", "VAR_28, VAR_14, VAR_9, VAR_25, VAR_24, VAR_26 = self._process()\n", "bot_management.bot_event(VAR_31='bot_connected', VAR_14=bot_id, external_ip\n =self.request.remote_addr, VAR_24=dimensions, VAR_25=state, VAR_9=\n version, VAR_16=bool(quarantined_msg), VAR_17='', VAR_32=None, VAR_8=\n quarantined_msg)\n", "VAR_29 = {'bot_version': bot_code.get_bot_version(self.request.host_url),\n 'expiration_sec': auth.handler.XSRFToken.expiration_sec,\n 'server_version': utils.get_app_version(), 'xsrf_token': self.\n generate_xsrf_token()}\n", "self.send_response(VAR_29)\n" ]
[ "@auth.require_xsrf_token_request...\n", "_request, bot_id, version, state, dimensions, quarantined_msg = self._process()\n", "bot_management.bot_event(event_type='bot_connected', bot_id=bot_id,\n external_ip=self.request.remote_addr, dimensions=dimensions, state=\n state, version=version, quarantined=bool(quarantined_msg), task_id='',\n task_name=None, message=quarantined_msg)\n", "data = {'bot_version': bot_code.get_bot_version(self.request.host_url),\n 'expiration_sec': auth.handler.XSRFToken.expiration_sec,\n 'server_version': utils.get_app_version(), 'xsrf_token': self.\n generate_xsrf_token()}\n", "self.send_response(data)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_32(self):...\n", "\"\"\"docstring\"\"\"\n", "tournament.editPlayer(player='38471237401238', new_name='Michael Bay',\n new_country='Japan')\n" ]
[ "def test_edit_invalid_player_id(self):...\n", "\"\"\"docstring\"\"\"\n", "tournament.editPlayer(player='38471237401238', new_name='Michael Bay',\n new_country='Japan')\n" ]
[ 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "VAR_19 = self.common.create_cloned_volume(VAR_6, VAR_7)\n", "self.common.client_logout()\n", "return {'metadata': VAR_19}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "new_vol = self.common.create_cloned_volume(volume, src_vref)\n", "self.common.client_logout()\n", "return {'metadata': new_vol}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "from django.conf.urls import include, url\n", "from pretix.control.views import attendees, auth, dashboards, event, help, item, main, orders, organizer, user, vouchers\n", "VAR_0 = [url('^logout$', auth.logout, name='auth.logout'), url('^login$',\n auth.login, name='auth.login'), url('^register$', auth.register, name=\n 'auth.register'), url('^forgot$', auth.Forgot.as_view(), name=\n 'auth.forgot'), url('^forgot/recover$', auth.Recover.as_view(), name=\n 'auth.forgot.recover'), url('^$', dashboards.user_index, name='index'),\n url('^settings$', user.UserSettings.as_view(), name='user.settings'),\n url('^organizers/$', organizer.OrganizerList.as_view(), name=\n 'organizers'), url('^organizers/add$', organizer.OrganizerCreate.\n as_view(), name='organizers.add'), url(\n '^organizer/(?P<organizer>[^/]+)/edit$', organizer.OrganizerUpdate.\n as_view(), name='organizer.edit'), url('^events/$', main.EventList.\n as_view(), name='events'), url('^events/add$', main.EventCreateStart.\n as_view(), name='events.add'), url('^event/(?P<organizer>[^/]+)/add',\n main.EventCreate.as_view(), name='events.create'), url(\n '^event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/', include([url('^$',\n dashboards.event_index, name='event.index'), url('^live/$', event.\n EventLive.as_view(), name='event.live'), url('^settings/$', event.\n EventUpdate.as_view(), name='event.settings'), url('^settings/plugins$',\n event.EventPlugins.as_view(), name='event.settings.plugins'), url(\n '^settings/permissions$', event.EventPermissions.as_view(), name=\n 'event.settings.permissions'), url('^settings/payment$', event.\n PaymentSettings.as_view(), name='event.settings.payment'), url(\n '^settings/tickets$', event.TicketSettings.as_view(), name=\n 'event.settings.tickets'), url('^settings/email$', event.MailSettings.\n as_view(), name='event.settings.mail'), url('^settings/invoice$', event\n .InvoiceSettings.as_view(), name='event.settings.invoice'), url(\n '^settings/display', event.DisplaySettings.as_view(), name=\n 'event.settings.display'), url('^items/$', item.ItemList.as_view(),\n name='event.items'), url('^items/add$', item.ItemCreate.as_view(), name\n ='event.items.add'), url('^items/(?P<item>\\\\d+)/$', item.\n ItemUpdateGeneral.as_view(), name='event.item'), url(\n '^items/(?P<item>\\\\d+)/variations$', item.ItemVariations.as_view(),\n name='event.item.variations'), url('^items/(?P<item>\\\\d+)/up$', item.\n item_move_up, name='event.items.up'), url('^items/(?P<item>\\\\d+)/down$',\n item.item_move_down, name='event.items.down'), url(\n '^items/(?P<item>\\\\d+)/delete$', item.ItemDelete.as_view(), name=\n 'event.items.delete'), url('^categories/$', item.CategoryList.as_view(),\n name='event.items.categories'), url(\n '^categories/(?P<category>\\\\d+)/delete$', item.CategoryDelete.as_view(),\n name='event.items.categories.delete'), url(\n '^categories/(?P<category>\\\\d+)/up$', item.category_move_up, name=\n 'event.items.categories.up'), url(\n '^categories/(?P<category>\\\\d+)/down$', item.category_move_down, name=\n 'event.items.categories.down'), url('^categories/(?P<category>\\\\d+)/$',\n item.CategoryUpdate.as_view(), name='event.items.categories.edit'), url\n ('^categories/add$', item.CategoryCreate.as_view(), name=\n 'event.items.categories.add'), url('^questions/$', item.QuestionList.\n as_view(), name='event.items.questions'), url(\n '^questions/(?P<question>\\\\d+)/delete$', item.QuestionDelete.as_view(),\n name='event.items.questions.delete'), url(\n '^questions/(?P<question>\\\\d+)/up$', item.question_move_up, name=\n 'event.items.questions.up'), url('^questions/(?P<question>\\\\d+)/down$',\n item.question_move_down, name='event.items.questions.down'), url(\n '^questions/(?P<question>\\\\d+)/$', item.QuestionUpdate.as_view(), name=\n 'event.items.questions.edit'), url('^questions/add$', item.\n QuestionCreate.as_view(), name='event.items.questions.add'), url(\n '^quotas/$', item.QuotaList.as_view(), name='event.items.quotas'), url(\n '^quotas/(?P<quota>\\\\d+)/$', item.QuotaUpdate.as_view(), name=\n 'event.items.quotas.edit'), url('^quotas/(?P<quota>\\\\d+)/delete$', item\n .QuotaDelete.as_view(), name='event.items.quotas.delete'), url(\n '^quotas/add$', item.QuotaCreate.as_view(), name=\n 'event.items.quotas.add'), url('^vouchers/$', vouchers.VoucherList.\n as_view(), name='event.vouchers'), url('^vouchers/tags/$', vouchers.\n VoucherTags.as_view(), name='event.vouchers.tags'), url(\n '^vouchers/(?P<voucher>\\\\d+)/$', vouchers.VoucherUpdate.as_view(), name\n ='event.voucher'), url('^vouchers/(?P<voucher>\\\\d+)/delete$', vouchers.\n VoucherDelete.as_view(), name='event.voucher.delete'), url(\n '^vouchers/add$', vouchers.VoucherCreate.as_view(), name=\n 'event.vouchers.add'), url('^vouchers/bulk_add$', vouchers.\n VoucherBulkCreate.as_view(), name='event.vouchers.bulk'), url(\n '^orders/(?P<code>[0-9A-Z]+)/transition$', orders.OrderTransition.\n as_view(), name='event.order.transition'), url(\n '^orders/(?P<code>[0-9A-Z]+)/resend$', orders.OrderResendLink.as_view(),\n name='event.order.resendlink'), url(\n '^orders/(?P<code>[0-9A-Z]+)/invoice$', orders.OrderInvoiceCreate.\n as_view(), name='event.order.geninvoice'), url(\n '^orders/(?P<code>[0-9A-Z]+)/invoices/(?P<id>\\\\d+)/regenerate$', orders\n .OrderInvoiceRegenerate.as_view(), name='event.order.regeninvoice'),\n url('^orders/(?P<code>[0-9A-Z]+)/invoices/(?P<id>\\\\d+)/reissue$',\n orders.OrderInvoiceReissue.as_view(), name='event.order.reissueinvoice'\n ), url('^orders/(?P<code>[0-9A-Z]+)/extend$', orders.OrderExtend.\n as_view(), name='event.order.extend'), url(\n '^orders/(?P<code>[0-9A-Z]+)/comment$', orders.OrderComment.as_view(),\n name='event.order.comment'), url('^orders/(?P<code>[0-9A-Z]+)/$',\n orders.OrderDetail.as_view(), name='event.order'), url(\n '^orders/(?P<code>[0-9A-Z]+)/download/(?P<output>[^/]+)$', orders.\n OrderDownload.as_view(), name='event.order.download'), url(\n '^invoice/(?P<invoice>[^/]+)$', orders.InvoiceDownload.as_view(), name=\n 'event.invoice.download'), url('^orders/overview/$', orders.OverView.\n as_view(), name='event.orders.overview'), url('^orders/export/$',\n orders.ExportView.as_view(), name='event.orders.export'), url(\n '^orders/go$', orders.OrderGo.as_view(), name='event.orders.go'), url(\n '^orders/$', orders.OrderList.as_view(), name='event.orders'), url(\n '^attendees/$', attendees.AttendeeList.as_view(), name=\n 'event.attendees')])), url('^help/(?P<topic>[^.]+)$', help.HelpView.\n as_view(), name='help')]\n" ]
[ "from django.conf.urls import include, url\n", "from pretix.control.views import attendees, auth, dashboards, event, help, item, main, orders, organizer, user, vouchers\n", "urlpatterns = [url('^logout$', auth.logout, name='auth.logout'), url(\n '^login$', auth.login, name='auth.login'), url('^register$', auth.\n register, name='auth.register'), url('^forgot$', auth.Forgot.as_view(),\n name='auth.forgot'), url('^forgot/recover$', auth.Recover.as_view(),\n name='auth.forgot.recover'), url('^$', dashboards.user_index, name=\n 'index'), url('^settings$', user.UserSettings.as_view(), name=\n 'user.settings'), url('^organizers/$', organizer.OrganizerList.as_view(\n ), name='organizers'), url('^organizers/add$', organizer.\n OrganizerCreate.as_view(), name='organizers.add'), url(\n '^organizer/(?P<organizer>[^/]+)/edit$', organizer.OrganizerUpdate.\n as_view(), name='organizer.edit'), url('^events/$', main.EventList.\n as_view(), name='events'), url('^events/add$', main.EventCreateStart.\n as_view(), name='events.add'), url('^event/(?P<organizer>[^/]+)/add',\n main.EventCreate.as_view(), name='events.create'), url(\n '^event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/', include([url('^$',\n dashboards.event_index, name='event.index'), url('^live/$', event.\n EventLive.as_view(), name='event.live'), url('^settings/$', event.\n EventUpdate.as_view(), name='event.settings'), url('^settings/plugins$',\n event.EventPlugins.as_view(), name='event.settings.plugins'), url(\n '^settings/permissions$', event.EventPermissions.as_view(), name=\n 'event.settings.permissions'), url('^settings/payment$', event.\n PaymentSettings.as_view(), name='event.settings.payment'), url(\n '^settings/tickets$', event.TicketSettings.as_view(), name=\n 'event.settings.tickets'), url('^settings/email$', event.MailSettings.\n as_view(), name='event.settings.mail'), url('^settings/invoice$', event\n .InvoiceSettings.as_view(), name='event.settings.invoice'), url(\n '^settings/display', event.DisplaySettings.as_view(), name=\n 'event.settings.display'), url('^items/$', item.ItemList.as_view(),\n name='event.items'), url('^items/add$', item.ItemCreate.as_view(), name\n ='event.items.add'), url('^items/(?P<item>\\\\d+)/$', item.\n ItemUpdateGeneral.as_view(), name='event.item'), url(\n '^items/(?P<item>\\\\d+)/variations$', item.ItemVariations.as_view(),\n name='event.item.variations'), url('^items/(?P<item>\\\\d+)/up$', item.\n item_move_up, name='event.items.up'), url('^items/(?P<item>\\\\d+)/down$',\n item.item_move_down, name='event.items.down'), url(\n '^items/(?P<item>\\\\d+)/delete$', item.ItemDelete.as_view(), name=\n 'event.items.delete'), url('^categories/$', item.CategoryList.as_view(),\n name='event.items.categories'), url(\n '^categories/(?P<category>\\\\d+)/delete$', item.CategoryDelete.as_view(),\n name='event.items.categories.delete'), url(\n '^categories/(?P<category>\\\\d+)/up$', item.category_move_up, name=\n 'event.items.categories.up'), url(\n '^categories/(?P<category>\\\\d+)/down$', item.category_move_down, name=\n 'event.items.categories.down'), url('^categories/(?P<category>\\\\d+)/$',\n item.CategoryUpdate.as_view(), name='event.items.categories.edit'), url\n ('^categories/add$', item.CategoryCreate.as_view(), name=\n 'event.items.categories.add'), url('^questions/$', item.QuestionList.\n as_view(), name='event.items.questions'), url(\n '^questions/(?P<question>\\\\d+)/delete$', item.QuestionDelete.as_view(),\n name='event.items.questions.delete'), url(\n '^questions/(?P<question>\\\\d+)/up$', item.question_move_up, name=\n 'event.items.questions.up'), url('^questions/(?P<question>\\\\d+)/down$',\n item.question_move_down, name='event.items.questions.down'), url(\n '^questions/(?P<question>\\\\d+)/$', item.QuestionUpdate.as_view(), name=\n 'event.items.questions.edit'), url('^questions/add$', item.\n QuestionCreate.as_view(), name='event.items.questions.add'), url(\n '^quotas/$', item.QuotaList.as_view(), name='event.items.quotas'), url(\n '^quotas/(?P<quota>\\\\d+)/$', item.QuotaUpdate.as_view(), name=\n 'event.items.quotas.edit'), url('^quotas/(?P<quota>\\\\d+)/delete$', item\n .QuotaDelete.as_view(), name='event.items.quotas.delete'), url(\n '^quotas/add$', item.QuotaCreate.as_view(), name=\n 'event.items.quotas.add'), url('^vouchers/$', vouchers.VoucherList.\n as_view(), name='event.vouchers'), url('^vouchers/tags/$', vouchers.\n VoucherTags.as_view(), name='event.vouchers.tags'), url(\n '^vouchers/(?P<voucher>\\\\d+)/$', vouchers.VoucherUpdate.as_view(), name\n ='event.voucher'), url('^vouchers/(?P<voucher>\\\\d+)/delete$', vouchers.\n VoucherDelete.as_view(), name='event.voucher.delete'), url(\n '^vouchers/add$', vouchers.VoucherCreate.as_view(), name=\n 'event.vouchers.add'), url('^vouchers/bulk_add$', vouchers.\n VoucherBulkCreate.as_view(), name='event.vouchers.bulk'), url(\n '^orders/(?P<code>[0-9A-Z]+)/transition$', orders.OrderTransition.\n as_view(), name='event.order.transition'), url(\n '^orders/(?P<code>[0-9A-Z]+)/resend$', orders.OrderResendLink.as_view(),\n name='event.order.resendlink'), url(\n '^orders/(?P<code>[0-9A-Z]+)/invoice$', orders.OrderInvoiceCreate.\n as_view(), name='event.order.geninvoice'), url(\n '^orders/(?P<code>[0-9A-Z]+)/invoices/(?P<id>\\\\d+)/regenerate$', orders\n .OrderInvoiceRegenerate.as_view(), name='event.order.regeninvoice'),\n url('^orders/(?P<code>[0-9A-Z]+)/invoices/(?P<id>\\\\d+)/reissue$',\n orders.OrderInvoiceReissue.as_view(), name='event.order.reissueinvoice'\n ), url('^orders/(?P<code>[0-9A-Z]+)/extend$', orders.OrderExtend.\n as_view(), name='event.order.extend'), url(\n '^orders/(?P<code>[0-9A-Z]+)/comment$', orders.OrderComment.as_view(),\n name='event.order.comment'), url('^orders/(?P<code>[0-9A-Z]+)/$',\n orders.OrderDetail.as_view(), name='event.order'), url(\n '^orders/(?P<code>[0-9A-Z]+)/download/(?P<output>[^/]+)$', orders.\n OrderDownload.as_view(), name='event.order.download'), url(\n '^invoice/(?P<invoice>[^/]+)$', orders.InvoiceDownload.as_view(), name=\n 'event.invoice.download'), url('^orders/overview/$', orders.OverView.\n as_view(), name='event.orders.overview'), url('^orders/export/$',\n orders.ExportView.as_view(), name='event.orders.export'), url(\n '^orders/go$', orders.OrderGo.as_view(), name='event.orders.go'), url(\n '^orders/$', orders.OrderList.as_view(), name='event.orders'), url(\n '^attendees/$', attendees.AttendeeList.as_view(), name=\n 'event.attendees')])), url('^help/(?P<topic>[^.]+)$', help.HelpView.\n as_view(), name='help')]\n" ]
[ 0, 0, 1 ]
[ "ImportFrom'", "ImportFrom'", "Assign'" ]
[ "def FUNC_8():...\n", "VAR_17 = False\n", "VAR_18 = 'campaign-data/' + str(self.campaign_data['id']) + '/results/' + str(\n self.result_data['id'])\n", "os.makedirs(VAR_18)\n", "VAR_19 = VAR_18 + '/' + self.campaign_data['output_file']\n", "VAR_20 = 'campaign-data/' + str(self.campaign_data['id']\n ) + '/gold_' + self.campaign_data['output_file']\n", "if self.campaign_data['use_aux_output']:\n", "self.debugger.aux.get_file(self.campaign_data['output_file'], VAR_19)\n", "self.debugger.dut.get_file(self.campaign_data['output_file'], VAR_19)\n", "if not os.listdir(VAR_18):\n", "os.rmdir(VAR_18)\n", "VAR_28 = solution.read()\n", "VAR_17 = True\n", "VAR_29 = result.read()\n", "if self.campaign_data['use_aux_output']:\n", "self.result_data['data_diff'] = SequenceMatcher(None, VAR_28, VAR_29\n ).quick_ratio()\n", "self.debugger.aux.command('rm ' + self.campaign_data['output_file'])\n", "self.debugger.dut.command('rm ' + self.campaign_data['output_file'])\n", "if self.result_data['data_diff'] == 1.0:\n", "if VAR_17:\n", "os.remove(VAR_19)\n", "if not os.listdir(VAR_18):\n", "os.rmdir(VAR_18)\n" ]
[ "def check_output():...\n", "missing_output = False\n", "result_folder = 'campaign-data/' + str(self.campaign_data['id']\n ) + '/results/' + str(self.result_data['id'])\n", "os.makedirs(result_folder)\n", "output_location = result_folder + '/' + self.campaign_data['output_file']\n", "gold_location = 'campaign-data/' + str(self.campaign_data['id']\n ) + '/gold_' + self.campaign_data['output_file']\n", "if self.campaign_data['use_aux_output']:\n", "self.debugger.aux.get_file(self.campaign_data['output_file'], output_location)\n", "self.debugger.dut.get_file(self.campaign_data['output_file'], output_location)\n", "if not os.listdir(result_folder):\n", "os.rmdir(result_folder)\n", "solutionContents = solution.read()\n", "missing_output = True\n", "resultContents = result.read()\n", "if self.campaign_data['use_aux_output']:\n", "self.result_data['data_diff'] = SequenceMatcher(None, solutionContents,\n resultContents).quick_ratio()\n", "self.debugger.aux.command('rm ' + self.campaign_data['output_file'])\n", "self.debugger.dut.command('rm ' + self.campaign_data['output_file'])\n", "if self.result_data['data_diff'] == 1.0:\n", "if missing_output:\n", "os.remove(output_location)\n", "if not os.listdir(result_folder):\n", "os.rmdir(result_folder)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_12(self):...\n", "VAR_27 = self.builder.get_object('password_unlock_entry')\n", "VAR_33 = self.builder.get_object('composite_unlock_entry')\n", "VAR_27.set_text('')\n", "VAR_33.set_text('')\n" ]
[ "def clear_input_fields(self):...\n", "password_unlock_entry = self.builder.get_object('password_unlock_entry')\n", "composite_unlock_entry = self.builder.get_object('composite_unlock_entry')\n", "password_unlock_entry.set_text('')\n", "composite_unlock_entry.set_text('')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement\n", "import logging\n", "import os\n", "import subprocess\n", "from collections import namedtuple\n", "from pants.base.exceptions import TaskError\n", "from pants.binaries.binary_util import BinaryUtil\n", "from pants.fs.archive import TGZ\n", "from pants.subsystem.subsystem import Subsystem\n", "from pants.util.contextutil import temporary_dir\n", "from pants.util.memo import memoized_property\n", "VAR_0 = logging.getLogger(__name__)\n", "\"\"\"Represents a self-bootstrapping Node distribution.\"\"\"\n", "VAR_15 = 'node-distribution'\n", "@classmethod...\n", "return BinaryUtil.Factory,\n" ]
[ "from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement\n", "import logging\n", "import os\n", "import subprocess\n", "from collections import namedtuple\n", "from pants.base.exceptions import TaskError\n", "from pants.binaries.binary_util import BinaryUtil\n", "from pants.fs.archive import TGZ\n", "from pants.subsystem.subsystem import Subsystem\n", "from pants.util.contextutil import temporary_dir\n", "from pants.util.memo import memoized_property\n", "logger = logging.getLogger(__name__)\n", "\"\"\"Represents a self-bootstrapping Node distribution.\"\"\"\n", "options_scope = 'node-distribution'\n", "@classmethod...\n", "return BinaryUtil.Factory,\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.docstring = VAR_68\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.docstring = string\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_4(self, VAR_1, VAR_2, VAR_5, VAR_10=None, VAR_11=False, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_10:\n", "VAR_10 = []\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_29 = {}\n", "for VAR_48 in VAR_5:\n", "VAR_29[VAR_48] = {}.fromkeys(VAR_10, 0.0)\n", "for VAR_55 in VAR_10:\n", "VAR_49 = VAR_4.copy()\n", "return VAR_29\n", "if VAR_55 == 'qty_available':\n", "VAR_49.update({'states': ('done',), 'what': ('in', 'out')})\n", "if VAR_55 == 'virtual_available':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned', 'done'),\n 'what': ('in', 'out')})\n", "if VAR_55 == 'incoming_qty':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('in',)}\n )\n", "if VAR_55 == 'outgoing_qty':\n", "VAR_49.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': (\n 'out',)})\n", "VAR_50 = self.get_product_available(VAR_1, VAR_2, VAR_5, VAR_4=c)\n", "for VAR_48 in VAR_5:\n", "VAR_29[VAR_48][VAR_55] = VAR_50.get(VAR_48, 0.0)\n" ]
[ "def _product_available(self, cr, uid, ids, field_names=None, arg=False,...\n", "\"\"\"docstring\"\"\"\n", "if not field_names:\n", "field_names = []\n", "if context is None:\n", "context = {}\n", "res = {}\n", "for id in ids:\n", "res[id] = {}.fromkeys(field_names, 0.0)\n", "for f in field_names:\n", "c = context.copy()\n", "return res\n", "if f == 'qty_available':\n", "c.update({'states': ('done',), 'what': ('in', 'out')})\n", "if f == 'virtual_available':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned', 'done'), 'what': (\n 'in', 'out')})\n", "if f == 'incoming_qty':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('in',)})\n", "if f == 'outgoing_qty':\n", "c.update({'states': ('confirmed', 'waiting', 'assigned'), 'what': ('out',)})\n", "stock = self.get_product_available(cr, uid, ids, context=c)\n", "for id in ids:\n", "res[id][f] = stock.get(id, 0.0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "For", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "For", "Assign'" ]
[ "def FUNC_18():...\n", "populate_test_database()\n", "FUNC_0(1, 'title', 'thumbnail', 1)\n", "FUNC_0(1, 'title2', 'thumbnail2', 2)\n", "VAR_11 = VAR_3.put('/videos/1/1/2')\n", "assert VAR_11.json['status'] == 'NOK'\n", "assert VAR_11.json['message'] != None\n", "VAR_12 = VAR_3.put('/videos/1/1/5')\n", "assert VAR_12.json['status'] == 'NOK'\n", "assert VAR_12.json['message'] != None\n" ]
[ "def test_should_return_a_not_ok_status_when_either_specifying_an_out_of_bounds_or_similar_position(...\n", "populate_test_database()\n", "create_video(1, 'title', 'thumbnail', 1)\n", "create_video(1, 'title2', 'thumbnail2', 2)\n", "response = test_app.put('/videos/1/1/2')\n", "assert response.json['status'] == 'NOK'\n", "assert response.json['message'] != None\n", "response2 = test_app.put('/videos/1/1/5')\n", "assert response2.json['status'] == 'NOK'\n", "assert response2.json['message'] != None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Assert'", "Assert'", "Assign'", "Assert'", "Assert'" ]
[ "import json as json_module\n", "import logging\n", "import sys\n", "from citest.service_testing import HttpContractBuilder\n", "from citest.service_testing import NoOpOperation\n", "import citest.gcp_testing as gcp\n", "import citest.json_contract as jc\n", "import citest.service_testing as st\n", "import spinnaker_testing as sk\n", "import spinnaker_testing.kato as kato\n", "VAR_0 = []\n", "VAR_1 = []\n", "VAR_2 = ''\n", "VAR_3 = ''\n", "VAR_4 = ''\n", "VAR_5 = ''\n", "VAR_6 = ''\n", "VAR_7 = ''\n", "VAR_8 = ''\n", "VAR_9 = ''\n", "VAR_10 = ''\n", "VAR_11 = ''\n", "VAR_12 = ''\n", "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return kato.new_agent(VAR_14)\n" ]
[ "import json as json_module\n", "import logging\n", "import sys\n", "from citest.service_testing import HttpContractBuilder\n", "from citest.service_testing import NoOpOperation\n", "import citest.gcp_testing as gcp\n", "import citest.json_contract as jc\n", "import citest.service_testing as st\n", "import spinnaker_testing as sk\n", "import spinnaker_testing.kato as kato\n", "use_instance_names = []\n", "use_instance_zones = []\n", "__use_lb_name = ''\n", "__use_lb_tp_name = ''\n", "__use_lb_hc_name = ''\n", "__use_lb_target = ''\n", "__use_http_lb_name = ''\n", "__use_http_lb_proxy_name = ''\n", "__use_http_lb_hc_name = ''\n", "__use_http_lb_bs_name = ''\n", "__use_http_lb_fr_name = ''\n", "__use_http_lb_map_name = ''\n", "__use_http_lb_http_proxy_name = ''\n", "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return kato.new_agent(bindings)\n" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Docstring", "Return'" ]
[ "def FUNC_11(VAR_7):...\n", "@wraps(VAR_7)...\n", "if not app.config.get('USE_AUTH'):\n", "return VAR_7(*VAR_9, **kwargs)\n", "VAR_17 = FUNC_8()\n", "logging.warning('Invalid token version used.')\n", "if VAR_17:\n", "return abort(403)\n", "VAR_2 = 'user'\n", "if VAR_17['user_type'] not in app.config['KMS_AUTH_USER_TYPES']:\n", "logging.exception('Failed to decrypt authentication token.')\n", "logging.error('Ran out of authentication methods')\n", "if not FUNC_5(VAR_2, VAR_7.func_name):\n", "VAR_18 = '{0} is not an allowed user type for KMS auth.'\n", "VAR_19 = keymanager.decrypt_token(VAR_17['version'], VAR_17['user_type'],\n VAR_17['from'], VAR_17['token'])\n", "VAR_18 = 'Access denied for {0}. Authentication Failed.'\n", "return abort(403)\n", "return abort(403)\n", "if VAR_1.is_expired():\n", "VAR_18 = VAR_18.format(VAR_17['user_type'])\n", "logging.debug('Auth request had the following token_data: {0}'.format(VAR_19))\n", "VAR_18 = VAR_18.format(VAR_17['from'])\n", "return abort(401)\n", "if VAR_1.is_authenticated():\n", "logging.warning(VAR_18)\n", "VAR_18 = 'Authenticated {0} with user_type {1} via kms auth'\n", "logging.warning(VAR_18)\n", "return abort(401)\n", "VAR_1.check_authorization()\n", "logging.warning('Not authorized -- ' + e.message)\n", "VAR_1.set_expiration()\n", "return abort(403)\n", "VAR_18 = VAR_18.format(VAR_17['from'], VAR_17['user_type'])\n", "return abort(403)\n", "return abort(403)\n", "g.user_type = VAR_2\n", "logging.debug(VAR_18)\n", "g.auth_type = VAR_1.auth_type\n", "if FUNC_5(VAR_17['user_type'], VAR_7.func_name):\n", "return VAR_7(*VAR_9, **kwargs)\n", "g.user_type = VAR_17['user_type']\n", "VAR_18 = '{0} is not authorized to access {1}.'\n", "g.auth_type = 'kms'\n", "VAR_18 = VAR_18.format(VAR_17['from'], VAR_7.func_name)\n", "g.account = FUNC_4(VAR_19['key_alias'])\n", "logging.warning(VAR_18)\n", "g.username = VAR_17['from']\n", "return abort(403)\n", "return VAR_7(*VAR_9, **kwargs)\n" ]
[ "def require_auth(f):...\n", "@wraps(f)...\n", "if not app.config.get('USE_AUTH'):\n", "return f(*args, **kwargs)\n", "kms_auth_data = _get_kms_auth_data()\n", "logging.warning('Invalid token version used.')\n", "if kms_auth_data:\n", "return abort(403)\n", "user_type = 'user'\n", "if kms_auth_data['user_type'] not in app.config['KMS_AUTH_USER_TYPES']:\n", "logging.exception('Failed to decrypt authentication token.')\n", "logging.error('Ran out of authentication methods')\n", "if not user_type_has_privilege(user_type, f.func_name):\n", "msg = '{0} is not an allowed user type for KMS auth.'\n", "token_data = keymanager.decrypt_token(kms_auth_data['version'],\n kms_auth_data['user_type'], kms_auth_data['from'], kms_auth_data['token'])\n", "msg = 'Access denied for {0}. Authentication Failed.'\n", "return abort(403)\n", "return abort(403)\n", "if user_mod.is_expired():\n", "msg = msg.format(kms_auth_data['user_type'])\n", "logging.debug('Auth request had the following token_data: {0}'.format(\n token_data))\n", "msg = msg.format(kms_auth_data['from'])\n", "return abort(401)\n", "if user_mod.is_authenticated():\n", "logging.warning(msg)\n", "msg = 'Authenticated {0} with user_type {1} via kms auth'\n", "logging.warning(msg)\n", "return abort(401)\n", "user_mod.check_authorization()\n", "logging.warning('Not authorized -- ' + e.message)\n", "user_mod.set_expiration()\n", "return abort(403)\n", "msg = msg.format(kms_auth_data['from'], kms_auth_data['user_type'])\n", "return abort(403)\n", "return abort(403)\n", "g.user_type = user_type\n", "logging.debug(msg)\n", "g.auth_type = user_mod.auth_type\n", "if user_type_has_privilege(kms_auth_data['user_type'], f.func_name):\n", "return f(*args, **kwargs)\n", "g.user_type = kms_auth_data['user_type']\n", "msg = '{0} is not authorized to access {1}.'\n", "g.auth_type = 'kms'\n", "msg = msg.format(kms_auth_data['from'], f.func_name)\n", "g.account = account_for_key_alias(token_data['key_alias'])\n", "logging.warning(msg)\n", "g.username = kms_auth_data['from']\n", "return abort(403)\n", "return f(*args, **kwargs)\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 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Return'", "Condition", "Assign'", "Expr'", "Assign'", "Return'", "Condition", "Expr'", "Assign'", "Expr'", "Return'", "Expr'", "Expr'", "Expr'", "Return'", "Assign'", "Return'", "Return'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = 'string'.format(VAR_1, VAR_2)\n", "VAR_6 = FUNC_3(VAR_0, VAR_4)\n", "if VAR_6 is not None:\n", "VAR_8 = open('top_articles_report.txt', 'w')\n", "return False\n", "for row in VAR_6:\n", "VAR_8.write('\"{}\" - {} views \\n'.format(row[0], row[1]))\n", "VAR_8.close()\n", "return True\n" ]
[ "def get_top_articles(cur, order, limit):...\n", "\"\"\"docstring\"\"\"\n", "query = (\n \"\"\"SELECT articles.title, COUNT(*) as views\n FROM log, articles\n WHERE log.path LIKE '%'||articles.slug AND\n log.method = 'GET'\n GROUP BY articles.title\n ORDER BY views {}\n LIMIT {}\"\"\"\n .format(order, limit))\n", "rows = get_data(cur, query)\n", "if rows is not None:\n", "file = open('top_articles_report.txt', 'w')\n", "return False\n", "for row in rows:\n", "file.write('\"{}\" - {} views \\n'.format(row[0], row[1]))\n", "file.close()\n", "return True\n" ]
[ 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "For", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_15(self, VAR_16, VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = self._eql_execute('volume', 'select', VAR_18['volume_name'],\n 'snapshot', 'select', VAR_18['name'], 'clone', VAR_16['name'])\n", "VAR_0.error(_('Failed to create volume from snapshot %s'), VAR_18['name'])\n", "return self._get_volume_data(VAR_25)\n" ]
[ "def create_volume_from_snapshot(self, volume, snapshot):...\n", "\"\"\"docstring\"\"\"\n", "out = self._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'select', snapshot['name'], 'clone', volume['name'])\n", "LOG.error(_('Failed to create volume from snapshot %s'), snapshot['name'])\n", "return self._get_volume_data(out)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0():...\n", "return st.ScenarioTestRunner.main(CLASS_0, test_case_list=[\n GoogleKatoIntegrationTest])\n" ]
[ "def main():...\n", "return st.ScenarioTestRunner.main(GoogleKatoTestScenario, test_case_list=[\n GoogleKatoIntegrationTest])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "" ]
[ "def do_get(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_18(self, VAR_9):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "VAR_20 = self.send_cmd('delete_comment{} {}'.format(self.insecure_mode, VAR_9))\n", "return\n", "print(VAR_20)\n" ]
[ "def do_delete_comment(self, line):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "response = self.send_cmd('delete_comment{} {}'.format(self.insecure_mode, line)\n )\n", "return\n", "print(response)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_3(self):...\n", "auth.login(self.request, self.user)\n", "VAR_5 = import_from_settings('OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS', 60 * 15)\n", "self.request.session['oidc_id_token_expiration'] = time.time() + VAR_5\n", "return HttpResponseRedirect(self.success_url)\n" ]
[ "def login_success(self):...\n", "auth.login(self.request, self.user)\n", "expiration_interval = import_from_settings('OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS'\n , 60 * 15)\n", "self.request.session['oidc_id_token_expiration'] = time.time(\n ) + expiration_interval\n", "return HttpResponseRedirect(self.success_url)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(self):...\n", "VAR_14 = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "VAR_14.delete('unique-id')\n", "FUNC_1('delete', VAR_14, 'https://1.2.3.4/api/v1/ports/unique-id')\n" ]
[ "def test_client_delete(self):...\n", "api = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "api.delete('unique-id')\n", "assert_call('delete', api, 'https://1.2.3.4/api/v1/ports/unique-id')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_17(self, VAR_16, VAR_24='GET', VAR_15=None, VAR_12=None, VAR_13=False...\n", "VAR_40 = VAR_12.copy() if VAR_12 else {}\n", "VAR_40.update(self._default_headers)\n", "VAR_41 = self._build_url(VAR_16)\n", "VAR_42 = getattr(self._conn, VAR_24.lower())\n", "if not VAR_13:\n", "VAR_0.debug('REST call: %s %s. Headers: %s. Body: %s', VAR_24, VAR_41,\n VAR_40, self._mask_password(VAR_15))\n", "VAR_43 = time.time()\n", "VAR_19 = VAR_42(VAR_41, data=body, VAR_12=request_headers)\n", "VAR_44 = time.time()\n", "if not VAR_13:\n", "VAR_0.debug('REST call: %s %s. Response: %s. Took %2.4f', VAR_24, VAR_41, \n VAR_19.json() if VAR_19.content else '', VAR_44 - VAR_43)\n", "self._validate_result(VAR_19, CLASS_0._VERB_RESP_CODES[VAR_24.lower()], _(\n '%(verb)s %(url)s') % {'verb': VAR_24, 'url': VAR_41}, VAR_13=silent)\n", "return VAR_19\n" ]
[ "def _rest_call(self, url, method='GET', body=None, headers=None, silent=False):...\n", "request_headers = headers.copy() if headers else {}\n", "request_headers.update(self._default_headers)\n", "request_url = self._build_url(url)\n", "do_request = getattr(self._conn, method.lower())\n", "if not silent:\n", "LOG.debug('REST call: %s %s. Headers: %s. Body: %s', method, request_url,\n request_headers, self._mask_password(body))\n", "ts = time.time()\n", "result = do_request(request_url, data=body, headers=request_headers)\n", "te = time.time()\n", "if not silent:\n", "LOG.debug('REST call: %s %s. Response: %s. Took %2.4f', method, request_url,\n result.json() if result.content else '', te - ts)\n", "self._validate_result(result, RESTClient._VERB_RESP_CODES[method.lower()], \n _('%(verb)s %(url)s') % {'verb': method, 'url': request_url}, silent=silent\n )\n", "return result\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Return'" ]
[ "@property...\n", "return await GithubUser.get(gid=self.github_id)\n" ]
[ "@property...\n", "return await GithubUser.get(gid=self.github_id)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __init__(self, VAR_0):...\n", "self.txt = VAR_0\n" ]
[ "def __init__(self, txt):...\n", "self.txt = txt\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "@tornado.web.asynchronous...\n", "def FUNC_5():...\n", "self.set_status(404, 'Not Found')\n", "self._headers = tornado.httputil.HTTPHeaders()\n", "self.add_header('Content-Length', '0')\n", "self.flush()\n", "return\n" ]
[ "@tornado.web.asynchronous...\n", "def invoke_404():...\n", "self.set_status(404, 'Not Found')\n", "self._headers = tornado.httputil.HTTPHeaders()\n", "self.add_header('Content-Length', '0')\n", "self.flush()\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 4 ]
[ "Condition", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "@property...\n", "return os.path.expanduser('~/.oms_history')\n" ]
[ "@property...\n", "return os.path.expanduser('~/.oms_history')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_1(VAR_0, VAR_1=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_34 = VAR_0.split('\\n')\n", "if VAR_1:\n", "VAR_34 = VAR_34[0:1] + VAR_34[3:]\n", "return '\\n'.join(VAR_34)\n" ]
[ "def format_error_message(exception_message, task_exception=False):...\n", "\"\"\"docstring\"\"\"\n", "lines = exception_message.split('\\n')\n", "if task_exception:\n", "lines = lines[0:1] + lines[3:]\n", "return '\\n'.join(lines)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@classmethod...\n", "return NotImplementedError()\n" ]
[ "@classmethod...\n", "return NotImplementedError()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import os.path\n", "from django.test import TestCase\n", "from django.conf import settings\n", "from api.models import App\n", "\"\"\"Tests creation of applications\"\"\"\n", "VAR_1 = ['tests.json']\n", "def FUNC_0(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "settings.SSH_PRIVATE_KEY = '<some-ssh-private-key>'\n", "def FUNC_1(self):...\n", "settings.SSH_PRIVATE_KEY = ''\n", "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = '/api/apps'\n", "VAR_3 = self.client.post(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "self.assertIn('id', VAR_3.data)\n", "self.assertIn('url', VAR_3.data)\n", "self.assertEqual(VAR_3.data['url'], '{app_id}.deisapp.local'.format(**locals())\n )\n", "VAR_3 = self.client.get('/api/apps')\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertEqual(len(VAR_3.data['results']), 1)\n", "VAR_2 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 200)\n", "VAR_5 = {'id': 'new'}\n", "VAR_3 = self.client.patch(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 405)\n", "VAR_3 = self.client.delete(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 204)\n", "def FUNC_3(self):...\n", "VAR_5 = {'id': 'myid'}\n", "VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_5 = {'id': VAR_3.data['id']}\n", "VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertContains(VAR_3, 'App with this Id already exists.', status_code=400)\n", "return VAR_3\n" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import os.path\n", "from django.test import TestCase\n", "from django.conf import settings\n", "from api.models import App\n", "\"\"\"Tests creation of applications\"\"\"\n", "fixtures = ['tests.json']\n", "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "settings.SSH_PRIVATE_KEY = '<some-ssh-private-key>'\n", "def tearDown(self):...\n", "settings.SSH_PRIVATE_KEY = ''\n", "def test_app(self):...\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", "self.assertIn('id', response.data)\n", "self.assertIn('url', response.data)\n", "self.assertEqual(response.data['url'], '{app_id}.deisapp.local'.format(**\n locals()))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "body = {'id': 'new'}\n", "response = self.client.patch(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 405)\n", "response = self.client.delete(url)\n", "self.assertEqual(response.status_code, 204)\n", "def test_app_override_id(self):...\n", "body = {'id': 'myid'}\n", "response = self.client.post('/api/apps', json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "body = {'id': response.data['id']}\n", "response = self.client.post('/api/apps', json.dumps(body), content_type=\n 'application/json')\n", "self.assertContains(response, 'App with this Id already exists.',\n status_code=400)\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 5, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_50(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'LOW': 11}, 'CONFIDENCE': {'HIGH': 11}}\n", "self.check_example('partial_path_process.py', VAR_2)\n" ]
[ "def test_partial_path(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'LOW': 11}, 'CONFIDENCE': {'HIGH': 11}}\n", "self.check_example('partial_path_process.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "@app.route('/people/<user_id>/delete_name/<name_id>', methods=['POST'])...\n", "if not current_user.editor:\n", "return redirect(url_for('error403'))\n", "VAR_9 = Name.query.filter_by(id=name_id).first()\n", "db.session.delete(VAR_9)\n", "db.session.commit()\n", "return redirect(url_for('person_edit', VAR_0=user_id))\n" ]
[ "@app.route('/people/<user_id>/delete_name/<name_id>', methods=['POST'])...\n", "if not current_user.editor:\n", "return redirect(url_for('error403'))\n", "name_to_delete = Name.query.filter_by(id=name_id).first()\n", "db.session.delete(name_to_delete)\n", "db.session.commit()\n", "return redirect(url_for('person_edit', user_id=user_id))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "import pyxl\n", "import mysql.connector\n", "from pypika import MySQLQuery, Table, Field\n", "def FUNC_0(VAR_0, VAR_1, VAR_2):...\n", "VAR_4 = VAR_0.cursor()\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "VAR_6 = Table('Presets')\n", "VAR_7 = MySQLQuery.into(VAR_6).columns('querval', 'description').insert(VAR_1,\n VAR_2)\n", "print(VAR_7)\n", "VAR_5 = str(VAR_7)\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "def FUNC_1(VAR_0, VAR_3, VAR_1, VAR_2):...\n", "VAR_4 = VAR_0.cursor()\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "if VAR_1 != 'NA':\n", "VAR_5 = \"UPDATE Presets SET querval='\" + VAR_1 + \"' WHERE id=\" + str(VAR_3\n ) + ';'\n", "if VAR_2 != 'NA':\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = \"UPDATE Presets SET description='\" + VAR_2 + \"' WHERE id=\" + str(VAR_3\n ) + ';'\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "def FUNC_2(VAR_0, VAR_3):...\n", "VAR_4 = VAR_0.cursor()\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = 'DELETE FROM Presets WHERE id = ' + VAR_3\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "def FUNC_3(VAR_0, VAR_3):...\n", "VAR_4 = VAR_0.cursor()\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "VAR_6 = Table('Presets')\n", "VAR_7 = MySQLQuery.from_(VAR_6).select(VAR_6.querval).where(VAR_6.id == VAR_3)\n", "print(VAR_7)\n", "VAR_5 = str(VAR_7)\n", "VAR_4.execute(VAR_5)\n", "VAR_8 = VAR_4.fetchone()\n", "VAR_9 = str(VAR_8)\n", "return VAR_9[2:-3]\n" ]
[ "import pyxl\n", "import mysql.connector\n", "from pypika import MySQLQuery, Table, Field\n", "def write_preset(conn, queryin, descriptin):...\n", "cursor = conn.cursor()\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "extable = Table('Presets')\n", "q = MySQLQuery.into(extable).columns('querval', 'description').insert(queryin,\n descriptin)\n", "print(q)\n", "quer = str(q)\n", "cursor.execute(quer)\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "def edit_preset(conn, key, queryin, descriptin):...\n", "cursor = conn.cursor()\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "if queryin != 'NA':\n", "quer = \"UPDATE Presets SET querval='\" + queryin + \"' WHERE id=\" + str(key\n ) + ';'\n", "if descriptin != 'NA':\n", "cursor.execute(quer)\n", "quer = \"UPDATE Presets SET description='\" + descriptin + \"' WHERE id=\" + str(\n key) + ';'\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "def remove_preset(conn, key):...\n", "cursor = conn.cursor()\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "quer = 'DELETE FROM Presets WHERE id = ' + key\n", "cursor.execute(quer)\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "def get_preset(conn, key):...\n", "cursor = conn.cursor()\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "extable = Table('Presets')\n", "q = MySQLQuery.from_(extable).select(extable.querval).where(extable.id == key)\n", "print(q)\n", "quer = str(q)\n", "cursor.execute(quer)\n", "row = cursor.fetchone()\n", "strrow = str(row)\n", "return strrow[2:-3]\n" ]
[ 0, 0, 0, 0, 4, 4, 4, 4, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 4, 4 ]
[ "Import'", "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self, VAR_5):...\n", "self.common = self._init_common()\n", "self._check_flags()\n", "self.common.do_setup(VAR_5)\n" ]
[ "def do_setup(self, context):...\n", "self.common = self._init_common()\n", "self._check_flags()\n", "self.common.do_setup(context)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_23 = self.common.create_volume_from_snapshot(VAR_7, VAR_9)\n", "self.common.client_logout()\n", "return {'metadata': VAR_23}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n", "self.common.client_logout()\n", "return {'metadata': metadata}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@VAR_1.route('/run/form/submit', methods=['POST'])...\n", "VAR_37 = FUNC_15()\n", "VAR_10 = FUNC_14(VAR_37)\n", "if VAR_37.validate_on_submit():\n", "return json.dumps({'commands': VAR_10, 'html': render_template(\n 'run_success.html', VAR_10=commands)})\n", "return json.dumps({'commands': VAR_10, 'html': render_template(\n 'run_form.html', VAR_9=run_form)}), 400\n" ]
[ "@app.route('/run/form/submit', methods=['POST'])...\n", "run_form = get_run_form()\n", "commands = get_commands(run_form)\n", "if run_form.validate_on_submit():\n", "return json.dumps({'commands': commands, 'html': render_template(\n 'run_success.html', commands=commands)})\n", "return json.dumps({'commands': commands, 'html': render_template(\n 'run_form.html', form=run_form)}), 400\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "For", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "@VAR_0.route('/api/issue', methods=['PATCH'])...\n", "return 'Not implemented.', 501\n" ]
[ "@app.route('/api/issue', methods=['PATCH'])...\n", "return 'Not implemented.', 501\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_5(VAR_2: db.note.Note, VAR_0: Request):...\n", "content: str = VAR_0.params['note']\n", "VAR_2.content = content.replace('\\r', '')\n", "return db.note.save_note(VAR_0.db, VAR_2)\n" ]
[ "def _save_or_create_note(note: db.note.Note, request: Request):...\n", "content: str = request.params['note']\n", "note.content = content.replace('\\r', '')\n", "return db.note.save_note(request.db, note)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "AnnAssign'", "Assign'", "Return'" ]
[ "def FUNC_5(self):...\n", "" ]
[ "def _check_children_depth(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self, VAR_11):...\n", "return utils.sanitize_url(VAR_11)\n" ]
[ "def run(self, url):...\n", "return utils.sanitize_url(url)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if _sparse.issparse(VAR_13) == False:\n", "VAR_34, VAR_35 = _sla.eigs(VAR_13, VAR_1=1, which='LM', ncv=lanczosVecs,\n VAR_6=maxiter)\n", "VAR_35 = VAR_35.reshape(VAR_35.size)\n", "if VAR_14:\n", "VAR_35 /= sum(VAR_35)\n", "return VAR_35\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if _sparse.issparse(A) == False:\n", "w, pi = _sla.eigs(A, k=1, which='LM', ncv=lanczosVecs, maxiter=maxiter)\n", "pi = pi.reshape(pi.size)\n", "if normalized:\n", "pi /= sum(pi)\n", "return pi\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Condition", "AugAssign'", "Return'" ]
[ "def FUNC_39(self, *VAR_19, **VAR_46):...\n", "return super(CLASS_1, self).render(*VAR_19, **kwargs)\n" ]
[ "def render(self, *args, **kwargs):...\n", "return super(MetalTemplate, self).render(*args, **kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_12():...\n", "VAR_20 = []\n", "for i in range(int(VAR_2)):\n", "VAR_26 = subprocess.Popen([sys.executable, __file__], stdout=subprocess.\n PIPE, stderr=subprocess.PIPE)\n", "VAR_20.append(VAR_26.pid)\n", "log.info('Started worker with pid %s' % VAR_26.pid)\n" ]
[ "def run_children():...\n", "child_pids = []\n", "for i in range(int(no_subprocess)):\n", "proc = subprocess.Popen([sys.executable, __file__], stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n", "child_pids.append(proc.pid)\n", "log.info('Started worker with pid %s' % proc.pid)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_9(self, VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = pathexpr.SearcherExists(self, VAR_7)\n", "VAR_10 = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n", "VAR_11 = self._doc['rules']['ROOT']\n", "ds._traverse(VAR_5, VAR_11, VAR_10, self)\n", "return VAR_5._store\n" ]
[ "def search_paths(self, searchexpr):...\n", "\"\"\"docstring\"\"\"\n", "searcher = pathexpr.SearcherExists(self, searchexpr)\n", "ctx = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n", "rule = self._doc['rules']['ROOT']\n", "ds._traverse(searcher, rule, ctx, self)\n", "return searcher._store\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_1=None, VAR_2=5):...\n", "self.size = VAR_2\n", "self.data = VAR_1 or []\n" ]
[ "def __init__(self, list=None, size=5):...\n", "self.size = size\n", "self.data = list or []\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_24(self, VAR_17):...\n", "VAR_35, VAR_9, VAR_36 = sys.exc_info()\n", "VAR_16, VAR_37 = str(VAR_17).split(\"'\")[-2], None\n", "if 'unique_' in VAR_16:\n", "VAR_16 = VAR_16.split('_', 1)[1]\n", "VAR_25 = self.meta.get_field(VAR_16)\n", "if VAR_25:\n", "VAR_37 = VAR_25.label\n", "VAR_54.msgprint(_('{0} must be unique'.format(VAR_37 or VAR_16)))\n" ]
[ "def show_unique_validation_message(self, e):...\n", "type, value, traceback = sys.exc_info()\n", "fieldname, label = str(e).split(\"'\")[-2], None\n", "if 'unique_' in fieldname:\n", "fieldname = fieldname.split('_', 1)[1]\n", "df = self.meta.get_field(fieldname)\n", "if df:\n", "label = df.label\n", "frappe.msgprint(_('{0} must be unique'.format(label or fieldname)))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = ['hp3par_api_url', 'hp3par_username', 'hp3par_password', 'san_ip',\n 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, VAR_18)\n" ]
[ "def _check_flags(self):...\n", "\"\"\"docstring\"\"\"\n", "required_flags = ['hp3par_api_url', 'hp3par_username', 'hp3par_password',\n 'san_ip', 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, required_flags)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_15(self, VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "self.log_debug('Reading file %s' % VAR_14)\n", "if VAR_67.errno == 2:\n", "if not self.local:\n", "self.log_debug('File %s does not exist on node' % VAR_14)\n", "self.log_error('Error reading %s: %s' % (VAR_14, VAR_67))\n", "VAR_63 = self.sftp.open(VAR_14)\n", "return rfile.read()\n", "return ''\n", "return VAR_63.read()\n" ]
[ "def read_file(self, to_read):...\n", "\"\"\"docstring\"\"\"\n", "self.log_debug('Reading file %s' % to_read)\n", "if err.errno == 2:\n", "if not self.local:\n", "self.log_debug('File %s does not exist on node' % to_read)\n", "self.log_error('Error reading %s: %s' % (to_read, err))\n", "remote = self.sftp.open(to_read)\n", "return rfile.read()\n", "return ''\n", "return remote.read()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Condition", "Condition", "Expr'", "Expr'", "Assign'", "Return'", "Return'", "Return'" ]
[ "def FUNC_4(self):...\n", "self.uut.executable = 'more'\n", "self.uut.use_stdin = True\n", "self.uut.use_stderr = False\n", "self.uut.process_output = lambda output, filename, file: output\n", "VAR_1 = self.uut.lint(file=lines)\n", "self.assertTrue(('abcd\\n', 'efgh\\n') == VAR_1 or ('abcd\\n', 'efgh\\n', '\\n') ==\n VAR_1)\n" ]
[ "def test_stdin_input(self):...\n", "self.uut.executable = 'more'\n", "self.uut.use_stdin = True\n", "self.uut.use_stderr = False\n", "self.uut.process_output = lambda output, filename, file: output\n", "out = self.uut.lint(file=lines)\n", "self.assertTrue(('abcd\\n', 'efgh\\n') == out or ('abcd\\n', 'efgh\\n', '\\n') ==\n out)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = self.get_vendor_id(VAR_14)\n", "VAR_26 = {'name': VAR_25.id, 'min_qty': VAR_15, 'price': VAR_16,\n 'product_code': VAR_17, 'product_name': self.name, 'date_start': VAR_18,\n 'product_tmpl_id': self.id}\n", "VAR_27 = self.seller_ids.search([('name', '=', VAR_25.id), (\n 'product_tmpl_id', '=', self.id), ('date_end', '=', False)])\n", "for reg in VAR_27:\n", "VAR_33 = datetime.strptime(VAR_18[0:10], '%Y-%m-%d')\n", "self.seller_ids = [(0, 0, VAR_26)]\n", "VAR_33 = datetime.strftime(VAR_33 - timedelta(1), '%Y-%m-%d')\n", "reg.date_end = VAR_33 if VAR_33 >= reg.date_start else reg.date_start\n" ]
[ "def insert_historic_cost(self, vendor_ref, min_qty, cost, vendors_code, date):...\n", "\"\"\"docstring\"\"\"\n", "vendor_id = self.get_vendor_id(vendor_ref)\n", "supplierinfo = {'name': vendor_id.id, 'min_qty': min_qty, 'price': cost,\n 'product_code': vendors_code, 'product_name': self.name, 'date_start':\n date, 'product_tmpl_id': self.id}\n", "sellers = self.seller_ids.search([('name', '=', vendor_id.id), (\n 'product_tmpl_id', '=', self.id), ('date_end', '=', False)])\n", "for reg in sellers:\n", "dt = datetime.strptime(date[0:10], '%Y-%m-%d')\n", "self.seller_ids = [(0, 0, supplierinfo)]\n", "dt = datetime.strftime(dt - timedelta(1), '%Y-%m-%d')\n", "reg.date_end = dt if dt >= reg.date_start else reg.date_start\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_38(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n", "self.check_example('subprocess_shell.py', VAR_2)\n" ]
[ "def test_subprocess_shell(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'HIGH': 3, 'MEDIUM': 1, 'LOW': 14}, 'CONFIDENCE': {\n 'HIGH': 17, 'LOW': 1}}\n", "self.check_example('subprocess_shell.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_2(VAR_5):...\n", "VAR_12 = 'string'\n", "VAR_14 = create_connection()\n", "VAR_14.close()\n", "VAR_15 = VAR_14.cursor()\n", "VAR_15.execute(VAR_12, VAR_5)\n", "return VAR_15.fetchall()\n" ]
[ "def get_invoice(id):...\n", "sql_query = (\n 'select t2.id as id_invoice , t2.transaction_date, sum(t3.price * t1.quantity) as montant from invoice_products as t1 inner join invoices as t2 on t2.id = t1.invoice_id inner join products as t3 on t3.id = t1.product_id and t2.user_id= %s group by t2.id, t2.transaction_date order by t2.transaction_date DESC'\n )\n", "connection = create_connection()\n", "connection.close()\n", "cursor = connection.cursor()\n", "cursor.execute(sql_query, id)\n", "return cursor.fetchall()\n" ]
[ 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_3(self, VAR_5, VAR_6):...\n", "self.reset()\n", "self.on_sort.emit(self.columns[VAR_5], bool(VAR_6))\n" ]
[ "def sort(self, column, order):...\n", "self.reset()\n", "self.on_sort.emit(self.columns[column], bool(order))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]