lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_0(VAR_0, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = OUTPUT_DIR + VAR_0 + '.log'\n", "if type(VAR_1) is tuple or type(VAR_1) is list:\n", "for m in VAR_1:\n", "f.write(VAR_1)\n", "f.write(m + '\\n')\n", "f.write('\\n')\n" ]
[ "def logger(filename, content):...\n", "\"\"\"docstring\"\"\"\n", "output_file = OUTPUT_DIR + filename + '.log'\n", "if type(content) is tuple or type(content) is list:\n", "for m in content:\n", "f.write(content)\n", "f.write(m + '\\n')\n", "f.write('\\n')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_36(VAR_11):...\n", "for VAR_51, VAR_58 in VAR_11.items():\n", "if isinstance(VAR_58, str) or not isinstance(VAR_58, Iterable):\n", "VAR_58 = [VAR_58]\n", "yield [(VAR_51, VAR_16) for VAR_16 in VAR_58]\n" ]
[ "def flatten(wildcards):...\n", "for wildcard, values in wildcards.items():\n", "if isinstance(values, str) or not isinstance(values, Iterable):\n", "values = [values]\n", "yield [(wildcard, value) for value in values]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_4(self):...\n", "VAR_4 = super().get_form_kwargs()\n", "VAR_4.update({'view': self})\n", "return VAR_4\n" ]
[ "def get_form_kwargs(self):...\n", "kwargs = super().get_form_kwargs()\n", "kwargs.update({'view': self})\n", "return kwargs\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "@classmethod...\n", "VAR_17 = str(VAR_12)\n", "VAR_18 = \"UPPER(tag.name) LIKE UPPER('%%%s%%')\" % VAR_17\n", "return self.select(VAR_18)\n" ]
[ "@classmethod...\n", "text_query_str = str(text_query)\n", "sql_query = \"UPPER(tag.name) LIKE UPPER('%%%s%%')\" % text_query_str\n", "return self.select(sql_query)\n" ]
[ 0, 4, 4, 4 ]
[ "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_15(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = BokChoyTestSuite('', num_processes=2, verbosity=3)\n", "BokChoyTestSuite.verbosity_processes_string(VAR_7)\n" ]
[ "def test_invalid_verbosity_and_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "suite = BokChoyTestSuite('', num_processes=2, verbosity=3)\n", "BokChoyTestSuite.verbosity_processes_string(suite)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "\"\"\"The base class of the TornadoResource classes in the api module.\"\"\"\n", "from abc import ABCMeta, abstractmethod\n", "from collections import OrderedDict\n", "from time import localtime\n", "from passlib.hash import bcrypt_sha256\n", "from restless.tnd import TornadoResource\n", "import restless.exceptions as exc\n", "from sqlalchemy import text, func\n", "from sqlalchemy.sql.expression import false\n", "from sqlalchemy.sql.functions import count\n", "from sqlalchemy.exc import SQLAlchemyError\n", "from sqlalchemy.orm.exc import NoResultFound\n", "import tornado.web\n", "from dokomoforms.api.serializer import ModelJSONSerializer\n", "from dokomoforms.handlers.util import BaseHandler, BaseAPIHandler\n", "from dokomoforms.models import SurveyCreator, Email\n", "from dokomoforms.models.util import column_search, get_fields_subset\n", "from dokomoforms.exc import DokomoError\n", "\"\"\"string\"\"\"\n", "VAR_0 = BaseAPIHandler\n", "VAR_1 = ModelJSONSerializer()\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.r_handler.session\n" ]
[ "\"\"\"The base class of the TornadoResource classes in the api module.\"\"\"\n", "from abc import ABCMeta, abstractmethod\n", "from collections import OrderedDict\n", "from time import localtime\n", "from passlib.hash import bcrypt_sha256\n", "from restless.tnd import TornadoResource\n", "import restless.exceptions as exc\n", "from sqlalchemy import text, func\n", "from sqlalchemy.sql.expression import false\n", "from sqlalchemy.sql.functions import count\n", "from sqlalchemy.exc import SQLAlchemyError\n", "from sqlalchemy.orm.exc import NoResultFound\n", "import tornado.web\n", "from dokomoforms.api.serializer import ModelJSONSerializer\n", "from dokomoforms.handlers.util import BaseHandler, BaseAPIHandler\n", "from dokomoforms.models import SurveyCreator, Email\n", "from dokomoforms.models.util import column_search, get_fields_subset\n", "from dokomoforms.exc import DokomoError\n", "\"\"\"Set up the basics for the model resource.\n\n BaseResource does some basic configuration for the restless resources.\n - sets the base request handler class which is used by the resources\n - providing reference to the ORM session via request handler\n - inserting a serializer for dokomo Models\n - setting up authentication\n \"\"\"\n", "_request_handler_base_ = BaseAPIHandler\n", "serializer = ModelJSONSerializer()\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.r_handler.session\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "Assign'", "Condition", "Docstring", "Condition", "Docstring", "Condition", "Docstring", "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(VAR_2=None, VAR_3=None, VAR_4=None, VAR_5=None, VAR_6=None,...\n", "VAR_8 = []\n", "VAR_1 = VAR_0.cursor()\n", "VAR_9 = []\n", "VAR_10 = 'SELECT Id, Time, Origin, Key, Value FROM log_metric '\n", "if VAR_2 != None or VAR_3 != None or VAR_4 != None or VAR_5 != None:\n", "VAR_10 += 'WHERE '\n", "if VAR_2 != None:\n", "VAR_10 += 'Time >= %s AND '\n", "if VAR_3 != None:\n", "VAR_9.append(VAR_2)\n", "VAR_10 += 'Time <= %s AND '\n", "if VAR_4 != None:\n", "VAR_9.append(VAR_3)\n", "VAR_10 += 'Origin = %s AND '\n", "if VAR_5 != None:\n", "VAR_9.append(VAR_4)\n", "VAR_10 += 'Key = %s AND '\n", "VAR_10 = VAR_10.strip('AND ')\n", "VAR_9.append(VAR_5)\n", "VAR_10 += ' '\n", "if VAR_7 != None and VAR_7[0] != None:\n", "if VAR_7[1]:\n", "if VAR_6 != None:\n", "VAR_10 += 'ORDER BY %s DESC ' % VAR_7[0]\n", "VAR_10 += 'ORDER BY %s ASC ' % VAR_7[0]\n", "VAR_10 += 'LIMIT %s '\n", "VAR_1.execute(VAR_10, tuple(VAR_9))\n", "VAR_9.append(VAR_6)\n", "for row in VAR_1:\n", "VAR_8.append({'Id': str(row[0]), 'Time': str(row[1]), 'Origin': str(row[2]),\n 'Key': str(row[3]), 'Value': str(row[4])})\n", "return VAR_8\n" ]
[ "def getMetric(timefrom=None, timeto=None, origin=None, key=None, count=None,...\n", "results = []\n", "cursor = database.cursor()\n", "params = []\n", "query = 'SELECT Id, Time, Origin, Key, Value FROM log_metric '\n", "if timefrom != None or timeto != None or origin != None or key != None:\n", "query += 'WHERE '\n", "if timefrom != None:\n", "query += 'Time >= %s AND '\n", "if timeto != None:\n", "params.append(timefrom)\n", "query += 'Time <= %s AND '\n", "if origin != None:\n", "params.append(timeto)\n", "query += 'Origin = %s AND '\n", "if key != None:\n", "params.append(origin)\n", "query += 'Key = %s AND '\n", "query = query.strip('AND ')\n", "params.append(key)\n", "query += ' '\n", "if order != None and order[0] != None:\n", "if order[1]:\n", "if count != None:\n", "query += 'ORDER BY %s DESC ' % order[0]\n", "query += 'ORDER BY %s ASC ' % order[0]\n", "query += 'LIMIT %s '\n", "cursor.execute(query, tuple(params))\n", "params.append(count)\n", "for row in cursor:\n", "results.append({'Id': str(row[0]), 'Time': str(row[1]), 'Origin': str(row[2\n ]), 'Key': str(row[3]), 'Value': str(row[4])})\n", "return results\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Condition", "Expr'", "AugAssign'", "Condition", "Expr'", "AugAssign'", "Condition", "Expr'", "AugAssign'", "Assign'", "Expr'", "AugAssign'", "Condition", "Condition", "Condition", "AugAssign'", "AugAssign'", "AugAssign'", "Expr'", "Expr'", "For", "Expr'", "Return'" ]
[ "def FUNC_7(VAR_13):...\n", "VAR_32 = BeautifulSoup(VAR_13, 'html.parser')\n", "VAR_21 = VAR_32.find_all('form')\n", "VAR_33 = []\n", "if len(VAR_21) > 0:\n", "for VAR_46 in VAR_21:\n", "return VAR_33\n", "VAR_42 = VAR_46.findChildren('input', {'type': 'file'})\n", "if len(VAR_42) > 0:\n", "VAR_33.append((VAR_46, VAR_42))\n" ]
[ "def detectForms(html):...\n", "soup = BeautifulSoup(html, 'html.parser')\n", "detectedForms = soup.find_all('form')\n", "returnForms = []\n", "if len(detectedForms) > 0:\n", "for f in detectedForms:\n", "return returnForms\n", "fileInputs = f.findChildren('input', {'type': 'file'})\n", "if len(fileInputs) > 0:\n", "returnForms.append((f, fileInputs))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "For", "Return'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_17(self, VAR_23):...\n", "\"\"\"docstring\"\"\"\n", "return self._get_users_api().create_logout_url(self.request, VAR_23)\n" ]
[ "def create_logout_url(self, dest_url):...\n", "\"\"\"docstring\"\"\"\n", "return self._get_users_api().create_logout_url(self.request, dest_url)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_20(self, VAR_19, VAR_20):...\n", "\"\"\"docstring\"\"\"\n", "for clause in reversed(self.order):\n", "VAR_40 = VAR_20.has_wildcards() - VAR_19.has_wildcards()\n", "VAR_51 = clause.index(VAR_19.name)\n", "if VAR_40 != 0:\n", "VAR_52 = clause.index(VAR_20.name)\n", "return VAR_40\n", "return 0\n", "VAR_39 = VAR_52 - VAR_51\n", "if VAR_39 < 0:\n", "VAR_39 = -1\n", "if VAR_39 > 0:\n", "return VAR_39\n", "VAR_39 = 1\n" ]
[ "def compare(self, rule1, rule2):...\n", "\"\"\"docstring\"\"\"\n", "for clause in reversed(self.order):\n", "wildcard_cmp = rule2.has_wildcards() - rule1.has_wildcards()\n", "i = clause.index(rule1.name)\n", "if wildcard_cmp != 0:\n", "j = clause.index(rule2.name)\n", "return wildcard_cmp\n", "return 0\n", "comp = j - i\n", "if comp < 0:\n", "comp = -1\n", "if comp > 0:\n", "return comp\n", "comp = 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_0(self, VAR_0='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n" ]
[ "def connect(self, database='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_6):...\n", "self.update(VAR_6)\n", "self.dont_update_if_missing = []\n", "if hasattr(self, '__setup__'):\n", "self.__setup__()\n" ]
[ "def __init__(self, d):...\n", "self.update(d)\n", "self.dont_update_if_missing = []\n", "if hasattr(self, '__setup__'):\n", "self.__setup__()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_14(self, VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = self._eql_execute('volume', 'select', VAR_18['volume_name'],\n 'snapshot', 'create-now')\n", "VAR_0.error(_('Failed to create snapshot of volume %s'), VAR_18['volume_name'])\n", "VAR_9 = 'Snapshot name is '\n", "VAR_45 = self._get_prefixed_value(VAR_25, VAR_9)\n", "self._eql_execute('volume', 'select', VAR_18['volume_name'], 'snapshot',\n 'rename', VAR_45, VAR_18['name'])\n" ]
[ "def create_snapshot(self, snapshot):...\n", "\"\"\"docstring\"\"\"\n", "out = self._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'create-now')\n", "LOG.error(_('Failed to create snapshot of volume %s'), snapshot['volume_name'])\n", "prefix = 'Snapshot name is '\n", "snap_name = self._get_prefixed_value(out, prefix)\n", "self._eql_execute('volume', 'select', snapshot['volume_name'], 'snapshot',\n 'rename', snap_name, snapshot['name'])\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_33(self):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_54.flags.in_install:\n", "return\n", "for VAR_16, VAR_9 in self.get_valid_dict().items():\n", "if not VAR_9 or not isinstance(VAR_9, string_types):\n", "VAR_9 = VAR_54.as_unicode(VAR_9)\n", "if u'<' not in VAR_9 and u'>' not in VAR_9:\n", "if '<!-- markdown -->' in VAR_9 and not ('<script' in VAR_9 or \n", "VAR_25 = self.meta.get_field(VAR_16)\n", "VAR_61 = VAR_9\n", "if VAR_25 and VAR_25.get('fieldtype') in ('Data', 'Code', 'Small Text'\n", "VAR_61 = sanitize_email(VAR_9)\n", "if VAR_25 and (VAR_25.get('ignore_xss_filter') or VAR_25.get('fieldtype') ==\n", "self.set(VAR_16, VAR_61)\n", "VAR_61 = sanitize_html(VAR_9, linkify=df.fieldtype == 'Text Editor')\n" ]
[ "def _sanitize_content(self):...\n", "\"\"\"docstring\"\"\"\n", "if frappe.flags.in_install:\n", "return\n", "for fieldname, value in self.get_valid_dict().items():\n", "if not value or not isinstance(value, string_types):\n", "value = frappe.as_unicode(value)\n", "if u'<' not in value and u'>' not in value:\n", "if '<!-- markdown -->' in value and not ('<script' in value or \n", "df = self.meta.get_field(fieldname)\n", "sanitized_value = value\n", "if df and df.get('fieldtype') in ('Data', 'Code', 'Small Text') and df.get(\n", "sanitized_value = sanitize_email(value)\n", "if df and (df.get('ignore_xss_filter') or df.get('fieldtype') == 'Code' and\n", "self.set(fieldname, sanitized_value)\n", "sanitized_value = sanitize_html(value, linkify=df.fieldtype == 'Text Editor')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "\"\"\"string\"\"\"\n", "import re\n", "from lib.core.data import conf\n", "from lib.core.settings import MATCH_RATIO\n", "def FUNC_0(VAR_0, VAR_1=None, VAR_2=False):...\n", "VAR_3 = None\n", "if conf.eString and conf.eString in VAR_0:\n", "VAR_4 = VAR_0.index(conf.eString)\n", "if conf.eRegexp:\n", "VAR_5 = len(conf.eString)\n", "VAR_3 = re.findall(conf.eRegexp, VAR_0, re.I | re.M)\n", "if conf.string:\n", "VAR_6 = VAR_0[:VAR_4]\n", "if VAR_3:\n", "if conf.string in VAR_0:\n", "if conf.regexp:\n", "VAR_6 += VAR_0[VAR_4 + VAR_5:]\n", "for regExpResult in VAR_3:\n", "return True\n", "return False\n", "if re.search(conf.regexp, VAR_0, re.I | re.M):\n", "conf.seqMatcher.set_seq2(VAR_0)\n", "VAR_0 = VAR_6\n", "VAR_4 = VAR_0.index(regExpResult)\n", "return True\n", "return False\n", "if VAR_2:\n", "VAR_5 = len(regExpResult)\n", "return round(conf.seqMatcher.ratio(), 5)\n", "if round(conf.seqMatcher.ratio(), 5) >= MATCH_RATIO:\n", "VAR_7 = VAR_0[:VAR_4]\n", "return True\n", "return False\n", "VAR_7 += VAR_0[VAR_4 + VAR_5:]\n", "VAR_0 = VAR_7\n" ]
[ "\"\"\"\n$Id$\n\nThis file is part of the sqlmap project, http://sqlmap.sourceforge.net.\n\nCopyright (c) 2006-2008 Bernardo Damele A. G. <[email protected]>\n and Daniele Bellucci <[email protected]>\n\nsqlmap is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation version 2 of the License.\n\nsqlmap is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\nFOR A PARTICULAR PURPOSE. See the GNU General Public License for more\ndetails.\n\nYou should have received a copy of the GNU General Public License along\nwith sqlmap; if not, write to the Free Software Foundation, Inc., 51\nFranklin St, Fifth Floor, Boston, MA 02110-1301 USA\n\"\"\"\n", "import re\n", "from lib.core.data import conf\n", "from lib.core.settings import MATCH_RATIO\n", "def comparison(page, headers=None, getSeqMatcher=False):...\n", "regExpResults = None\n", "if conf.eString and conf.eString in page:\n", "index = page.index(conf.eString)\n", "if conf.eRegexp:\n", "length = len(conf.eString)\n", "regExpResults = re.findall(conf.eRegexp, page, re.I | re.M)\n", "if conf.string:\n", "pageWithoutString = page[:index]\n", "if regExpResults:\n", "if conf.string in page:\n", "if conf.regexp:\n", "pageWithoutString += page[index + length:]\n", "for regExpResult in regExpResults:\n", "return True\n", "return False\n", "if re.search(conf.regexp, page, re.I | re.M):\n", "conf.seqMatcher.set_seq2(page)\n", "page = pageWithoutString\n", "index = page.index(regExpResult)\n", "return True\n", "return False\n", "if getSeqMatcher:\n", "length = len(regExpResult)\n", "return round(conf.seqMatcher.ratio(), 5)\n", "if round(conf.seqMatcher.ratio(), 5) >= MATCH_RATIO:\n", "pageWithoutRegExp = page[:index]\n", "return True\n", "return False\n", "pageWithoutRegExp += page[index + length:]\n", "page = pageWithoutRegExp\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, 2, 2, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "AugAssign'", "For", "Return'", "Return'", "Condition", "Expr'", "Assign'", "Assign'", "Return'", "Return'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Return'", "Return'", "AugAssign'", "Assign'" ]
[ "async def FUNC_4(VAR_6):...\n", "VAR_10 = {'Authorization': f'Bearer {VAR_1}'}\n", "VAR_7 = {'date': '1971-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n", "VAR_8 = await VAR_6.post('/results', VAR_10=headers, VAR_7=json.dumps(data))\n", "assert VAR_8.status == 400\n" ]
[ "async def test_negative_jogging_result(test_cli):...\n", "headers = {'Authorization': f'Bearer {access_token}'}\n", "data = {'date': '1971-06-20', 'distance': 2000, 'time': 405, 'location':\n '32.0853 34.7818'}\n", "resp = await test_cli.post('/results', headers=headers, data=json.dumps(data))\n", "assert resp.status == 400\n" ]
[ 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Assign'", "Assign'", "Assign'", "Assert'" ]
[ "def FUNC_12(self, VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "if self.test_name is None:\n", "self.initFile('counterclockwise')\n", "self.testSquare(VAR_19, self.cc_square)\n" ]
[ "def testCCsquare(self, length):...\n", "\"\"\"docstring\"\"\"\n", "if self.test_name is None:\n", "self.initFile('counterclockwise')\n", "self.testSquare(length, self.cc_square)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_7(self):...\n", "return \"\"\"Username: %s\nPassword: %s\n\"\"\" % (self.username, self.password\n ) + CLASS_1.specific_info(self)\n" ]
[ "def specific_info(self):...\n", "return \"\"\"Username: %s\nPassword: %s\n\"\"\" % (self.username, self.password\n ) + GenericRequest.specific_info(self)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from __future__ import unicode_literals\n", "from six import iteritems, string_types\n", "import datetime\n", "import frappe, sys\n", "from frappe import _\n", "from frappe.utils import cint, flt, now, cstr, strip_html, sanitize_html, sanitize_email, cast_fieldtype\n", "from frappe.model import default_fields\n", "from frappe.model.naming import set_new_name\n", "from frappe.model.utils.link_count import notify_link_count\n", "from frappe.modules import load_doctype_module\n", "from frappe.model import display_fieldtypes\n", "from frappe.model.db_schema import type_map, varchar_len\n", "from frappe.utils.password import get_decrypted_password, set_encrypted_password\n", "VAR_0 = {}\n", "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.document import Document\n", "if not VAR_1 in VAR_0:\n", "VAR_31, VAR_32 = VAR_54.db.get_value('DocType', VAR_1, ('module', 'custom'),\n cache=True) or ['Core', False]\n", "return VAR_0[VAR_1]\n", "if VAR_32:\n", "VAR_51 = Document\n", "VAR_52 = load_doctype_module(VAR_1, VAR_31)\n", "VAR_0[VAR_1] = VAR_51\n", "VAR_53 = VAR_1.replace(' ', '').replace('-', '')\n", "if hasattr(VAR_52, VAR_53):\n", "VAR_51 = getattr(VAR_52, VAR_53)\n", "if issubclass(VAR_51, CLASS_0):\n", "VAR_51 = getattr(VAR_52, VAR_53)\n" ]
[ "from __future__ import unicode_literals\n", "from six import iteritems, string_types\n", "import datetime\n", "import frappe, sys\n", "from frappe import _\n", "from frappe.utils import cint, flt, now, cstr, strip_html, sanitize_html, sanitize_email, cast_fieldtype\n", "from frappe.model import default_fields\n", "from frappe.model.naming import set_new_name\n", "from frappe.model.utils.link_count import notify_link_count\n", "from frappe.modules import load_doctype_module\n", "from frappe.model import display_fieldtypes\n", "from frappe.model.db_schema import type_map, varchar_len\n", "from frappe.utils.password import get_decrypted_password, set_encrypted_password\n", "_classes = {}\n", "def get_controller(doctype):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.document import Document\n", "if not doctype in _classes:\n", "module_name, custom = frappe.db.get_value('DocType', doctype, ('module',\n 'custom'), cache=True) or ['Core', False]\n", "return _classes[doctype]\n", "if custom:\n", "_class = Document\n", "module = load_doctype_module(doctype, module_name)\n", "_classes[doctype] = _class\n", "classname = doctype.replace(' ', '').replace('-', '')\n", "if hasattr(module, classname):\n", "_class = getattr(module, classname)\n", "if issubclass(_class, BaseDocument):\n", "_class = getattr(module, classname)\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 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Docstring", "ImportFrom'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'" ]
[ "def __getattr__(self, VAR_52):...\n", "VAR_58 = getattr(self.orig_obj, VAR_52)\n", "if not callable(VAR_58):\n", "return VAR_58\n", "VAR_60 = self._wrapper_cache.get(VAR_52)\n", "if VAR_60 is None:\n", "@functools.wraps(VAR_58)...\n", "return VAR_60\n", "return VAR_58(*VAR_61, **kwargs)\n" ]
[ "def __getattr__(self, attr):...\n", "orig_attr = getattr(self.orig_obj, attr)\n", "if not callable(orig_attr):\n", "return orig_attr\n", "wrapper = self._wrapper_cache.get(attr)\n", "if wrapper is None:\n", "@functools.wraps(orig_attr)...\n", "return wrapper\n", "return orig_attr(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_16(self, VAR_8, **VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = dict()\n", "VAR_22.update(self.rule.workflow.globals)\n", "VAR_22.update(dict(input=self.input, output=self.output, VAR_24=self.params,\n VAR_16=self._format_wildcards, threads=self.threads, VAR_23=self.\n resources, log=self.log, version=self.rule.version, VAR_3=self.rule.name))\n", "VAR_22.update(VAR_9)\n", "return format(VAR_8, **_variables)\n" ]
[ "def format_wildcards(self, string, **variables):...\n", "\"\"\"docstring\"\"\"\n", "_variables = dict()\n", "_variables.update(self.rule.workflow.globals)\n", "_variables.update(dict(input=self.input, output=self.output, params=self.\n params, wildcards=self._format_wildcards, threads=self.threads,\n resources=self.resources, log=self.log, version=self.rule.version, rule\n =self.rule.name))\n", "_variables.update(variables)\n", "return format(string, **_variables)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(self):...\n", "self.oms_ssh = OmsSshProtocol()\n", "self.terminal = mock.Mock()\n", "self.oms_ssh.terminal = self.terminal\n", "self.oms_ssh.connectionMade()\n", "self.orig_commands = cmd.commands\n", "cmd.commands = lambda : dict(hello=cmd.Cmd, **self.orig_commands())\n" ]
[ "def setUp(self):...\n", "self.oms_ssh = OmsSshProtocol()\n", "self.terminal = mock.Mock()\n", "self.oms_ssh.terminal = self.terminal\n", "self.oms_ssh.connectionMade()\n", "self.orig_commands = cmd.commands\n", "cmd.commands = lambda : dict(hello=cmd.Cmd, **self.orig_commands())\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'" ]
[ "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 __getitem__(self, note_id):...\n", "note = db.note.find_note(self.request.db, note_id)\n", "if note:\n", "return NoteResource(note)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_7():...\n", "VAR_21 = random.SystemRandom()\n", "VAR_22 = str(VAR_21.getrandbits(128))\n", "return tornado.web.Application([('/', CLASS_4), ('/login', CLASS_1), (\n '/logout', CLASS_2), ('/settings', CLASS_5), ('/runScriptWebSocket',\n CLASS_7), ('/randomImageBrowserWebSocket', CLASS_6), (\n '/webInterface/(.*)', CLASS_3, {'path': 'webInterface'}), (\n '/output/(.*)', CLASS_3, {'path': VAR_51.settings['Output_dir']}), (\n '/webInterfaceNoAuth/(.*)', tornado.web.StaticFileHandler, {'path':\n 'webInterfaceNoAuth'})], xsrf_cookies=True, cookie_secret=cookieSecret,\n login_url='/login')\n" ]
[ "def make_app():...\n", "randomGenerator = random.SystemRandom()\n", "cookieSecret = str(randomGenerator.getrandbits(128))\n", "return tornado.web.Application([('/', HomeHandler), ('/login', LoginHandler\n ), ('/logout', LogoutHandler), ('/settings', SettingsHandler), (\n '/runScriptWebSocket', RunScriptWebSocket), (\n '/randomImageBrowserWebSocket', RandomImageBrowserWebSocket), (\n '/webInterface/(.*)', AuthedStaticHandler, {'path': 'webInterface'}), (\n '/output/(.*)', AuthedStaticHandler, {'path': settings.settings[\n 'Output_dir']}), ('/webInterfaceNoAuth/(.*)', tornado.web.\n StaticFileHandler, {'path': 'webInterfaceNoAuth'})], xsrf_cookies=True,\n cookie_secret=cookieSecret, login_url='/login')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_27(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def pre_validate(self, form):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "@property...\n", "return tornado.web.HTTPError\n" ]
[ "@property...\n", "return tornado.web.HTTPError\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_2(VAR_7):...\n", "return urlparse.urljoin(CLASS_0.server_location, VAR_7)\n" ]
[ "def _BuildUri(handler):...\n", "return urlparse.urljoin(BaseRequest.server_location, handler)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import os\n", "import re\n", "import sys\n", "import inspect\n", "import sre_constants\n", "from collections import defaultdict\n", "from snakemake.io import IOFile, _IOFile, protected, temp, dynamic, Namedlist\n", "from snakemake.io import expand, InputFiles, OutputFiles, Wildcards, Params, Log\n", "from snakemake.io import apply_wildcards, is_flagged, not_iterable\n", "from snakemake.exceptions import RuleException, IOFileException, WildcardError, InputFunctionException\n", "def __init__(self, *VAR_0, VAR_1=None, VAR_2=None):...\n", "\"\"\"docstring\"\"\"\n", "if len(VAR_0) == 2:\n", "VAR_10, VAR_41 = VAR_0\n", "if len(VAR_0) == 1:\n", "self.name = VAR_10\n", "VAR_17 = VAR_0[0]\n", "def FUNC_0(self, VAR_3, VAR_4=True):...\n", "self.workflow = VAR_41\n", "self.name = VAR_17.name\n", "def FUNC_21(VAR_16):...\n", "self.docstring = None\n", "self.workflow = VAR_17.workflow\n", "return (VAR_16.input, VAR_16.dynamic_input) if VAR_4 else (VAR_16.output,\n VAR_16.dynamic_output)\n", "self.message = None\n", "self.docstring = VAR_17.docstring\n", "self._input = InputFiles()\n", "self.message = VAR_17.message\n", "self._output = OutputFiles()\n", "self._input = InputFiles(VAR_17._input)\n", "self._params = Params()\n", "self._output = OutputFiles(VAR_17._output)\n", "self.dependencies = dict()\n", "self._params = Params(VAR_17._params)\n", "self.dynamic_output = set()\n", "self.dependencies = dict(VAR_17.dependencies)\n", "self.dynamic_input = set()\n", "self.dynamic_output = set(VAR_17.dynamic_output)\n", "self.temp_output = set()\n", "self.dynamic_input = set(VAR_17.dynamic_input)\n", "self.protected_output = set()\n", "self.temp_output = set(VAR_17.temp_output)\n", "self.touch_output = set()\n", "self.protected_output = set(VAR_17.protected_output)\n", "self.subworkflow_input = dict()\n", "self.touch_output = set(VAR_17.touch_output)\n", "self.resources = dict(_cores=1, _nodes=1)\n", "self.subworkflow_input = dict(VAR_17.subworkflow_input)\n", "self.priority = 0\n", "self.resources = VAR_17.resources\n", "self.version = None\n", "self.priority = VAR_17.priority\n", "self._log = Log()\n", "self.version = VAR_17.version\n", "self._benchmark = None\n", "self._log = VAR_17._log\n", "self.wildcard_names = set()\n", "self._benchmark = VAR_17._benchmark\n", "self.lineno = VAR_1\n", "self.wildcard_names = set(VAR_17.wildcard_names)\n", "self.snakefile = VAR_2\n", "self.lineno = VAR_17.lineno\n", "self.run_func = None\n", "self.snakefile = VAR_17.snakefile\n", "self.shellcmd = None\n", "self.run_func = VAR_17.run_func\n", "self.norun = False\n", "self.shellcmd = VAR_17.shellcmd\n", "self.norun = VAR_17.norun\n" ]
[ "__author__ = 'Johannes Köster'\n", "__copyright__ = 'Copyright 2015, Johannes Köster'\n", "__email__ = '[email protected]'\n", "__license__ = 'MIT'\n", "import os\n", "import re\n", "import sys\n", "import inspect\n", "import sre_constants\n", "from collections import defaultdict\n", "from snakemake.io import IOFile, _IOFile, protected, temp, dynamic, Namedlist\n", "from snakemake.io import expand, InputFiles, OutputFiles, Wildcards, Params, Log\n", "from snakemake.io import apply_wildcards, is_flagged, not_iterable\n", "from snakemake.exceptions import RuleException, IOFileException, WildcardError, InputFunctionException\n", "def __init__(self, *args, lineno=None, snakefile=None):...\n", "\"\"\"docstring\"\"\"\n", "if len(args) == 2:\n", "name, workflow = args\n", "if len(args) == 1:\n", "self.name = name\n", "other = args[0]\n", "def dynamic_branch(self, wildcards, input=True):...\n", "self.workflow = workflow\n", "self.name = other.name\n", "def get_io(rule):...\n", "self.docstring = None\n", "self.workflow = other.workflow\n", "return (rule.input, rule.dynamic_input) if input else (rule.output, rule.\n dynamic_output)\n", "self.message = None\n", "self.docstring = other.docstring\n", "self._input = InputFiles()\n", "self.message = other.message\n", "self._output = OutputFiles()\n", "self._input = InputFiles(other._input)\n", "self._params = Params()\n", "self._output = OutputFiles(other._output)\n", "self.dependencies = dict()\n", "self._params = Params(other._params)\n", "self.dynamic_output = set()\n", "self.dependencies = dict(other.dependencies)\n", "self.dynamic_input = set()\n", "self.dynamic_output = set(other.dynamic_output)\n", "self.temp_output = set()\n", "self.dynamic_input = set(other.dynamic_input)\n", "self.protected_output = set()\n", "self.temp_output = set(other.temp_output)\n", "self.touch_output = set()\n", "self.protected_output = set(other.protected_output)\n", "self.subworkflow_input = dict()\n", "self.touch_output = set(other.touch_output)\n", "self.resources = dict(_cores=1, _nodes=1)\n", "self.subworkflow_input = dict(other.subworkflow_input)\n", "self.priority = 0\n", "self.resources = other.resources\n", "self.version = None\n", "self.priority = other.priority\n", "self._log = Log()\n", "self.version = other.version\n", "self._benchmark = None\n", "self._log = other._log\n", "self.wildcard_names = set()\n", "self._benchmark = other._benchmark\n", "self.lineno = lineno\n", "self.wildcard_names = set(other.wildcard_names)\n", "self.snakefile = snakefile\n", "self.lineno = other.lineno\n", "self.run_func = None\n", "self.snakefile = other.snakefile\n", "self.shellcmd = None\n", "self.run_func = other.run_func\n", "self.norun = False\n", "self.shellcmd = other.shellcmd\n", "self.norun = other.norun\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Assign'", "Assign'", "Assign'", "Assign'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Return'", "Assign'", "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'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(self, VAR_18):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def execute(self, builtins):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_23(VAR_3, VAR_12=False):...\n", "VAR_0, VAR_10 = FUNC_0()\n", "VAR_30 = FUNC_22(VAR_10, VAR_3, VAR_12)\n", "FUNC_1(VAR_0)\n", "return VAR_30\n" ]
[ "def genTokensExternal(poll_name, count=False):...\n", "conn, c = connectDB()\n", "tok = genTokens(c, poll_name, count)\n", "closeDB(conn)\n", "return tok\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_28(self, VAR_18=False):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_45(VAR_25, VAR_39):...\n", "if self.parentfield:\n", "return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(VAR_25.label), VAR_39)\n", "return '{}: {}'.format(_(VAR_25.label), VAR_39)\n" ]
[ "def get_invalid_links(self, is_submittable=False):...\n", "\"\"\"docstring\"\"\"\n", "def get_msg(df, docname):...\n", "if self.parentfield:\n", "return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(df.label), docname)\n", "return '{}: {}'.format(_(df.label), docname)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_6 = ['preferred', 'other', 'exceptions']\n", "VAR_7 = VAR_0.head.commit.tree['LICENSES']\n", "VAR_8 = CLASS_2()\n", "for d in VAR_6:\n", "for VAR_5 in VAR_7[d].traverse():\n", "return VAR_8\n", "if not os.path.isfile(VAR_5.path):\n", "VAR_23 = None\n", "for l in open(VAR_5.path).readlines():\n", "if l.startswith('Valid-License-Identifier:'):\n", "VAR_26 = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Exception-Identifier:'):\n", "if VAR_26 in VAR_8.licenses:\n", "VAR_23 = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Licenses:'):\n", "VAR_8.licenses.append(VAR_26)\n", "VAR_8.exceptions[VAR_23] = []\n", "for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\\t', ''\n", "if l.startswith('License-Text:'):\n", "if not lic in VAR_8.licenses:\n", "if VAR_23:\n", "VAR_8.exceptions[VAR_23].append(lic)\n", "if not len(VAR_8.exceptions[VAR_23]):\n", "VAR_8.license_files += 1\n", "VAR_8.exception_files += 1\n" ]
[ "def read_spdxdata(repo):...\n", "license_dirs = ['preferred', 'other', 'exceptions']\n", "lictree = repo.head.commit.tree['LICENSES']\n", "spdx = SPDXdata()\n", "for d in license_dirs:\n", "for el in lictree[d].traverse():\n", "return spdx\n", "if not os.path.isfile(el.path):\n", "exception = None\n", "for l in open(el.path).readlines():\n", "if l.startswith('Valid-License-Identifier:'):\n", "lid = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Exception-Identifier:'):\n", "if lid in spdx.licenses:\n", "exception = l.split(':')[1].strip().upper()\n", "if l.startswith('SPDX-Licenses:'):\n", "spdx.licenses.append(lid)\n", "spdx.exceptions[exception] = []\n", "for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\\t', ''\n", "if l.startswith('License-Text:'):\n", "if not lic in spdx.licenses:\n", "if exception:\n", "spdx.exceptions[exception].append(lic)\n", "if not len(spdx.exceptions[exception]):\n", "spdx.license_files += 1\n", "spdx.exception_files += 1\n" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "For", "Return'", "Condition", "Assign'", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "For", "Condition", "Condition", "Condition", "Expr'", "Condition", "AugAssign'", "AugAssign'" ]
[ "def FUNC_1(self, VAR_1):...\n", "VAR_4 = {'X-XSRF-TOKEN': self.xsrf_token}\n", "if 'headers' in VAR_1:\n", "VAR_1['headers'].update(VAR_4)\n", "VAR_1['headers'] = VAR_4\n", "return VAR_1\n" ]
[ "def _set_xsrf_headers(self, kwargs):...\n", "xsrf_header = {'X-XSRF-TOKEN': self.xsrf_token}\n", "if 'headers' in kwargs:\n", "kwargs['headers'].update(xsrf_header)\n", "kwargs['headers'] = xsrf_header\n", "return kwargs\n" ]
[ 0, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_0(self):...\n", "if not GenericRequest.test_success(self):\n", "return False\n", "VAR_13 = re.compile(self.username)\n", "if self.loggedin:\n", "if VAR_13.search(self.res_data) is None:\n", "if VAR_13.search(self.res_data) is not None:\n", "return False\n", "return True\n", "return False\n" ]
[ "def test_success(self):...\n", "if not GenericRequest.test_success(self):\n", "return False\n", "username_re = re.compile(self.username)\n", "if self.loggedin:\n", "if username_re.search(self.res_data) is None:\n", "if username_re.search(self.res_data) is not None:\n", "return False\n", "return True\n", "return False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Condition", "Condition", "Return'", "Return'", "Return'" ]
[ "def FUNC_3(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = VAR_1.file_name().split('/')[-1]\n", "VAR_14 = VAR_2.strftime('<%a., %b. %d, %Y, %I:%M %p>')\n", "VAR_1.run_command('move_to', {'to': 'eof'})\n", "VAR_1.run_command('insert_snippet', {'contents': '\\n\\n' + VAR_4() +\n 'Created ' + VAR_14 + '\\n'})\n", "VAR_1.run_command('move_to', {'to': 'bof'})\n" ]
[ "def add_created_timestamp(view, timestamp):...\n", "\"\"\"docstring\"\"\"\n", "filename = view.file_name().split('/')[-1]\n", "text_timestamp = timestamp.strftime('<%a., %b. %d, %Y, %I:%M %p>')\n", "view.run_command('move_to', {'to': 'eof'})\n", "view.run_command('insert_snippet', {'contents': '\\n\\n' + meta_separator() +\n 'Created ' + text_timestamp + '\\n'})\n", "view.run_command('move_to', {'to': 'bof'})\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_4(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name, 'size': 1, 'id': self.volid}\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show').AndRaise(\n processutils.ProcessExecutionError(stdout=\n \"\"\"% Error ..... does not exist.\n\"\"\"))\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(VAR_1)\n" ]
[ "def test_delete_absent_volume(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name, 'size': 1, 'id': self.volid}\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'show').AndRaise(\n processutils.ProcessExecutionError(stdout=\n \"\"\"% Error ..... does not exist.\n\"\"\"))\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(volume)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "return \"\"\"Task: %s (ID %d)\nSubmission: %s\n\"\"\" % (self.task[1], self.task[0],\n self.submission_num) + GenericRequest.specific_info(self)\n" ]
[ "def specific_info(self):...\n", "return \"\"\"Task: %s (ID %d)\nSubmission: %s\n\"\"\" % (self.task[1], self.task[0],\n self.submission_num) + GenericRequest.specific_info(self)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self):...\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n" ]
[ "def tearDown(self):...\n", "self.handled_resp = None\n", "self.handled_remote = None\n", "self.handled_args = None\n", "self.handled_kwargs = None\n", "from invenio.modules.oauthclient.models import RemoteToken, RemoteAccount\n", "RemoteToken.query.delete()\n", "RemoteAccount.query.delete()\n", "db.session.commit()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_4...\n", "if not VAR_6.check(cmdline.ArgumentParsingError):\n", "VAR_6.raiseException()\n", "self.print_prompt()\n" ]
[ "@deferred...\n", "if not f.check(cmdline.ArgumentParsingError):\n", "f.raiseException()\n", "self.print_prompt()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_3, VAR_4=True):...\n", "def FUNC_21(VAR_16):...\n", "return (VAR_16.input, VAR_16.dynamic_input) if VAR_4 else (VAR_16.output,\n VAR_16.dynamic_output)\n" ]
[ "def dynamic_branch(self, wildcards, input=True):...\n", "def get_io(rule):...\n", "return (rule.input, rule.dynamic_input) if input else (rule.output, rule.\n dynamic_output)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Return'" ]
[ "def FUNC_6(self, VAR_46, VAR_47):...\n", "return True\n" ]
[ "def run(self, vh, thing_name):...\n", "return True\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@auth.require(auth.is_admin)...\n", "VAR_4 = {'lease_requests': [], 'next_page_token': None, 'now_ts': utils.\n time_time()}\n", "if VAR_2:\n", "VAR_8 = models.LeaseRequest.get_by_id(VAR_2)\n", "VAR_6 = models.LeaseRequest.query().order(-models.LeaseRequest.last_modified_ts\n )\n", "if not VAR_8:\n", "VAR_7 = self.request.get('page_token') or ''\n", "self.abort(404)\n", "VAR_4['lease_requests'] = [VAR_8]\n", "VAR_4['lease_requests'], VAR_4['next_page_token'] = datastore_utils.fetch_page(\n VAR_6, 50, VAR_7)\n", "self.response.write(template.render('templates/leases.html', VAR_4=params))\n" ]
[ "@auth.require(auth.is_admin)...\n", "params = {'lease_requests': [], 'next_page_token': None, 'now_ts': utils.\n time_time()}\n", "if lease_id:\n", "lease_request = models.LeaseRequest.get_by_id(lease_id)\n", "query = models.LeaseRequest.query().order(-models.LeaseRequest.last_modified_ts\n )\n", "if not lease_request:\n", "page_token = self.request.get('page_token') or ''\n", "self.abort(404)\n", "params['lease_requests'] = [lease_request]\n", "params['lease_requests'], params['next_page_token'\n ] = datastore_utils.fetch_page(query, 50, page_token)\n", "self.response.write(template.render('templates/leases.html', params=params))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_11(VAR_14, VAR_3=None, VAR_4=None, VAR_5=None, VAR_2=VAR_0, VAR_24...\n", "if VAR_14.method == 'GET':\n", "if VAR_3 is not None:\n", "return HttpResponseNotAllowed(['GET'])\n", "VAR_8 = get_object_or_404(VAR_5, **{group_slug_field: group_slug})\n", "VAR_46 = VAR_47 = True\n", "VAR_24 = VAR_24.filter(article__content_type=get_ct(group),\n article__object_id=group.id)\n", "if not VAR_46:\n", "VAR_46 = FUNC_3(VAR_14.user, VAR_8, VAR_12, VAR_13)\n", "return HttpResponseForbidden()\n", "VAR_48 = {'changes': VAR_24.order_by('-modified'), 'allow_write': VAR_47}\n", "VAR_47 = FUNC_4(VAR_14.user, VAR_8, VAR_12)\n", "if VAR_3 is not None:\n", "VAR_48['group'] = VAR_3\n", "if VAR_18 is not None:\n", "VAR_48.update(VAR_18)\n", "return render_to_response('/'.join([VAR_17, VAR_16]), VAR_48,\n context_instance=RequestContext(request))\n" ]
[ "def history(request, group_slug=None, group_slug_field=None, group_qs=None,...\n", "if request.method == 'GET':\n", "if group_slug is not None:\n", "return HttpResponseNotAllowed(['GET'])\n", "group = get_object_or_404(group_qs, **{group_slug_field: group_slug})\n", "allow_read = allow_write = True\n", "changes_qs = changes_qs.filter(article__content_type=get_ct(group),\n article__object_id=group.id)\n", "if not allow_read:\n", "allow_read = has_read_perm(request.user, group, is_member, is_private)\n", "return HttpResponseForbidden()\n", "template_params = {'changes': changes_qs.order_by('-modified'),\n 'allow_write': allow_write}\n", "allow_write = has_write_perm(request.user, group, is_member)\n", "if group_slug is not None:\n", "template_params['group'] = group_slug\n", "if extra_context is not None:\n", "template_params.update(extra_context)\n", "return render_to_response('/'.join([template_dir, template_name]),\n template_params, context_instance=RequestContext(request))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_12():...\n", "VAR_39 = ''\n", "if not VAR_3:\n", "logging.error('Could not read metafile!', full_traceback())\n", "return VAR_39\n", "VAR_39 = f.read()\n", "VAR_39 = self.getDropboxFile(VAR_12).decode()\n" ]
[ "def getMetadata():...\n", "metadata = ''\n", "if not FROM_DROPBOX:\n", "logging.error('Could not read metafile!', full_traceback())\n", "return metadata\n", "metadata = f.read()\n", "metadata = self.getDropboxFile(filepath).decode()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_2():...\n", "db.test()\n" ]
[ "def configure_extensions():...\n", "db.test()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_24(self, VAR_7, VAR_17):...\n", "self.common.extend_volume(VAR_7, VAR_17)\n" ]
[ "def extend_volume(self, volume, new_size):...\n", "self.common.extend_volume(volume, new_size)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@property...\n", "return self._input\n" ]
[ "@property...\n", "return self._input\n" ]
[ 0, 0 ]
[ "Condition", "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'" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.RESTART, *VAR_13, **kwargs)\n" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.RESTART, *args, **kwargs)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __setstate__(self, VAR_1):...\n", "return self.deserialize(VAR_1)\n" ]
[ "def __setstate__(self, data):...\n", "return self.deserialize(data)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@inlineCallbacks...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.nodes[0].overlay.metadata_store.ChannelMetadata.create_channel(\n 'test', 'bla')\n", "self.add_random_torrent(self.nodes[0].overlay.metadata_store.TorrentMetadata)\n", "VAR_6.commit_channel_torrent()\n", "self.nodes[0].overlay.send_random_to(Peer(self.nodes[1].my_peer.public_key,\n self.nodes[1].endpoint.wan_address))\n", "yield self.deliver_messages()\n", "self.assertEqual(len(self.nodes[1].overlay.metadata_store.ChannelMetadata.\n select()), 1)\n", "VAR_6 = self.nodes[1].overlay.metadata_store.ChannelMetadata.select()[:][0]\n", "self.assertEqual(VAR_6.contents_len, 1)\n" ]
[ "@inlineCallbacks...\n", "\"\"\"docstring\"\"\"\n", "channel = self.nodes[0].overlay.metadata_store.ChannelMetadata.create_channel(\n 'test', 'bla')\n", "self.add_random_torrent(self.nodes[0].overlay.metadata_store.TorrentMetadata)\n", "channel.commit_channel_torrent()\n", "self.nodes[0].overlay.send_random_to(Peer(self.nodes[1].my_peer.public_key,\n self.nodes[1].endpoint.wan_address))\n", "yield self.deliver_messages()\n", "self.assertEqual(len(self.nodes[1].overlay.metadata_store.ChannelMetadata.\n select()), 1)\n", "channel = self.nodes[1].overlay.metadata_store.ChannelMetadata.select()[:][0]\n", "self.assertEqual(channel.contents_len, 1)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "@tornado.gen.coroutine...\n", "VAR_17 = 'INSERT INTO users(email, pass_hash) VALUES (%s, %s)'\n", "VAR_18 = VAR_15, VAR_16\n", "yield VAR_1.execute(query=sql, VAR_18=params)\n" ]
[ "@tornado.gen.coroutine...\n", "sql = 'INSERT INTO users(email, pass_hash) VALUES (%s, %s)'\n", "params = email, pass_hash\n", "yield tx.execute(query=sql, params=params)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_8(self, VAR_5, VAR_6, VAR_23, VAR_24=None, VAR_25='ilike', VAR_13=...\n", "\"\"\"docstring\"\"\"\n", "if VAR_24 is None:\n", "VAR_24 = []\n", "VAR_20 = self.search(VAR_5, VAR_6, ['|', ('name', VAR_25, VAR_23), ('code',\n VAR_25, VAR_23)] + VAR_24, VAR_26=limit, VAR_13=context)\n", "return self.name_get(VAR_5, VAR_6, VAR_20, VAR_13=context)\n" ]
[ "def name_search(self, cr, uid, name, args=None, operator='ilike', context=...\n", "\"\"\"docstring\"\"\"\n", "if args is None:\n", "args = []\n", "ids = self.search(cr, uid, ['|', ('name', operator, name), ('code',\n operator, name)] + args, limit=limit, context=context)\n", "return self.name_get(cr, uid, ids, context=context)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def __getitem__(self, VAR_44):...\n", "" ]
[ "def __getitem__(self, key):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_3(self):...\n", "VAR_2 = self.connect()\n", "VAR_3 = 'DELETE FROM crimes;'\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "VAR_2.commit()\n" ]
[ "def clear_all(self):...\n", "connection = self.connect()\n", "query = 'DELETE FROM crimes;'\n", "connection.close()\n", "cursor.execute(query)\n", "connection.commit()\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_18(self, VAR_18, VAR_14=None, VAR_10='main'):...\n", "\"\"\"docstring\"\"\"\n", "if type(VAR_18) != type(u''):\n", "VAR_18 = VAR_18.decode('utf8')\n", "if type(VAR_14) != type(u''):\n", "VAR_14 = VAR_14.decode('utf8')\n", "if len(VAR_18) < 4:\n", "return\n", "VAR_26 = 'string' % {'phrase': VAR_18, 'input_phrase': VAR_14}\n", "VAR_35 = self.db.execute(VAR_26).fetchall()\n", "filter(lambda x: x[-3] == VAR_18 and VAR_35.append(tuple(x)), self.\n hunspell_obj.suggest(VAR_14))\n", "if len(VAR_35) == 0:\n", "self.add_phrase((VAR_14, VAR_18, -2, 1), VAR_10='mudb')\n", "VAR_38 = {}\n", "VAR_37 = {}\n", "VAR_21 = {}\n", "map(lambda x: VAR_38.update([(x[3:-2], x[:])]), filter(lambda x: not x[-1],\n VAR_35))\n", "map(lambda x: VAR_37.update([(x[3:-2], x[:])]), filter(lambda x: x[-2] in [\n 0, -1] and x[-1], VAR_35))\n", "map(lambda x: VAR_21.update([(x[3:-2], x[:])]), filter(lambda x: x[-2] not in\n [0, -1] and x[-1], VAR_35))\n", "map(VAR_37.pop, filter(lambda VAR_4: VAR_4 in VAR_21, VAR_37.keys()))\n", "map(VAR_38.pop, filter(lambda VAR_4: VAR_4 in VAR_21 or VAR_4 in VAR_37,\n VAR_38.keys()))\n", "map(lambda VAR_54: self.add_phrase((VAR_54[0], VAR_18, -3 if VAR_37[VAR_54]\n [-2] == -1 else 1, VAR_37[VAR_54][-1] + 1), VAR_10='mudb'), VAR_37.keys())\n", "map(lambda VAR_54: self.add_phrase((VAR_54[0], VAR_18, 2, 1), VAR_10='mudb'\n ), VAR_38.keys())\n", "map(lambda VAR_4: self.update_phrase((VAR_21[VAR_4][3], VAR_21[VAR_4][4],\n VAR_21[VAR_4][5], VAR_21[VAR_4][6] + 1), VAR_10='mudb'), VAR_21.keys())\n" ]
[ "def check_phrase(self, phrase, input_phrase=None, database='main'):...\n", "\"\"\"docstring\"\"\"\n", "if type(phrase) != type(u''):\n", "phrase = phrase.decode('utf8')\n", "if type(input_phrase) != type(u''):\n", "input_phrase = input_phrase.decode('utf8')\n", "if len(phrase) < 4:\n", "return\n", "sqlstr = (\n \"\"\"\n SELECT * FROM user_db.phrases WHERE phrase = \"%(phrase)s\" and input_phrase = \"%(input_phrase)s\"\n UNION ALL\n SELECT * FROM mudb.phrases WHERE phrase = \"%(phrase)s\" and input_phrase = \"%(input_phrase)s\"\n ORDER BY user_freq DESC, freq DESC, id ASC;\"\"\"\n % {'phrase': phrase, 'input_phrase': input_phrase})\n", "result = self.db.execute(sqlstr).fetchall()\n", "filter(lambda x: x[-3] == phrase and result.append(tuple(x)), self.\n hunspell_obj.suggest(input_phrase))\n", "if len(result) == 0:\n", "self.add_phrase((input_phrase, phrase, -2, 1), database='mudb')\n", "sysdb = {}\n", "usrdb = {}\n", "mudb = {}\n", "map(lambda x: sysdb.update([(x[3:-2], x[:])]), filter(lambda x: not x[-1],\n result))\n", "map(lambda x: usrdb.update([(x[3:-2], x[:])]), filter(lambda x: x[-2] in [0,\n -1] and x[-1], result))\n", "map(lambda x: mudb.update([(x[3:-2], x[:])]), filter(lambda x: x[-2] not in\n [0, -1] and x[-1], result))\n", "map(usrdb.pop, filter(lambda key: key in mudb, usrdb.keys()))\n", "map(sysdb.pop, filter(lambda key: key in mudb or key in usrdb, sysdb.keys()))\n", "map(lambda res: self.add_phrase((res[0], phrase, -3 if usrdb[res][-2] == -1\n else 1, usrdb[res][-1] + 1), database='mudb'), usrdb.keys())\n", "map(lambda res: self.add_phrase((res[0], phrase, 2, 1), database='mudb'),\n sysdb.keys())\n", "map(lambda key: self.update_phrase((mudb[key][3], mudb[key][4], mudb[key][5\n ], mudb[key][6] + 1), database='mudb'), mudb.keys())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "return 'release test the %s-th submission for task %s (ID %d)' % (self.\n submission_num, self.task[1], self.task[0])\n" ]
[ "def describe(self):...\n", "return 'release test the %s-th submission for task %s (ID %d)' % (self.\n submission_num, self.task[1], self.task[0])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@web.authenticated...\n", "VAR_3 = self.contents_manager\n", "if VAR_3.is_hidden(VAR_1) and not VAR_3.allow_hidden:\n", "self.log.info('Refusing to serve hidden file, via 404 Error')\n", "VAR_1 = VAR_1.strip('/')\n", "if '/' in VAR_1:\n", "VAR_5, VAR_6 = VAR_1.rsplit('/', 1)\n", "VAR_6 = VAR_1\n", "VAR_4 = yield maybe_future(VAR_3.get(VAR_1, type='file', content=include_body))\n", "if self.get_argument('download', False):\n", "self.set_attachment_header(VAR_6)\n", "if VAR_6.lower().endswith('.ipynb'):\n", "self.set_header('Content-Type', 'application/x-ipynb+json')\n", "VAR_7 = mimetypes.guess_type(VAR_6)[0]\n", "if VAR_2:\n", "if VAR_7 == 'text/plain':\n", "if VAR_4['format'] == 'base64':\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "if VAR_7 is not None:\n", "VAR_8 = VAR_4['content'].encode('ascii')\n", "if VAR_4['format'] == 'json':\n", "self.set_header('Content-Type', VAR_7)\n", "if VAR_4['format'] == 'base64':\n", "self.write(decodebytes(VAR_8))\n", "self.write(json.dumps(VAR_4['content']))\n", "self.write(VAR_4['content'])\n", "self.set_header('Content-Type', 'application/octet-stream')\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "self.flush()\n" ]
[ "@web.authenticated...\n", "cm = self.contents_manager\n", "if cm.is_hidden(path) and not cm.allow_hidden:\n", "self.log.info('Refusing to serve hidden file, via 404 Error')\n", "path = path.strip('/')\n", "if '/' in path:\n", "_, name = path.rsplit('/', 1)\n", "name = path\n", "model = yield maybe_future(cm.get(path, type='file', content=include_body))\n", "if self.get_argument('download', False):\n", "self.set_attachment_header(name)\n", "if name.lower().endswith('.ipynb'):\n", "self.set_header('Content-Type', 'application/x-ipynb+json')\n", "cur_mime = mimetypes.guess_type(name)[0]\n", "if include_body:\n", "if cur_mime == 'text/plain':\n", "if model['format'] == 'base64':\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "if cur_mime is not None:\n", "b64_bytes = model['content'].encode('ascii')\n", "if model['format'] == 'json':\n", "self.set_header('Content-Type', cur_mime)\n", "if model['format'] == 'base64':\n", "self.write(decodebytes(b64_bytes))\n", "self.write(json.dumps(model['content']))\n", "self.write(model['content'])\n", "self.set_header('Content-Type', 'application/octet-stream')\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "self.flush()\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 ]
[ "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "For", "Expr'", "Condition", "Assign'", "For", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_33(self):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.norun = True\n", "return VAR_101\n" ]
[ "def norun(self):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.norun = True\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_9, VAR_28, VAR_19=None):...\n", "super(CLASS_3, self).__init__(VAR_9['command'], VAR_19)\n", "self.req = VAR_9\n", "self._result_getter = VAR_28\n" ]
[ "def __init__(self, req, result_getter, event=None):...\n", "super(AwaitableResponse, self).__init__(req['command'], event)\n", "self.req = req\n", "self._result_getter = result_getter\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_1, VAR_2=None):...\n", "if isinstance(VAR_1, CLASS_3):\n", "for attr in ('_r_item_', '_r_is_multi_item_', '_r_raise_'):\n", "self._r_item_ = VAR_1\n", "setattr(self, attr, getattr(VAR_1, attr))\n", "self._r_path_ = CLASS_1(VAR_1._r_item_, VAR_1._r_path_)\n", "self._r_path_ = CLASS_1(self._r_item_)\n", "if VAR_2 is not None:\n", "self._r_raise_ = bool(VAR_2)\n" ]
[ "def __init__(self, item, _raise=None):...\n", "if isinstance(item, Roamer):\n", "for attr in ('_r_item_', '_r_is_multi_item_', '_r_raise_'):\n", "self._r_item_ = item\n", "setattr(self, attr, getattr(item, attr))\n", "self._r_path_ = _Path(item._r_item_, item._r_path_)\n", "self._r_path_ = _Path(self._r_item_)\n", "if _raise is not None:\n", "self._r_raise_ = bool(_raise)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "For", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "@gallery.before_request...\n", "g.user = current_user\n" ]
[ "@gallery.before_request...\n", "g.user = current_user\n" ]
[ 0, 0 ]
[ "For", "Assign'" ]
[ "def FUNC_32(VAR_19):...\n", "return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n VAR_19)\n" ]
[ "def BuildExtraConfData(extra_conf_vim_data):...\n", "return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n extra_conf_vim_data)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __eq__(self, VAR_3):...\n", "if isinstance(VAR_3, CLASS_1):\n", "return hash(self) == hash(VAR_3)\n", "return False\n" ]
[ "def __eq__(self, other):...\n", "if isinstance(other, TraversalPath):\n", "return hash(self) == hash(other)\n", "return False\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_3(VAR_4=None):...\n", "if VAR_4 is None:\n", "VAR_13 = web.Application()\n", "VAR_13 = web.Application(VAR_4=loop)\n", "VAR_13.router.add_static('/images', VAR_3.STORAGE_DIR)\n", "VAR_13.router.add_static('/static', os.path.join(VAR_0, 'app'))\n", "VAR_13.router.add_route('GET', '/', FUNC_0)\n", "VAR_13.router.add_route('POST', '/save/', FUNC_1)\n", "return VAR_13\n" ]
[ "def create_app(loop=None):...\n", "if loop is None:\n", "app = web.Application()\n", "app = web.Application(loop=loop)\n", "app.router.add_static('/images', settings.STORAGE_DIR)\n", "app.router.add_static('/static', os.path.join(BASE_DIR, 'app'))\n", "app.router.add_route('GET', '/', homepage)\n", "app.router.add_route('POST', '/save/', save)\n", "return app\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_27(self):...\n", "VAR_16 = vimsupport.CurrentFiletypes()\n", "VAR_17 = self._user_options['filetype_specific_completion_to_disable']\n", "return not all([(x in VAR_17) for x in VAR_16])\n" ]
[ "def CurrentFiletypeCompletionEnabled(self):...\n", "filetypes = vimsupport.CurrentFiletypes()\n", "filetype_to_disable = self._user_options[\n 'filetype_specific_completion_to_disable']\n", "return not all([(x in filetype_to_disable) for x in filetypes])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "" ]
[ "@property...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "import logging\n", "import uuid\n", "from crochet import setup, wait_for\n", "from leap.common.events.server import ensure_server\n", "from twisted.internet import defer\n", "from pixelated.application import UserAgentMode\n", "from pixelated.config.site import PixelatedSite\n", "from test.support.dispatcher.proxy import Proxy\n", "from test.support.integration import AppTestClient\n", "from selenium import webdriver\n", "from pixelated.resources.features_resource import FeaturesResource\n", "from steps.common import *\n", "import os\n", "setup()\n", "@wait_for(timeout=5.0)...\n", "return VAR_0.start_client(VAR_1=mode)\n" ]
[ "import logging\n", "import uuid\n", "from crochet import setup, wait_for\n", "from leap.common.events.server import ensure_server\n", "from twisted.internet import defer\n", "from pixelated.application import UserAgentMode\n", "from pixelated.config.site import PixelatedSite\n", "from test.support.dispatcher.proxy import Proxy\n", "from test.support.integration import AppTestClient\n", "from selenium import webdriver\n", "from pixelated.resources.features_resource import FeaturesResource\n", "from steps.common import *\n", "import os\n", "setup()\n", "@wait_for(timeout=5.0)...\n", "return client.start_client(mode=mode)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Expr'", "For", "Return'" ]
[ "def FUNC_12(self):...\n", "return self._omnicomp\n" ]
[ "def GetOmniCompleter(self):...\n", "return self._omnicomp\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2(VAR_0, VAR_1):...\n", "VAR_5 = frappe.session.user\n", "VAR_6 = get_leave_allocation_records(VAR_0.to_date)\n", "VAR_7 = get_leave_allocation_records(VAR_0.from_date)\n", "VAR_8 = frappe.get_all('Employee', VAR_0={'status': 'Active', 'company':\n filters.company}, fields=['name', 'employee_name', 'department', 'user_id']\n )\n", "VAR_4 = []\n", "for employee in VAR_8:\n", "VAR_12 = FUNC_3(employee.department)\n", "return VAR_4\n", "if len(VAR_12) and VAR_5 in VAR_12 or VAR_5 in ['Administrator', employee.\n", "VAR_13 = [employee.name, employee.employee_name, employee.department]\n", "for leave_type in VAR_1:\n", "VAR_14 = get_approved_leaves_for_period(employee.name, leave_type, VAR_0.\n from_date, VAR_0.to_date)\n", "VAR_4.append(VAR_13)\n", "VAR_15 = get_leave_balance_on(employee.name, leave_type, VAR_0.from_date,\n VAR_7.get(employee.name, frappe._dict()))\n", "VAR_16 = get_leave_balance_on(employee.name, leave_type, VAR_0.to_date,\n VAR_6.get(employee.name, frappe._dict()))\n", "VAR_13 += [VAR_15, VAR_14, VAR_16]\n" ]
[ "def get_data(filters, leave_types):...\n", "user = frappe.session.user\n", "allocation_records_based_on_to_date = get_leave_allocation_records(filters.\n to_date)\n", "allocation_records_based_on_from_date = get_leave_allocation_records(filters\n .from_date)\n", "active_employees = frappe.get_all('Employee', filters={'status': 'Active',\n 'company': filters.company}, fields=['name', 'employee_name',\n 'department', 'user_id'])\n", "data = []\n", "for employee in active_employees:\n", "leave_approvers = get_approvers(employee.department)\n", "return data\n", "if len(leave_approvers) and user in leave_approvers or user in ['Administrator'\n", "row = [employee.name, employee.employee_name, employee.department]\n", "for leave_type in leave_types:\n", "leaves_taken = get_approved_leaves_for_period(employee.name, leave_type,\n filters.from_date, filters.to_date)\n", "data.append(row)\n", "opening = get_leave_balance_on(employee.name, leave_type, filters.from_date,\n allocation_records_based_on_from_date.get(employee.name, frappe._dict()))\n", "closing = get_leave_balance_on(employee.name, leave_type, filters.to_date,\n allocation_records_based_on_to_date.get(employee.name, frappe._dict()))\n", "row += [opening, leaves_taken, closing]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Assign'", "For", "Assign'", "Expr'", "Assign'", "Assign'", "AugAssign'" ]
[ "def FUNC_37(self, VAR_69):...\n", "if not_iterable(VAR_69):\n", "return flag(os.path.join(self.workdir, VAR_69), 'subworkflow', self)\n", "return [self.target(VAR_0) for VAR_0 in VAR_69]\n" ]
[ "def target(self, paths):...\n", "if not_iterable(paths):\n", "return flag(os.path.join(self.workdir, paths), 'subworkflow', self)\n", "return [self.target(path) for path in paths]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "from lib.core.agent import agent\n", "from lib.core.data import conf\n", "from lib.core.data import kb\n", "from lib.core.data import logger\n", "from lib.core.data import queries\n", "from lib.core.session import setUnion\n", "from lib.request.connect import Connect as Request\n", "def FUNC_0(VAR_0, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {}\n", "for count in range(0, 50):\n", "if kb.dbms == 'Oracle' and VAR_0.endswith(' FROM DUAL'):\n", "return None\n", "VAR_0 = VAR_0[:-len(' FROM DUAL')]\n", "if count:\n", "VAR_0 += ', NULL'\n", "if kb.dbms == 'Oracle':\n", "VAR_0 += ' FROM DUAL'\n", "VAR_5 = agent.postfixQuery(VAR_0, VAR_1)\n", "VAR_6 = agent.payload(newValue=commentedQuery)\n", "VAR_7 = Request.queryPage(VAR_6)\n", "if not VAR_7 in VAR_2.keys():\n", "VAR_2[VAR_7] = 1, VAR_5\n", "VAR_2[VAR_7] = VAR_2[VAR_7][0] + 1, VAR_5\n", "if count:\n", "for element in VAR_2.values():\n", "if element[0] == 1:\n", "if kb.injPlace == 'GET':\n", "VAR_4 = '%s?%s' % (conf.url, VAR_6)\n", "if kb.injPlace == 'POST':\n", "return VAR_4\n", "VAR_4 = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'Cookie':\n", "VAR_4 += \"\\nPOST:\\t'%s'\\n\" % VAR_6\n", "VAR_4 = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'User-Agent':\n", "VAR_4 += \"\\nCookie:\\t'%s'\\n\" % VAR_6\n", "VAR_4 = \"URL:\\t\\t'%s'\" % conf.url\n", "VAR_4 += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % VAR_6\n" ]
[ "\"\"\"\n$Id$\n\nThis file is part of the sqlmap project, http://sqlmap.sourceforge.net.\n\nCopyright (c) 2006-2008 Bernardo Damele A. G. <[email protected]>\n and Daniele Bellucci <[email protected]>\n\nsqlmap is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation version 2 of the License.\n\nsqlmap is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\nFOR A PARTICULAR PURPOSE. See the GNU General Public License for more\ndetails.\n\nYou should have received a copy of the GNU General Public License along\nwith sqlmap; if not, write to the Free Software Foundation, Inc., 51\nFranklin St, Fifth Floor, Boston, MA 02110-1301 USA\n\"\"\"\n", "from lib.core.agent import agent\n", "from lib.core.data import conf\n", "from lib.core.data import kb\n", "from lib.core.data import logger\n", "from lib.core.data import queries\n", "from lib.core.session import setUnion\n", "from lib.request.connect import Connect as Request\n", "def __effectiveUnionTest(query, comment):...\n", "\"\"\"docstring\"\"\"\n", "resultDict = {}\n", "for count in range(0, 50):\n", "if kb.dbms == 'Oracle' and query.endswith(' FROM DUAL'):\n", "return None\n", "query = query[:-len(' FROM DUAL')]\n", "if count:\n", "query += ', NULL'\n", "if kb.dbms == 'Oracle':\n", "query += ' FROM DUAL'\n", "commentedQuery = agent.postfixQuery(query, comment)\n", "payload = agent.payload(newValue=commentedQuery)\n", "newResult = Request.queryPage(payload)\n", "if not newResult in resultDict.keys():\n", "resultDict[newResult] = 1, commentedQuery\n", "resultDict[newResult] = resultDict[newResult][0] + 1, commentedQuery\n", "if count:\n", "for element in resultDict.values():\n", "if element[0] == 1:\n", "if kb.injPlace == 'GET':\n", "value = '%s?%s' % (conf.url, payload)\n", "if kb.injPlace == 'POST':\n", "return value\n", "value = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'Cookie':\n", "value += \"\\nPOST:\\t'%s'\\n\" % payload\n", "value = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'User-Agent':\n", "value += \"\\nCookie:\\t'%s'\\n\" % payload\n", "value = \"URL:\\t\\t'%s'\" % conf.url\n", "value += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % payload\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 2 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "For", "Condition", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Condition", "AugAssign'", "Assign'", "Condition", "AugAssign'", "Assign'", "AugAssign'" ]
[ "def FUNC_6(self, VAR_11):...\n", "self._portal = VAR_11\n" ]
[ "def set_portal(self, portal):...\n", "self._portal = portal\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "@defer.inlineCallbacks...\n", "self._initialize()\n", "self._mode = VAR_15\n", "self._test_account = CLASS_0(self.ACCOUNT, self._tmp_dir.name)\n", "yield self._test_account.start()\n", "self.cleanup = lambda : self._tmp_dir.dissolve()\n", "self.soledad = self._test_account.soledad\n", "self.search_engine = self._test_account.search_engine\n", "self.keymanager = self._test_account.keymanager\n", "self.mail_sender = self._test_account.mail_sender\n", "self.mail_store = self._test_account.mail_store\n", "self.attachment_store = self._test_account.attachment_store\n", "self.draft_service = self._test_account.draft_service\n", "self.leap_session = self._test_account.leap_session\n", "self.feedback_service = self._test_account.feedback_service\n", "self.mail_service = self._test_account.mail_service\n", "self.account = self._test_account.account\n", "if VAR_15.is_single_user:\n", "self.service_factory = SingleUserServicesFactory(VAR_15)\n", "self.service_factory = CLASS_2(self.accounts, VAR_15)\n", "VAR_79 = self._test_account.services\n", "VAR_80 = mock()\n", "self.service_factory.add_session('someuserid', VAR_79)\n", "VAR_80.config = LeapConfig(self._tmp_dir.name)\n", "self.resource = RootResource(self.service_factory)\n", "self.resource = set_up_protected_resources(RootResource(self.\n service_factory), VAR_80, self.service_factory, checker=StubSRPChecker(\n provider))\n", "self.resource.initialize()\n" ]
[ "@defer.inlineCallbacks...\n", "self._initialize()\n", "self._mode = mode\n", "self._test_account = AppTestAccount(self.ACCOUNT, self._tmp_dir.name)\n", "yield self._test_account.start()\n", "self.cleanup = lambda : self._tmp_dir.dissolve()\n", "self.soledad = self._test_account.soledad\n", "self.search_engine = self._test_account.search_engine\n", "self.keymanager = self._test_account.keymanager\n", "self.mail_sender = self._test_account.mail_sender\n", "self.mail_store = self._test_account.mail_store\n", "self.attachment_store = self._test_account.attachment_store\n", "self.draft_service = self._test_account.draft_service\n", "self.leap_session = self._test_account.leap_session\n", "self.feedback_service = self._test_account.feedback_service\n", "self.mail_service = self._test_account.mail_service\n", "self.account = self._test_account.account\n", "if mode.is_single_user:\n", "self.service_factory = SingleUserServicesFactory(mode)\n", "self.service_factory = StubServicesFactory(self.accounts, mode)\n", "services = self._test_account.services\n", "provider = mock()\n", "self.service_factory.add_session('someuserid', services)\n", "provider.config = LeapConfig(self._tmp_dir.name)\n", "self.resource = RootResource(self.service_factory)\n", "self.resource = set_up_protected_resources(RootResource(self.\n service_factory), provider, self.service_factory, checker=\n StubSRPChecker(provider))\n", "self.resource.initialize()\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 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_18(self):...\n", "VAR_13 = ['Line1 passed', 'Line1 failed']\n", "VAR_14 = ['Line1', 'Line2']\n", "VAR_15 = [' passed', None]\n", "self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[0]), VAR_15[0])\n", "self.assertEqual(self.driver._get_prefixed_value(VAR_13, VAR_14[1]), VAR_15[1])\n" ]
[ "def test_get_prefixed_value(self):...\n", "lines = ['Line1 passed', 'Line1 failed']\n", "prefix = ['Line1', 'Line2']\n", "expected_output = [' passed', None]\n", "self.assertEqual(self.driver._get_prefixed_value(lines, prefix[0]),\n expected_output[0])\n", "self.assertEqual(self.driver._get_prefixed_value(lines, prefix[1]),\n expected_output[1])\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2():...\n", "VAR_9 = MySQLdb.connect('localhost', 'root', os.environ['PASSWORD'], 'test')\n", "return VAR_9\n" ]
[ "def connect_to_database():...\n", "db = MySQLdb.connect('localhost', 'root', os.environ['PASSWORD'], 'test')\n", "return db\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@VAR_0.filter...\n", "return Submission.STATUS[VAR_6]\n" ]
[ "@register.filter...\n", "return Submission.STATUS[status]\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_34(VAR_25):...\n", "VAR_24 = os.environ.get(VAR_25)\n", "return self.Location.from_home(VAR_24) if VAR_24 else None\n" ]
[ "def env_home(home_env_var):...\n", "home = os.environ.get(home_env_var)\n", "return self.Location.from_home(home) if home else None\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "from base import Field\n", "VAR_0 = 'BOOL'\n", "def __init__(self, *VAR_1, **VAR_2):...\n", "super(CLASS_0, self).__init__(*VAR_1, **kwargs)\n", "def FUNC_0(self, VAR_3):...\n", "VAR_5 = '%s bool' % str(VAR_3)\n", "return VAR_5\n" ]
[ "from base import Field\n", "TYPE = 'BOOL'\n", "def __init__(self, *args, **kwargs):...\n", "super(BooleanField, self).__init__(*args, **kwargs)\n", "def create_field(self, name):...\n", "field_string = '%s bool' % str(name)\n", "return field_string\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_7(self):...\n", "super(CLASS_0, self).validate()\n", "if not self.blog_intro:\n", "self.blog_intro = self.content[:140]\n", "if self.blog_intro:\n", "self.blog_intro = strip_html_tags(self.blog_intro)\n", "self.blog_intro = self.blog_intro[:140]\n", "if self.published and not self.published_on:\n", "self.published_on = today()\n", "frappe.db.sql('string', (self.blogger,))\n" ]
[ "def validate(self):...\n", "super(BlogPost, self).validate()\n", "if not self.blog_intro:\n", "self.blog_intro = self.content[:140]\n", "if self.blog_intro:\n", "self.blog_intro = strip_html_tags(self.blog_intro)\n", "self.blog_intro = self.blog_intro[:140]\n", "if self.published and not self.published_on:\n", "self.published_on = today()\n", "frappe.db.sql(\n \"\"\"update tabBlogger set posts=(select count(*) from `tabBlog Post`\n\t\t\twhere ifnull(blogger,'')=tabBlogger.name)\n\t\t\twhere name=%s\"\"\"\n , (self.blogger,))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_23(VAR_11):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ "def _fake_recv(ignore_arg):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from django.forms import SelectMultiple, Textarea\n", "import django_filters\n", "from re import split\n", "from .models import event, injection, result, simics_register_diff\n", "def FUNC_0(VAR_0):...\n", "return ''.join([(text.zfill(5) if text.isdigit() else text.lower()) for\n text in split('([0-9]+)', str(VAR_0))])\n" ]
[ "from django.forms import SelectMultiple, Textarea\n", "import django_filters\n", "from re import split\n", "from .models import event, injection, result, simics_register_diff\n", "def fix_sort(string):...\n", "return ''.join([(text.zfill(5) if text.isdigit() else text.lower()) for\n text in split('([0-9]+)', str(string))])\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Return'" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "VAR_0 = [('notification', '0002_auto_20160912_1341')]\n", "VAR_1 = [migrations.AlterField(model_name='notification', name='submission',\n field=models.ForeignKey(blank=True, related_name='notifications', null=\n True, to='exercise.Submission'), preserve_default=True)]\n" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "dependencies = [('notification', '0002_auto_20160912_1341')]\n", "operations = [migrations.AlterField(model_name='notification', name=\n 'submission', field=models.ForeignKey(blank=True, related_name=\n 'notifications', null=True, to='exercise.Submission'), preserve_default\n =True)]\n" ]
[ 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'" ]
[ "def FUNC_7(self, VAR_8, VAR_9):...\n", "VAR_14 = False\n", "while not VAR_14:\n", "VAR_24 = VAR_8.value\n", "if VAR_24:\n", "VAR_8.value -= 1\n", "self.create_result()\n", "if VAR_9:\n", "VAR_25 = 'campaign-data/' + str(self.campaign_data['id']) + '/results/' + str(\n self.result_data['id'])\n", "if self.campaign_data['use_aux']:\n", "os.makedirs(VAR_25)\n", "self.debugger.aux.write('./' + self.campaign_data['aux_command'] + '\\n')\n", "self.debugger.dut.write('./' + self.campaign_data['command'] + '\\n')\n", "VAR_26 = open(VAR_25 + '/capture.pcap', 'w')\n", "self.result_data['outcome'], self.result_data['outcome_category'\n ] = self.__monitor_execution()\n", "if self.campaign_data['use_simics']:\n", "self.log_result()\n", "VAR_27 = Popen(['ssh', 'p2020', 'tshark -F pcap -i eth1 -w -'], stderr=PIPE,\n stdout=capture_file)\n", "self.debugger.continue_dut()\n", "self.debugger.dut.serial.write('\\x03')\n", "if VAR_9:\n", "VAR_21 = ''\n", "self.debugger.dut.read_until()\n", "os.system(\"ssh p2020 'killall tshark'\")\n", "while True:\n", "if self.campaign_data['use_aux']:\n", "VAR_27.wait()\n", "VAR_21 += VAR_27.stderr.read(1)\n", "self.debugger.aux.serial.write('\\x03')\n", "self.result_data.update({'outcome_category': 'Incomplete', 'outcome':\n 'Interrupted'})\n", "VAR_26.close()\n", "if VAR_21[-len(\"Capturing on 'eth1'\"):] == \"Capturing on 'eth1'\":\n", "self.debugger.aux.read_until()\n", "VAR_14 = True\n" ]
[ "def supervise(self, iteration_counter, packet_capture):...\n", "interrupted = False\n", "while not interrupted:\n", "iteration = iteration_counter.value\n", "if iteration:\n", "iteration_counter.value -= 1\n", "self.create_result()\n", "if packet_capture:\n", "data_dir = 'campaign-data/' + str(self.campaign_data['id']\n ) + '/results/' + str(self.result_data['id'])\n", "if self.campaign_data['use_aux']:\n", "os.makedirs(data_dir)\n", "self.debugger.aux.write('./' + self.campaign_data['aux_command'] + '\\n')\n", "self.debugger.dut.write('./' + self.campaign_data['command'] + '\\n')\n", "capture_file = open(data_dir + '/capture.pcap', 'w')\n", "self.result_data['outcome'], self.result_data['outcome_category'\n ] = self.__monitor_execution()\n", "if self.campaign_data['use_simics']:\n", "self.log_result()\n", "capture_process = Popen(['ssh', 'p2020', 'tshark -F pcap -i eth1 -w -'],\n stderr=PIPE, stdout=capture_file)\n", "self.debugger.continue_dut()\n", "self.debugger.dut.serial.write('\\x03')\n", "if packet_capture:\n", "buff = ''\n", "self.debugger.dut.read_until()\n", "os.system(\"ssh p2020 'killall tshark'\")\n", "while True:\n", "if self.campaign_data['use_aux']:\n", "capture_process.wait()\n", "buff += capture_process.stderr.read(1)\n", "self.debugger.aux.serial.write('\\x03')\n", "self.result_data.update({'outcome_category': 'Incomplete', 'outcome':\n 'Interrupted'})\n", "capture_file.close()\n", "if buff[-len(\"Capturing on 'eth1'\"):] == \"Capturing on 'eth1'\":\n", "self.debugger.aux.read_until()\n", "interrupted = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "AugAssign'", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "AugAssign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_0(self):...\n", "return {'user_id': self.user_id, 'username': self.username}\n" ]
[ "def to_dict(self):...\n", "return {'user_id': self.user_id, 'username': self.username}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return VAR_14(VAR_4=None, VAR_5=bin_path)\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "return cls(home_path=None, bin_path=bin_path)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(self):...\n", "VAR_3 = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "VAR_4 = db.GqlQuery('SELECT * FROM LoginInformation WHERE user_id = :1',\n VAR_3.created_by_id).get()\n", "database.render_template(self, 'items/view_item.html', {'item': VAR_3, 'li':\n VAR_4})\n" ]
[ "def get(self):...\n", "item = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "li = db.GqlQuery('SELECT * FROM LoginInformation WHERE user_id = :1', item.\n created_by_id).get()\n", "database.render_template(self, 'items/view_item.html', {'item': item, 'li': li}\n )\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_10):...\n", "return '%s%s' % (self.configuration.iscsi_target_prefix, VAR_10['name'])\n" ]
[ "def _build_iscsi_target_name(self, volume):...\n", "return '%s%s' % (self.configuration.iscsi_target_prefix, volume['name'])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import logging\n", "from django import template\n", "from apps.app_renderers import build_plugin_renderers\n", "from course.models import CourseInstance\n", "from exercise.exercise_models import BaseExercise\n", "from exercise.submission_models import Submission\n", "VAR_0 = logging.getLogger('aplus.apps')\n", "VAR_1 = template.Library()\n", "@VAR_1.assignment_tag...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = VAR_2.userprofile if VAR_2.is_authenticated() else None\n", "if isinstance(VAR_3, CourseInstance):\n", "return build_plugin_renderers(VAR_3.plugins.all(), VAR_4 or\n 'course_instance', user_profile=profile, VAR_6=some_model)\n", "if isinstance(VAR_3, BaseExercise):\n", "VAR_6 = VAR_3.course_instance\n", "if isinstance(VAR_3, Submission):\n", "return build_plugin_renderers(VAR_6.plugins.all(), VAR_4 or 'exercise',\n user_profile=profile, exercise=some_model, VAR_6=course_instance)\n", "VAR_6 = VAR_3.exercise.course_instance\n", "VAR_0.warn('Unrecognized model type received for plugin_renderers tag: {}'.\n format(str(type(VAR_3))))\n", "return build_plugin_renderers(VAR_6.plugins.all(), VAR_4 or 'submission',\n user_profile=profile, submission=some_model, exercise=some_model.\n exercise, VAR_6=course_instance)\n", "return []\n" ]
[ "import logging\n", "from django import template\n", "from apps.app_renderers import build_plugin_renderers\n", "from course.models import CourseInstance\n", "from exercise.exercise_models import BaseExercise\n", "from exercise.submission_models import Submission\n", "logger = logging.getLogger('aplus.apps')\n", "register = template.Library()\n", "@register.assignment_tag...\n", "\"\"\"docstring\"\"\"\n", "profile = user.userprofile if user.is_authenticated() else None\n", "if isinstance(some_model, CourseInstance):\n", "return build_plugin_renderers(some_model.plugins.all(), view_name or\n 'course_instance', user_profile=profile, course_instance=some_model)\n", "if isinstance(some_model, BaseExercise):\n", "course_instance = some_model.course_instance\n", "if isinstance(some_model, Submission):\n", "return build_plugin_renderers(course_instance.plugins.all(), view_name or\n 'exercise', user_profile=profile, exercise=some_model, course_instance=\n course_instance)\n", "course_instance = some_model.exercise.course_instance\n", "logger.warn('Unrecognized model type received for plugin_renderers tag: {}'\n .format(str(type(some_model))))\n", "return build_plugin_renderers(course_instance.plugins.all(), view_name or\n 'submission', user_profile=profile, submission=some_model, exercise=\n some_model.exercise, course_instance=course_instance)\n", "return []\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Condition", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_0, VAR_1):...\n", "self.object_list = self.get_queryset(VAR_0, VAR_1)\n", "VAR_14 = self.get_context_data()\n", "return render(VAR_0, 'threat_hunter/event_list.html', VAR_14)\n" ]
[ "def get(self, request, pk):...\n", "self.object_list = self.get_queryset(request, pk)\n", "context = self.get_context_data()\n", "return render(request, 'threat_hunter/event_list.html', context)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_0() ->tornado.web.Application:...\n", "return tornado.web.Application([('/', CLASS_2), ('/\\\\+(.*)', CLASS_2), (\n '/show/(.*)', CLASS_3), ('/raw/(.*)', CLASS_4), ('/remove/(.*)',\n CLASS_5), ('/static/(.*)', tornado.web.StaticFileHandler, {'path': path\n .static})], template_path=path.template, session_factory=database.\n session_factory)\n" ]
[ "def make_application() ->tornado.web.Application:...\n", "return tornado.web.Application([('/', CreatePaste), ('/\\\\+(.*)',\n CreatePaste), ('/show/(.*)', ShowPaste), ('/raw/(.*)', RawPaste), (\n '/remove/(.*)', RemovePaste), ('/static/(.*)', tornado.web.\n StaticFileHandler, {'path': path.static})], template_path=path.template,\n session_factory=database.session_factory)\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_7(self):...\n", "self.cursor.execute('SELECT * FROM log_result WHERE campaign_id=?', [self.\n campaign['id']])\n", "return self.cursor.fetchall()\n" ]
[ "def get_result(self):...\n", "self.cursor.execute('SELECT * FROM log_result WHERE campaign_id=?', [self.\n campaign['id']])\n", "return self.cursor.fetchall()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "@cached_property...\n", "\"\"\"docstring\"\"\"\n", "return self.fields + self.virtual_fields\n" ]
[ "@cached_property...\n", "\"\"\"docstring\"\"\"\n", "return self.fields + self.virtual_fields\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_1(self, VAR_2):...\n", "for VAR_6 in self.actors.keys():\n", "if not self.actors[VAR_6].noclip:\n", "VAR_7, VAR_8 = self.actors[VAR_6].getPos()\n", "assert VAR_2[VAR_7][VAR_8].isTraversable(), 'Actor not within traversable unit'\n", "VAR_16 = self.actors[VAR_6].getColliding()\n", "if VECTOR_RIGHT in VAR_16:\n", "if not VAR_2[(VAR_7 + 1) % len(VAR_2)][VAR_8].isTraversable():\n", "if VECTOR_LEFT in VAR_16:\n", "self.actors[VAR_6].resetSubx()\n", "if not VAR_2[(VAR_7 - 1) % len(VAR_2)][VAR_8].isTraversable():\n", "if VECTOR_UP in VAR_16:\n", "self.actors[VAR_6].resetSubx()\n", "if not VAR_2[VAR_7][(VAR_8 + 1) % len(VAR_2[0])].isTraversable():\n", "if VECTOR_DOWN in VAR_16:\n", "self.actors[VAR_6].resetSuby()\n", "if not VAR_2[VAR_7][(VAR_8 - 1) % len(VAR_2[0])].isTraversable():\n", "self.actors[VAR_6].resetSuby()\n" ]
[ "def boundIDbyBoard(self, board):...\n", "for ID in self.actors.keys():\n", "if not self.actors[ID].noclip:\n", "x, y = self.actors[ID].getPos()\n", "assert board[x][y].isTraversable(), 'Actor not within traversable unit'\n", "vecs = self.actors[ID].getColliding()\n", "if VECTOR_RIGHT in vecs:\n", "if not board[(x + 1) % len(board)][y].isTraversable():\n", "if VECTOR_LEFT in vecs:\n", "self.actors[ID].resetSubx()\n", "if not board[(x - 1) % len(board)][y].isTraversable():\n", "if VECTOR_UP in vecs:\n", "self.actors[ID].resetSubx()\n", "if not board[x][(y + 1) % len(board[0])].isTraversable():\n", "if VECTOR_DOWN in vecs:\n", "self.actors[ID].resetSuby()\n", "if not board[x][(y - 1) % len(board[0])].isTraversable():\n", "self.actors[ID].resetSuby()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Assert'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Expr'" ]
[ "@VAR_0.filter...\n", "VAR_6 = None\n", "if ',' in VAR_2:\n", "VAR_2, VAR_6 = VAR_2.split(',', 1)\n", "if isinstance(VAR_4, CourseInstance):\n", "return reverse('model-create', VAR_5=_normal_kwargs(model_object, model_name))\n", "if VAR_6:\n", "return reverse('model-create-type-for', VAR_5=_normal_kwargs(model_object.\n course_instance, model_name, parent_id=model_object.id, type=type_name))\n", "return reverse('model-create-for', VAR_5=_normal_kwargs(model_object.\n course_instance, model_name, parent_id=model_object.id))\n" ]
[ "@register.filter...\n", "type_name = None\n", "if ',' in model_name:\n", "model_name, type_name = model_name.split(',', 1)\n", "if isinstance(model_object, CourseInstance):\n", "return reverse('model-create', kwargs=_normal_kwargs(model_object, model_name))\n", "if type_name:\n", "return reverse('model-create-type-for', kwargs=_normal_kwargs(model_object.\n course_instance, model_name, parent_id=model_object.id, type=type_name))\n", "return reverse('model-create-for', kwargs=_normal_kwargs(model_object.\n course_instance, model_name, parent_id=model_object.id))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = self.redirect_url\n", "if is_authenticated(VAR_1.user):\n", "VAR_13 = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n", "return HttpResponseRedirect(VAR_12)\n", "if VAR_13:\n", "VAR_12 = import_string(VAR_13)()\n", "auth.logout(VAR_1)\n" ]
[ "def post(self, request):...\n", "\"\"\"docstring\"\"\"\n", "logout_url = self.redirect_url\n", "if is_authenticated(request.user):\n", "logout_from_op = import_from_settings('OIDC_OP_LOGOUT_URL_METHOD', '')\n", "return HttpResponseRedirect(logout_url)\n", "if logout_from_op:\n", "logout_url = import_string(logout_from_op)()\n", "auth.logout(request)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "self.tables = ['`tab' + self.doctype + '`']\n", "if self.fields:\n", "for VAR_34 in self.fields:\n", "if not ('tab' in VAR_34 and '.' in VAR_34\n", "VAR_32 = VAR_34.split('.')[0]\n", "if VAR_32.lower().startswith('group_concat('):\n", "VAR_32 = VAR_32[13:]\n", "if VAR_32.lower().startswith('ifnull('):\n", "VAR_32 = VAR_32[7:]\n", "if not VAR_32[0] == '`':\n", "VAR_32 = '`' + VAR_32 + '`'\n", "if not VAR_32 in self.tables:\n", "self.append_table(VAR_32)\n" ]
[ "def extract_tables(self):...\n", "\"\"\"docstring\"\"\"\n", "self.tables = ['`tab' + self.doctype + '`']\n", "if self.fields:\n", "for f in self.fields:\n", "if not ('tab' in f and '.' in f) or 'locate(' in f or 'count(' in f:\n", "table_name = f.split('.')[0]\n", "if table_name.lower().startswith('group_concat('):\n", "table_name = table_name[13:]\n", "if table_name.lower().startswith('ifnull('):\n", "table_name = table_name[7:]\n", "if not table_name[0] == '`':\n", "table_name = '`' + table_name + '`'\n", "if not table_name in self.tables:\n", "self.append_table(table_name)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Expr'" ]
[ "import sqlite3\n", "import os\n", "import random\n", "import matplotlib.pyplot as plt\n", "VAR_0 = ['math', 'strings', 'trees', 'graphs', 'dp', 'greedy', 'geometry',\n 'combinatorics']\n", "VAR_1 = ['A', 'B', 'C', 'D', 'E', 'F']\n", "def FUNC_0(VAR_2, VAR_3):...\n", "VAR_4 = list()\n", "VAR_5 = list()\n", "VAR_6 = list()\n", "def FUNC_4(VAR_2):...\n", "VAR_8 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) +\n '\\\\users\\\\' + VAR_3 + '.db')\n", "VAR_9 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n", "VAR_10 = VAR_8.cursor()\n", "VAR_11 = VAR_9.cursor()\n", "VAR_11.execute('SELECT * FROM ' + VAR_2)\n", "VAR_18 = list()\n", "VAR_12 = VAR_11.fetchone()\n", "while VAR_12 != None:\n", "VAR_10.execute(\"SELECT * FROM result WHERE problem = '\" + str(VAR_12[0]) +\n \"' AND diff = '\" + str(VAR_12[1]) + \"' AND NOT verdict = 'OK'\")\n", "VAR_8.close()\n", "VAR_30 = VAR_10.fetchone()\n", "VAR_9.close()\n", "if VAR_30 != None and VAR_30 in VAR_4:\n", "return VAR_18\n", "VAR_18.append(VAR_30)\n", "VAR_12 = VAR_11.fetchone()\n" ]
[ "import sqlite3\n", "import os\n", "import random\n", "import matplotlib.pyplot as plt\n", "available_tags = ['math', 'strings', 'trees', 'graphs', 'dp', 'greedy',\n 'geometry', 'combinatorics']\n", "available_diff = ['A', 'B', 'C', 'D', 'E', 'F']\n", "def get_unsolved_problem(tag, username):...\n", "tasks = list()\n", "list_of_current_tags = list()\n", "list_of_current_diff = list()\n", "def find_intersection(tag):...\n", "conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) +\n '\\\\users\\\\' + username + '.db')\n", "conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n", "cursor = conn.cursor()\n", "cursor2 = conn2.cursor()\n", "cursor2.execute('SELECT * FROM ' + tag)\n", "a = list()\n", "problem_and_diff = cursor2.fetchone()\n", "while problem_and_diff != None:\n", "cursor.execute(\"SELECT * FROM result WHERE problem = '\" + str(\n problem_and_diff[0]) + \"' AND diff = '\" + str(problem_and_diff[1]) +\n \"' AND NOT verdict = 'OK'\")\n", "conn.close()\n", "problem_and_diff_and_ok = cursor.fetchone()\n", "conn2.close()\n", "if problem_and_diff_and_ok != None and problem_and_diff_and_ok in tasks:\n", "return a\n", "a.append(problem_and_diff_and_ok)\n", "problem_and_diff = cursor2.fetchone()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "@VAR_0.route('/delete_selection', methods=['POST'])...\n", "VAR_1 = get_dataset_with_id(request.args.get('dataset_id'))\n", "VAR_6 = request.form.getlist('data_id')\n", "VAR_7 = table_name_to_object(VAR_1.working_copy)\n", "for data in VAR_6:\n", "VAR_7.delete(VAR_7.c.index == data).execute()\n", "create_action('deleted selected items', VAR_1.id, current_user.id)\n", "return redirect(request.referrer)\n" ]
[ "@_transform.route('/delete_selection', methods=['POST'])...\n", "dataset = get_dataset_with_id(request.args.get('dataset_id'))\n", "selected_data = request.form.getlist('data_id')\n", "table = table_name_to_object(dataset.working_copy)\n", "for data in selected_data:\n", "table.delete(table.c.index == data).execute()\n", "create_action('deleted selected items', dataset.id, current_user.id)\n", "return redirect(request.referrer)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Expr'", "Return'" ]