lines
listlengths
1
444
raw_lines
listlengths
1
444
label
listlengths
1
444
type
listlengths
1
444
[ "def FUNC_5(self):...\n", "" ]
[ "def Start(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_12(self, VAR_22):...\n", "logging.warning(\"\"\"Authentication error.\n%s\"\"\", VAR_22)\n", "self.abort_with_error(401, text=str(error))\n" ]
[ "def authentication_error(self, error):...\n", "logging.warning(\"\"\"Authentication error.\n%s\"\"\", error)\n", "self.abort_with_error(401, text=str(error))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "return os.stat(VAR_0, follow_symlinks=os.stat not in os.\n supports_follow_symlinks)\n" ]
[ "def lstat(f):...\n", "return os.stat(f, follow_symlinks=os.stat not in os.supports_follow_symlinks)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6(VAR_9):...\n", "return VAR_5.search(VAR_9) is not None\n" ]
[ "def contains_wildcard(path):...\n", "return _wildcard_regex.search(path) is not None\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(self, VAR_1):...\n", "if self.is_sys_user(VAR_1):\n", "logger.error('{0} is a system user. Will not delete it.', VAR_1)\n", "shellutil.run('> /var/run/utx.active')\n", "shellutil.run('rmuser -y ' + VAR_1)\n", "self.conf_sudoer(VAR_1, remove=True)\n" ]
[ "def del_account(self, username):...\n", "if self.is_sys_user(username):\n", "logger.error('{0} is a system user. Will not delete it.', username)\n", "shellutil.run('> /var/run/utx.active')\n", "shellutil.run('rmuser -y ' + username)\n", "self.conf_sudoer(username, remove=True)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_2.route('/player')...\n", "if VAR_0 == None:\n", "FUNC_16()\n", "VAR_5 = request.args.get('tag', default='christmasmike').capitalize()\n", "VAR_8 = \"SELECT count(*) FROM matches WHERE winner='{}'\".format(VAR_5)\n", "VAR_9 = VAR_0.exec(VAR_8)[0][0]\n", "VAR_8 = (\n \"SELECT count(*) FROM matches WHERE (player1='{}' or player2='{}') AND NOT winner='{}'\"\n .format(VAR_5, VAR_5, VAR_5))\n", "VAR_10 = VAR_0.exec(VAR_8)[0][0]\n", "VAR_11 = (0.0 + int(1000 * ((0.0 + VAR_9) / (0.0 + VAR_10 + VAR_9)))) / 10\n", "VAR_8 = 'string'.format(VAR_5)\n", "VAR_12 = VAR_0.exec(VAR_8)\n", "VAR_13 = 0\n", "if len(VAR_12) > 0:\n", "VAR_13 = VAR_12[0][0]\n", "VAR_8 = \"SELECT scene FROM players WHERE tag='{}'\".format(VAR_5)\n", "VAR_14 = VAR_0.exec(VAR_8)[0][0].capitalize()\n", "VAR_15, VAR_16 = bracket_utils.get_ranking_graph_data(VAR_0, VAR_5)\n", "VAR_15 = json.dumps(VAR_15)\n", "VAR_16 = json.dumps(VAR_16)\n", "VAR_17 = bracket_utils.get_bracket_graph_data(VAR_0, VAR_5)\n", "VAR_18 = []\n", "for s in VAR_17:\n", "VAR_18.extend([bracket[0] for bracket in VAR_17[s]])\n", "VAR_18 = sorted(VAR_18)\n", "return render_template('libraries/html/player.html', VAR_5=tag, VAR_9=wins,\n VAR_10=losses, VAR_11=percentage, VAR_13=rank, VAR_14=scene, VAR_15=\n ranks_data, VAR_16=months_ranked, VAR_17=brackets_data, VAR_18=\n months_played)\n" ]
[ "@endpoints.route('/player')...\n", "if db == None:\n", "init()\n", "tag = request.args.get('tag', default='christmasmike').capitalize()\n", "sql = \"SELECT count(*) FROM matches WHERE winner='{}'\".format(tag)\n", "wins = db.exec(sql)[0][0]\n", "sql = (\n \"SELECT count(*) FROM matches WHERE (player1='{}' or player2='{}') AND NOT winner='{}'\"\n .format(tag, tag, tag))\n", "losses = db.exec(sql)[0][0]\n", "percentage = (0.0 + int(1000 * ((0.0 + wins) / (0.0 + losses + wins)))) / 10\n", "sql = (\n \"select rank from players join ranks where players.scene=ranks.scene and players.tag=ranks.player and players.tag='{}' order by date desc limit 1;\"\n .format(tag))\n", "res = db.exec(sql)\n", "rank = 0\n", "if len(res) > 0:\n", "rank = res[0][0]\n", "sql = \"SELECT scene FROM players WHERE tag='{}'\".format(tag)\n", "scene = db.exec(sql)[0][0].capitalize()\n", "ranks_data, months_ranked = bracket_utils.get_ranking_graph_data(db, tag)\n", "ranks_data = json.dumps(ranks_data)\n", "months_ranked = json.dumps(months_ranked)\n", "brackets_data = bracket_utils.get_bracket_graph_data(db, tag)\n", "months_played = []\n", "for s in brackets_data:\n", "months_played.extend([bracket[0] for bracket in brackets_data[s]])\n", "months_played = sorted(months_played)\n", "return render_template('libraries/html/player.html', tag=tag, wins=wins,\n losses=losses, percentage=percentage, rank=rank, scene=scene,\n ranks_data=ranks_data, months_ranked=months_ranked, brackets_data=\n brackets_data, months_played=months_played)\n" ]
[ 0, 0, 0, 0, 4, 4, 4, 4, 0, 4, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_4(self, VAR_8):...\n", "VAR_16 = \"SELECT Votes FROM report WHERE Report_ID = '\" + VAR_8 + \"'\"\n", "self.cursor.execute(VAR_16)\n", "VAR_15 = self.cursor.fetchone()\n", "VAR_17 = ' '.join(map(str, VAR_15))\n", "VAR_18 = int(VAR_17)\n", "VAR_18 = VAR_18 + 1\n", "VAR_19 = \"UPDATE `testdb`.`report` SET `Votes` = '\" + str(VAR_18\n ) + \"' WHERE `report`.`Report_ID` = \" + VAR_8\n", "self.cursor.execute(VAR_19)\n", "self.connection.commit()\n" ]
[ "def increment_vote(self, reportID):...\n", "query1 = \"SELECT Votes FROM report WHERE Report_ID = '\" + reportID + \"'\"\n", "self.cursor.execute(query1)\n", "fetch = self.cursor.fetchone()\n", "curVote = ' '.join(map(str, fetch))\n", "intVote = int(curVote)\n", "intVote = intVote + 1\n", "query2 = \"UPDATE `testdb`.`report` SET `Votes` = '\" + str(intVote\n ) + \"' WHERE `report`.`Report_ID` = \" + reportID\n", "self.cursor.execute(query2)\n", "self.connection.commit()\n" ]
[ 0, 4, 4, 0, 0, 0, 0, 4, 4, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2(self, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if self.mode != ray.WORKER_MODE:\n", "if VAR_2.startswith(b'FunctionsToRun'):\n", "if VAR_2.startswith(b'RemoteFunction'):\n", "self.fetch_and_execute_function_to_run(VAR_2)\n", "return\n", "self.worker.function_actor_manager.fetch_and_register_remote_function(VAR_2)\n", "if VAR_2.startswith(b'FunctionsToRun'):\n", "self.fetch_and_execute_function_to_run(VAR_2)\n", "if VAR_2.startswith(b'ActorClass'):\n", "self.worker.function_actor_manager.imported_actor_classes.add(VAR_2)\n" ]
[ "def _process_key(self, key):...\n", "\"\"\"docstring\"\"\"\n", "if self.mode != ray.WORKER_MODE:\n", "if key.startswith(b'FunctionsToRun'):\n", "if key.startswith(b'RemoteFunction'):\n", "self.fetch_and_execute_function_to_run(key)\n", "return\n", "self.worker.function_actor_manager.fetch_and_register_remote_function(key)\n", "if key.startswith(b'FunctionsToRun'):\n", "self.fetch_and_execute_function_to_run(key)\n", "if key.startswith(b'ActorClass'):\n", "self.worker.function_actor_manager.imported_actor_classes.add(key)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Condition", "Expr'", "Return'", "Expr'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_3(self):...\n", "if self.telnet:\n", "self.telnet.close()\n", "self.dut.close()\n", "db.log_event('Information', 'Debugger', 'Closed telnet')\n", "if self.db.campaign['aux']:\n", "self.aux.close()\n" ]
[ "def close(self):...\n", "if self.telnet:\n", "self.telnet.close()\n", "self.dut.close()\n", "db.log_event('Information', 'Debugger', 'Closed telnet')\n", "if self.db.campaign['aux']:\n", "self.aux.close()\n" ]
[ 0, 0, 0, 0, 2, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "from peewee import Database, SqliteDatabase\n", "def FUNC_0():...\n", "return False\n" ]
[ "from peewee import Database, SqliteDatabase\n", "def can_import_apsw():...\n", "return False\n" ]
[ 0, 0, 6 ]
[ "ImportFrom'", "FunctionDef'", "Return'" ]
[ "def FUNC_40(self, VAR_35):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_40, (i, j) in VAR_35:\n", "self.set_name(VAR_40, i, VAR_42=j)\n" ]
[ "def take_names(self, names):...\n", "\"\"\"docstring\"\"\"\n", "for name, (i, j) in names:\n", "self.set_name(name, i, end=j)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'" ]
[ "def FUNC_0(self):...\n", "VAR_6 = request.get_json(force=True)\n", "VAR_7 = Table.filter_by(email=post_data.get('email'))\n", "print(e)\n", "if len(VAR_7) >= 1 and VAR_6.get('password'):\n", "VAR_8 = {'status': 'fail', 'message': 'Try again'}\n", "if str(VAR_7[0][3]) == str(VAR_6.get('password')):\n", "VAR_8 = {'status': 'fail', 'message': 'User does not exist.'}\n", "return make_response(jsonify(VAR_8)), 500\n", "VAR_10 = encode_auth_token(VAR_7[0][0])\n", "VAR_8 = {'status': 'fail', 'message': 'Password or email do not match.'}\n", "return make_response(jsonify(VAR_8)), 404\n", "if VAR_10:\n", "print(e)\n", "return make_response(jsonify(VAR_8)), 401\n", "VAR_8 = {'status': 'success', 'id': VAR_7[0][0], 'message':\n 'Successfully logged in.', 'auth_token': VAR_10.decode()}\n", "return {'message': 'Error decoding token'}, 401\n", "return make_response(jsonify(VAR_8)), 200\n" ]
[ "def post(self):...\n", "post_data = request.get_json(force=True)\n", "user = Table.filter_by(email=post_data.get('email'))\n", "print(e)\n", "if len(user) >= 1 and post_data.get('password'):\n", "response_object = {'status': 'fail', 'message': 'Try again'}\n", "if str(user[0][3]) == str(post_data.get('password')):\n", "response_object = {'status': 'fail', 'message': 'User does not exist.'}\n", "return make_response(jsonify(response_object)), 500\n", "auth_token = encode_auth_token(user[0][0])\n", "response_object = {'status': 'fail', 'message':\n 'Password or email do not match.'}\n", "return make_response(jsonify(response_object)), 404\n", "if auth_token:\n", "print(e)\n", "return make_response(jsonify(response_object)), 401\n", "response_object = {'status': 'success', 'id': user[0][0], 'message':\n 'Successfully logged in.', 'auth_token': auth_token.decode()}\n", "return {'message': 'Error decoding token'}, 401\n", "return make_response(jsonify(response_object)), 200\n" ]
[ 0, 0, 4, 0, 4, 4, 4, 4, 0, 4, 4, 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Return'", "Condition", "Expr'", "Return'", "Assign'", "Return'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return sum(map(len, VAR_3.values()))\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "return sum(map(len, wildcards.values()))\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_16(self):...\n", "if self.doctype not in VAR_54.local.valid_columns:\n", "if self.doctype in ('DocField', 'DocPerm') and self.parent in ('DocType',\n", "return VAR_54.local.valid_columns[self.doctype]\n", "from frappe.model.meta import get_table_columns\n", "VAR_65 = self.meta.get_valid_columns()\n", "VAR_65 = get_table_columns(self.doctype)\n", "VAR_54.local.valid_columns[self.doctype] = VAR_65\n" ]
[ "def get_valid_columns(self):...\n", "if self.doctype not in frappe.local.valid_columns:\n", "if self.doctype in ('DocField', 'DocPerm') and self.parent in ('DocType',\n", "return frappe.local.valid_columns[self.doctype]\n", "from frappe.model.meta import get_table_columns\n", "valid = self.meta.get_valid_columns()\n", "valid = get_table_columns(self.doctype)\n", "frappe.local.valid_columns[self.doctype] = valid\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Return'", "ImportFrom'", "Assign'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_11, VAR_4, VAR_5=None):...\n", "\"\"\"docstring\"\"\"\n", "self.profiler = VAR_11\n", "self.event_type = VAR_4\n", "self.extra_data = VAR_5 if VAR_5 is not None else {}\n" ]
[ "def __init__(self, profiler, event_type, extra_data=None):...\n", "\"\"\"docstring\"\"\"\n", "self.profiler = profiler\n", "self.event_type = event_type\n", "self.extra_data = extra_data if extra_data is not None else {}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(VAR_9):...\n", "if VAR_0:\n", "VAR_29 = VAR_9.get_secure_cookie('user')\n", "return 'authentication_disabled'\n", "if VAR_29 in VAR_1:\n", "return VAR_29\n", "print('Bad/expired cookie received')\n", "return None\n" ]
[ "def login_get_current_user(handler):...\n", "if enable_authentication:\n", "cookie = handler.get_secure_cookie('user')\n", "return 'authentication_disabled'\n", "if cookie in authenticated_users:\n", "return cookie\n", "print('Bad/expired cookie received')\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_9(self):...\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndRaise(urllib2.HTTPError('url', 400, 'error message',\n None, None))\n", "self._mox.ReplayAll()\n", "self.assertIsNone(url_helper.UrlOpen('url', max_tries=10))\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenHTTPErrorNoRetry(self):...\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndRaise(urllib2.HTTPError('url', 400, 'error message',\n None, None))\n", "self._mox.ReplayAll()\n", "self.assertIsNone(url_helper.UrlOpen('url', max_tries=10))\n", "self._mox.VerifyAll()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_15(self, VAR_65):...\n", "if self.overwrite_workdir is None:\n", "if not os.path.exists(VAR_65):\n", "os.makedirs(VAR_65)\n", "self._workdir = VAR_65\n", "os.chdir(VAR_65)\n" ]
[ "def workdir(self, workdir):...\n", "if self.overwrite_workdir is None:\n", "if not os.path.exists(workdir):\n", "os.makedirs(workdir)\n", "self._workdir = workdir\n", "os.chdir(workdir)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_40(VAR_63=None):...\n", "VAR_81 = VAR_20.getWrittenData()\n", "if VAR_81:\n", "return FUNC_39(VAR_81)\n" ]
[ "def get_request_written_data(_=None):...\n", "written_data = request.getWrittenData()\n", "if written_data:\n", "return get_str(written_data)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_5(VAR_1, VAR_5=''):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = VAR_17(VAR_1.name)\n", "if VAR_18 not in VAR_16 and current_user.is_authenticated():\n", "VAR_26 = RemoteToken.get(current_user.get_id(), VAR_1.consumer_key, VAR_3=token\n )\n", "return VAR_16.get(VAR_18, None)\n", "if VAR_26 is None:\n", "return None\n", "VAR_16[VAR_18] = VAR_26.token()\n" ]
[ "def token_getter(remote, token=''):...\n", "\"\"\"docstring\"\"\"\n", "session_key = token_session_key(remote.name)\n", "if session_key not in session and current_user.is_authenticated():\n", "remote_token = RemoteToken.get(current_user.get_id(), remote.consumer_key,\n token_type=token)\n", "return session.get(session_key, None)\n", "if remote_token is None:\n", "return None\n", "session[session_key] = remote_token.token()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_20(self):...\n", "VAR_16 = self.mox.CreateMock(paramiko.SSHClient)\n", "VAR_12 = self.mox.CreateMock(paramiko.Channel)\n", "VAR_17 = self.mox.CreateMock(paramiko.Transport)\n", "self.mox.StubOutWithMock(self.driver, '_get_output')\n", "self.mox.StubOutWithMock(VAR_16, 'get_transport')\n", "self.mox.StubOutWithMock(VAR_12, 'invoke_shell')\n", "VAR_15 = ['Error: test run', '% Error']\n", "VAR_16.get_transport().AndReturn(VAR_17)\n", "VAR_17.open_session().AndReturn(VAR_12)\n", "VAR_12.invoke_shell()\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_18 = 'this is dummy command'\n", "VAR_12.send('stty columns 255' + '\\r')\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_12.send(VAR_18 + '\\r')\n", "self.driver._get_output(VAR_12).AndReturn(VAR_15)\n", "VAR_12.close()\n", "self.mox.ReplayAll()\n", "self.assertRaises(processutils.ProcessExecutionError, self.driver.\n _ssh_execute, VAR_16, VAR_18)\n" ]
[ "def test_ssh_execute_error(self):...\n", "ssh = self.mox.CreateMock(paramiko.SSHClient)\n", "chan = self.mox.CreateMock(paramiko.Channel)\n", "transport = self.mox.CreateMock(paramiko.Transport)\n", "self.mox.StubOutWithMock(self.driver, '_get_output')\n", "self.mox.StubOutWithMock(ssh, 'get_transport')\n", "self.mox.StubOutWithMock(chan, 'invoke_shell')\n", "expected_output = ['Error: test run', '% Error']\n", "ssh.get_transport().AndReturn(transport)\n", "transport.open_session().AndReturn(chan)\n", "chan.invoke_shell()\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "cmd = 'this is dummy command'\n", "chan.send('stty columns 255' + '\\r')\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "chan.send(cmd + '\\r')\n", "self.driver._get_output(chan).AndReturn(expected_output)\n", "chan.close()\n", "self.mox.ReplayAll()\n", "self.assertRaises(processutils.ProcessExecutionError, self.driver.\n _ssh_execute, ssh, cmd)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_32(self, **VAR_50):...\n", "VAR_69, VAR_73 = self.get('/tags', VAR_50)\n", "return VAR_69\n" ]
[ "def get_tags(self, **kwargs):...\n", "res, req = self.get('/tags', kwargs)\n", "return res\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@api.public...\n", "VAR_6.assertEqual(model.Anonymous, api.get_current_identity())\n", "self.response.write('OK')\n" ]
[ "@api.public...\n", "test.assertEqual(model.Anonymous, api.get_current_identity())\n", "self.response.write('OK')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import re\n", "import os\n", "import sys\n", "import signal\n", "import json\n", "import urllib\n", "from collections import OrderedDict\n", "from itertools import filterfalse, chain\n", "from functools import partial\n", "from operator import attrgetter\n", "from snakemake.logging import logger, format_resources, format_resource_names\n", "from snakemake.rules import Rule, Ruleorder\n", "from snakemake.exceptions import RuleException, CreateRuleException, UnknownRuleException, NoRulesException, print_exception, WorkflowError\n", "from snakemake.shell import shell\n", "from snakemake.dag import DAG\n", "from snakemake.scheduler import JobScheduler\n", "from snakemake.parser import parse\n", "import snakemake.io\n", "from snakemake.io import protected, temp, temporary, expand, dynamic, glob_wildcards, flag, not_iterable, touch\n", "from snakemake.persistence import Persistence\n", "from snakemake.utils import update_config\n", "def __init__(self, VAR_1=None, VAR_2=None, VAR_3=None, VAR_4=None, VAR_5=...\n", "\"\"\"docstring\"\"\"\n", "self._rules = OrderedDict()\n", "self.first_rule = None\n", "self._workdir = None\n", "self.overwrite_workdir = VAR_6\n", "self.workdir_init = os.path.abspath(os.curdir)\n", "self._ruleorder = Ruleorder()\n", "self._localrules = set()\n", "self.linemaps = dict()\n", "self.rule_count = 0\n", "self.basedir = os.path.dirname(VAR_1)\n", "self.snakefile = os.path.abspath(VAR_1)\n", "self.snakemakepath = VAR_2\n", "self.included = []\n", "self.included_stack = []\n", "self.jobscript = VAR_3\n", "self.persistence = None\n", "self.global_resources = None\n", "self.globals = globals()\n", "self._subworkflows = dict()\n", "self.overwrite_shellcmd = VAR_4\n", "self.overwrite_config = VAR_5\n", "self.overwrite_configfile = VAR_7\n", "self.config_args = VAR_8\n", "self._onsuccess = lambda log: None\n", "self._onerror = lambda log: None\n", "self.debug = VAR_9\n", "VAR_85 = dict()\n", "VAR_85.update(self.overwrite_config)\n", "VAR_86 = CLASS_3()\n", "@property...\n", "return self._subworkflows.values()\n" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import re\n", "import os\n", "import sys\n", "import signal\n", "import json\n", "import urllib\n", "from collections import OrderedDict\n", "from itertools import filterfalse, chain\n", "from functools import partial\n", "from operator import attrgetter\n", "from snakemake.logging import logger, format_resources, format_resource_names\n", "from snakemake.rules import Rule, Ruleorder\n", "from snakemake.exceptions import RuleException, CreateRuleException, UnknownRuleException, NoRulesException, print_exception, WorkflowError\n", "from snakemake.shell import shell\n", "from snakemake.dag import DAG\n", "from snakemake.scheduler import JobScheduler\n", "from snakemake.parser import parse\n", "import snakemake.io\n", "from snakemake.io import protected, temp, temporary, expand, dynamic, glob_wildcards, flag, not_iterable, touch\n", "from snakemake.persistence import Persistence\n", "from snakemake.utils import update_config\n", "def __init__(self, snakefile=None, snakemakepath=None, jobscript=None,...\n", "\"\"\"docstring\"\"\"\n", "self._rules = OrderedDict()\n", "self.first_rule = None\n", "self._workdir = None\n", "self.overwrite_workdir = overwrite_workdir\n", "self.workdir_init = os.path.abspath(os.curdir)\n", "self._ruleorder = Ruleorder()\n", "self._localrules = set()\n", "self.linemaps = dict()\n", "self.rule_count = 0\n", "self.basedir = os.path.dirname(snakefile)\n", "self.snakefile = os.path.abspath(snakefile)\n", "self.snakemakepath = snakemakepath\n", "self.included = []\n", "self.included_stack = []\n", "self.jobscript = jobscript\n", "self.persistence = None\n", "self.global_resources = None\n", "self.globals = globals()\n", "self._subworkflows = dict()\n", "self.overwrite_shellcmd = overwrite_shellcmd\n", "self.overwrite_config = overwrite_config\n", "self.overwrite_configfile = overwrite_configfile\n", "self.config_args = config_args\n", "self._onsuccess = lambda log: None\n", "self._onerror = lambda log: None\n", "self.debug = debug\n", "config = dict()\n", "config.update(self.overwrite_config)\n", "rules = Rules()\n", "@property...\n", "return self._subworkflows.values()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Assign'", "Assign'", "Assign'", "Assign'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "@property...\n", "return dict(self)\n" ]
[ "@property...\n", "return dict(self)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n", "self.state = ray.experimental.state.GlobalState()\n", "self.state._initialize_global_state(VAR_1, VAR_2, VAR_4=redis_password)\n", "self.redis = VAR_42.StrictRedis(host=redis_address, port=redis_port, db=0,\n password=redis_password)\n", "self.primary_subscribe_client = self.redis.pubsub(ignore_subscribe_messages\n =True)\n", "self.local_scheduler_id_to_ip_map = {}\n", "self.load_metrics = LoadMetrics()\n", "if VAR_3:\n", "self.autoscaler = StandardAutoscaler(VAR_3, self.load_metrics)\n", "self.autoscaler = None\n", "self.issue_gcs_flushes = 'RAY_USE_NEW_GCS' in os.environ\n", "self.gcs_flush_policy = None\n", "if self.issue_gcs_flushes:\n", "VAR_31 = self.redis.lrange('RedisShards', 0, -1)\n", "if len(VAR_31) > 1:\n", "VAR_0.warning(\n 'Monitor: TODO: if launching > 1 redis shard, flushing needs to touch shards in parallel.'\n )\n", "VAR_31 = VAR_31[0].split(b':')\n", "self.issue_gcs_flushes = False\n", "self.redis_shard = VAR_42.StrictRedis(host=addr_port[0], port=addr_port[1],\n password=redis_password)\n", "self.redis_shard.execute_command('HEAD.FLUSH 0')\n", "VAR_0.info('Monitor: Turning off flushing due to exception: {}'.format(str(e)))\n", "self.issue_gcs_flushes = False\n" ]
[ "def __init__(self, redis_address, redis_port, autoscaling_config,...\n", "self.state = ray.experimental.state.GlobalState()\n", "self.state._initialize_global_state(redis_address, redis_port,\n redis_password=redis_password)\n", "self.redis = redis.StrictRedis(host=redis_address, port=redis_port, db=0,\n password=redis_password)\n", "self.primary_subscribe_client = self.redis.pubsub(ignore_subscribe_messages\n =True)\n", "self.local_scheduler_id_to_ip_map = {}\n", "self.load_metrics = LoadMetrics()\n", "if autoscaling_config:\n", "self.autoscaler = StandardAutoscaler(autoscaling_config, self.load_metrics)\n", "self.autoscaler = None\n", "self.issue_gcs_flushes = 'RAY_USE_NEW_GCS' in os.environ\n", "self.gcs_flush_policy = None\n", "if self.issue_gcs_flushes:\n", "addr_port = self.redis.lrange('RedisShards', 0, -1)\n", "if len(addr_port) > 1:\n", "logger.warning(\n 'Monitor: TODO: if launching > 1 redis shard, flushing needs to touch shards in parallel.'\n )\n", "addr_port = addr_port[0].split(b':')\n", "self.issue_gcs_flushes = False\n", "self.redis_shard = redis.StrictRedis(host=addr_port[0], port=addr_port[1],\n password=redis_password)\n", "self.redis_shard.execute_command('HEAD.FLUSH 0')\n", "logger.info('Monitor: Turning off flushing due to exception: {}'.format(str(e))\n )\n", "self.issue_gcs_flushes = False\n" ]
[ 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_6(self, VAR_23):...\n", "if VAR_23:\n", "VAR_94 = _force_ascii(VAR_23)\n", "if VAR_94 == VAR_23:\n", "abort(404, 'page not found')\n", "return Tag._by_name(VAR_94)\n" ]
[ "def run(self, name):...\n", "if name:\n", "cleaned = _force_ascii(name)\n", "if cleaned == name:\n", "abort(404, 'page not found')\n", "return Tag._by_name(cleaned)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_2(self):...\n", "VAR_0.info('Closing the MySQL connection pool (id {})'.format(id(self)))\n", "while not self._pool.empty():\n", "VAR_11 = self._pool.get()\n", "VAR_0.info('Closed all connections in the MySQL connection pool (id {})'.\n format(id(self)))\n", "if not isinstance(VAR_11, MySQLdb.connections.Connection):\n", "return 0\n", "VAR_11.close()\n", "self._pool.task_done()\n" ]
[ "def clear_pool(self):...\n", "logger.info('Closing the MySQL connection pool (id {})'.format(id(self)))\n", "while not self._pool.empty():\n", "db = self._pool.get()\n", "logger.info('Closed all connections in the MySQL connection pool (id {})'.\n format(id(self)))\n", "if not isinstance(db, MySQLdb.connections.Connection):\n", "return 0\n", "db.close()\n", "self._pool.task_done()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Return'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = self.bindings['TEST_APP_COMPONENT_NAME']\n", "if not VAR_5:\n", "VAR_7 += '-pub'\n", "VAR_12 = self.agent.make_json_payload_from_kwargs(job=[{'type':\n 'deleteLoadBalancer', 'cloudProvider': 'aws', 'credentials': self.\n bindings['AWS_CREDENTIALS'], 'regions': [self.bindings[\n 'TEST_AWS_REGION']], 'loadBalancerName': load_balancer_name}],\n description='Delete Load Balancer: {0} in {1}:{2}'.format(\n load_balancer_name, self.bindings['AWS_CREDENTIALS'], self.bindings[\n 'TEST_AWS_REGION']), application=self.TEST_APP)\n", "VAR_13 = aws.AwsContractBuilder(self.aws_observer)\n", "VAR_13.new_clause_builder('Load Balancer Removed').collect_resources(aws_module\n ='elb', command='describe-load-balancers', args=[\n '--load-balancer-names', load_balancer_name], no_resources_ok=True\n ).excludes_path_value('LoadBalancerName', VAR_7)\n", "VAR_14 = '_with_vpc' if VAR_5 else '_without_vpc'\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer' + title_decorator, data=payload, path='tasks'),\n VAR_6=builder.build())\n" ]
[ "def delete_load_balancer(self, use_vpc):...\n", "\"\"\"docstring\"\"\"\n", "load_balancer_name = self.bindings['TEST_APP_COMPONENT_NAME']\n", "if not use_vpc:\n", "load_balancer_name += '-pub'\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'type':\n 'deleteLoadBalancer', 'cloudProvider': 'aws', 'credentials': self.\n bindings['AWS_CREDENTIALS'], 'regions': [self.bindings[\n 'TEST_AWS_REGION']], 'loadBalancerName': load_balancer_name}],\n description='Delete Load Balancer: {0} in {1}:{2}'.format(\n load_balancer_name, self.bindings['AWS_CREDENTIALS'], self.bindings[\n 'TEST_AWS_REGION']), application=self.TEST_APP)\n", "builder = aws.AwsContractBuilder(self.aws_observer)\n", "builder.new_clause_builder('Load Balancer Removed').collect_resources(\n aws_module='elb', command='describe-load-balancers', args=[\n '--load-balancer-names', load_balancer_name], no_resources_ok=True\n ).excludes_path_value('LoadBalancerName', load_balancer_name)\n", "title_decorator = '_with_vpc' if use_vpc else '_without_vpc'\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer' + title_decorator, data=payload, path='tasks'),\n contract=builder.build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "AugAssign'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "@VAR_0.route('/logout', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = VAR_3.get('user_eppn')\n", "if VAR_13 is None:\n", "current_app.logger.info('Session cookie has expired, no logout action needed')\n", "VAR_12 = current_app.central_userdb.get_user_by_eppn(VAR_13)\n", "VAR_27 = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "current_app.logger.debug('Logout process started for user {!r}'.format(VAR_12))\n", "return LogoutPayload().dump({'location': VAR_27}).data\n", "VAR_14 = StateCache(VAR_3)\n", "VAR_15 = IdentityCache(VAR_3)\n", "VAR_16 = Saml2Client(current_app.saml2_config, state_cache=state,\n identity_cache=identity)\n", "VAR_17 = FUNC_5(VAR_3)\n", "if VAR_17 is None:\n", "current_app.logger.warning(\n 'The session does not contain the subject id for user {!r}'.format(VAR_12))\n", "VAR_28 = VAR_16.global_logout(VAR_17)\n", "VAR_27 = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "VAR_29 = VAR_28.values()[0]\n", "VAR_14.sync()\n", "if isinstance(VAR_29, LogoutResponse):\n", "return LogoutPayload().dump({'location': VAR_27}).data\n", "if VAR_29.status_ok():\n", "VAR_30 = VAR_29[1]['headers']\n", "current_app.logger.debug('Performing local logout for {!r}'.format(VAR_12))\n", "abort(500)\n", "VAR_27 = VAR_30[0][1]\n", "VAR_3.clear()\n", "current_app.logger.info(\n 'Redirecting to {!r} to continue the logout process for user {!r}'.\n format(VAR_27, VAR_12))\n", "VAR_27 = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "VAR_27 = request.form.get('RelayState', VAR_27)\n", "return LogoutPayload().dump({'location': VAR_27}).data\n" ]
[ "@authn_views.route('/logout', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "eppn = session.get('user_eppn')\n", "if eppn is None:\n", "current_app.logger.info('Session cookie has expired, no logout action needed')\n", "user = current_app.central_userdb.get_user_by_eppn(eppn)\n", "location = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "current_app.logger.debug('Logout process started for user {!r}'.format(user))\n", "return LogoutPayload().dump({'location': location}).data\n", "state = StateCache(session)\n", "identity = IdentityCache(session)\n", "client = Saml2Client(current_app.saml2_config, state_cache=state,\n identity_cache=identity)\n", "subject_id = _get_name_id(session)\n", "if subject_id is None:\n", "current_app.logger.warning(\n 'The session does not contain the subject id for user {!r}'.format(user))\n", "logouts = client.global_logout(subject_id)\n", "location = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "loresponse = logouts.values()[0]\n", "state.sync()\n", "if isinstance(loresponse, LogoutResponse):\n", "return LogoutPayload().dump({'location': location}).data\n", "if loresponse.status_ok():\n", "headers_tuple = loresponse[1]['headers']\n", "current_app.logger.debug('Performing local logout for {!r}'.format(user))\n", "abort(500)\n", "location = headers_tuple[0][1]\n", "session.clear()\n", "current_app.logger.info(\n 'Redirecting to {!r} to continue the logout process for user {!r}'.\n format(location, user))\n", "location = current_app.config.get('SAML2_LOGOUT_REDIRECT_URL')\n", "location = request.form.get('RelayState', location)\n", "return LogoutPayload().dump({'location': location}).data\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, 6, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Condition", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(VAR_8, VAR_4, VAR_2):...\n", "VAR_10 = sqlite3.connect(VAR_1)\n", "VAR_11 = VAR_10.cursor()\n", "VAR_11.execute('string', [VAR_8])\n", "VAR_17 = VAR_11.fetchone()\n", "VAR_10.close()\n", "return VAR_17[0] == VAR_4 and VAR_17[1] == VAR_2\n" ]
[ "def confirm_owner_of_file(file_id, session_id, username):...\n", "connection = sqlite3.connect(DATABASE_PATH)\n", "cursor = connection.cursor()\n", "cursor.execute(\n \"\"\"SELECT session_id, username FROM UserData WHERE user_id = \n (SELECT user_id FROM Notes WHERE uuid_filename = ?)\"\"\"\n , [file_id])\n", "row = cursor.fetchone()\n", "connection.close()\n", "return row[0] == session_id and row[1] == username\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_5(self):...\n", "VAR_23 = shellutil.run('pw usermod root -h -')\n", "if VAR_23:\n" ]
[ "def del_root_password(self):...\n", "err = shellutil.run('pw usermod root -h -')\n", "if err:\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition" ]
[ "def FUNC_20(self, VAR_17, VAR_16):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_export(self, context, volume):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_24(self):...\n", "self.log.info('Initializing interprocess backward socket %s', self.pr_ba)\n", "self.pr_back_sock = self.p.ctx.socket(zmq.ROUTER)\n", "self.pr_back_sock.bind(self.pr_ba)\n" ]
[ "def init_pr_back_sock(self):...\n", "self.log.info('Initializing interprocess backward socket %s', self.pr_ba)\n", "self.pr_back_sock = self.p.ctx.socket(zmq.ROUTER)\n", "self.pr_back_sock.bind(self.pr_ba)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "from django.conf.urls import url, include\n", "from .projects import ProjectViewSet\n", "from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n", "from .processingnodes import ProcessingNodeViewSet\n", "from rest_framework_nested import routers\n", "VAR_0 = routers.DefaultRouter()\n", "VAR_0.register('projects', ProjectViewSet)\n", "VAR_0.register('processingnodes', ProcessingNodeViewSet)\n", "VAR_1 = routers.NestedSimpleRouter(VAR_0, 'projects', lookup='project')\n", "VAR_1.register('tasks', TaskViewSet, base_name='projects-tasks')\n", "VAR_2 = [url('^', include(VAR_0.urls)), url('^', include(VAR_1.urls)), url(\n 'string', TaskTiles.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles\\\\.json$',\n TaskTilesJson.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/download/(?P<asset>[^/.]+)/$'\n , TaskAssets.as_view()), url('^auth/', include('rest_framework.urls'))]\n" ]
[ "from django.conf.urls import url, include\n", "from .projects import ProjectViewSet\n", "from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n", "from .processingnodes import ProcessingNodeViewSet\n", "from rest_framework_nested import routers\n", "router = routers.DefaultRouter()\n", "router.register('projects', ProjectViewSet)\n", "router.register('processingnodes', ProcessingNodeViewSet)\n", "tasks_router = routers.NestedSimpleRouter(router, 'projects', lookup='project')\n", "tasks_router.register('tasks', TaskViewSet, base_name='projects-tasks')\n", "urlpatterns = [url('^', include(router.urls)), url('^', include(\n tasks_router.urls)), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles/(?P<z>[\\\\d]+)/(?P<x>[\\\\d]+)/(?P<y>[\\\\d]+)\\\\.png$'\n , TaskTiles.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles\\\\.json$',\n TaskTilesJson.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/download/(?P<asset>[^/.]+)/$'\n , TaskAssets.as_view()), url('^auth/', include('rest_framework.urls'))]\n" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_10(VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_26 = VAR_10.unrestrictedTraverse\n", "VAR_27 = '/'.join(VAR_10.getPhysicalPath())\n", "if isinstance(VAR_27, six.text_type):\n", "VAR_27 = VAR_27.encode('utf-8')\n", "VAR_28 = len(VAR_27) + 1\n", "VAR_29 = [VAR_27]\n", "for idx, VAR_21 in enumerate(VAR_29):\n", "VAR_34 = VAR_26(VAR_21)\n", "yield VAR_21[VAR_28:], VAR_34\n", "if hasattr(aq_base(VAR_34), 'objectIds'):\n", "for VAR_36 in VAR_34.objectIds():\n", "if isinstance(VAR_36, six.text_type):\n", "VAR_36 = VAR_36.encode('utf-8')\n", "VAR_29.insert(idx + 1, VAR_21 + b'/' + VAR_36)\n" ]
[ "def findObjects(origin):...\n", "\"\"\"docstring\"\"\"\n", "traverse = origin.unrestrictedTraverse\n", "base = '/'.join(origin.getPhysicalPath())\n", "if isinstance(base, six.text_type):\n", "base = base.encode('utf-8')\n", "cut = len(base) + 1\n", "paths = [base]\n", "for idx, path in enumerate(paths):\n", "obj = traverse(path)\n", "yield path[cut:], obj\n", "if hasattr(aq_base(obj), 'objectIds'):\n", "for id in obj.objectIds():\n", "if isinstance(id, six.text_type):\n", "id = id.encode('utf-8')\n", "paths.insert(idx + 1, path + b'/' + id)\n" ]
[ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Condition", "For", "Condition", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_10, VAR_11=None, VAR_12=None):...\n", "BaseResource.__init__(self, VAR_10)\n", "self._static_folder = FUNC_1()\n", "self._startup_folder = FUNC_0()\n", "self._portal = VAR_11\n", "self._disclaimer_banner = VAR_12\n", "self.putChild('startup-assets', File(self._startup_folder))\n" ]
[ "def __init__(self, services_factory, portal=None, disclaimer_banner=None):...\n", "BaseResource.__init__(self, services_factory)\n", "self._static_folder = _get_static_folder()\n", "self._startup_folder = _get_startup_folder()\n", "self._portal = portal\n", "self._disclaimer_banner = disclaimer_banner\n", "self.putChild('startup-assets', File(self._startup_folder))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_14 = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "VAR_21 = [utils.PathToPythonInterpreter(), FUNC_0(), '--port={0}'.format(\n VAR_14), '--options_file={0}'.format(options_file.name), '--log={0}'.\n format(self._user_options['server_log_level']),\n '--idle_suicide_seconds={0}'.format(VAR_4)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "VAR_26 = VAR_0.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log')\n", "self._server_popen = utils.SafePopen(VAR_21, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = VAR_26.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(VAR_14)\n", "self._server_stderr = VAR_26.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "VAR_21.append('--stdout={0}'.format(self._server_stdout))\n", "VAR_21.append('--stderr={0}'.format(self._server_stderr))\n", "if self._user_options['server_keep_logfiles']:\n", "VAR_21.append('--keep_logfiles')\n" ]
[ "def _SetupServer(self):...\n", "server_port = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "args = [utils.PathToPythonInterpreter(), _PathToServerScript(),\n '--port={0}'.format(server_port), '--options_file={0}'.format(\n options_file.name), '--log={0}'.format(self._user_options[\n 'server_log_level']), '--idle_suicide_seconds={0}'.format(\n SERVER_IDLE_SUICIDE_SECONDS)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "filename_format = os.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log'\n )\n", "self._server_popen = utils.SafePopen(args, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = filename_format.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(server_port)\n", "self._server_stderr = filename_format.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "args.append('--stdout={0}'.format(self._server_stdout))\n", "args.append('--stderr={0}'.format(self._server_stderr))\n", "if self._user_options['server_keep_logfiles']:\n", "args.append('--keep_logfiles')\n" ]
[ 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_2(VAR_3):...\n", "print(CLASS_0.OKGREEN + '✔', VAR_3, CLASS_0.END)\n" ]
[ "def print_right(str):...\n", "print(c.OKGREEN + '✔', str, c.END)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "from cmd import Cmd\n", "import wrapper\n", "from objects import Project\n", "from color import prnt, prnt_str, VIOLET, PURPLE, ORANGE, TURQ, BLUE\n", "from cli_helpers import arglen, inject, state, emptystate, restrict, command\n", "from cli_helpers import CmdError\n", "import cli_helpers as cli\n", "from state import CLIState\n", "def __init__(self, VAR_0):...\n", "super().__init__()\n", "self.state = CLIState()\n", "self.conf = VAR_0\n", "@command...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = wrapper.todoist.get_projects()\n", "cli.print_listing(VAR_3, 0)\n", "return VAR_3\n" ]
[ "from cmd import Cmd\n", "import wrapper\n", "from objects import Project\n", "from color import prnt, prnt_str, VIOLET, PURPLE, ORANGE, TURQ, BLUE\n", "from cli_helpers import arglen, inject, state, emptystate, restrict, command\n", "from cli_helpers import CmdError\n", "import cli_helpers as cli\n", "from state import CLIState\n", "def __init__(self, conf):...\n", "super().__init__()\n", "self.state = CLIState()\n", "self.conf = conf\n", "@command...\n", "\"\"\"docstring\"\"\"\n", "projects = wrapper.todoist.get_projects()\n", "cli.print_listing(projects, 0)\n", "return projects\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Condition", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = CLASS_1.query.filter(CLASS_1.to_user_id == VAR_21).all()\n", "if len(VAR_25) == 0:\n", "VAR_26 = MessagesDTO()\n", "for VAR_6 in VAR_25:\n", "VAR_26.user_messages.append(VAR_6.as_dto())\n", "return VAR_26\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "user_messages = Message.query.filter(Message.to_user_id == user_id).all()\n", "if len(user_messages) == 0:\n", "messages_dto = MessagesDTO()\n", "for message in user_messages:\n", "messages_dto.user_messages.append(message.as_dto())\n", "return messages_dto\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_9(self, VAR_5, VAR_7):...\n", "VAR_14 = 'delete from friends where userid=%d and friendid=%d;' % (VAR_5, VAR_7\n )\n", "VAR_11 = sql.deleteDB(self.conn, VAR_14)\n", "return VAR_11\n" ]
[ "def cancelFollow(self, userid, friendid):...\n", "sqlText = 'delete from friends where userid=%d and friendid=%d;' % (userid,\n friendid)\n", "result = sql.deleteDB(self.conn, sqlText)\n", "return result\n" ]
[ 0, 4, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_29(self):...\n", "return self.spawn_nworkers(0, WipeThread, self.c.tcount, (self.pc, self.\n spawnqueue))\n" ]
[ "def spawn_wipethreads(self):...\n", "return self.spawn_nworkers(0, WipeThread, self.c.tcount, (self.pc, self.\n spawnqueue))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self, VAR_4, VAR_5, VAR_6=True):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = []\n", "for VAR_43, v in VAR_5.items():\n", "VAR_14.append(' %s=%s' % (VAR_43, v))\n", "VAR_15 = VAR_4 + ''.join(VAR_14)\n", "return self._run_ssh(VAR_15, VAR_6)\n" ]
[ "def _cliq_run(self, verb, cliq_args, check_exit_code=True):...\n", "\"\"\"docstring\"\"\"\n", "cliq_arg_strings = []\n", "for k, v in cliq_args.items():\n", "cliq_arg_strings.append(' %s=%s' % (k, v))\n", "cmd = verb + ''.join(cliq_arg_strings)\n", "return self._run_ssh(cmd, check_exit_code)\n" ]
[ 0, 0, 2, 0, 2, 2, 2 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_3(self, VAR_3, VAR_5=None):...\n", "VAR_17 = quotas.tenant_quota_usages(VAR_3)\n", "VAR_2 = len(self.table.data)\n", "if VAR_17.get('key_pairs') and VAR_17['key_pairs']['quota'] <= VAR_2:\n", "if 'disabled' not in self.classes:\n", "VAR_9 = [c for c in self.classes if c != 'disabled']\n", "self.classes = [c for c in self.classes] + ['disabled']\n", "return False\n", "self.classes = VAR_9\n", "self.verbose_name = string_concat(self.verbose_name, ' ', _('(Quota exceeded)')\n )\n", "return True\n" ]
[ "def allowed(self, request, datum=None):...\n", "usages = quotas.tenant_quota_usages(request)\n", "count = len(self.table.data)\n", "if usages.get('key_pairs') and usages['key_pairs']['quota'] <= count:\n", "if 'disabled' not in self.classes:\n", "classes = [c for c in self.classes if c != 'disabled']\n", "self.classes = [c for c in self.classes] + ['disabled']\n", "return False\n", "self.classes = classes\n", "self.verbose_name = string_concat(self.verbose_name, ' ', _('(Quota exceeded)')\n )\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_26(VAR_22, **VAR_20):...\n", "" ]
[ "def tpl2(template, **ka):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = self.events\n", "self.events = []\n", "if self.worker.mode == ray.WORKER_MODE:\n", "VAR_15 = 'worker'\n", "VAR_15 = 'driver'\n", "self.worker.raylet_client.push_profile_events(VAR_15, ray.UniqueID(self.\n worker.worker_id), self.worker.node_ip_address, VAR_14)\n" ]
[ "def flush_profile_data(self):...\n", "\"\"\"docstring\"\"\"\n", "events = self.events\n", "self.events = []\n", "if self.worker.mode == ray.WORKER_MODE:\n", "component_type = 'worker'\n", "component_type = 'driver'\n", "self.worker.raylet_client.push_profile_events(component_type, ray.UniqueID(\n self.worker.worker_id), self.worker.node_ip_address, events)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_0):...\n", "self.shape = VAR_0\n" ]
[ "def __init__(self, shape):...\n", "self.shape = shape\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_11(VAR_3=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = FUNC_12(VAR_3).message\n", "for file in os.listdir(VAR_2):\n", "if file.endswith('.txt'):\n", "return\n", "if FUNC_3(file)['id'] > 0:\n", "if FUNC_3(file)['verified'] == 0:\n", "FUNC_6(file)\n", "if FUNC_0(file) > FUNC_3(file)['size']:\n", "FUNC_7(file)\n", "FUNC_4(file)\n", "if FUNC_2() - FUNC_3(file)['age'] > 60:\n", "FUNC_7(file)\n", "if FUNC_3(file)['passes'] >= 3:\n", "if FUNC_8(file) == FUNC_9(file):\n", "FUNC_5(file)\n", "FUNC_10(file)\n" ]
[ "def main(arguments=None):...\n", "\"\"\"docstring\"\"\"\n", "path = parse_arguments(arguments).message\n", "for file in os.listdir(path):\n", "if file.endswith('.txt'):\n", "return\n", "if db_get_file_details(file)['id'] > 0:\n", "if db_get_file_details(file)['verified'] == 0:\n", "db_insert_new_file(file)\n", "if get_file_size(file) > db_get_file_details(file)['size']:\n", "log_event(file)\n", "db_update_file_details(file)\n", "if get_time_now() - db_get_file_details(file)['age'] > 60:\n", "log_event(file)\n", "if db_get_file_details(file)['passes'] >= 3:\n", "if hash_md5_for_file(file) == get_md5_from_file(file):\n", "db_increment_passes(file)\n", "db_verify_file_integrity(file)\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_3(VAR_1, VAR_2, VAR_4=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_16 = f'SELECT COUNT(*) as count FROM {VAR_2};'\n", "if VAR_4:\n", "print(VAR_16)\n", "VAR_17 = VAR_1.cursor()\n", "VAR_19 = VAR_17.execute(VAR_16).fetchone()[0]\n", "VAR_17.close()\n", "return VAR_19\n" ]
[ "def db_count(conn, table, debug=False):...\n", "\"\"\"docstring\"\"\"\n", "sql = f'SELECT COUNT(*) as count FROM {table};'\n", "if debug:\n", "print(sql)\n", "cursor = conn.cursor()\n", "num_rows = cursor.execute(sql).fetchone()[0]\n", "cursor.close()\n", "return num_rows\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@defer.inlineCallbacks...\n", "if self._mode.is_single_user:\n", "VAR_61 = CLASS_0(VAR_19, self._tmp_dir.name)\n", "yield VAR_61.start()\n", "self.accounts[VAR_19] = VAR_61\n" ]
[ "@defer.inlineCallbacks...\n", "if self._mode.is_single_user:\n", "account = AppTestAccount(account_name, self._tmp_dir.name)\n", "yield account.start()\n", "self.accounts[account_name] = account\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Expr'", "Assign'" ]
[ "async def FUNC_1(self, VAR_1: int, VAR_2: str, VAR_3):...\n", "VAR_5 = f\"\"\"INSERT INTO user_info (member_id, {VAR_2}) \n VALUES ({VAR_1}, {VAR_3})\n ON CONFLICT (member_id)\n DO UPDATE SET {VAR_2} = {VAR_3};\"\"\"\n", "await self.db_conn.execute(VAR_5)\n" ]
[ "async def insert_user_info(self, member_id: int, column: str, col_value):...\n", "execute = f\"\"\"INSERT INTO user_info (member_id, {column}) \n VALUES ({member_id}, {col_value})\n ON CONFLICT (member_id)\n DO UPDATE SET {column} = {col_value};\"\"\"\n", "await self.db_conn.execute(execute)\n" ]
[ 0, 4, 4 ]
[ "AsyncFunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_60(self):...\n", "VAR_2 = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('input.py', VAR_2)\n" ]
[ "def test_blacklist_input(self):...\n", "expect = {'SEVERITY': {'HIGH': 1}, 'CONFIDENCE': {'HIGH': 1}}\n", "self.check_example('input.py', expect)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_11(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = {'CO': ExtractedChemical, 'FU': ExtractedFunctionalUse, 'HP':\n ExtractedHabitsAndPractices, 'CP': ExtractedListPresence, 'HH':\n ExtractedHHRec}\n", "for code, model in VAR_10.items():\n", "if DataDocument.objects.filter(document_type__group_type__code=code,\n", "VAR_1 = DataDocument.objects.filter(document_type__group_type__code=code,\n extractedtext__isnull=False).first()\n", "VAR_2 = self.client.get(reverse('data_document', kwargs={'pk': doc.pk}))\n", "VAR_23 = VAR_2.context['detail_formset'].total_form_count()\n", "VAR_24 = model.objects.filter(VAR_20=doc.extractedtext).count()\n", "if VAR_1.detail_page_editable:\n", "VAR_26 = f'{model.__module__} should have one more forms than instances'\n", "VAR_26 = (\n f'{model.__module__} should have the same number of forms as instances')\n", "self.assertEqual(VAR_23, VAR_24 + 1, VAR_26)\n", "self.assertEqual(VAR_23, VAR_24, VAR_26)\n" ]
[ "def test_num_forms(self):...\n", "\"\"\"docstring\"\"\"\n", "group_models = {'CO': ExtractedChemical, 'FU': ExtractedFunctionalUse, 'HP':\n ExtractedHabitsAndPractices, 'CP': ExtractedListPresence, 'HH':\n ExtractedHHRec}\n", "for code, model in group_models.items():\n", "if DataDocument.objects.filter(document_type__group_type__code=code,\n", "doc = DataDocument.objects.filter(document_type__group_type__code=code,\n extractedtext__isnull=False).first()\n", "response = self.client.get(reverse('data_document', kwargs={'pk': doc.pk}))\n", "num_forms = response.context['detail_formset'].total_form_count()\n", "children = model.objects.filter(extracted_text=doc.extractedtext).count()\n", "if doc.detail_page_editable:\n", "error = f'{model.__module__} should have one more forms than instances'\n", "error = f'{model.__module__} should have the same number of forms as instances'\n", "self.assertEqual(num_forms, children + 1, error)\n", "self.assertEqual(num_forms, children, error)\n" ]
[ 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "VAR_0 = 'pos.open.statement'\n", "VAR_1 = 'Open Statements'\n", "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = []\n", "VAR_7 = self.pool.get('ir.model.data')\n", "VAR_8 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('ir.sequence')\n", "VAR_11 = 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_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_12)))\n", "VAR_13 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_11.browse(VAR_2, VAR_3, VAR_13):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_14 = self.pool.get('ir.model.data')\n", "if len(VAR_4):\n", "VAR_15 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_17 = ''\n", "VAR_16 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if VAR_15:\n", "VAR_17 = VAR_10.get_id(VAR_2, VAR_3, journal.sequence_id.id)\n", "VAR_17 = VAR_10.get(VAR_2, VAR_3, 'account.bank.statement')\n", "VAR_15 = VAR_14.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "if VAR_16:\n", "VAR_18 = VAR_9.create(VAR_2, VAR_3, {'journal_id': journal.id, 'company_id':\n VAR_8, 'user_id': VAR_3, 'state': 'open', 'name': VAR_17,\n 'starting_details_ids': VAR_9._get_cash_close_box_lines(VAR_2, VAR_3, [])})\n", "VAR_16 = VAR_14.browse(VAR_2, VAR_3, VAR_16, VAR_5=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(VAR_15, 'tree'), (VAR_16, 'form')],\n 'type': 'ir.actions.act_window'}\n", "VAR_9.button_open(VAR_2, VAR_3, [VAR_18], VAR_5)\n" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "_name = 'pos.open.statement'\n", "_description = 'Open Statements'\n", "def open_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "statement_obj = self.pool.get('account.bank.statement')\n", "sequence_obj = self.pool.get('ir.sequence')\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 len(ids):\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "number = ''\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if id2:\n", "number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)\n", "number = sequence_obj.get(cr, uid, 'account.bank.statement')\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id,\n 'company_id': company_id, 'user_id': uid, 'state': 'open', 'name':\n number, 'starting_details_ids': statement_obj._get_cash_close_box_lines\n (cr, uid, [])})\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(id2, 'tree'), (id3, 'form')],\n 'type': 'ir.actions.act_window'}\n", "statement_obj.button_open(cr, uid, [statement_id], context)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "import pymysql\n", "import dbconfig\n", "def FUNC_0(self, VAR_0='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ "import pymysql\n", "import dbconfig\n", "def connect(self, database='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ 0, 0, 0, 0 ]
[ "Import'", "Import'", "FunctionDef'", "Return'" ]
[ "@staticmethod...\n", "for VAR_16 in VAR_13:\n", "if VAR_16 in VAR_12 and isinstance(VAR_13[VAR_16], dict) and isinstance(VAR_12\n", "CLASS_0.recursiveUpdate(VAR_12[VAR_16], VAR_13[VAR_16])\n", "if VAR_16 in VAR_12 and isinstance(VAR_13[VAR_16], list) and isinstance(VAR_12\n", "VAR_12[VAR_16] += VAR_13[VAR_16]\n", "VAR_12[VAR_16] = VAR_13[VAR_16]\n" ]
[ "@staticmethod...\n", "for k in content:\n", "if k in target and isinstance(content[k], dict) and isinstance(target[k], dict\n", "Config.recursiveUpdate(target[k], content[k])\n", "if k in target and isinstance(content[k], list) and isinstance(target[k], list\n", "target[k] += content[k]\n", "target[k] = content[k]\n" ]
[ 2, 2, 2, 2, 2, 2, 2 ]
[ "Condition", "For", "Condition", "Expr'", "Condition", "AugAssign'", "Assign'" ]
[ "def FUNC_30():...\n", "if VAR_3 == 'text':\n", "print('Input file: %s' % VAR_75)\n", "VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronyms)\n", "if VAR_12:\n", "return VAR_52\n", "if isinstance(VAR_52, dict):\n", "for VAR_84 in VAR_52:\n", "print(VAR_52[VAR_84])\n" ]
[ "def process_lines():...\n", "if output_mode == 'text':\n", "print('Input file: %s' % source)\n", "output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with_author_keywords, rebuild_cache=rebuild_cache, only_core_tags=\n only_core_tags, extract_acronyms=extract_acronyms)\n", "if api:\n", "return output\n", "if isinstance(output, dict):\n", "for i in output:\n", "print(output[i])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Condition", "For", "Expr'" ]
[ "def FUNC_4(self, VAR_8):...\n", "return json.dumps(self.value_from_object(VAR_8))\n" ]
[ "def value_to_string(self, obj):...\n", "return json.dumps(self.value_from_object(obj))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_5(VAR_8):...\n", "return set(VAR_29.group('name') for VAR_29 in VAR_5.finditer(VAR_8))\n" ]
[ "def get_wildcard_names(pattern):...\n", "return set(match.group('name') for match in _wildcard_regex.finditer(pattern))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0():...\n", "if VAR_8 is None:\n", "VAR_8 = Browser()\n", "return VAR_8\n", "VAR_53 = AWSLoginRequest(VAR_8, VAR_5['username'], VAR_5['password'],\n base_url=AWS_BASE_URL)\n", "VAR_8.login(VAR_53)\n" ]
[ "def get_aws_browser():...\n", "if aws_browser is None:\n", "aws_browser = Browser()\n", "return aws_browser\n", "lr = AWSLoginRequest(aws_browser, admin_info['username'], admin_info[\n 'password'], base_url=AWS_BASE_URL)\n", "aws_browser.login(lr)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_8(VAR_2, *VAR_3, **VAR_4):...\n", "self = VAR_11(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'head'):\n", "self.head = self.get\n", "self.request = VAR_2\n", "self.args = VAR_3\n", "self.kwargs = VAR_4\n", "self.setup(VAR_2, *VAR_3, **kwargs)\n", "return self.dispatch(VAR_2, *VAR_3, **kwargs)\n" ]
[ "def view(request, *args, **kwargs):...\n", "self = cls(**initkwargs)\n", "if hasattr(self, 'get') and not hasattr(self, 'head'):\n", "self.head = self.get\n", "self.request = request\n", "self.args = args\n", "self.kwargs = kwargs\n", "self.setup(request, *args, **kwargs)\n", "return self.dispatch(request, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = {}\n", "VAR_8 = []\n", "VAR_26 = Contest.get_from_id(VAR_0, session)\n", "for participation in VAR_26.participations:\n", "VAR_31 = participation.user\n", "for VAR_30 in VAR_26.tasks:\n", "VAR_12[VAR_31.username] = {'password': VAR_31.password}\n", "VAR_8.append((VAR_30.id, VAR_30.name, VAR_30.statements.keys()))\n", "return VAR_12, VAR_8\n" ]
[ "def harvest_contest_data(contest_id):...\n", "\"\"\"docstring\"\"\"\n", "users = {}\n", "tasks = []\n", "contest = Contest.get_from_id(contest_id, session)\n", "for participation in contest.participations:\n", "user = participation.user\n", "for task in contest.tasks:\n", "users[user.username] = {'password': user.password}\n", "tasks.append((task.id, task.name, task.statements.keys()))\n", "return users, tasks\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "For", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_7(self, *VAR_16, **VAR_17):...\n", "" ]
[ "def recv(self, *args, **kwargs):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_14(VAR_10, VAR_8):...\n", "if not VAR_8 in VAR_10 or VAR_10[VAR_8] is None:\n", "return '-'\n", "return VAR_10[VAR_8]\n" ]
[ "def get_html_val(src, name):...\n", "if not name in src or src[name] is None:\n", "return '-'\n", "return src[name]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(self):...\n", "self.builder = Gtk.Builder()\n", "self.builder.add_from_resource('/run/terminal/KeepassGtk/unlock_database.ui')\n", "self.set_headerbar()\n", "self.assemble_stack()\n", "self.connect_events()\n" ]
[ "def unlock_database(self):...\n", "self.builder = Gtk.Builder()\n", "self.builder.add_from_resource('/run/terminal/KeepassGtk/unlock_database.ui')\n", "self.set_headerbar()\n", "self.assemble_stack()\n", "self.connect_events()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "from pyramid.httpexceptions import HTTPFound, HTTPNoContent\n", "from pyramid.request import Request\n", "from pyramid.security import Allow\n", "from pyramid.view import view_config\n", "from . import db\n", "from .app import RootContextFactory\n", "from .embed import embeddable\n", "def __getitem__(self, VAR_4):...\n", "VAR_2 = db.note.find_note(self.request.db, VAR_4)\n", "if VAR_2:\n", "return CLASS_1(VAR_2)\n", "def __init__(self, VAR_2: db.note.Note):...\n", "self.note = VAR_2\n", "@property...\n", "return [(Allow, self.note.user_id, ('view', 'edit'))]\n" ]
[ "from pyramid.httpexceptions import HTTPFound, HTTPNoContent\n", "from pyramid.request import Request\n", "from pyramid.security import Allow\n", "from pyramid.view import view_config\n", "from . import db\n", "from .app import RootContextFactory\n", "from .embed import embeddable\n", "def __getitem__(self, note_id):...\n", "note = db.note.find_note(self.request.db, note_id)\n", "if note:\n", "return NoteResource(note)\n", "def __init__(self, note: db.note.Note):...\n", "self.note = note\n", "@property...\n", "return [(Allow, self.note.user_id, ('view', 'edit'))]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Condition", "Return'", "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_3(VAR_4, VAR_5, VAR_6):...\n", "VAR_14 = ''\n", "VAR_15 = ()\n", "if VAR_4:\n", "VAR_14 = 'where c.author_id=' + str(int(VAR_4))\n", "if VAR_5:\n", "if VAR_6:\n", "VAR_14 = 'where b.series_id=' + str(int(VAR_5))\n", "VAR_20 = '%' + VAR_6 + '%'\n", "VAR_9 = 'string'.format(VAR_14)\n", "VAR_15 += VAR_20.encode('utf-8'),\n", "VAR_11 = get_cursor()\n", "VAR_14 = 'where b.Title like ?'\n", "if len(VAR_15) > 0:\n", "VAR_13 = VAR_11.execute(VAR_9, VAR_15).fetchone()[0]\n", "VAR_13 = VAR_11.execute(VAR_9).fetchone()[0]\n", "return VAR_13\n" ]
[ "def get_filtered_books_count(author_id, series_id, search_arg):...\n", "wh = ''\n", "parameters = ()\n", "if author_id:\n", "wh = 'where c.author_id=' + str(int(author_id))\n", "if series_id:\n", "if search_arg:\n", "wh = 'where b.series_id=' + str(int(series_id))\n", "s = '%' + search_arg + '%'\n", "stmt = (\n \"\"\"\n select count(*) from books as b\n left outer join collaborations as c on c.book_id=b.id\n left outer join authors as a on a.id=c.author_id\n left join series as s on s.id=b.series_id\n {0}\n \"\"\"\n .format(wh))\n", "parameters += s.encode('utf-8'),\n", "csr = get_cursor()\n", "wh = 'where b.Title like ?'\n", "if len(parameters) > 0:\n", "count = csr.execute(stmt, parameters).fetchone()[0]\n", "count = csr.execute(stmt).fetchone()[0]\n", "return count\n" ]
[ 0, 0, 4, 0, 4, 0, 0, 4, 0, 0, 4, 0, 4, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "AugAssign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(self, *VAR_4, **VAR_5):...\n", "return self._run_ssh(VAR_4, VAR_14=self.configuration.eqlx_cli_max_retries)\n" ]
[ "def _eql_execute(self, *args, **kwargs):...\n", "return self._run_ssh(args, attempts=self.configuration.eqlx_cli_max_retries)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import pymysql\n", "import dbconfig\n", "def FUNC_0(self, VAR_0='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ "import pymysql\n", "import dbconfig\n", "def connect(self, database='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ 0, 0, 0, 0 ]
[ "Import'", "Import'", "FunctionDef'", "Return'" ]
[ "def FUNC_6(VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16):...\n", "VAR_17 = generate_matched_table_name(VAR_11, 'hmis_service_stays')\n", "VAR_18 = generate_matched_table_name(VAR_11, 'jail_bookings')\n", "VAR_33 = table_exists(VAR_17, db.engine)\n", "VAR_34 = table_exists(VAR_18, db.engine)\n", "if not VAR_33:\n", "if not VAR_34:\n", "VAR_35 = [('matched_id', 'matched_id'), (\n 'coalesce(hmis_summary.first_name, jail_summary.first_name)',\n 'first_name'), (\n 'coalesce(hmis_summary.last_name, jail_summary.last_name)', 'last_name'\n ), ('hmis_summary.hmis_id', 'hmis_id'), ('hmis_summary.hmis_contact',\n 'hmis_contact'), ('hmis_summary.last_hmis_contact', 'last_hmis_contact'\n ), ('hmis_summary.cumu_hmis_days', 'cumu_hmis_days'), (\n 'jail_summary.jail_id', 'jail_id'), ('jail_summary.jail_contact',\n 'jail_contact'), ('jail_summary.last_jail_contact', 'last_jail_contact'\n ), ('jail_summary.cumu_jail_days', 'cumu_jail_days'), (\n 'coalesce(hmis_summary.hmis_contact, 0) + coalesce(jail_summary.jail_contact, 0)'\n , 'total_contact')]\n", "if not any(VAR_14 for expression, alias in VAR_35):\n", "VAR_36 = 'string'.format(hmis_table=matched_hmis_table, booking_table=\n matched_bookings_table, VAR_35=',\\n'.join('{} as {}'.format(expression,\n alias) for expression, alias in columns))\n", "logging.info('Querying table records')\n", "if VAR_15 not in {'asc', 'desc'}:\n", "if not isinstance(VAR_12, int) and not VAR_12.isdigit() and VAR_12 != 'ALL':\n", "VAR_37 = {'Jail': 'jail_summary.matched_id is not null', 'HMIS':\n 'hmis_summary.matched_id is not null', 'Intersection':\n 'hmis_summary.matched_id = jail_summary.matched_id'}\n", "VAR_38 = VAR_37.get(VAR_16, 'true')\n", "VAR_39 = [dict(row) for row in db.engine.execute(\n \"\"\"\n {}\n where {}\n order by {} {}\n limit {} offset %(offset)s\"\"\"\n .format(VAR_36, VAR_38, VAR_14, VAR_15, VAR_12), start_date=start_time,\n end_date=end_time, VAR_13=offset)]\n", "VAR_40 = 'string'\n", "VAR_41 = VAR_40.format(table_name=matched_hmis_table, start=\n 'client_location_start_date', exit='client_location_end_date')\n", "VAR_42 = VAR_40.format(table_name=matched_bookings_table, start=\n 'jail_entry_date', exit='jail_exit_date')\n", "logging.info('Done querying table records')\n", "logging.info('Querying venn diagram stats')\n", "VAR_43 = next(db.engine.execute('string'.format(VAR_41, VAR_42), VAR_9=\n start_time, VAR_10=end_time))\n", "VAR_44 = {'HMIS': VAR_43[0], 'Jail': VAR_43[1], 'Intersection': VAR_43[2]}\n", "logging.info('Done querying venn diagram stats')\n", "VAR_45 = [{'sets': ['Jail'], 'size': VAR_43[1]}, {'sets': ['Homeless'],\n 'size': VAR_43[0]}, {'sets': ['Jail', 'Homeless'], 'size': VAR_43[2]}]\n", "logging.info('Retrieving bar data from database')\n", "VAR_46 = FUNC_7(VAR_17, VAR_18, VAR_9, VAR_10)\n", "logging.info('Done retrieving bar data from database')\n", "VAR_46['tableData'] = VAR_39\n", "return {'vennDiagramData': VAR_45, 'totalTableRows': VAR_44.get(VAR_16,\n VAR_43[3]), 'filteredData': VAR_46}\n" ]
[ "def get_records_by_time(start_time, end_time, jurisdiction, limit, offset,...\n", "matched_hmis_table = generate_matched_table_name(jurisdiction,\n 'hmis_service_stays')\n", "matched_bookings_table = generate_matched_table_name(jurisdiction,\n 'jail_bookings')\n", "hmis_exists = table_exists(matched_hmis_table, db.engine)\n", "bookings_exists = table_exists(matched_bookings_table, db.engine)\n", "if not hmis_exists:\n", "if not bookings_exists:\n", "columns = [('matched_id', 'matched_id'), (\n 'coalesce(hmis_summary.first_name, jail_summary.first_name)',\n 'first_name'), (\n 'coalesce(hmis_summary.last_name, jail_summary.last_name)', 'last_name'\n ), ('hmis_summary.hmis_id', 'hmis_id'), ('hmis_summary.hmis_contact',\n 'hmis_contact'), ('hmis_summary.last_hmis_contact', 'last_hmis_contact'\n ), ('hmis_summary.cumu_hmis_days', 'cumu_hmis_days'), (\n 'jail_summary.jail_id', 'jail_id'), ('jail_summary.jail_contact',\n 'jail_contact'), ('jail_summary.last_jail_contact', 'last_jail_contact'\n ), ('jail_summary.cumu_jail_days', 'cumu_jail_days'), (\n 'coalesce(hmis_summary.hmis_contact, 0) + coalesce(jail_summary.jail_contact, 0)'\n , 'total_contact')]\n", "if not any(order_column for expression, alias in columns):\n", "base_query = (\n \"\"\"WITH hmis_summary AS (\n SELECT\n matched_id,\n string_agg(distinct internal_person_id::text, ',') as hmis_id,\n sum(\n case when client_location_end_date is not null \n then date_part('day', client_location_end_date::timestamp - client_location_start_date::timestamp) else date_part('day', updated_ts::timestamp - client_location_start_date::timestamp) \n end\n )::int as cumu_hmis_days,\n count(*) AS hmis_contact,\n to_char(max(client_location_start_date::timestamp), 'YYYY-MM-DD') as last_hmis_contact,\n max(first_name) as first_name,\n max(last_name) as last_name\n FROM (\n SELECT\n *\n FROM {hmis_table}\n WHERE\n not (client_location_start_date < %(start_date)s AND client_location_end_date < %(start_date)s) and\n not (client_location_start_date > %(end_date)s AND client_location_end_date > %(end_date)s)\n ) AS hmis\n GROUP BY matched_id\n ), jail_summary AS (\n SELECT\n matched_id,\n string_agg(distinct coalesce(internal_person_id, inmate_number)::text, ',') as jail_id,\n sum(\n case when jail_exit_date is not null \n then date_part('day', jail_exit_date::timestamp - jail_entry_date::timestamp) else date_part('day', updated_ts::timestamp - jail_entry_date::timestamp) \n end\n )::int as cumu_jail_days,\n count(*) AS jail_contact,\n to_char(max(jail_entry_date::timestamp), 'YYYY-MM-DD') as last_jail_contact,\n max(first_name) as first_name,\n max(last_name) as last_name\n FROM (\n SELECT\n *\n FROM {booking_table}\n WHERE\n not (jail_entry_date < %(start_date)s AND jail_exit_date < %(start_date)s) and\n not (jail_entry_date > %(end_date)s AND jail_exit_date > %(end_date)s)\n ) AS jail\n GROUP BY matched_id\n )\n SELECT\n {columns}\n FROM hmis_summary\n FULL OUTER JOIN jail_summary USING(matched_id)\n \"\"\"\n .format(hmis_table=matched_hmis_table, booking_table=\n matched_bookings_table, columns=',\\n'.join('{} as {}'.format(expression,\n alias) for expression, alias in columns)))\n", "logging.info('Querying table records')\n", "if order not in {'asc', 'desc'}:\n", "if not isinstance(limit, int) and not limit.isdigit() and limit != 'ALL':\n", "filter_by_status = {'Jail': 'jail_summary.matched_id is not null', 'HMIS':\n 'hmis_summary.matched_id is not null', 'Intersection':\n 'hmis_summary.matched_id = jail_summary.matched_id'}\n", "status_filter = filter_by_status.get(set_status, 'true')\n", "rows_to_show = [dict(row) for row in db.engine.execute(\n \"\"\"\n {}\n where {}\n order by {} {}\n limit {} offset %(offset)s\"\"\"\n .format(base_query, status_filter, order_column, order, limit),\n start_date=start_time, end_date=end_time, offset=offset)]\n", "query = \"\"\"\n SELECT\n *,\n DATE_PART('day', {exit}::timestamp - {start}::timestamp) as days\n FROM {table_name}\n WHERE\n not ({start} < %(start_time)s AND {exit} < %(start_time)s) and\n not ({start} > %(end_time)s AND {exit} > %(end_time)s)\n \"\"\"\n", "hmis_query = query.format(table_name=matched_hmis_table, start=\n 'client_location_start_date', exit='client_location_end_date')\n", "bookings_query = query.format(table_name=matched_bookings_table, start=\n 'jail_entry_date', exit='jail_exit_date')\n", "logging.info('Done querying table records')\n", "logging.info('Querying venn diagram stats')\n", "venn_diagram_stats = next(db.engine.execute(\n \"\"\"select\n count(distinct(hmis.matched_id)) as hmis_size,\n count(distinct(bookings.matched_id)) as bookings_size,\n count(distinct(case when hmis.matched_id = bookings.matched_id then hmis.matched_id else null end)) as shared_size,\n count(distinct(matched_id))\n from ({}) hmis\n full outer join ({}) bookings using (matched_id)\n \"\"\"\n .format(hmis_query, bookings_query), start_time=start_time, end_time=\n end_time))\n", "counts_by_status = {'HMIS': venn_diagram_stats[0], 'Jail':\n venn_diagram_stats[1], 'Intersection': venn_diagram_stats[2]}\n", "logging.info('Done querying venn diagram stats')\n", "venn_diagram_data = [{'sets': ['Jail'], 'size': venn_diagram_stats[1]}, {\n 'sets': ['Homeless'], 'size': venn_diagram_stats[0]}, {'sets': ['Jail',\n 'Homeless'], 'size': venn_diagram_stats[2]}]\n", "logging.info('Retrieving bar data from database')\n", "filtered_data = retrieve_bar_data(matched_hmis_table,\n matched_bookings_table, start_time, end_time)\n", "logging.info('Done retrieving bar data from database')\n", "filtered_data['tableData'] = rows_to_show\n", "return {'vennDiagramData': venn_diagram_data, 'totalTableRows':\n counts_by_status.get(set_status, venn_diagram_stats[3]), 'filteredData':\n filtered_data}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "For", "Assign'", "Expr'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "from flask import Flask, render_template, url_for, flash, redirect, request\n", "from flask_sqlalchemy import SQLAlchemy\n", "VAR_0 = Flask(__name__, static_folder='static', static_url_path='')\n", "VAR_0.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.sqlite3'\n", "VAR_0.config['SECRET_KEY'] = 'random string'\n", "VAR_1 = SQLAlchemy(VAR_0)\n", "VAR_2 = VAR_1.Column(VAR_1.Integer, primary_key=True)\n", "VAR_3 = VAR_1.Column(VAR_1.String(50))\n", "VAR_4 = VAR_1.Column(VAR_1.String(20))\n", "def __init__(self, VAR_3, VAR_4):...\n", "self.email = VAR_3\n", "self.password = VAR_4\n", "@VAR_0.route('/')...\n", "return render_template('home.html')\n" ]
[ "from flask import Flask, render_template, url_for, flash, redirect, request\n", "from flask_sqlalchemy import SQLAlchemy\n", "app = Flask(__name__, static_folder='static', static_url_path='')\n", "app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.sqlite3'\n", "app.config['SECRET_KEY'] = 'random string'\n", "db = SQLAlchemy(app)\n", "id = db.Column(db.Integer, primary_key=True)\n", "email = db.Column(db.String(50))\n", "password = db.Column(db.String(20))\n", "def __init__(self, email, password):...\n", "self.email = email\n", "self.password = password\n", "@app.route('/')...\n", "return render_template('home.html')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_1(self):...\n", "return 'check the main page'\n" ]
[ "def describe(self):...\n", "return 'check the main page'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_15(self, VAR_14):...\n", "" ]
[ "def is_date(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_3(VAR_1):...\n", "return frappe.db.get_value('Blog Category', {'name': VAR_1}, 'title') or VAR_1\n" ]
[ "def get_blog_category(route):...\n", "return frappe.db.get_value('Blog Category', {'name': route}, 'title') or route\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_30(self):...\n", "VAR_25 = -430000000\n", "self.cursor.execute('create table t1(d bigint)')\n", "self.cursor.execute('insert into t1 values (?)', VAR_25)\n", "VAR_20 = self.cursor.execute('select d from t1').fetchone()[0]\n", "self.assertEqual(VAR_20, VAR_25)\n" ]
[ "def test_negative_bigint(self):...\n", "input = -430000000\n", "self.cursor.execute('create table t1(d bigint)')\n", "self.cursor.execute('insert into t1 values (?)', input)\n", "result = self.cursor.execute('select d from t1').fetchone()[0]\n", "self.assertEqual(result, input)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "return os.stat(VAR_0, follow_symlinks=os.stat not in os.\n supports_follow_symlinks)\n" ]
[ "def lstat(f):...\n", "return os.stat(f, follow_symlinks=os.stat not in os.supports_follow_symlinks)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@property...\n", "return super(CLASS_0, self).content_security_policy + '; sandbox allow-scripts'\n" ]
[ "@property...\n", "return super(FilesHandler, self\n ).content_security_policy + '; sandbox allow-scripts'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "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'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "return chain(*map(attrgetter(VAR_1), VAR_0))\n" ]
[ "def jobfiles(jobs, type):...\n", "return chain(*map(attrgetter(type), jobs))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_54=None, VAR_55=None, VAR_14=errors....\n", "self.min = VAR_54\n", "self.max = VAR_55\n", "self.error = VAR_14\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, min=None, max=None, error=errors.BAD_NUMBER, *a, **kw...\n", "self.min = min\n", "self.max = max\n", "self.error = error\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n" ]
[ "def test_filters_2(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_5(self):...\n", "self._check_duplicate_key(VAR_0)\n" ]
[ "def test_rsa_duplicate_key(self):...\n", "self._check_duplicate_key(RSA_PUBKEY)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n", "def FUNC_0(VAR_0=None):...\n", "VAR_1 = frappe.db.sql_list('select name from `tabLeave Type` order by name asc'\n )\n", "VAR_3 = FUNC_1(VAR_1)\n", "VAR_4 = FUNC_2(VAR_0, VAR_1)\n", "return VAR_3, VAR_4\n" ]
[ "from __future__ import unicode_literals\n", "import frappe\n", "from frappe import _\n", "from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n", "def execute(filters=None):...\n", "leave_types = frappe.db.sql_list(\n 'select name from `tabLeave Type` order by name asc')\n", "columns = get_columns(leave_types)\n", "data = get_data(filters, leave_types)\n", "return columns, data\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "import sqlalchemy\n", "VAR_0 = \"SELECT * FROM foo WHERE id = '%s'\" % identifier\n", "VAR_0 = \"INSERT INTO foo VALUES ('a', 'b', '%s')\" % value\n", "VAR_0 = \"DELETE FROM foo WHERE id = '%s'\" % identifier\n", "VAR_0 = \"UPDATE foo SET value = 'b' WHERE id = '%s'\" % identifier\n", "VAR_0 = (\n \"\"\"WITH cte AS (SELECT x FROM foo)\nSELECT x FROM cte WHERE x = '%s'\"\"\" %\n identifier)\n", "cur.execute(\"SELECT * FROM foo WHERE id = '%s'\" % identifier)\n", "cur.execute(\"INSERT INTO foo VALUES ('a', 'b', '%s')\" % value)\n", "cur.execute(\"DELETE FROM foo WHERE id = '%s'\" % identifier)\n", "cur.execute(\"UPDATE foo SET value = 'b' WHERE id = '%s'\" % identifier)\n", "cur.execute(\"SELECT * FROM foo WHERE id = '%s'\", identifier)\n", "cur.execute(\"INSERT INTO foo VALUES ('a', 'b', '%s')\", value)\n", "cur.execute(\"DELETE FROM foo WHERE id = '%s'\", identifier)\n", "cur.execute(\"UPDATE foo SET value = 'b' WHERE id = '%s'\", identifier)\n", "VAR_0 = 'SELECT ' + val + ' FROM ' + val + ' WHERE id = ' + val\n", "cur.execute('SELECT ' + val + ' FROM ' + val + ' WHERE id = ' + val)\n", "def FUNC_0():...\n", "def FUNC_1():...\n", "return FUNC_1\n" ]
[ "import sqlalchemy\n", "query = \"SELECT * FROM foo WHERE id = '%s'\" % identifier\n", "query = \"INSERT INTO foo VALUES ('a', 'b', '%s')\" % value\n", "query = \"DELETE FROM foo WHERE id = '%s'\" % identifier\n", "query = \"UPDATE foo SET value = 'b' WHERE id = '%s'\" % identifier\n", "query = (\n \"\"\"WITH cte AS (SELECT x FROM foo)\nSELECT x FROM cte WHERE x = '%s'\"\"\" %\n identifier)\n", "cur.execute(\"SELECT * FROM foo WHERE id = '%s'\" % identifier)\n", "cur.execute(\"INSERT INTO foo VALUES ('a', 'b', '%s')\" % value)\n", "cur.execute(\"DELETE FROM foo WHERE id = '%s'\" % identifier)\n", "cur.execute(\"UPDATE foo SET value = 'b' WHERE id = '%s'\" % identifier)\n", "cur.execute(\"SELECT * FROM foo WHERE id = '%s'\", identifier)\n", "cur.execute(\"INSERT INTO foo VALUES ('a', 'b', '%s')\", value)\n", "cur.execute(\"DELETE FROM foo WHERE id = '%s'\", identifier)\n", "cur.execute(\"UPDATE foo SET value = 'b' WHERE id = '%s'\", identifier)\n", "query = 'SELECT ' + val + ' FROM ' + val + ' WHERE id = ' + val\n", "cur.execute('SELECT ' + val + ' FROM ' + val + ' WHERE id = ' + val)\n", "def a():...\n", "def b():...\n", "return b\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0 ]
[ "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "FunctionDef'", "Return'" ]
[ "def FUNC_14(self):...\n", "self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n" ]
[ "def test_z_delete_app(self):...\n", "self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_28(self, VAR_5):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "VAR_18 = vimsupport.CurrentFiletypes()[0]\n", "if VAR_18 in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(VAR_18)\n", "VAR_5['syntax_keywords'] = list(syntax_parse.SyntaxKeywordsForCurrentBuffer())\n" ]
[ "def _AddSyntaxDataIfNeeded(self, extra_data):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "filetype = vimsupport.CurrentFiletypes()[0]\n", "if filetype in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(filetype)\n", "extra_data['syntax_keywords'] = list(syntax_parse.\n SyntaxKeywordsForCurrentBuffer())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_4(VAR_5, VAR_6, VAR_7='stable'):...\n", "VAR_0 = 'https://static.rust-lang.org/dist/channel-rust-' + VAR_7 + '.toml'\n", "VAR_21 = requests.get(VAR_0)\n", "VAR_21.raise_for_status()\n", "VAR_3 = toml.loads(VAR_21.content)\n", "if VAR_3['manifest-version'] != '2':\n", "print('ERROR: unrecognized manifest version %s.' % VAR_3['manifest-version'])\n", "print('Using manifest for rust %s as of %s.' % (VAR_7, VAR_3['date']))\n", "return\n", "VAR_22, VAR_23 = FUNC_3(VAR_3, 'rustc', VAR_5)\n", "if VAR_23['available']:\n", "print(\"\"\"rustc %s\n %s\n %s\"\"\" % (VAR_22, VAR_23['url'], VAR_23['hash']))\n", "VAR_24, VAR_25 = FUNC_3(VAR_3, 'cargo', VAR_5)\n", "FUNC_1(VAR_23['url'])\n", "if VAR_25['available']:\n", "print(\"\"\"cargo %s\n %s\n %s\"\"\" % (VAR_24, VAR_25['url'], VAR_25['hash']))\n", "VAR_26 = []\n", "FUNC_1(VAR_25['url'])\n", "for VAR_2 in VAR_6:\n", "VAR_19, VAR_20 = FUNC_3(VAR_3, 'rust-std', VAR_2)\n", "print('Installing packages...')\n", "if VAR_20['available']:\n", "VAR_27 = 'rustc-%s-repack' % VAR_5\n", "print(\"\"\"rust-std %s\n %s\n %s\"\"\" % (VAR_19, VAR_20['url'], VAR_20['hash']))\n", "VAR_28 = 'rustc'\n", "FUNC_1(VAR_20['url'])\n", "os.system('rm -rf %s' % VAR_28)\n", "VAR_26.append(VAR_20)\n", "FUNC_2(os.path.basename(VAR_23['url']), VAR_28)\n", "FUNC_2(os.path.basename(VAR_25['url']), VAR_28)\n", "for std in VAR_26:\n", "FUNC_2(os.path.basename(std['url']), VAR_28)\n", "print('Tarring %s...' % VAR_27)\n", "os.system('tar cjf %s.tar.bz2 %s/*' % (VAR_27, VAR_28))\n", "os.system('rm -rf %s' % VAR_28)\n" ]
[ "def repack(host, targets, channel='stable'):...\n", "url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n", "req = requests.get(url)\n", "req.raise_for_status()\n", "manifest = toml.loads(req.content)\n", "if manifest['manifest-version'] != '2':\n", "print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version']\n )\n", "print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n", "return\n", "rustc_version, rustc = package(manifest, 'rustc', host)\n", "if rustc['available']:\n", "print(\"\"\"rustc %s\n %s\n %s\"\"\" % (rustc_version, rustc['url'], rustc['hash']))\n", "cargo_version, cargo = package(manifest, 'cargo', host)\n", "fetch(rustc['url'])\n", "if cargo['available']:\n", "print(\"\"\"cargo %s\n %s\n %s\"\"\" % (cargo_version, cargo['url'], cargo['hash']))\n", "stds = []\n", "fetch(cargo['url'])\n", "for target in targets:\n", "version, info = package(manifest, 'rust-std', target)\n", "print('Installing packages...')\n", "if info['available']:\n", "tar_basename = 'rustc-%s-repack' % host\n", "print(\"\"\"rust-std %s\n %s\n %s\"\"\" % (version, info['url'], info['hash']))\n", "install_dir = 'rustc'\n", "fetch(info['url'])\n", "os.system('rm -rf %s' % install_dir)\n", "stds.append(info)\n", "install(os.path.basename(rustc['url']), install_dir)\n", "install(os.path.basename(cargo['url']), install_dir)\n", "for std in stds:\n", "install(os.path.basename(std['url']), install_dir)\n", "print('Tarring %s...' % tar_basename)\n", "os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n", "os.system('rm -rf %s' % install_dir)\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, 2, 0, 0, 0, 0, 0, 0, 2, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Return'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_12):...\n", "VAR_14 = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(VAR_12))\n", "VAR_15 = self.cur.execute(VAR_14)\n", "self.conn.commit()\n", "return VAR_15\n" ]
[ "def delete_event(self, event_id):...\n", "sql = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(event_id))\n", "affected_count = self.cur.execute(sql)\n", "self.conn.commit()\n", "return affected_count\n" ]
[ 0, 4, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_0(self):...\n", "self.client.login(username='Karyn', password='specialP@55word')\n" ]
[ "def setUp(self):...\n", "self.client.login(username='Karyn', password='specialP@55word')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_7(VAR_2, VAR_16):...\n", "return FUNC_9(VAR_2, 'submission.id = %s' % VAR_16)[0]\n" ]
[ "def get_full_by_id(db, id):...\n", "return get_full_sql(db, 'submission.id = %s' % id)[0]\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_19(self, VAR_9=True):...\n", "\"\"\"docstring\"\"\"\n", "self._kill_process_type(VAR_13.PROCESS_TYPE_LOG_MONITOR, VAR_9=check_alive)\n" ]
[ "def kill_log_monitor(self, check_alive=True):...\n", "\"\"\"docstring\"\"\"\n", "self._kill_process_type(ray_constants.PROCESS_TYPE_LOG_MONITOR, check_alive\n =check_alive)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_6(self, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_9 = \"SELECT rowid FROM tags WHERE tag = '\" + VAR_6 + \"'\"\n", "self.query(VAR_9)\n", "return self.c.fetchone()[0]\n" ]
[ "def tag_to_tag_num(self, tag):...\n", "\"\"\"docstring\"\"\"\n", "q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n", "self.query(q)\n", "return self.c.fetchone()[0]\n" ]
[ 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_2(VAR_0, VAR_1, VAR_2, VAR_4, VAR_5, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3)\n", "if VAR_8:\n", "ereporter2.log_request(VAR_4, VAR_5=source, VAR_8=message)\n", "return VAR_8\n" ]
[ "def log_unexpected_subset_keys(expected_keys, minimum_keys, actual_keys,...\n", "\"\"\"docstring\"\"\"\n", "message = has_unexpected_subset_keys(expected_keys, minimum_keys,\n actual_keys, name)\n", "if message:\n", "ereporter2.log_request(request, source=source, message=message)\n", "return message\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_10(self, VAR_9, VAR_10=None, VAR_11=None, VAR_15=False):...\n", "get_and_check_project(VAR_9, VAR_11, ('change_project',))\n", "VAR_28 = self.queryset.get(VAR_10=pk, VAR_1=project_pk)\n", "VAR_26 = CLASS_1(VAR_28, data=request.data, VAR_15=partial)\n", "VAR_26.is_valid(raise_exception=True)\n", "VAR_26.save()\n", "scheduler.process_pending_tasks(background=True)\n", "return Response(VAR_26.data)\n" ]
[ "def update(self, request, pk=None, project_pk=None, partial=False):...\n", "get_and_check_project(request, project_pk, ('change_project',))\n", "task = self.queryset.get(pk=pk, project=project_pk)\n", "serializer = TaskSerializer(task, data=request.data, partial=partial)\n", "serializer.is_valid(raise_exception=True)\n", "serializer.save()\n", "scheduler.process_pending_tasks(background=True)\n", "return Response(serializer.data)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def __getstate__(self):...\n", "return self.serialize()\n" ]
[ "def __getstate__(self):...\n", "return self.serialize()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self, VAR_2):...\n", "return self.c.execute(VAR_2)\n" ]
[ "def query(self, query):...\n", "return self.c.execute(query)\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Return'" ]
[ "@functools.wraps(VAR_3)...\n", "VAR_23 = VAR_5.pop('timeout', None)\n", "VAR_24 = eventlet.spawn(VAR_3, self, *VAR_4, **kwargs)\n", "if VAR_23 is None:\n", "return VAR_24.wait()\n", "VAR_36 = eventlet.spawn_after(VAR_23, VAR_24.kill)\n", "VAR_48 = VAR_24.wait()\n", "VAR_36.cancel()\n", "return VAR_48\n" ]
[ "@functools.wraps(f)...\n", "timeout = kwargs.pop('timeout', None)\n", "gt = eventlet.spawn(f, self, *args, **kwargs)\n", "if timeout is None:\n", "return gt.wait()\n", "kill_thread = eventlet.spawn_after(timeout, gt.kill)\n", "res = gt.wait()\n", "kill_thread.cancel()\n", "return res\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_2(self, VAR_4, VAR_5):...\n", "VAR_8 = (\n \"\"\"\n INSERT INTO Clients (username, password)\n VALUES ('{}', '{}')\n \"\"\"\n .format(VAR_4, VAR_5))\n", "VAR_7 = self.__conn.cursor()\n", "VAR_7.execute(VAR_8)\n", "self.__conn.commit()\n" ]
[ "def register(self, username, password):...\n", "insert_sql = (\n \"\"\"\n INSERT INTO Clients (username, password)\n VALUES ('{}', '{}')\n \"\"\"\n .format(username, password))\n", "cursor = self.__conn.cursor()\n", "cursor.execute(insert_sql)\n", "self.__conn.commit()\n" ]
[ 0, 4, 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_7 = engine.connect()\n", "VAR_8 = VAR_7.begin()\n", "VAR_9 = text(\n 'INSERT INTO users(username, hashed_password, roll_id) VALUES(:username, :hashed_password, :roll_id)'\n )\n", "VAR_8.rollback()\n", "VAR_7.close()\n", "VAR_7.execute(VAR_9, VAR_1=self.username, VAR_2=self.hashed_password, VAR_3\n =self.roll_id)\n", "VAR_8.commit()\n" ]
[ "def save(self):...\n", "connection = engine.connect()\n", "trans = connection.begin()\n", "s = text(\n 'INSERT INTO users(username, hashed_password, roll_id) VALUES(:username, :hashed_password, :roll_id)'\n )\n", "trans.rollback()\n", "connection.close()\n", "connection.execute(s, username=self.username, hashed_password=self.\n hashed_password, roll_id=self.roll_id)\n", "trans.commit()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]