lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_1(VAR_0, VAR_1):...\n", "" ]
[ "def delete_attribute(table_name, column):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_3(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "FUNC_1(VAR_0)\n", "os.chdir(VAR_0.folderName)\n", "FUNC_4(VAR_0)\n" ]
[ "def post_folder(args):...\n", "\"\"\"docstring\"\"\"\n", "get_folder_data(args)\n", "os.chdir(args.folderName)\n", "post_ad(args)\n" ]
[ 0, 0, 0, 5, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self):...\n", "self.authomatic_config = {'google': {'class_': oauth2.Google,\n 'consumer_key': app.config['GOOGLE_OAUTH_CLIENT_ID'], 'consumer_secret':\n app.config['GOOGLE_OAUTH_CONSUMER_SECRET'], 'scope': ['profile', 'email']}}\n", "self.authomatic = Authomatic(self.authomatic_config, app.config[\n 'AUTHOMATIC_SALT'])\n" ]
[ "def __init__(self):...\n", "self.authomatic_config = {'google': {'class_': oauth2.Google,\n 'consumer_key': app.config['GOOGLE_OAUTH_CLIENT_ID'], 'consumer_secret':\n app.config['GOOGLE_OAUTH_CONSUMER_SECRET'], 'scope': ['profile', 'email']}}\n", "self.authomatic = Authomatic(self.authomatic_config, app.config[\n 'AUTHOMATIC_SALT'])\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "@staticmethod...\n", "def FUNC_14(VAR_7):...\n", "def FUNC_13(self, *VAR_16, **VAR_10):...\n", "if not self.is_group_user(VAR_8):\n", "return VAR_7(self, *VAR_16, **kwargs)\n" ]
[ "@staticmethod...\n", "def decorator(method):...\n", "def wrapper(self, *args, **kwargs):...\n", "if not self.is_group_user(group):\n", "return method(self, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "FunctionDef'", "FunctionDef'", "Condition", "Return'" ]
[ "def FUNC_6(self, VAR_21):...\n", "if VAR_21:\n", "VAR_106 = int(VAR_21, 36)\n", "if self.redirect:\n", "return Link._byID(VAR_106, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ "def run(self, link_id):...\n", "if link_id:\n", "aid = int(link_id, 36)\n", "if self.redirect:\n", "return Link._byID(aid, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_17(VAR_16):...\n", "return VAR_19(VAR_16, 'touch')\n" ]
[ "def touch(value):...\n", "return flag(value, 'touch')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_18(self):...\n", "VAR_26 = []\n", "def FUNC_25(VAR_14, VAR_27, VAR_28):...\n", "VAR_26.append((VAR_14, VAR_27.splitlines()[0], VAR_28))\n", "self.mock(bot_main, 'post_error_task', FUNC_25)\n", "def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n", "if VAR_23 == 'on_after_task':\n", "VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n", "self.mock(bot_main, 'call_hook', FUNC_24)\n", "self.assertEqual(False, VAR_50)\n", "def FUNC_26(*VAR_29, **VAR_30):...\n", "self.assertEqual(True, VAR_51)\n", "self.mock(subprocess42, 'Popen', FUNC_26)\n", "self.assertEqual({'pool': 'default'}, VAR_5)\n", "VAR_19 = {'command': ['echo', 'hi'], 'dimensions': {'pool': 'default'},\n 'grace_period': 30, 'hard_timeout': 60, 'task_id': '24'}\n", "self.assertEqual({}, VAR_52)\n", "bot_main.run_manifest(self.bot, VAR_19, time.time())\n", "VAR_6 = [(self.bot, 'Internal exception occured: Dang', '24')]\n", "self.assertEqual(VAR_6, VAR_26)\n" ]
[ "def test_run_manifest_exception(self):...\n", "posted = []\n", "def post_error_task(botobj, msg, task_id):...\n", "posted.append((botobj, msg.splitlines()[0], task_id))\n", "self.mock(bot_main, 'post_error_task', post_error_task)\n", "def call_hook(_botobj, name, *args):...\n", "if name == 'on_after_task':\n", "failure, internal_failure, dimensions, summary = args\n", "self.mock(bot_main, 'call_hook', call_hook)\n", "self.assertEqual(False, failure)\n", "def raiseOSError(*_a, **_k):...\n", "self.assertEqual(True, internal_failure)\n", "self.mock(subprocess42, 'Popen', raiseOSError)\n", "self.assertEqual({'pool': 'default'}, dimensions)\n", "manifest = {'command': ['echo', 'hi'], 'dimensions': {'pool': 'default'},\n 'grace_period': 30, 'hard_timeout': 60, 'task_id': '24'}\n", "self.assertEqual({}, summary)\n", "bot_main.run_manifest(self.bot, manifest, time.time())\n", "expected = [(self.bot, 'Internal exception occured: Dang', '24')]\n", "self.assertEqual(expected, posted)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(self):...\n", "self.win = Toplevel()\n", "self.win.title = 'Input JIRA Login'\n", "self.username_static_text = Label(self.win, text='Username:')\n", "self.username_static_text.grid(column=0, row=0, sticky='E')\n", "self.username_field = Entry(self.win)\n", "self.username_field.configure(background=self.colorGreyBackground,\n foreground=self.colorWhiteText)\n", "self.username_field.grid(column=1, row=0, sticky='W')\n", "self.password_static_text = Label(self.win, text='Password:')\n", "self.password_static_text.grid(column=0, row=1, sticky='E')\n", "self.password_field = Entry(self.win, show='*')\n", "self.password_field.configure(background=self.colorGreyBackground,\n foreground=self.colorWhiteText)\n", "self.password_field.grid(column=1, row=1, sticky='W')\n", "self.submit_button = Button(self.win, text='Save Credentials', command=self\n .setLoginInfo)\n", "self.submit_button.grid(column=1, row=2, columnspan=2)\n" ]
[ "def setCredentials(self):...\n", "self.win = Toplevel()\n", "self.win.title = 'Input JIRA Login'\n", "self.username_static_text = Label(self.win, text='Username:')\n", "self.username_static_text.grid(column=0, row=0, sticky='E')\n", "self.username_field = Entry(self.win)\n", "self.username_field.configure(background=self.colorGreyBackground,\n foreground=self.colorWhiteText)\n", "self.username_field.grid(column=1, row=0, sticky='W')\n", "self.password_static_text = Label(self.win, text='Password:')\n", "self.password_static_text.grid(column=0, row=1, sticky='E')\n", "self.password_field = Entry(self.win, show='*')\n", "self.password_field.configure(background=self.colorGreyBackground,\n foreground=self.colorWhiteText)\n", "self.password_field.grid(column=1, row=1, sticky='W')\n", "self.submit_button = Button(self.win, text='Save Credentials', command=self\n .setLoginInfo)\n", "self.submit_button.grid(column=1, row=2, columnspan=2)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "from lxml import etree\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder.volume.drivers.san.san import SanISCSIDriver\n", "VAR_0 = logging.getLogger(__name__)\n", "\"\"\"string\"\"\"\n", "VAR_1 = {}\n", "def __init__(self, *VAR_2, **VAR_3):...\n", "super(CLASS_0, self).__init__(*VAR_2, **kwargs)\n", "self.cluster_vip = None\n", "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" ]
[ "\"\"\"\nHP Lefthand SAN ISCSI Driver.\n\nThe driver communicates to the backend aka Cliq via SSH to perform all the\noperations on the SAN.\n\"\"\"\n", "from lxml import etree\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder.volume.drivers.san.san import SanISCSIDriver\n", "LOG = logging.getLogger(__name__)\n", "\"\"\"Executes commands relating to HP/Lefthand SAN ISCSI volumes.\n\n We use the CLIQ interface, over SSH.\n\n Rough overview of CLIQ commands used:\n\n :createVolume: (creates the volume)\n\n :getVolumeInfo: (to discover the IQN etc)\n\n :getClusterInfo: (to discover the iSCSI target IP address)\n\n :assignVolumeChap: (exports it with CHAP security)\n\n The 'trick' here is that the HP SAN enforces security by default, so\n normally a volume mount would need both to configure the SAN in the volume\n layer and do the mount on the compute layer. Multi-layer operations are\n not catered for at the moment in the cinder architecture, so instead we\n share the volume using CHAP at volume creation time. Then the mount need\n only use those CHAP credentials, so can take place exclusively in the\n compute layer.\n \"\"\"\n", "device_stats = {}\n", "def __init__(self, *args, **kwargs):...\n", "super(HpSanISCSIDriver, self).__init__(*args, **kwargs)\n", "self.cluster_vip = None\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_3(self, VAR_9):...\n", "VAR_23 = super().get_transform(VAR_9)\n", "if VAR_23:\n", "return VAR_23\n", "return CLASS_13(VAR_9)\n" ]
[ "def get_transform(self, name):...\n", "transform = super().get_transform(name)\n", "if transform:\n", "return transform\n", "return KeyTransformFactory(name)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_2(VAR_4, VAR_5, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = [TranslationMemoryEntry(source=t.entity.string, target=t.string,\n VAR_2=locale, entity=t.entity, translation=t, VAR_5=project) for t in\n Translation.objects.filter(pk__in=changed_translation_pks).\n prefetch_related('entity__resource')]\n", "TranslationMemoryEntry.objects.bulk_create(VAR_10)\n" ]
[ "def update_translation_memory(changed_translation_pks, project, locale):...\n", "\"\"\"docstring\"\"\"\n", "memory_entries = [TranslationMemoryEntry(source=t.entity.string, target=t.\n string, locale=locale, entity=t.entity, translation=t, project=project) for\n t in Translation.objects.filter(pk__in=changed_translation_pks).\n prefetch_related('entity__resource')]\n", "TranslationMemoryEntry.objects.bulk_create(memory_entries)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_3(VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7):...\n", "VAR_11, VAR_10 = FUNC_1()\n", "VAR_12 = FUNC_0()\n", "VAR_11.execute(\"INSERT INTO npc VALUES ('\" + VAR_12 + \"','\" + str(VAR_1) +\n \"','\" + VAR_2 + \"','\" + VAR_3 + \"','\" + VAR_4 + \"','\" + str(VAR_5) +\n \"','\" + VAR_6 + \"','\" + str(VAR_7) + \"')\")\n", "VAR_10.commit()\n", "VAR_10.close()\n" ]
[ "def insertNPC(name, race, classe, sex, level, image, legit):...\n", "c, conn = getConnection()\n", "date = now()\n", "c.execute(\"INSERT INTO npc VALUES ('\" + date + \"','\" + str(name) + \"','\" +\n race + \"','\" + classe + \"','\" + sex + \"','\" + str(level) + \"','\" +\n image + \"','\" + str(legit) + \"')\")\n", "conn.commit()\n", "conn.close()\n" ]
[ 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self):...\n", "if self._IsServerAlive():\n", "self._server_popen.terminate()\n", "utils.RemoveIfExists(self._temp_options_filename)\n" ]
[ "def _ServerCleanup(self):...\n", "if self._IsServerAlive():\n", "self._server_popen.terminate()\n", "utils.RemoveIfExists(self._temp_options_filename)\n" ]
[ 0, 0, 0, 7 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'" ]
[ "@tornado.gen.coroutine...\n", "VAR_17 = 'SELECT {} FROM users WHERE email = %s'.format(VAR_6)\n", "VAR_18 = VAR_15\n", "VAR_19 = yield VAR_1.execute(query=sql, VAR_18=params)\n", "return VAR_19.fetchone()\n" ]
[ "@tornado.gen.coroutine...\n", "sql = 'SELECT {} FROM users WHERE email = %s'.format(cols)\n", "params = email\n", "cursor = yield tx.execute(query=sql, params=params)\n", "return cursor.fetchone()\n" ]
[ 0, 0, 4, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_13(VAR_7, VAR_1, VAR_12=True):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_7, six.text_type):\n", "VAR_7 = import_string(VAR_7)\n", "@wraps(VAR_7)...\n", "if VAR_12:\n", "return VAR_7(VAR_8[0], VAR_1, *VAR_8[1:], **kwargs)\n", "return VAR_7(VAR_1, *VAR_8, **kwargs)\n" ]
[ "def make_handler(f, remote, with_response=True):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(f, six.text_type):\n", "f = import_string(f)\n", "@wraps(f)...\n", "if with_response:\n", "return f(args[0], remote, *args[1:], **kwargs)\n", "return f(remote, *args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_15(VAR_6):...\n", "VAR_4.register_jvm_tool(VAR_8, VAR_4._key_for_tool_version('scalastyle',\n VAR_6), VAR_15=[scala_style_jar])\n" ]
[ "def register_style_tool(version):...\n", "cls.register_jvm_tool(register, cls._key_for_tool_version('scalastyle',\n version), classpath=[scala_style_jar])\n" ]
[ 0, 7 ]
[ "FunctionDef'", "Expr'" ]
[ "@auth.require(acl.is_bot)...\n", "VAR_4, VAR_14, VAR_9, VAR_25, VAR_24, VAR_26 = self._process()\n", "VAR_37 = VAR_4.get('event')\n", "if VAR_37 not in ('bot_error', 'bot_rebooting', 'bot_shutdown'):\n", "self.abort_with_error(400, error='Unsupported event type')\n", "VAR_8 = VAR_4.get('message')\n", "bot_management.bot_event(VAR_31=event, VAR_14=bot_id, external_ip=self.\n request.remote_addr, VAR_24=dimensions, VAR_25=state, VAR_9=version,\n VAR_16=bool(quarantined_msg), VAR_17=None, VAR_32=None, VAR_8=message)\n", "if VAR_37 == 'bot_error':\n", "VAR_50 = \"\"\"Bot: https://%s/restricted/bot/%s\nBot error:\n%s\"\"\" % (app_identity\n .get_default_version_hostname(), VAR_14, VAR_8)\n", "self.send_response({})\n", "ereporter2.log_request(self.request, VAR_5='bot', VAR_8=line)\n" ]
[ "@auth.require(acl.is_bot)...\n", "request, bot_id, version, state, dimensions, quarantined_msg = self._process()\n", "event = request.get('event')\n", "if event not in ('bot_error', 'bot_rebooting', 'bot_shutdown'):\n", "self.abort_with_error(400, error='Unsupported event type')\n", "message = request.get('message')\n", "bot_management.bot_event(event_type=event, bot_id=bot_id, external_ip=self.\n request.remote_addr, dimensions=dimensions, state=state, version=\n version, quarantined=bool(quarantined_msg), task_id=None, task_name=\n None, message=message)\n", "if event == 'bot_error':\n", "line = \"\"\"Bot: https://%s/restricted/bot/%s\nBot error:\n%s\"\"\" % (app_identity\n .get_default_version_hostname(), bot_id, message)\n", "self.send_response({})\n", "ereporter2.log_request(self.request, source='bot', message=line)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_6):...\n", "VAR_24 = self._get_net_info()\n", "if VAR_24[0] == VAR_6:\n", "return VAR_24[2].replace(':', '').upper()\n", "return None\n" ]
[ "def get_if_mac(self, ifname):...\n", "data = self._get_net_info()\n", "if data[0] == ifname:\n", "return data[2].replace(':', '').upper()\n", "return None\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Return'" ]
[ "from cores.base_plugins import Scanner\n", "import re\n", "def FUNC_0(self):...\n", "from cores.xeger import Xeger\n", "VAR_4 = Xeger()\n", "while True:\n", "VAR_5 = VAR_4.xeger(\n \"\"\"((\\\\%3C)|<)((\\\\%69)|i|(\\\\%49))((\\\\%6D)|m|(\\\\%4D))((\\\\%67)|g|(\\\\%47))[^\n]+((\\\\%3E)|>)\"\"\"\n )\n", "if any(x in VAR_5 for x in '\"\\'><;/'):\n", "return VAR_5\n" ]
[ "from cores.base_plugins import Scanner\n", "import re\n", "def gen_payload(self):...\n", "from cores.xeger import Xeger\n", "generate = Xeger()\n", "while True:\n", "_payload = generate.xeger(\n \"\"\"((\\\\%3C)|<)((\\\\%69)|i|(\\\\%49))((\\\\%6D)|m|(\\\\%4D))((\\\\%67)|g|(\\\\%47))[^\n]+((\\\\%3E)|>)\"\"\"\n )\n", "if any(x in _payload for x in '\"\\'><;/'):\n", "return _payload\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "FunctionDef'", "ImportFrom'", "Assign'", "Condition", "Assign'", "For", "Return'" ]
[ "@VAR_0.route('/api/issue', methods=['PUT'])...\n", "VAR_10 = FUNC_1()\n", "VAR_5 = VAR_10.cursor()\n", "print(error)\n", "return 'Not implemented.', 501\n", "for VAR_7 in request.get_json().get('data', {}):\n", "return jsonify({'error': str(error)}), 500\n", "VAR_21 = FUNC_3(VAR_5, VAR_7.get('id', -1))\n", "if VAR_21 is None:\n", "FUNC_4(VAR_5, VAR_7)\n", "if 'title' not in VAR_7:\n", "VAR_7['title'] = ''\n", "if 'description' not in VAR_7:\n", "VAR_7['description'] = ''\n", "if 'tags' not in VAR_7:\n", "VAR_7['tags'] = []\n", "FUNC_5(VAR_5, VAR_7['id'], VAR_7)\n" ]
[ "@app.route('/api/issue', methods=['PUT'])...\n", "connection = get_database_connection()\n", "cursor = connection.cursor()\n", "print(error)\n", "return 'Not implemented.', 501\n", "for issue in request.get_json().get('data', {}):\n", "return jsonify({'error': str(error)}), 500\n", "fetched_issue = fetch_issue(cursor, issue.get('id', -1))\n", "if fetched_issue is None:\n", "create_issue(cursor, issue)\n", "if 'title' not in issue:\n", "issue['title'] = ''\n", "if 'description' not in issue:\n", "issue['description'] = ''\n", "if 'tags' not in issue:\n", "issue['tags'] = []\n", "update_issue(cursor, issue['id'], issue)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'", "Return'", "For", "Return'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_7(self):...\n", "VAR_21 = pyodbc.dataSources()\n", "self.assertTrue(isinstance(VAR_21, dict))\n" ]
[ "def test_datasources(self):...\n", "p = pyodbc.dataSources()\n", "self.assertTrue(isinstance(p, dict))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_7(self, *VAR_7, **VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_9 in VAR_7:\n", "self._set_inoutput_item(VAR_9, VAR_7=True)\n", "for VAR_10, VAR_9 in VAR_8.items():\n", "self._set_inoutput_item(VAR_9, VAR_7=True, VAR_10=name)\n", "for VAR_9 in self.output:\n", "if self.dynamic_output and VAR_9 not in self.dynamic_output:\n", "VAR_3 = VAR_9.get_wildcard_names()\n", "if self.wildcard_names:\n", "if self.wildcard_names != VAR_3:\n", "self.wildcard_names = VAR_3\n" ]
[ "def set_output(self, *output, **kwoutput):...\n", "\"\"\"docstring\"\"\"\n", "for item in output:\n", "self._set_inoutput_item(item, output=True)\n", "for name, item in kwoutput.items():\n", "self._set_inoutput_item(item, output=True, name=name)\n", "for item in self.output:\n", "if self.dynamic_output and item not in self.dynamic_output:\n", "wildcards = item.get_wildcard_names()\n", "if self.wildcard_names:\n", "if self.wildcard_names != wildcards:\n", "self.wildcard_names = wildcards\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'", "For", "Expr'", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'" ]
[ "\"\"\"\nModule contains functions and CVE class for returning data from DB\n\"\"\"\n", "\"\"\"\n Class to hold CVE attributes\n \"\"\"\n", "VAR_0 = None\n", "def __init__(self, VAR_1, VAR_2):...\n", "for col_name in VAR_2:\n", "setattr(self, col_name, VAR_1[VAR_2.index(col_name)])\n", "self.cwe = self.associate_cwes()\n", "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = []\n", "if CLASS_0.cve_cwe_map is not None:\n", "VAR_8 = [item[1] for item in CLASS_0.cve_cwe_map if self.get_val('cve.id') ==\n item[0]]\n", "return VAR_8\n" ]
[ "\"\"\"\nModule contains functions and CVE class for returning data from DB\n\"\"\"\n", "\"\"\"\n Class to hold CVE attributes\n \"\"\"\n", "cve_cwe_map = None\n", "def __init__(self, cve_entry, column_names):...\n", "for col_name in column_names:\n", "setattr(self, col_name, cve_entry[column_names.index(col_name)])\n", "self.cwe = self.associate_cwes()\n", "def associate_cwes(self):...\n", "\"\"\"docstring\"\"\"\n", "cwe_map = []\n", "if CVE.cve_cwe_map is not None:\n", "cwe_map = [item[1] for item in CVE.cve_cwe_map if self.get_val('cve.id') ==\n item[0]]\n", "return cwe_map\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Expr'", "Assign'", "FunctionDef'", "For", "Expr'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@VAR_2.route('/big_wins')...\n", "if VAR_0 == None:\n", "FUNC_16()\n", "VAR_5 = request.args.get('tag', default=None)\n", "VAR_19 = request.args.get('date', default=None)\n", "VAR_14 = request.args.get('scene', default=None)\n", "VAR_32 = not (VAR_5 == None and VAR_19 == None)\n", "if VAR_32:\n", "VAR_38 = 'select ranks.player, ranks.rank, matches.date, matches.score'\n", "return ''\n", "VAR_39 = (\n 'from matches join ranks where ((ranks.player=matches.player1 and matches.player2=\"{}\")'\n .format(VAR_5))\n", "VAR_40 = (\n 'or (ranks.player=matches.player2 and matches.player1=\"{}\")) and winner=\"{}\"'\n .format(VAR_5, VAR_5))\n", "VAR_41 = 'string'\n", "VAR_42 = 'and ranks.date=\"{}\"'.format(VAR_19)\n", "VAR_43 = 'and ranks.scene=\"{}\"'.format(VAR_14)\n", "VAR_44 = 'order by rank;'\n", "VAR_8 = '{} {} {} {} {} {} {}'.format(VAR_38, VAR_39, VAR_40, VAR_41,\n VAR_42, VAR_43, VAR_44)\n", "VAR_7 = VAR_0.exec(VAR_8)\n", "def FUNC_18(VAR_37):...\n", "VAR_37 = VAR_37.replace('[', '')\n", "VAR_37 = VAR_37.replace(']', '')\n", "VAR_45, VAR_46 = VAR_37.split(',')\n", "VAR_37 = '{} - {}'.format(VAR_45, VAR_46)\n", "return VAR_37\n" ]
[ "@endpoints.route('/big_wins')...\n", "if db == None:\n", "init()\n", "tag = request.args.get('tag', default=None)\n", "date = request.args.get('date', default=None)\n", "scene = request.args.get('scene', default=None)\n", "valid = not (tag == None and date == None)\n", "if valid:\n", "select = 'select ranks.player, ranks.rank, matches.date, matches.score'\n", "return ''\n", "frm = (\n 'from matches join ranks where ((ranks.player=matches.player1 and matches.player2=\"{}\")'\n .format(tag))\n", "player_where = (\n 'or (ranks.player=matches.player2 and matches.player1=\"{}\")) and winner=\"{}\"'\n .format(tag, tag))\n", "date_where = (\n 'and matches.scene=ranks.scene and datediff(ranks.date, matches.date)<=31 and ranks.date>matches.date'\n )\n", "also_date_where = 'and ranks.date=\"{}\"'.format(date)\n", "scene_where = 'and ranks.scene=\"{}\"'.format(scene)\n", "order = 'order by rank;'\n", "sql = '{} {} {} {} {} {} {}'.format(select, frm, player_where, date_where,\n also_date_where, scene_where, order)\n", "data = db.exec(sql)\n", "def reformat(score):...\n", "score = score.replace('[', '')\n", "score = score.replace(']', '')\n", "win, loss = score.split(',')\n", "score = '{} - {}'.format(win, loss)\n", "return score\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_10(VAR_7):...\n", "VAR_12 = urlparse(request.host_url)\n", "VAR_13 = urlparse(urljoin(request.host_url, VAR_7))\n", "return VAR_13.scheme in ('http', 'https') and VAR_12.netloc == VAR_13.netloc\n" ]
[ "def is_safe_url(target):...\n", "ref_url = urlparse(request.host_url)\n", "test_url = urlparse(urljoin(request.host_url, target))\n", "return test_url.scheme in ('http', 'https'\n ) and ref_url.netloc == test_url.netloc\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_12(self, VAR_10, VAR_12, **VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['volumeName'] = VAR_10['name']\n", "VAR_5['serverName'] = VAR_12['host']\n", "self._cliq_run_xml('unassignVolumeToServer', VAR_5)\n" ]
[ "def terminate_connection(self, volume, connector, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['volumeName'] = volume['name']\n", "cliq_args['serverName'] = connector['host']\n", "self._cliq_run_xml('unassignVolumeToServer', cliq_args)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_8():...\n", "VAR_0.create_table()\n", "VAR_19 = None\n", "while True:\n", "VAR_16 = FUNC_1(VAR_8, VAR_19)\n", "if VAR_16['result']:\n", "VAR_19 = FUNC_2(VAR_16) + 1\n", "time.sleep(1)\n", "FUNC_5(VAR_16, VAR_19)\n" ]
[ "def main():...\n", "db.create_table()\n", "latest_update_id = None\n", "while True:\n", "updates = get_updates(timeout_oth, latest_update_id)\n", "if updates['result']:\n", "latest_update_id = get_latest_update_id(updates) + 1\n", "time.sleep(1)\n", "handle_updates(updates, latest_update_id)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = 'string' % VAR_1\n", "VAR_3 = psycopg2.connect(database=DBNAME)\n", "VAR_4 = VAR_3.cursor()\n", "VAR_4.execute(VAR_2)\n", "VAR_5 = VAR_4.fetchall()\n", "VAR_3.close()\n", "return VAR_5\n" ]
[ "def get_top_articles(list_count):...\n", "\"\"\"docstring\"\"\"\n", "query = (\n 'select a.title, count(alv.article) as views from articles a, article_log_view alv where a.slug = alv.article group by a.title order by count(alv.article) desc limit %d;'\n % list_count)\n", "db = psycopg2.connect(database=DBNAME)\n", "c = db.cursor()\n", "c.execute(query)\n", "rows = c.fetchall()\n", "db.close()\n", "return rows\n" ]
[ 0, 0, 4, 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self, VAR_12):...\n", "VAR_14 = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(VAR_12))\n", "VAR_15 = self.cur.execute(VAR_14)\n", "self.conn.commit()\n", "return VAR_15\n" ]
[ "def delete_event(self, event_id):...\n", "sql = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(event_id))\n", "affected_count = self.cur.execute(sql)\n", "self.conn.commit()\n", "return affected_count\n" ]
[ 0, 4, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_8(self):...\n", "VAR_9 = {}\n", "VAR_9['inventory_hostname'] = self.name\n", "VAR_9['inventory_hostname_short'] = self.name.split('.')[0]\n", "VAR_9['group_names'] = sorted([VAR_10.name for VAR_10 in self.get_groups() if\n VAR_10.name != 'all'])\n", "return VAR_9\n" ]
[ "def get_magic_vars(self):...\n", "results = {}\n", "results['inventory_hostname'] = self.name\n", "results['inventory_hostname_short'] = self.name.split('.')[0]\n", "results['group_names'] = sorted([g.name for g in self.get_groups() if g.\n name != 'all'])\n", "return results\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_15(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7, VAR_12 = self.make_xsrf_handling_app()\n", "VAR_15 = VAR_7.post('/request', expect_errors=True)\n", "self.assertEqual(403, VAR_15.status_int)\n", "self.assertFalse(VAR_12)\n" ]
[ "def test_xsrf_token_missing(self):...\n", "\"\"\"docstring\"\"\"\n", "app, calls = self.make_xsrf_handling_app()\n", "response = app.post('/request', expect_errors=True)\n", "self.assertEqual(403, response.status_int)\n", "self.assertFalse(calls)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@login_required...\n", "from .forms import MetadataForm\n", "VAR_15 = FUNC_8(VAR_3=candidate_id, VAR_2=request)\n", "return HttpResponseRedirect(reverse('register'))\n", "if VAR_15.thesis.is_locked():\n", "return HttpResponseForbidden('Thesis has already been submitted and is locked.'\n )\n", "if VAR_2.method == 'POST':\n", "VAR_34 = VAR_2.POST.copy()\n", "VAR_39 = MetadataForm(instance=candidate.thesis)\n", "VAR_34['candidate'] = VAR_15.id\n", "VAR_22 = {'candidate': VAR_15, 'form': VAR_39, 'ID_VAL_SEPARATOR':\n ID_VAL_SEPARATOR}\n", "VAR_39 = MetadataForm(VAR_34, instance=candidate.thesis)\n", "return render(VAR_2, 'etd_app/candidate_metadata.html', VAR_22)\n", "if VAR_39.is_valid():\n", "VAR_4 = VAR_39.save()\n", "if VAR_4.abstract != VAR_39.cleaned_data['abstract']:\n", "messages.info(VAR_2, 'string')\n", "if VAR_4.title != VAR_39.cleaned_data['title']:\n", "messages.info(VAR_2, 'string')\n", "if FUNC_13(VAR_4, VAR_2.POST.getlist('keywords', [])):\n", "messages.info(VAR_2, 'string')\n", "return HttpResponseRedirect(reverse('candidate_home', kwargs={\n 'candidate_id': candidate.id}))\n" ]
[ "@login_required...\n", "from .forms import MetadataForm\n", "candidate = _get_candidate(candidate_id=candidate_id, request=request)\n", "return HttpResponseRedirect(reverse('register'))\n", "if candidate.thesis.is_locked():\n", "return HttpResponseForbidden('Thesis has already been submitted and is locked.'\n )\n", "if request.method == 'POST':\n", "post_data = request.POST.copy()\n", "form = MetadataForm(instance=candidate.thesis)\n", "post_data['candidate'] = candidate.id\n", "context = {'candidate': candidate, 'form': form, 'ID_VAL_SEPARATOR':\n ID_VAL_SEPARATOR}\n", "form = MetadataForm(post_data, instance=candidate.thesis)\n", "return render(request, 'etd_app/candidate_metadata.html', context)\n", "if form.is_valid():\n", "thesis = form.save()\n", "if thesis.abstract != form.cleaned_data['abstract']:\n", "messages.info(request,\n \"Your abstract contained invisible characters that we've removed. Please make sure your abstract is correct in the information section below.\"\n )\n", "if thesis.title != form.cleaned_data['title']:\n", "messages.info(request,\n \"Your title contained invisible characters that we've removed. Please make sure your title is correct in the information section below.\"\n )\n", "if _user_keywords_changed(thesis, request.POST.getlist('keywords', [])):\n", "messages.info(request,\n \"Your keywords contained invisible characters that we've removed. Please make sure your keywords are correct in the information section below.\"\n )\n", "return HttpResponseRedirect(reverse('candidate_home', kwargs={\n 'candidate_id': candidate.id}))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "ImportFrom'", "Assign'", "Return'", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_5(self, **VAR_15):...\n", "VAR_19 = self.executable + ' ' + self.arguments\n", "for VAR_30 in ('filename', 'config_file'):\n", "VAR_15[VAR_30] = escape_path_argument(VAR_15.get(VAR_30, '') or '')\n", "return VAR_19.format(**kwargs)\n" ]
[ "def _create_command(self, **kwargs):...\n", "command = self.executable + ' ' + self.arguments\n", "for key in ('filename', 'config_file'):\n", "kwargs[key] = escape_path_argument(kwargs.get(key, '') or '')\n", "return command.format(**kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'" ]
[ "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_8(self, VAR_9, VAR_10=None, VAR_11=None, VAR_12=True, VAR_13=None,...\n", "if VAR_10 is not None:\n", "def FUNC_17(*VAR_20, **VAR_7):...\n", "VAR_21 = DebugAdapter.start\n", "return DebugAdapter.start_wrapper_script(VAR_10, *VAR_20, **kwargs)\n", "VAR_17 = Address.as_server if VAR_12 else Address.as_client\n", "VAR_1 = VAR_17(None, self._addr.port)\n", "self._adapter = VAR_21(VAR_9, VAR_1=addr, VAR_13=env, VAR_14=cwd)\n", "if VAR_11:\n", "VAR_11()\n", "wait_for_socket_server(VAR_1)\n", "self._attach(VAR_1, **kwargs)\n" ]
[ "def _launch(self, argv, script=None, wait_for_connect=None, detachable=True,...\n", "if script is not None:\n", "def start(*args, **kwargs):...\n", "start = DebugAdapter.start\n", "return DebugAdapter.start_wrapper_script(script, *args, **kwargs)\n", "new_addr = Address.as_server if detachable else Address.as_client\n", "addr = new_addr(None, self._addr.port)\n", "self._adapter = start(argv, addr=addr, env=env, cwd=cwd)\n", "if wait_for_connect:\n", "wait_for_connect()\n", "wait_for_socket_server(addr)\n", "self._attach(addr, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "FunctionDef'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def __eq__(self, VAR_35):...\n", "return self.__class__ == VAR_35.__class__ and self.length == VAR_35.length\n" ]
[ "def __eq__(self, other):...\n", "return self.__class__ == other.__class__ and self.length == other.length\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from flask import request\n", "from api import *\n", "import faf.db as db\n", "VAR_0 = 'string'\n", "@app.route('/achievements')...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = request.args.get('language', 'en')\n", "VAR_6 = request.args.get('region', 'US')\n", "VAR_11 = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "VAR_11.execute(VAR_0 + ' ORDER BY `order` ASC', {'language': VAR_5,\n 'region': VAR_6})\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ "from flask import request\n", "from api import *\n", "import faf.db as db\n", "SELECT_ACHIEVEMENTS_QUERY = \"\"\"SELECT\n ach.id,\n ach.type,\n ach.total_steps,\n ach.revealed_icon_url,\n ach.unlocked_icon_url,\n ach.initial_state,\n ach.experience_points,\n COALESCE(name_langReg.value, name_lang.value, name_def.value) as name,\n COALESCE(desc_langReg.value, desc_lang.value, desc_def.value) as description\n FROM achievement_definitions ach\n LEFT OUTER JOIN messages name_langReg\n ON ach.name_key = name_langReg.key\n AND name_langReg.language = %(language)s\n AND name_langReg.region = %(region)s\n LEFT OUTER JOIN messages name_lang\n ON ach.name_key = name_lang.key\n AND name_lang.language = %(language)s\n LEFT OUTER JOIN messages name_def\n ON ach.name_key = name_def.key\n AND name_def.language = 'en'\n AND name_def.region = 'US'\n LEFT OUTER JOIN messages desc_langReg\n ON ach.description_key = desc_langReg.key\n AND desc_langReg.language = %(language)s\n AND desc_langReg.region = %(region)s\n LEFT OUTER JOIN messages desc_lang\n ON ach.description_key = desc_lang.key\n AND desc_lang.language = %(language)s\n LEFT OUTER JOIN messages desc_def\n ON ach.description_key = desc_def.key\n AND desc_def.language = 'en'\n AND desc_def.region = 'US'\"\"\"\n", "@app.route('/achievements')...\n", "\"\"\"docstring\"\"\"\n", "language = request.args.get('language', 'en')\n", "region = request.args.get('region', 'US')\n", "cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "cursor.execute(SELECT_ACHIEVEMENTS_QUERY + ' ORDER BY `order` ASC', {\n 'language': language, 'region': region})\n", "return flask.jsonify(items=cursor.fetchall())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_22(VAR_30, VAR_31=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_31 is None:\n", "VAR_31 = threading.Lock()\n", "return CLASS_0(VAR_30, VAR_31)\n" ]
[ "def thread_safe_client(client, lock=None):...\n", "\"\"\"docstring\"\"\"\n", "if lock is None:\n", "lock = threading.Lock()\n", "return _ThreadSafeProxy(client, lock)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'" ]
[ "def __bool__(self):...\n", "return bool(self.updated_input or self.missing_output or self.forced or\n self.updated_input_run or self.noio or self.nooutput)\n" ]
[ "def __bool__(self):...\n", "return bool(self.updated_input or self.missing_output or self.forced or\n self.updated_input_run or self.noio or self.nooutput)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_54=None, VAR_55=None, *VAR_15, **VAR_16):...\n", "self.min = VAR_54\n", "self.max = VAR_55\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, min=None, max=None, *a, **kw):...\n", "self.min = min\n", "self.max = max\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "import asyncio\n", "import sqlite3\n", "import discord\n", "from discord.ext import commands\n", "import to_sqlalchemy\n", "def __init__(self, VAR_0):...\n", "self.bot = VAR_0\n", "self.updating = False\n", "@commands.group(aliases=['elite', 'ed'])...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.invoked_subcommand is None:\n", "await VAR_1.send(\n f'Invalid command passed. Try \"{self.bot.command_prefix[0]}help eddb\"')\n", "@FUNC_1.command(aliases=['sys'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = asyncio.get_event_loop()\n", "VAR_7 = await VAR_6.run_in_executor(None, self.system_search, VAR_2)\n", "await VAR_1.send(VAR_7)\n", "def FUNC_3(self, VAR_3):...\n", "VAR_3 = VAR_3.lower()\n", "VAR_8 = sqlite3.connect('data/ed.db').cursor()\n", "VAR_9 = VAR_8.execute(f\"select * from populated where lower(name) = '{VAR_3}'\")\n", "VAR_10 = VAR_9.fetchone()\n", "if not VAR_10:\n", "VAR_9 = VAR_8.execute(f\"select * from systems where lower(name) = '{VAR_3}'\")\n", "if VAR_10:\n", "VAR_10 = VAR_9.fetchone()\n", "VAR_12 = tuple(i[0] for i in VAR_9.description)\n", "return 'No systems found.'\n", "return '\\n'.join(f\"{key.replace('_', ' ').title()}: {field}\" for key, field in\n zip(VAR_12[1:], VAR_10[1:]) if field)\n" ]
[ "import asyncio\n", "import sqlite3\n", "import discord\n", "from discord.ext import commands\n", "import to_sqlalchemy\n", "def __init__(self, bot):...\n", "self.bot = bot\n", "self.updating = False\n", "@commands.group(aliases=['elite', 'ed'])...\n", "\"\"\"docstring\"\"\"\n", "if ctx.invoked_subcommand is None:\n", "await ctx.send(\n f'Invalid command passed. Try \"{self.bot.command_prefix[0]}help eddb\"')\n", "@eddb.command(aliases=['sys'])...\n", "\"\"\"docstring\"\"\"\n", "loop = asyncio.get_event_loop()\n", "result = await loop.run_in_executor(None, self.system_search, inp)\n", "await ctx.send(result)\n", "def system_search(self, search):...\n", "search = search.lower()\n", "conn = sqlite3.connect('data/ed.db').cursor()\n", "table = conn.execute(f\"select * from populated where lower(name) = '{search}'\")\n", "results = table.fetchone()\n", "if not results:\n", "table = conn.execute(f\"select * from systems where lower(name) = '{search}'\")\n", "if results:\n", "results = table.fetchone()\n", "keys = tuple(i[0] for i in table.description)\n", "return 'No systems found.'\n", "return '\\n'.join(f\"{key.replace('_', ' ').title()}: {field}\" for key, field in\n zip(keys[1:], results[1:]) if field)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Docstring", "Condition", "Expr'", "Condition", "Docstring", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Return'" ]
[ "@csrf_exempt...\n", "\"\"\"docstring\"\"\"\n", "if VAR_7.method == 'POST':\n", "VAR_21 = VAR_7.POST.get('_action')\n", "print(VAR_21)\n", "if VAR_21 == 'registerService':\n", "VAR_22 = VAR_7.POST.get('name')\n", "if VAR_21 == 'getSchema':\n", "VAR_23 = VAR_7.POST.get('address')\n", "VAR_27 = FUNC_0()\n", "if VAR_21 == 'getIfConfigured':\n", "VAR_24 = VAR_7.POST.get('icon')\n", "return JsonResponse({'version_info': VAR_27}, safe=False)\n", "print(VAR_21)\n", "if VAR_21 == 'loadDependencies':\n", "print(VAR_22)\n", "VAR_15 = BoxDetails.objects.all()\n", "print(VAR_21)\n", "if VAR_21 == 'getAllAPs':\n", "print(VAR_23)\n", "VAR_28 = BoxDetailsSerializer(VAR_15, many=True)\n", "VAR_15 = RegisteredServices.objects.all()\n", "VAR_29 = FUNC_2()\n", "if VAR_21 == 'saveUserDetails':\n", "print(VAR_24)\n", "return JsonResponse(VAR_28.data, safe=False)\n", "VAR_28 = RegisteredServicesSerializer(VAR_15, many=True)\n", "return JsonResponse(VAR_29, safe=False)\n", "print(VAR_21)\n", "if VAR_21 == 'login':\n", "VAR_25 = RegisteredServices.objects.get_or_create(VAR_19=request_name,\n address=request_address, icon=request_icon)\n", "return JsonResponse(VAR_28.data, safe=False)\n", "VAR_30 = escape(VAR_7.POST.get('boxname'))\n", "print(VAR_21)\n", "if VAR_21 == 'logout':\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "print(VAR_21)\n", "if VAR_21 == 'getDashboardCards':\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_2 = VAR_7.POST.get('username')\n", "print(VAR_21)\n", "if VAR_21 == 'getDashboardChart':\n", "print(VAR_2)\n", "VAR_34 = ''\n", "print(VAR_2 + ' ')\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getDockerOverview':\n", "FUNC_3(VAR_2, VAR_3)\n", "\"\"\"string\"\"\"\n", "VAR_15 = User.objects.all().first()\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getContainerStats':\n", "VAR_31 = BoxDetails(VAR_30=boxname)\n", "VAR_35 = spwd.getspnam(VAR_2)[1]\n", "VAR_34 = \"User '%s' not found\" % VAR_2\n", "if len(VAR_34) == 0:\n", "if VAR_2 == VAR_15.username:\n", "VAR_37.execute(common.Q_DASHBOARD_CARDS)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getThreads':\n", "VAR_31.save()\n", "if VAR_35 in ['NP', '!', '', None]:\n", "return JsonResponse({'username': VAR_2}, safe=False)\n", "return JsonResponse(VAR_34, safe=False)\n", "return JsonResponse({'STATUS': 'SUCCESS', 'username': VAR_15.username},\n safe=False)\n", "return JsonResponse(VAR_28.errors, status=400)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'getContainerTop':\n", "VAR_32 = VAR_7.POST.get('wifi_password')\n", "VAR_34 = \"User '%s' has no password set\" % VAR_2\n", "if VAR_35 in ['LK', '*']:\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_DOCKER_OVERVIEW)\n", "VAR_37 = VAR_36.cursor()\n", "VAR_38 = []\n", "print(VAR_21)\n", "if VAR_21 == 'getSettings':\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_34 = 'account is locked'\n", "if VAR_35 == '!!':\n", "return JsonResponse(VAR_38, safe=False)\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_8 = subprocess.Popen(['top', '-b', '-n', '1'], stdout=subprocess.PIPE\n ).communicate()[0]\n", "VAR_36 = sqlite3.connect('dashboard.sqlite3')\n", "print(VAR_21)\n", "if VAR_21 == 'deleteUser':\n", "if len(VAR_33) > 0:\n", "VAR_34 = 'password has expired'\n", "if crypt.crypt(VAR_3, VAR_35) == VAR_35:\n", "VAR_39 = []\n", "print(VAR_38)\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_45 = VAR_8.decode().split('\\n')\n", "VAR_37 = VAR_36.cursor()\n", "VAR_8 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "print(VAR_21)\n", "if VAR_21 == 'addNewUser':\n", "FUNC_4(VAR_33, VAR_32)\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "VAR_34 = ''\n", "VAR_34 = 'incorrect password'\n", "for row in VAR_38:\n", "VAR_39 = []\n", "print(VAR_38)\n", "VAR_46 = len(VAR_45[0].split()) - 1\n", "VAR_37.execute(common.Q_GET_CONTAINER_ID)\n", "VAR_49 = VAR_8.split(':')[3].split(',')\n", "VAR_2 = escape(VAR_7.POST.get('user'))\n", "print(VAR_21)\n", "if VAR_21 == 'addWifi':\n", "VAR_37.execute(common.Q_GET_DASHBOARD_CHART, [row[0]])\n", "return JsonResponse(VAR_39, safe=False)\n", "for row in VAR_38:\n", "VAR_39 = []\n", "for row in VAR_45[4:]:\n", "VAR_38 = VAR_37.fetchall()\n", "VAR_50 = FUNC_1()\n", "VAR_8 = subprocess.Popen(['userdel', VAR_2], stdout=subprocess.PIPE\n ).communicate()\n", "VAR_2 = escape(VAR_7.POST.get('username'))\n", "print(VAR_21)\n", "if VAR_21 == 'deleteWifi':\n", "VAR_40 = VAR_37.fetchall()\n", "VAR_41 = {'state': row[0], 'container_id': row[1], 'name': row[2], 'image':\n row[3], 'running_for': row[4], 'command': row[5], 'ports': row[6],\n 'status': row[7], 'networks': row[8]}\n", "return JsonResponse(VAR_39, safe=False)\n", "VAR_42 = []\n", "VAR_38.append(row.split(None, VAR_46))\n", "return JsonResponse(VAR_38, safe=False)\n", "VAR_48 = []\n", "VAR_29 = FUNC_2()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_3 = escape(VAR_7.POST.get('password'))\n", "VAR_32 = escape(VAR_7.POST.get('wifi_password'))\n", "print(VAR_21)\n", "if VAR_21 == 'editWifi':\n", "print(VAR_40)\n", "VAR_39.append(VAR_41)\n", "VAR_43 = []\n", "for i in VAR_38:\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29\n }], safe=False)\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_3(VAR_2, VAR_3)\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_33 = VAR_7.POST.get('wifi')\n", "print(VAR_21)\n", "VAR_41 = {'container_name': row[1], 'data': VAR_40}\n", "VAR_44 = []\n", "VAR_41 = {}\n", "return JsonResponse(VAR_48, safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "if len(VAR_33) > 0:\n", "FUNC_5(VAR_33)\n", "VAR_33 = VAR_7.POST.get('wifi_ap')\n", "VAR_39.append(VAR_41)\n", "for row in VAR_38:\n", "VAR_40 = []\n", "VAR_29 = FUNC_2()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_4(VAR_33, VAR_32)\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_32 = escape(VAR_7.POST.get('wifi_password'))\n", "VAR_42 = []\n", "return JsonResponse(VAR_39, safe=False)\n", "VAR_8 = subprocess.Popen(['docker', 'top', i[0]], stdout=subprocess.PIPE\n ).communicate()[0]\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'deleteuser', 'endpoint': VAR_2}], safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "FUNC_6(VAR_33, VAR_32)\n", "VAR_43 = []\n", "VAR_45 = VAR_8.decode().split('\\n')\n", "VAR_29 = FUNC_2()\n", "VAR_50 = FUNC_1()\n", "VAR_50 = FUNC_1()\n", "VAR_51 = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "VAR_44 = []\n", "VAR_46 = len(VAR_45[0].split()) - 1\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'adduser', 'endpoint': VAR_2}], safe=False)\n", "VAR_29 = FUNC_2()\n", "VAR_29 = FUNC_2()\n", "VAR_49 = VAR_51.split(':')[3].split(',')\n", "for iter in range(0, 2):\n", "for p in VAR_45[1:]:\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'addwifi', 'endpoint': VAR_33}], safe=False)\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'deletewifi', 'endpoint': VAR_33}], safe=False)\n", "VAR_50 = FUNC_1()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS_CPU, [row[0], iter + 1])\n", "for iter in range(2, 4):\n", "VAR_40.append(p.split(None, VAR_46))\n", "VAR_41 = {'container_id': i[0], 'container_name': i[1], 'data': VAR_40}\n", "VAR_29 = FUNC_2()\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "for iter in range(4, 8):\n", "VAR_48.append(VAR_41)\n", "return JsonResponse([{'users': VAR_49, 'wifi': VAR_50, 'allwifiaps': VAR_29,\n 'reqtype': 'editwifi', 'endpoint': VAR_33}], safe=False)\n", "VAR_44.append(VAR_47)\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_37.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "VAR_41 = {'container_id': row[0], 'container_name': row[1], 'data_io':\n VAR_42, 'data_mem': VAR_43, 'data_perc': VAR_44}\n", "VAR_43.append(VAR_47)\n", "VAR_47 = VAR_37.fetchall()\n", "VAR_39.append(VAR_41)\n", "VAR_42.append(VAR_47)\n" ]
[ "@csrf_exempt...\n", "\"\"\"docstring\"\"\"\n", "if request.method == 'POST':\n", "action = request.POST.get('_action')\n", "print(action)\n", "if action == 'registerService':\n", "request_name = request.POST.get('name')\n", "if action == 'getSchema':\n", "request_address = request.POST.get('address')\n", "schema = get_osversion()\n", "if action == 'getIfConfigured':\n", "request_icon = request.POST.get('icon')\n", "return JsonResponse({'version_info': schema}, safe=False)\n", "print(action)\n", "if action == 'loadDependencies':\n", "print(request_name)\n", "queryset = BoxDetails.objects.all()\n", "print(action)\n", "if action == 'getAllAPs':\n", "print(request_address)\n", "serializer = BoxDetailsSerializer(queryset, many=True)\n", "queryset = RegisteredServices.objects.all()\n", "wifi_aps = get_allAPs()\n", "if action == 'saveUserDetails':\n", "print(request_icon)\n", "return JsonResponse(serializer.data, safe=False)\n", "serializer = RegisteredServicesSerializer(queryset, many=True)\n", "return JsonResponse(wifi_aps, safe=False)\n", "print(action)\n", "if action == 'login':\n", "setServiceDetails = RegisteredServices.objects.get_or_create(name=\n request_name, address=request_address, icon=request_icon)\n", "return JsonResponse(serializer.data, safe=False)\n", "boxname = escape(request.POST.get('boxname'))\n", "print(action)\n", "if action == 'logout':\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "username = escape(request.POST.get('username'))\n", "username = escape(request.POST.get('username'))\n", "print(action)\n", "if action == 'getDashboardCards':\n", "password = escape(request.POST.get('password'))\n", "password = escape(request.POST.get('password'))\n", "username = request.POST.get('username')\n", "print(action)\n", "if action == 'getDashboardChart':\n", "print(username)\n", "output = ''\n", "print(username + ' ')\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getDockerOverview':\n", "add_user(username, password)\n", "\"\"\"Tries to authenticate a user.\n Returns True if the authentication succeeds, else the reason\n (string) is returned.\"\"\"\n", "queryset = User.objects.all().first()\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getContainerStats':\n", "setBoxName = BoxDetails(boxname=boxname)\n", "enc_pwd = spwd.getspnam(username)[1]\n", "output = \"User '%s' not found\" % username\n", "if len(output) == 0:\n", "if username == queryset.username:\n", "cursor.execute(common.Q_DASHBOARD_CARDS)\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getThreads':\n", "setBoxName.save()\n", "if enc_pwd in ['NP', '!', '', None]:\n", "return JsonResponse({'username': username}, safe=False)\n", "return JsonResponse(output, safe=False)\n", "return JsonResponse({'STATUS': 'SUCCESS', 'username': queryset.username},\n safe=False)\n", "return JsonResponse(serializer.errors, status=400)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "cursor = con.cursor()\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'getContainerTop':\n", "wifi_pass = request.POST.get('wifi_password')\n", "output = \"User '%s' has no password set\" % username\n", "if enc_pwd in ['LK', '*']:\n", "print(rows)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_DOCKER_OVERVIEW)\n", "cursor = con.cursor()\n", "rows = []\n", "print(action)\n", "if action == 'getSettings':\n", "wifi_name = request.POST.get('wifi_ap')\n", "output = 'account is locked'\n", "if enc_pwd == '!!':\n", "return JsonResponse(rows, safe=False)\n", "print(rows)\n", "rows = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "ps = subprocess.Popen(['top', '-b', '-n', '1'], stdout=subprocess.PIPE\n ).communicate()[0]\n", "con = sqlite3.connect('dashboard.sqlite3')\n", "print(action)\n", "if action == 'deleteUser':\n", "if len(wifi_name) > 0:\n", "output = 'password has expired'\n", "if crypt.crypt(password, enc_pwd) == enc_pwd:\n", "finalset = []\n", "print(rows)\n", "rows = cursor.fetchall()\n", "processes = ps.decode().split('\\n')\n", "cursor = con.cursor()\n", "ps = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'], stdout=\n subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "print(action)\n", "if action == 'addNewUser':\n", "add_newWifiConn(wifi_name, wifi_pass)\n", "return JsonResponse({'STATUS': 'SUCCESS'}, safe=False)\n", "output = ''\n", "output = 'incorrect password'\n", "for row in rows:\n", "finalset = []\n", "print(rows)\n", "nfields = len(processes[0].split()) - 1\n", "cursor.execute(common.Q_GET_CONTAINER_ID)\n", "userlist = ps.split(':')[3].split(',')\n", "username = escape(request.POST.get('user'))\n", "print(action)\n", "if action == 'addWifi':\n", "cursor.execute(common.Q_GET_DASHBOARD_CHART, [row[0]])\n", "return JsonResponse(finalset, safe=False)\n", "for row in rows:\n", "finalset = []\n", "for row in processes[4:]:\n", "rows = cursor.fetchall()\n", "configuredwifi = get_allconfiguredwifi()\n", "ps = subprocess.Popen(['userdel', username], stdout=subprocess.PIPE\n ).communicate()\n", "username = escape(request.POST.get('username'))\n", "print(action)\n", "if action == 'deleteWifi':\n", "datasets = cursor.fetchall()\n", "data = {'state': row[0], 'container_id': row[1], 'name': row[2], 'image':\n row[3], 'running_for': row[4], 'command': row[5], 'ports': row[6],\n 'status': row[7], 'networks': row[8]}\n", "return JsonResponse(finalset, safe=False)\n", "datasets_io = []\n", "rows.append(row.split(None, nfields))\n", "return JsonResponse(rows, safe=False)\n", "resultset = []\n", "wifi_aps = get_allAPs()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "password = escape(request.POST.get('password'))\n", "wifi_pass = escape(request.POST.get('wifi_password'))\n", "print(action)\n", "if action == 'editWifi':\n", "print(datasets)\n", "finalset.append(data)\n", "datasets_mem = []\n", "for i in rows:\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps}], safe=False)\n", "userlist = fetchusers.split(':')[3].split(',')\n", "add_user(username, password)\n", "wifi_name = request.POST.get('wifi_ap')\n", "wifi_name = request.POST.get('wifi')\n", "print(action)\n", "data = {'container_name': row[1], 'data': datasets}\n", "datasets_perc = []\n", "data = {}\n", "return JsonResponse(resultset, safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "if len(wifi_name) > 0:\n", "delete_WifiConn(wifi_name)\n", "wifi_name = request.POST.get('wifi_ap')\n", "finalset.append(data)\n", "for row in rows:\n", "datasets = []\n", "wifi_aps = get_allAPs()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "add_newWifiConn(wifi_name, wifi_pass)\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "wifi_pass = escape(request.POST.get('wifi_password'))\n", "datasets_io = []\n", "return JsonResponse(finalset, safe=False)\n", "ps = subprocess.Popen(['docker', 'top', i[0]], stdout=subprocess.PIPE\n ).communicate()[0]\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'deleteuser', 'endpoint': username}],\n safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "userlist = fetchusers.split(':')[3].split(',')\n", "edit_WifiConn(wifi_name, wifi_pass)\n", "datasets_mem = []\n", "processes = ps.decode().split('\\n')\n", "wifi_aps = get_allAPs()\n", "configuredwifi = get_allconfiguredwifi()\n", "configuredwifi = get_allconfiguredwifi()\n", "fetchusers = subprocess.Popen(['grep', '/etc/group', '-e', 'docker'],\n stdout=subprocess.PIPE).communicate()[0].split('\\n')[0]\n", "datasets_perc = []\n", "nfields = len(processes[0].split()) - 1\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'adduser', 'endpoint': username}],\n safe=False)\n", "wifi_aps = get_allAPs()\n", "wifi_aps = get_allAPs()\n", "userlist = fetchusers.split(':')[3].split(',')\n", "for iter in range(0, 2):\n", "for p in processes[1:]:\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'addwifi', 'endpoint': wifi_name}],\n safe=False)\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'deletewifi', 'endpoint': wifi_name}\n ], safe=False)\n", "configuredwifi = get_allconfiguredwifi()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS_CPU, [row[0], iter + 1])\n", "for iter in range(2, 4):\n", "datasets.append(p.split(None, nfields))\n", "data = {'container_id': i[0], 'container_name': i[1], 'data': datasets}\n", "wifi_aps = get_allAPs()\n", "counter_val = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "for iter in range(4, 8):\n", "resultset.append(data)\n", "return JsonResponse([{'users': userlist, 'wifi': configuredwifi,\n 'allwifiaps': wifi_aps, 'reqtype': 'editwifi', 'endpoint': wifi_name}],\n safe=False)\n", "datasets_perc.append(counter_val)\n", "counter_val = cursor.fetchall()\n", "cursor.execute(common.Q_GET_CONTAINER_STATS, [row[0], iter + 1])\n", "data = {'container_id': row[0], 'container_name': row[1], 'data_io':\n datasets_io, 'data_mem': datasets_mem, 'data_perc': datasets_perc}\n", "datasets_mem.append(counter_val)\n", "counter_val = cursor.fetchall()\n", "finalset.append(data)\n", "datasets_io.append(counter_val)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Return'", "Assign'", "Return'", "Expr'", "Condition", "Assign'", "Return'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Condition", "Return'", "Return'", "Return'", "Return'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Return'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Return'", "For", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "For", "Return'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "For", "For", "Return'", "Return'", "Assign'", "Expr'", "For", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Expr'", "Return'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_11):...\n", "if VAR_11 and is_banned_domain(VAR_11):\n", "VAR_101.errors.add(errors.BANNED_DOMAIN)\n" ]
[ "def run(self, url):...\n", "if url and is_banned_domain(url):\n", "c.errors.add(errors.BANNED_DOMAIN)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'" ]
[ "def __hash__(self):...\n", "return self._file.__hash__()\n" ]
[ "def __hash__(self):...\n", "return self._file.__hash__()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(VAR_6):...\n", "VAR_10 = get_executing_test()\n", "VAR_14 = os.getcwd()\n", "os.chdir('/tmp')\n", "VAR_10.webdriver = selenium.webdriver.Chrome()\n", "os.chdir(VAR_14)\n", "VAR_10.webdriver.get(VAR_6)\n", "while VAR_10.webdriver:\n", "time.sleep(0.1)\n", "VAR_10.error = 'keyboard interrupt'\n", "FUNC_6(VAR_10)\n" ]
[ "def start_chrome_browser(url):...\n", "test = get_executing_test()\n", "old_cwd = os.getcwd()\n", "os.chdir('/tmp')\n", "test.webdriver = selenium.webdriver.Chrome()\n", "os.chdir(old_cwd)\n", "test.webdriver.get(url)\n", "while test.webdriver:\n", "time.sleep(0.1)\n", "test.error = 'keyboard interrupt'\n", "check_is_test_failed(test)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_12(VAR_16, VAR_19):...\n", "if isinstance(VAR_16, CLASS_1):\n", "return VAR_19 in VAR_16.flags\n", "return False\n" ]
[ "def is_flagged(value, flag):...\n", "if isinstance(value, AnnotatedString):\n", "return flag in value.flags\n", "return False\n" ]
[ 0, 0, 7, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_18(VAR_37):...\n", "VAR_37 = VAR_37.replace('[', '')\n", "VAR_37 = VAR_37.replace(']', '')\n", "VAR_45, VAR_46 = VAR_37.split(',')\n", "VAR_37 = '{} - {}'.format(VAR_46, VAR_45)\n", "return VAR_37\n" ]
[ "def reformat(score):...\n", "score = score.replace('[', '')\n", "score = score.replace(']', '')\n", "win, loss = score.split(',')\n", "score = '{} - {}'.format(loss, win)\n", "return score\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self, VAR_8):...\n", "VAR_8.destroy()\n" ]
[ "def destroy_window(self, window):...\n", "window.destroy()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_9():...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = FUNC_8('tasks')\n", "VAR_36 = re.findall('string', VAR_35.text, re.X)\n", "VAR_37 = {}\n", "for VAR_46 in VAR_36:\n", "VAR_57, VAR_58, VAR_59 = VAR_46\n", "return VAR_37\n", "VAR_57 = int(VAR_57)\n", "VAR_37[VAR_58] = {'title': VAR_59, 'id': VAR_57}\n" ]
[ "def get_tasks():...\n", "\"\"\"docstring\"\"\"\n", "r = admin_req('tasks')\n", "groups = re.findall(\n \"\"\"\n <tr>\\\\s*\n <td><a\\\\s+href=\"./task/(\\\\d+)\">(.*)</a></td>\\\\s*\n <td>(.*)</td>\\\\s*\n \"\"\"\n , r.text, re.X)\n", "tasks = {}\n", "for g in groups:\n", "id, name, title = g\n", "return tasks\n", "id = int(id)\n", "tasks[name] = {'title': title, 'id': id}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_18(self):...\n", "self.run_test_case(self.scenario.deregister_load_balancer_instances())\n" ]
[ "def test_w_deregister_load_balancer_instances(self):...\n", "self.run_test_case(self.scenario.deregister_load_balancer_instances())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(VAR_8, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = os.path.abspath(VAR_8)\n", "VAR_12 = FUNC_0(VAR_2, VAR_7='GET')\n", "if VAR_12 is None:\n", "return False\n", "f.write(VAR_12)\n", "logging.error(\"\"\"Failed to write to %s\n%s\"\"\", VAR_8, e)\n", "return True\n", "return False\n" ]
[ "def DownloadFile(local_file, url):...\n", "\"\"\"docstring\"\"\"\n", "local_file = os.path.abspath(local_file)\n", "url_data = UrlOpen(url, method='GET')\n", "if url_data is None:\n", "return False\n", "f.write(url_data)\n", "logging.error(\"\"\"Failed to write to %s\n%s\"\"\", local_file, e)\n", "return True\n", "return False\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Return'", "Expr'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_6(self):...\n", "self.assertTrue({'name': 'DocField'} in DatabaseQuery('DocType').execute(\n filters={'name': 'DocField'}))\n" ]
[ "def test_filters_4(self):...\n", "self.assertTrue({'name': 'DocField'} in DatabaseQuery('DocType').execute(\n filters={'name': 'DocField'}))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_5(self):...\n", "return self.data['points_created'], super().created()\n" ]
[ "def created(self):...\n", "return self.data['points_created'], super().created()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@property...\n", "if hasattr(self, 'curated_chemical') and self.curated_chemical is not None:\n", "return self.curated_chemical.true_chemname\n", "return None\n" ]
[ "@property...\n", "if hasattr(self, 'curated_chemical') and self.curated_chemical is not None:\n", "return self.curated_chemical.true_chemname\n", "return None\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_1 = 'http://my.url.com'\n", "VAR_2 = 'True'\n", "url_helper.urllib2.urlopen(mox.StrContains(VAR_1), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(VAR_2))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(VAR_1, method='GET'), VAR_2)\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenGETSuccess(self):...\n", "url = 'http://my.url.com'\n", "response = 'True'\n", "url_helper.urllib2.urlopen(mox.StrContains(url), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(response))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(url, method='GET'), response)\n", "self._mox.VerifyAll()\n" ]
[ 0, 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_2.route('/<pic_name>')...\n", "VAR_4 = 'SELECT comment, comment_id, img_name\\t\\t\\tFROM commentsTable'\n", "VAR_1.execute(VAR_4)\n", "return render_template('static_page.html', names=cursor, VAR_3=pic_name)\n" ]
[ "@app.route('/<pic_name>')...\n", "query = 'SELECT comment, comment_id, img_name\\t\\t\\tFROM commentsTable'\n", "cursor.execute(query)\n", "return render_template('static_page.html', names=cursor, pic_name=pic_name)\n" ]
[ 4, 4, 0, 4 ]
[ "Condition", "Assign'", "Expr'", "Return'" ]
[ "@functools.wraps(VAR_3)...\n", "VAR_23 = VAR_5.pop('timeout', None)\n", "VAR_24 = eventlet.spawn(VAR_3, self, *VAR_4, **kwargs)\n", "if VAR_23 is None:\n", "return VAR_24.wait()\n", "VAR_36 = eventlet.spawn_after(VAR_23, VAR_24.kill)\n", "VAR_48 = VAR_24.wait()\n", "VAR_36.cancel()\n", "return VAR_48\n" ]
[ "@functools.wraps(f)...\n", "timeout = kwargs.pop('timeout', None)\n", "gt = eventlet.spawn(f, self, *args, **kwargs)\n", "if timeout is None:\n", "return gt.wait()\n", "kill_thread = eventlet.spawn_after(timeout, gt.kill)\n", "res = gt.wait()\n", "kill_thread.cancel()\n", "return res\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_5(VAR_0, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_16 = VAR_0.tournamentplayer_set.all()\n", "VAR_20 = GameSeeder(GreatPower.objects.all(), starts=100, iterations=10)\n", "for tp in VAR_16:\n", "VAR_20.add_player(tp)\n", "for n in range(1, VAR_6):\n", "VAR_29 = VAR_0.round_numbered(n)\n", "for tp in VAR_16:\n", "for VAR_39 in VAR_29.game_set.all():\n", "for sb in tp.seederbias_set.all():\n", "return VAR_20\n", "VAR_37 = set()\n", "VAR_20.add_bias(sb.player1, sb.player2, sb.weight)\n", "for VAR_38 in VAR_39.gameplayer_set.all():\n", "VAR_37.add((VAR_38.tournamentplayer(), VAR_38.power))\n", "assert len(VAR_37) == 7\n", "VAR_20.add_played_game(VAR_37)\n" ]
[ "def _create_game_seeder(tournament, round_number):...\n", "\"\"\"docstring\"\"\"\n", "tourney_players = tournament.tournamentplayer_set.all()\n", "seeder = GameSeeder(GreatPower.objects.all(), starts=100, iterations=10)\n", "for tp in tourney_players:\n", "seeder.add_player(tp)\n", "for n in range(1, round_number):\n", "rnd = tournament.round_numbered(n)\n", "for tp in tourney_players:\n", "for g in rnd.game_set.all():\n", "for sb in tp.seederbias_set.all():\n", "return seeder\n", "game = set()\n", "seeder.add_bias(sb.player1, sb.player2, sb.weight)\n", "for gp in g.gameplayer_set.all():\n", "game.add((gp.tournamentplayer(), gp.power))\n", "assert len(game) == 7\n", "seeder.add_played_game(game)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Expr'", "For", "Assign'", "For", "For", "For", "Return'", "Assign'", "Expr'", "For", "Expr'", "Assert'", "Expr'" ]
[ "def FUNC_0():...\n", "VAR_8, VAR_3 = FUNC_1()\n", "VAR_9 = usr.validateCredentials(VAR_8, VAR_3, VAR_6)\n", "return VAR_9\n" ]
[ "def isUserAuthorized():...\n", "username, password = getUsernameAndPassword()\n", "response = usr.validateCredentials(username, password, mysql)\n", "return response\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "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'" ]
[ "def FUNC_16(self, VAR_34, VAR_35):...\n", "\"\"\"docstring\"\"\"\n", "return os.write(VAR_34, VAR_35)\n" ]
[ "def write(self, fd, string):...\n", "\"\"\"docstring\"\"\"\n", "return os.write(fd, string)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_7(self, VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = {'page_title': 'Access Denied', 'error': VAR_17}\n", "self.reply('auth/access_denied.html', VAR_15=env, VAR_16=401)\n" ]
[ "def authentication_error(self, error):...\n", "\"\"\"docstring\"\"\"\n", "env = {'page_title': 'Access Denied', 'error': error}\n", "self.reply('auth/access_denied.html', env=env, status=401)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_46(self, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "VAR_56 = self.regex.search(VAR_16)\n", "if VAR_56 is not None:\n", "return VAR_56.group('value')\n" ]
[ "def is_periodic(self, value):...\n", "\"\"\"docstring\"\"\"\n", "m = self.regex.search(value)\n", "if m is not None:\n", "return m.group('value')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'" ]
[ "def FUNC_19(self, VAR_11):...\n", "\"\"\"docstring\"\"\"\n", "if len(self.iscsi_ips) == 1:\n", "return self.iscsi_ips.keys()[0]\n", "VAR_15 = self._get_active_nsp(VAR_11)\n", "if VAR_15 is None:\n", "VAR_15 = self._get_least_used_nsp(self._get_iscsi_nsps())\n", "return self._get_ip_using_nsp(VAR_15)\n", "if VAR_15 is None:\n", "VAR_40 = _('Least busy iSCSI port not found, using first iSCSI port in list.')\n", "VAR_1.warn(VAR_40)\n", "return self.iscsi_ips.keys()[0]\n" ]
[ "def _get_iscsi_ip(self, hostname):...\n", "\"\"\"docstring\"\"\"\n", "if len(self.iscsi_ips) == 1:\n", "return self.iscsi_ips.keys()[0]\n", "nsp = self._get_active_nsp(hostname)\n", "if nsp is None:\n", "nsp = self._get_least_used_nsp(self._get_iscsi_nsps())\n", "return self._get_ip_using_nsp(nsp)\n", "if nsp is None:\n", "msg = _('Least busy iSCSI port not found, using first iSCSI port in list.')\n", "LOG.warn(msg)\n", "return self.iscsi_ips.keys()[0]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_30():...\n", "if VAR_3 == 'text':\n", "print('Input file: %s' % VAR_75)\n", "VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronyms)\n", "if VAR_12:\n", "return VAR_52\n", "if isinstance(VAR_52, dict):\n", "for VAR_84 in VAR_52:\n", "print(VAR_52[VAR_84])\n" ]
[ "def process_lines():...\n", "if output_mode == 'text':\n", "print('Input file: %s' % source)\n", "output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with_author_keywords, rebuild_cache=rebuild_cache, only_core_tags=\n only_core_tags, extract_acronyms=extract_acronyms)\n", "if api:\n", "return output\n", "if isinstance(output, dict):\n", "for i in output:\n", "print(output[i])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Condition", "For", "Expr'" ]
[ "from __future__ import absolute_import, division, print_function, unicode_literals\n", "from builtins import object\n", "from pants.backend.jvm.subsystems.dependency_context import DependencyContext\n", "from pants.backend.jvm.subsystems.java import Java\n", "from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin\n", "from pants.backend.jvm.subsystems.scala_platform import ScalaPlatform\n", "from pants.backend.jvm.subsystems.shader import Shader\n", "from pants.backend.jvm.targets.scala_jar_dependency import ScalaJarDependency\n", "from pants.backend.jvm.tasks.classpath_products import ClasspathEntry\n", "from pants.backend.jvm.tasks.classpath_util import ClasspathUtil\n", "from pants.base.build_environment import get_buildroot\n", "from pants.engine.fs import PathGlobs, PathGlobsAndRoot\n", "from pants.java.jar.jar_dependency import JarDependency\n", "from pants.subsystem.subsystem import Subsystem\n", "from pants.util.dirutil import fast_relpath\n", "from pants.util.memo import memoized_method, memoized_property\n", "\"\"\"Configuration for Pants' zinc wrapper tool.\"\"\"\n", "VAR_0 = 'org.pantsbuild.zinc.compiler.Main'\n", "VAR_1 = 'org.pantsbuild.zinc.extractor.Main'\n", "VAR_2 = ['default']\n", "VAR_3 = 'zinc'\n", "VAR_4 = 'zinc-extractor'\n", "VAR_11 = 'zinc'\n", "@classmethod...\n", "return super(CLASS_0.Factory, VAR_12).subsystem_dependencies() + (\n DependencyContext, Java, ScalaPlatform)\n" ]
[ "from __future__ import absolute_import, division, print_function, unicode_literals\n", "from builtins import object\n", "from pants.backend.jvm.subsystems.dependency_context import DependencyContext\n", "from pants.backend.jvm.subsystems.java import Java\n", "from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin\n", "from pants.backend.jvm.subsystems.scala_platform import ScalaPlatform\n", "from pants.backend.jvm.subsystems.shader import Shader\n", "from pants.backend.jvm.targets.scala_jar_dependency import ScalaJarDependency\n", "from pants.backend.jvm.tasks.classpath_products import ClasspathEntry\n", "from pants.backend.jvm.tasks.classpath_util import ClasspathUtil\n", "from pants.base.build_environment import get_buildroot\n", "from pants.engine.fs import PathGlobs, PathGlobsAndRoot\n", "from pants.java.jar.jar_dependency import JarDependency\n", "from pants.subsystem.subsystem import Subsystem\n", "from pants.util.dirutil import fast_relpath\n", "from pants.util.memo import memoized_method, memoized_property\n", "\"\"\"Configuration for Pants' zinc wrapper tool.\"\"\"\n", "ZINC_COMPILE_MAIN = 'org.pantsbuild.zinc.compiler.Main'\n", "ZINC_EXTRACT_MAIN = 'org.pantsbuild.zinc.extractor.Main'\n", "DEFAULT_CONFS = ['default']\n", "ZINC_COMPILER_TOOL_NAME = 'zinc'\n", "ZINC_EXTRACTOR_TOOL_NAME = 'zinc-extractor'\n", "options_scope = 'zinc'\n", "@classmethod...\n", "return super(Zinc.Factory, cls).subsystem_dependencies() + (DependencyContext,\n Java, ScalaPlatform)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_10(self):...\n", "from invenio.modules.oauthclient.models import RemoteAccount\n", "RemoteAccount.create(1, 'testid', None)\n", "self.assert401(self.client.get(url_for('oauthclient_settings.index'),\n follow_redirects=True))\n", "self.login('admin', '')\n", "VAR_10 = self.client.get(url_for('oauthclient_settings.index'))\n", "self.assert200(VAR_10)\n", "assert 'MyLinkedTestAccount' in VAR_10.data\n", "assert url_for('oauthclient.disconnect', remote_app='test') in VAR_10.data\n", "assert url_for('oauthclient.login', remote_app='full') in VAR_10.data\n", "assert url_for('oauthclient.login', remote_app='test_invalid') in VAR_10.data\n" ]
[ "def test_settings_view(self):...\n", "from invenio.modules.oauthclient.models import RemoteAccount\n", "RemoteAccount.create(1, 'testid', None)\n", "self.assert401(self.client.get(url_for('oauthclient_settings.index'),\n follow_redirects=True))\n", "self.login('admin', '')\n", "res = self.client.get(url_for('oauthclient_settings.index'))\n", "self.assert200(res)\n", "assert 'MyLinkedTestAccount' in res.data\n", "assert url_for('oauthclient.disconnect', remote_app='test') in res.data\n", "assert url_for('oauthclient.login', remote_app='full') in res.data\n", "assert url_for('oauthclient.login', remote_app='test_invalid') in res.data\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assert'", "Assert'", "Assert'", "Assert'" ]
[ "def FUNC_2(VAR_7, VAR_3, VAR_4):...\n", "VAR_22 = VAR_3[VAR_7]\n", "VAR_23 = SymbolicInput(VAR_4[0], 'Not', VAR_22)\n", "VAR_3[VAR_4[0]] = VAR_23\n", "VAR_4[0] -= 1\n" ]
[ "def makeJump(x, symbols, symId):...\n", "sym = symbols[x]\n", "newSym = SymbolicInput(symId[0], 'Not', sym)\n", "symbols[symId[0]] = newSym\n", "symId[0] -= 1\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "AugAssign'" ]
[ "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_36(self):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('create table t1(i int)')\n", "VAR_4 = self.cursor.execute('delete from t1')\n", "self.assertEqual(VAR_4, self.cursor)\n" ]
[ "def test_retcursor_nodata(self):...\n", "\"\"\"docstring\"\"\"\n", "self.cursor.execute('create table t1(i int)')\n", "v = self.cursor.execute('delete from t1')\n", "self.assertEqual(v, self.cursor)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_25(self, VAR_19=None):...\n", "super().clean_fields(VAR_19=exclude)\n", "if self.tracker.has_changed('group_type_id') and self.extracted_docs():\n", "VAR_31 = (\n 'The Group Type may not be changed once extracted documents have been associated with the group.'\n )\n" ]
[ "def clean_fields(self, exclude=None):...\n", "super().clean_fields(exclude=exclude)\n", "if self.tracker.has_changed('group_type_id') and self.extracted_docs():\n", "msg = (\n 'The Group Type may not be changed once extracted documents have been associated with the group.'\n )\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Assign'" ]
[ "def __bool__(self):...\n", "return bool(self._r_item_)\n" ]
[ "def __bool__(self):...\n", "return bool(self._r_item_)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "__author__ = 'vladimir'\n", "import ujson\n", "from flask import Blueprint\n", "VAR_0 = '/thread'\n", "VAR_1 = Blueprint('thread', __name__)\n", "@VAR_1.route(VAR_0 + '/create', methods=['GET'])...\n", "return ujson.dumps({'success': True})\n" ]
[ "__author__ = 'vladimir'\n", "import ujson\n", "from flask import Blueprint\n", "BASE_URL = '/thread'\n", "thread = Blueprint('thread', __name__)\n", "@thread.route(BASE_URL + '/create', methods=['GET'])...\n", "return ujson.dumps({'success': True})\n" ]
[ 0, 0, 0, 4, 4, 0, 0 ]
[ "Assign'", "Import'", "ImportFrom'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_15(self, VAR_65):...\n", "if self.overwrite_workdir is None:\n", "if not os.path.exists(VAR_65):\n", "os.makedirs(VAR_65)\n", "self._workdir = VAR_65\n", "os.chdir(VAR_65)\n" ]
[ "def workdir(self, workdir):...\n", "if self.overwrite_workdir is None:\n", "if not os.path.exists(workdir):\n", "os.makedirs(workdir)\n", "self._workdir = workdir\n", "os.chdir(workdir)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_38(self, VAR_40, VAR_41, VAR_42=None):...\n", "\"\"\"docstring\"\"\"\n", "self._names[VAR_40] = VAR_41, VAR_42\n", "if VAR_42 is None:\n", "setattr(self, VAR_40, self[VAR_41])\n", "setattr(self, VAR_40, CLASS_2(VAR_37=self[index:end]))\n" ]
[ "def set_name(self, name, index, end=None):...\n", "\"\"\"docstring\"\"\"\n", "self._names[name] = index, end\n", "if end is None:\n", "setattr(self, name, self[index])\n", "setattr(self, name, Namedlist(toclone=self[index:end]))\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_4(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def at_login(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_18(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7, VAR_12 = self.make_xsrf_handling_app(VAR_4='tok')\n", "VAR_17 = VAR_7.get('/request').body\n", "VAR_7.post('/request', {'tok': VAR_17})\n", "self.assertEqual([('POST', True)], VAR_12)\n" ]
[ "def test_xsrf_token_uses_xsrf_token_request_param(self):...\n", "\"\"\"docstring\"\"\"\n", "app, calls = self.make_xsrf_handling_app(xsrf_token_request_param='tok')\n", "token = app.get('/request').body\n", "app.post('/request', {'tok': token})\n", "self.assertEqual([('POST', True)], calls)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, *VAR_2, **VAR_1):...\n", "if VAR_1.pop('add_xsrf_token', True):\n", "VAR_1 = self._set_xsrf_headers(VAR_1)\n", "VAR_0 = super(CLASS_0, self).post(*VAR_2, **kwargs)\n", "self._store_xsrf_token(VAR_0)\n", "return VAR_0\n" ]
[ "def post(self, *args, **kwargs):...\n", "if kwargs.pop('add_xsrf_token', True):\n", "kwargs = self._set_xsrf_headers(kwargs)\n", "response = super(Session, self).post(*args, **kwargs)\n", "self._store_xsrf_token(response)\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "import mimetypes\n", "import os\n", "from django.contrib.gis.db.models import GeometryField\n", "from django.contrib.gis.db.models.functions import Envelope\n", "from django.core.exceptions import ObjectDoesNotExist\n", "from django.db.models.functions import Cast\n", "from django.http import HttpResponse\n", "from wsgiref.util import FileWrapper\n", "from rest_framework import status, serializers, viewsets, filters, exceptions, permissions, parsers\n", "from rest_framework.response import Response\n", "from rest_framework.decorators import detail_route\n", "from rest_framework.views import APIView\n", "from .common import get_and_check_project, get_tile_json\n", "from app import models, scheduler, pending_actions\n", "from nodeodm.models import ProcessingNode\n", "def FUNC_0(self, VAR_0):...\n", "return VAR_0.id\n" ]
[ "import mimetypes\n", "import os\n", "from django.contrib.gis.db.models import GeometryField\n", "from django.contrib.gis.db.models.functions import Envelope\n", "from django.core.exceptions import ObjectDoesNotExist\n", "from django.db.models.functions import Cast\n", "from django.http import HttpResponse\n", "from wsgiref.util import FileWrapper\n", "from rest_framework import status, serializers, viewsets, filters, exceptions, permissions, parsers\n", "from rest_framework.response import Response\n", "from rest_framework.decorators import detail_route\n", "from rest_framework.views import APIView\n", "from .common import get_and_check_project, get_tile_json\n", "from app import models, scheduler, pending_actions\n", "from nodeodm.models import ProcessingNode\n", "def to_representation(self, obj):...\n", "return obj.id\n" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Return'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = '/api/apps'\n", "VAR_3 = self.client.post(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "self.assertIn('structure', VAR_3.data)\n", "self.assertEqual(VAR_3.data['structure'], {})\n", "VAR_7 = App.objects.get(id=app_id)\n", "VAR_7.structure = {'web': 1}\n", "VAR_7.save()\n", "VAR_2 = '/api/apps/{}'.format(VAR_4)\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertIn('structure', VAR_3.data)\n", "self.assertEqual(VAR_3.data['structure'], {'web': 1})\n" ]
[ "def test_app_structure_is_valid_json(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "self.assertIn('structure', response.data)\n", "self.assertEqual(response.data['structure'], {})\n", "app = App.objects.get(id=app_id)\n", "app.structure = {'web': 1}\n", "app.save()\n", "url = '/api/apps/{}'.format(app_id)\n", "response = self.client.get(url)\n", "self.assertIn('structure', response.data)\n", "self.assertEqual(response.data['structure'], {'web': 1})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_1(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "from opennode.oms.zodb import db\n", "VAR_6 = db.get_root()['oms_root']\n", "VAR_7, VAR_8 = FUNC_0(VAR_6, VAR_2)\n", "if VAR_7 and not VAR_8:\n", "return VAR_7[-1]\n", "return None\n" ]
[ "def traverse1(path):...\n", "\"\"\"docstring\"\"\"\n", "from opennode.oms.zodb import db\n", "oms_root = db.get_root()['oms_root']\n", "objs, untraversed_path = traverse_path(oms_root, path)\n", "if objs and not untraversed_path:\n", "return objs[-1]\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_35(self, VAR_14):...\n", "VAR_20 = self.get_related_model(VAR_14)\n", "return self.session.query(VAR_20).all()\n" ]
[ "def query_model_relation(self, col_name):...\n", "model = self.get_related_model(col_name)\n", "return self.session.query(model).all()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_2(VAR_0, VAR_1, **VAR_2):...\n", "VAR_18 = VAR_1.course_instance\n", "if not VAR_18 and VAR_1.submission:\n", "VAR_18 = VAR_1.submission.exercise.course_instance\n", "CLASS_0.invalidate(VAR_18, VAR_1.recipient.user)\n" ]
[ "def invalidate_notification(sender, instance, **kwargs):...\n", "course = instance.course_instance\n", "if not course and instance.submission:\n", "course = instance.submission.exercise.course_instance\n", "CachedPoints.invalidate(course, instance.recipient.user)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def __iter__(self):...\n", "" ]
[ "def __iter__(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_4(VAR_2, VAR_3=None, VAR_4=None, VAR_5=0, VAR_6=20, VAR_7=None):...\n", "VAR_11 = []\n", "if VAR_4:\n", "if VAR_4.blogger:\n", "if VAR_3:\n", "VAR_11.append('t1.blogger=\"%s\"' % frappe.db.escape(VAR_4.blogger))\n", "if VAR_4.blog_category:\n", "VAR_11.append('(t1.content like \"%{0}%\" or t1.title like \"%{0}%\")'.format(\n frappe.db.escape(VAR_3)))\n", "if VAR_11:\n", "VAR_11.append('t1.blog_category=\"%s\"' % frappe.db.escape(VAR_4.blog_category))\n", "frappe.local.no_cache = 1\n", "VAR_12 = 'string' % {'start': VAR_5, 'page_len': VAR_6, 'condition': \n ' and ' + ' and '.join(VAR_11) if VAR_11 else ''}\n", "VAR_13 = frappe.db.sql(VAR_12, as_dict=1)\n", "for post in VAR_13:\n", "post.cover_image = find_first_image(post.content)\n", "return VAR_13\n", "post.published = global_date_format(post.creation)\n", "post.content = strip_html_tags(post.content[:340])\n", "if not post.comments:\n", "post.comment_text = _('No comments yet')\n", "if post.comments == 1:\n", "post.avatar = post.avatar or ''\n", "post.comment_text = _('1 comment')\n", "post.comment_text = _('{0} comments').format(str(post.comments))\n", "post.category = frappe.db.get_value('Blog Category', post.blog_category, [\n 'route', 'title'], as_dict=True)\n", "if post.avatar and (not 'http:' in post.avatar and not 'https:' in post.avatar\n", "post.avatar = '/' + post.avatar\n" ]
[ "def get_blog_list(doctype, txt=None, filters=None, limit_start=0,...\n", "conditions = []\n", "if filters:\n", "if filters.blogger:\n", "if txt:\n", "conditions.append('t1.blogger=\"%s\"' % frappe.db.escape(filters.blogger))\n", "if filters.blog_category:\n", "conditions.append('(t1.content like \"%{0}%\" or t1.title like \"%{0}%\")'.\n format(frappe.db.escape(txt)))\n", "if conditions:\n", "conditions.append('t1.blog_category=\"%s\"' % frappe.db.escape(filters.\n blog_category))\n", "frappe.local.no_cache = 1\n", "query = (\n \"\"\"\t\tselect\n\t\t\tt1.title, t1.name, t1.blog_category, t1.route, t1.published_on,\n\t\t\t\tt1.published_on as creation,\n\t\t\t\tt1.content as content,\n\t\t\t\tifnull(t1.blog_intro, t1.content) as intro,\n\t\t\t\tt2.full_name, t2.avatar, t1.blogger,\n\t\t\t\t(select count(name) from `tabCommunication`\n\t\t\t\t\twhere\n\t\t\t\t\t\tcommunication_type='Comment'\n\t\t\t\t\t\tand comment_type='Comment'\n\t\t\t\t\t\tand reference_doctype='Blog Post'\n\t\t\t\t\t\tand reference_name=t1.name) as comments\n\t\tfrom `tabBlog Post` t1, `tabBlogger` t2\n\t\twhere ifnull(t1.published,0)=1\n\t\tand t1.blogger = t2.name\n\t\t%(condition)s\n\t\torder by published_on desc, name asc\n\t\tlimit %(start)s, %(page_len)s\"\"\"\n % {'start': limit_start, 'page_len': limit_page_length, 'condition': \n ' and ' + ' and '.join(conditions) if conditions else ''})\n", "posts = frappe.db.sql(query, as_dict=1)\n", "for post in posts:\n", "post.cover_image = find_first_image(post.content)\n", "return posts\n", "post.published = global_date_format(post.creation)\n", "post.content = strip_html_tags(post.content[:340])\n", "if not post.comments:\n", "post.comment_text = _('No comments yet')\n", "if post.comments == 1:\n", "post.avatar = post.avatar or ''\n", "post.comment_text = _('1 comment')\n", "post.comment_text = _('{0} comments').format(str(post.comments))\n", "post.category = frappe.db.get_value('Blog Category', post.blog_category, [\n 'route', 'title'], as_dict=True)\n", "if post.avatar and (not 'http:' in post.avatar and not 'https:' in post.avatar\n", "post.avatar = '/' + post.avatar\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 ]
[ "FunctionDef'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "\"\"\"string\"\"\"\n", "import sys\n", "from hp3parclient import exceptions as hpexceptions\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder import utils\n", "import cinder.volume.driver\n", "from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon\n", "from cinder.volume.drivers.san import san\n", "VAR_0 = 1.1\n", "VAR_1 = logging.getLogger(__name__)\n", "VAR_2 = 3260\n", "\"\"\"string\"\"\"\n", "def __init__(self, *VAR_3, **VAR_4):...\n", "super(CLASS_0, self).__init__(*VAR_3, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n", "def FUNC_0(self):...\n", "return hpcommon.HP3PARCommon(self.configuration)\n" ]
[ "\"\"\"\nVolume driver for HP 3PAR Storage array.\nThis driver requires 3.1.2 MU2 firmware on the 3PAR array.\n\nYou will need to install the python hp3parclient.\nsudo pip install hp3parclient\n\nSet the following in the cinder.conf file to enable the\n3PAR iSCSI Driver along with the required flags:\n\nvolume_driver=cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver\n\"\"\"\n", "import sys\n", "from hp3parclient import exceptions as hpexceptions\n", "from cinder import exception\n", "from cinder.openstack.common import log as logging\n", "from cinder import utils\n", "import cinder.volume.driver\n", "from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon\n", "from cinder.volume.drivers.san import san\n", "VERSION = 1.1\n", "LOG = logging.getLogger(__name__)\n", "DEFAULT_ISCSI_PORT = 3260\n", "\"\"\"OpenStack iSCSI driver to enable 3PAR storage array.\n\n Version history:\n 1.0 - Initial driver\n 1.1 - QoS, extend volume, multiple iscsi ports, remove domain,\n session changes, faster clone, requires 3.1.2 MU2 firmware.\n\n \"\"\"\n", "def __init__(self, *args, **kwargs):...\n", "super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n", "def _init_common(self):...\n", "return hpcommon.HP3PARCommon(self.configuration)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Return'" ]
[ "\"\"\"todo_server_db.py\n\nA class for communicating with MySQL to add, update, and remove tags and tasks.\n\"\"\"\n", "import sys\n", "import datetime\n", "import MySQLdb\n", "\"\"\"string\"\"\"\n", "VAR_0 = 'misc'\n", "VAR_1 = 0\n", "VAR_2 = 1\n", "VAR_3 = 2\n", "VAR_4 = 3\n", "VAR_5 = 4\n", "VAR_6 = 5\n", "VAR_7 = 6\n", "def __init__(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "self.default_tag = VAR_8\n", "def FUNC_0(self, VAR_9='localhost', VAR_10='todo', VAR_11='todo', VAR_12='todo'...\n", "\"\"\"docstring\"\"\"\n", "self.__con = MySQLdb.connect(VAR_9, VAR_10, VAR_11, VAR_12)\n", "return CLASS_0.CANT_CONNECT\n", "def FUNC_1(self):...\n", "self.__con.autocommit(True)\n", "\"\"\"docstring\"\"\"\n", "return CLASS_0.SUCCESS\n", "self.__con.close()\n", "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = map(lambda x: int(x), VAR_13.split('-'))\n", "return CLASS_0.INVALID_DATE\n", "return VAR_23.isoformat()\n", "VAR_23 = datetime.date(VAR_22[2], VAR_22[0], VAR_22[1])\n" ]
[ "\"\"\"todo_server_db.py\n\nA class for communicating with MySQL to add, update, and remove tags and tasks.\n\"\"\"\n", "import sys\n", "import datetime\n", "import MySQLdb\n", "\"\"\"Interface to the MySQL database.\n\n A class for communicating with MySQL to add, update, and remove tags and\n tasks. Changing database methods will effect network/network.py since\n the method calls are only defined there and in the actual client script\n todo.py. The global attributes here are used as responses from the Todo\n server in todo_server_thread.py.\n\n Attributes:\n DEFAULT_TAG: tag to default to if no default tag is specified\n CANT_CONNECT: returned when Database can't connect to MySQL\n SUCCESS: returned for successful database calls\n DUPLICATE: returned when a method attempts to insert a duplicate entry\n DOES_NOT_EXIST: returned when a delete or update method can not find the\n row to delete or update\n INVALID_DATE: returned when a date passed to a method is not valid\n DATA: returned when data is passed across the network rather than an\n enumerated reponse\n \"\"\"\n", "DEFAULT_TAG = 'misc'\n", "CANT_CONNECT = 0\n", "SUCCESS = 1\n", "DUPLICATE = 2\n", "DOES_NOT_EXIST = 3\n", "INVALID_ID = 4\n", "INVALID_DATE = 5\n", "DATA = 6\n", "def __init__(self, default_tag):...\n", "\"\"\"docstring\"\"\"\n", "self.default_tag = default_tag\n", "def connect(self, hostname='localhost', username='todo', password='todo',...\n", "\"\"\"docstring\"\"\"\n", "self.__con = MySQLdb.connect(hostname, username, password, database)\n", "return Database.CANT_CONNECT\n", "def close(self):...\n", "self.__con.autocommit(True)\n", "\"\"\"docstring\"\"\"\n", "return Database.SUCCESS\n", "self.__con.close()\n", "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "pieces = map(lambda x: int(x), date.split('-'))\n", "return Database.INVALID_DATE\n", "return valid_date.isoformat()\n", "valid_date = datetime.date(pieces[2], pieces[0], pieces[1])\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 ]
[ "Expr'", "Import'", "Import'", "Import'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Condition", "Docstring", "Assign'", "Return'", "FunctionDef'", "Expr'", "Docstring", "Return'", "Expr'", "Condition", "Docstring", "Assign'", "Return'", "Return'", "Assign'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_16 = copy(self.flow)\n", "VAR_16.redirect_uri = url_for('oidc_callback', _external=True)\n", "return VAR_16\n" ]
[ "def flow_for_request(self):...\n", "\"\"\"docstring\"\"\"\n", "flow = copy(self.flow)\n", "flow.redirect_uri = url_for('oidc_callback', _external=True)\n", "return flow\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_12(self, VAR_1):...\n", "VAR_22 = VAR_1.split('-')\n", "VAR_23 = int(datetime(int(VAR_22[0]), int(VAR_22[1]), 1, 0, 0, 0, tzinfo=\n pytz.utc).timestamp())\n", "VAR_24 = int(datetime(int(VAR_22[0]), int(VAR_22[1]), self.\n get_last_day_of_month(VAR_1), 23, 59, 59, tzinfo=pytz.utc).timestamp())\n", "return VAR_23, VAR_24\n" ]
[ "def get_epoch_month(self, date):...\n", "s = date.split('-')\n", "epoch_start = int(datetime(int(s[0]), int(s[1]), 1, 0, 0, 0, tzinfo=pytz.\n utc).timestamp())\n", "epoch_end = int(datetime(int(s[0]), int(s[1]), self.get_last_day_of_month(\n date), 23, 59, 59, tzinfo=pytz.utc).timestamp())\n", "return epoch_start, epoch_end\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "self.keypairs[self.tenant_id] = self.verify(30, self._create_keypair, 1,\n 'Keypair can not be created.', 'keypair creation', self.compute_client)\n" ]
[ "def test_001_create_keypairs(self):...\n", "\"\"\"docstring\"\"\"\n", "self.keypairs[self.tenant_id] = self.verify(30, self._create_keypair, 1,\n 'Keypair can not be created.', 'keypair creation', self.compute_client)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'" ]
[ "def FUNC_21(self):...\n", "self.assertTrue(sys.stderr.fileno() > 2,\n 'Expected a pseudofile as stderr, got: {}'.format(sys.stderr))\n", "VAR_12, VAR_13, VAR_14 = sys.stdout, sys.stderr, sys.stdin\n", "self.assertEqual(sys.stdin.fileno(), 0)\n", "self.assertEqual(sys.stdout.fileno(), 1)\n", "self.assertEqual(sys.stderr.fileno(), 2)\n", "self.assertEqual(sys.stdout, VAR_12)\n", "self.assertEqual(sys.stderr, VAR_13)\n", "self.assertEqual(sys.stdin, VAR_14)\n" ]
[ "def test_stdio_as(self):...\n", "self.assertTrue(sys.stderr.fileno() > 2,\n 'Expected a pseudofile as stderr, got: {}'.format(sys.stderr))\n", "old_stdout, old_stderr, old_stdin = sys.stdout, sys.stderr, sys.stdin\n", "self.assertEqual(sys.stdin.fileno(), 0)\n", "self.assertEqual(sys.stdout.fileno(), 1)\n", "self.assertEqual(sys.stderr.fileno(), 2)\n", "self.assertEqual(sys.stdout, old_stdout)\n", "self.assertEqual(sys.stderr, old_stderr)\n", "self.assertEqual(sys.stdin, old_stdin)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_8(self, VAR_7, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = self._attributes.copy()\n", "VAR_13['event'] = VAR_7\n", "VAR_13['message'] = VAR_8\n", "self._remote.url_read_json('/swarming/api/v1/bot/event', VAR_13=data)\n" ]
[ "def post_event(self, event_type, message):...\n", "\"\"\"docstring\"\"\"\n", "data = self._attributes.copy()\n", "data['event'] = event_type\n", "data['message'] = message\n", "self._remote.url_read_json('/swarming/api/v1/bot/event', data=data)\n" ]
[ 0, 0, 0, 0, 0, 5 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_1 = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show')\n", "self.driver._eql_execute('volume', 'select', VAR_1['name'], 'offline')\n", "self.driver._eql_execute('volume', 'delete', VAR_1['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(VAR_1)\n" ]
[ "def test_delete_volume(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "volume = {'name': self.volume_name, 'size': 1}\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'show')\n", "self.driver._eql_execute('volume', 'select', volume['name'], 'offline')\n", "self.driver._eql_execute('volume', 'delete', volume['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_volume(volume)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@acs_action('terminate-account-action')...\n", "\"\"\"docstring\"\"\"\n", "return FUNC_3('reauthn-for-termination', VAR_0, VAR_1)\n" ]
[ "@acs_action('terminate-account-action')...\n", "\"\"\"docstring\"\"\"\n", "return _reauthn('reauthn-for-termination', session_info, user)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "@VAR_2.route('/data/setadetails/')...\n", "VAR_52 = request.args.get('date', '')\n", "VAR_53 = request.args.get('active', 0)\n", "VAR_54 = request.args.get('buildbot', 0)\n", "VAR_55 = request.args.get('branch', '')\n", "VAR_56 = request.args.get('taskcluster', 0)\n", "VAR_57 = request.args.get('priority', 'low')\n", "VAR_58 = VAR_3.jobnames_query()\n", "if VAR_52 == '' or VAR_52 == 'latest':\n", "VAR_72 = datetime.now()\n", "VAR_28 = FUNC_0()\n", "VAR_52 = VAR_72.strftime('%Y-%m-%d')\n", "VAR_32 = VAR_28.cursor()\n", "VAR_41 = \"select jobtype from seta where date='%s 00:00:00'\" % VAR_52\n", "VAR_32.execute(VAR_41)\n", "VAR_51 = {}\n", "VAR_51[VAR_52] = []\n", "VAR_59 = []\n", "if (str(VAR_55) in ['fx-team', 'mozilla-inbound', 'autoland']\n", "abort(404)\n", "for VAR_71 in VAR_32.fetchall():\n", "VAR_73 = VAR_71[0].split(\"'\")\n", "VAR_60 = VAR_3.jobtype_query()\n", "VAR_59.append([VAR_73[1], VAR_73[3], VAR_73[5]])\n", "if VAR_57 == 'low':\n", "VAR_74 = [low_value_job for low_value_job in VAR_60 if low_value_job not in\n VAR_59]\n", "if VAR_53:\n", "VAR_59 = VAR_74\n", "VAR_75 = []\n", "if VAR_54:\n", "for job in VAR_60:\n", "VAR_75 = []\n", "if VAR_56:\n", "VAR_85 = False\n", "VAR_59 = VAR_75\n", "VAR_76 = [job for job in VAR_58 if job['buildplatform'] == 'buildbot']\n", "VAR_75 = []\n", "VAR_51[VAR_52] = VAR_59\n", "for j in VAR_59:\n", "for job in VAR_59:\n", "VAR_77 = [job for job in VAR_58 if job['buildplatform'] == 'taskcluster']\n", "return {'jobtypes': VAR_51}\n", "if j[0] == job[0] and j[1] == job[1] and j[2] == job[2]:\n", "if not VAR_85:\n", "for j in VAR_76:\n", "VAR_59 = VAR_75\n", "for job in VAR_59:\n", "VAR_85 = True\n", "VAR_75.append(job)\n", "if j['name'] == job[2] and j['platform'] == job[0] and j['buildtype'] == job[1\n", "for j in VAR_77:\n", "VAR_59 = VAR_75\n", "VAR_75.append(j['ref_data_name'] if VAR_55 is 'mozilla-inbound' else j[\n 'ref_data_name'].replace('mozilla-inbound', VAR_55))\n", "if j['name'] == job[2] and j['platform'] == job[0] and j['buildtype'] == job[1\n", "VAR_75.append(j['ref_data_name'])\n" ]
[ "@app.route('/data/setadetails/')...\n", "date = request.args.get('date', '')\n", "active = request.args.get('active', 0)\n", "buildbot = request.args.get('buildbot', 0)\n", "branch = request.args.get('branch', '')\n", "taskcluster = request.args.get('taskcluster', 0)\n", "priority = request.args.get('priority', 'low')\n", "jobnames = JOBSDATA.jobnames_query()\n", "if date == '' or date == 'latest':\n", "today = datetime.now()\n", "db = create_db_connnection()\n", "date = today.strftime('%Y-%m-%d')\n", "cursor = db.cursor()\n", "query = \"select jobtype from seta where date='%s 00:00:00'\" % date\n", "cursor.execute(query)\n", "retVal = {}\n", "retVal[date] = []\n", "jobtype = []\n", "if (str(branch) in ['fx-team', 'mozilla-inbound', 'autoland']\n", "abort(404)\n", "for d in cursor.fetchall():\n", "parts = d[0].split(\"'\")\n", "alljobs = JOBSDATA.jobtype_query()\n", "jobtype.append([parts[1], parts[3], parts[5]])\n", "if priority == 'low':\n", "low_value_jobs = [low_value_job for low_value_job in alljobs if \n low_value_job not in jobtype]\n", "if active:\n", "jobtype = low_value_jobs\n", "active_jobs = []\n", "if buildbot:\n", "for job in alljobs:\n", "active_jobs = []\n", "if taskcluster:\n", "found = False\n", "jobtype = active_jobs\n", "buildbot_jobs = [job for job in jobnames if job['buildplatform'] == 'buildbot']\n", "active_jobs = []\n", "retVal[date] = jobtype\n", "for j in jobtype:\n", "for job in jobtype:\n", "taskcluster_jobs = [job for job in jobnames if job['buildplatform'] ==\n 'taskcluster']\n", "return {'jobtypes': retVal}\n", "if j[0] == job[0] and j[1] == job[1] and j[2] == job[2]:\n", "if not found:\n", "for j in buildbot_jobs:\n", "jobtype = active_jobs\n", "for job in jobtype:\n", "found = True\n", "active_jobs.append(job)\n", "if j['name'] == job[2] and j['platform'] == job[0] and j['buildtype'] == job[1\n", "for j in taskcluster_jobs:\n", "jobtype = active_jobs\n", "active_jobs.append(j['ref_data_name'] if branch is 'mozilla-inbound' else j\n ['ref_data_name'].replace('mozilla-inbound', branch))\n", "if j['name'] == job[2] and j['platform'] == job[0] and j['buildtype'] == job[1\n", "active_jobs.append(j['ref_data_name'])\n" ]
[ 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "For", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "For", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "For", "Assign'", "Return'", "Condition", "Condition", "For", "Assign'", "For", "Assign'", "Expr'", "For", "For", "Assign'", "Expr'", "For", "Expr'" ]
[ "def FUNC_5(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.arguments = 'hello'\n", "self.uut.use_stdin = False\n", "self.uut.use_stderr = True\n", "self.uut.process_output = lambda output, filename, file: output\n", "VAR_1 = self.uut.lint('unused_filename')\n", "self.assertEqual((), VAR_1)\n", "self.uut.use_stderr = False\n", "VAR_1 = self.uut.lint('unused_filename')\n", "self.assertEqual(('hello\\n',), VAR_1)\n", "def FUNC_9(VAR_2):...\n", "assert VAR_2 == 'hello'\n", "VAR_3 = self.uut.warn\n", "self.uut.warn = FUNC_9\n", "self.uut._print_errors(['hello', '\\n'])\n", "self.uut.warn = VAR_3\n" ]
[ "def test_stderr_output(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.arguments = 'hello'\n", "self.uut.use_stdin = False\n", "self.uut.use_stderr = True\n", "self.uut.process_output = lambda output, filename, file: output\n", "out = self.uut.lint('unused_filename')\n", "self.assertEqual((), out)\n", "self.uut.use_stderr = False\n", "out = self.uut.lint('unused_filename')\n", "self.assertEqual(('hello\\n',), out)\n", "def assert_warn(line):...\n", "assert line == 'hello'\n", "old_warn = self.uut.warn\n", "self.uut.warn = assert_warn\n", "self.uut._print_errors(['hello', '\\n'])\n", "self.uut.warn = old_warn\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assert'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_13(self, **VAR_6):...\n", "from common.forms import JsonField\n", "VAR_34 = {'form_class': VAR_17}\n", "VAR_34.update(VAR_6)\n", "return super().formfield(**defaults)\n" ]
[ "def formfield(self, **kwargs):...\n", "from common.forms import JsonField\n", "defaults = {'form_class': JsonField}\n", "defaults.update(kwargs)\n", "return super().formfield(**defaults)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_2(self):...\n", "CLASS_2.ScenarioMaker().given_a_deep_link_domain('pachatary://app'\n ).given_a_dynamic_link('').when_call_experience_redirect('AsdE43E4'\n ).then_response_should_be_a_redirect_to(\n 'pachatary://app/experiences/AsdE43E4')\n" ]
[ "def test_when_there_is_no_dynamic_link_returns_deep_link(self):...\n", "RedirectExperienceTestCase.ScenarioMaker().given_a_deep_link_domain(\n 'pachatary://app').given_a_dynamic_link('').when_call_experience_redirect(\n 'AsdE43E4').then_response_should_be_a_redirect_to(\n 'pachatary://app/experiences/AsdE43E4')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "import sublime\n", "import sublime_plugin\n", "import os\n", "import re\n", "import Urtext.urtext as Urtext\n", "def FUNC_0(self, VAR_0):...\n", "if self.view.settings().has('traverse'):\n", "if self.view.settings().get('traverse') == 'true':\n", "self.view.settings().set('traverse', 'true')\n", "self.view.settings().set('traverse', 'false')\n", "self.view.set_status('traverse', 'Traverse: On')\n", "self.view.set_status('traverse', 'Traverse: Off')\n", "self.view.window().set_layout({'cols': [0, 0.4, 1], 'rows': [0, 1], 'cells':\n [[0, 0, 1, 1], [1, 0, 2, 1]]})\n", "return\n", "VAR_3 = self.view.window().views()\n", "VAR_4 = 0\n", "for VAR_1 in VAR_3:\n", "if VAR_1 != self.view:\n", "self.view.window().focus_group(0)\n", "self.view.window().set_view_index(VAR_1, 1, VAR_4)\n", "def FUNC_1(self, VAR_1):...\n", "VAR_4 += 1\n", "if VAR_1.settings().get('traverse') == 'true':\n", "VAR_5 = VAR_1\n", "def FUNC_2(self, VAR_1, VAR_2):...\n", "VAR_6 = VAR_1.window()\n", "if not VAR_1.is_loading():\n", "VAR_7 = VAR_1.substr(VAR_1.line(VAR_1.sel()[0]))\n", "VAR_1.window().focus_view(VAR_2)\n", "sublime.set_timeout(lambda : self.return_to_left(VAR_1, VAR_2), 10)\n", "VAR_8 = re.findall('->\\\\s+([^\\\\|]+)', VAR_7)\n", "VAR_1.window().focus_group(0)\n", "if len(VAR_8) > 0:\n", "VAR_9 = Urtext.get_path(VAR_1.window())\n", "VAR_6.focus_group(1)\n", "VAR_10 = VAR_6.open_file(os.path.join(VAR_9, VAR_8[0].strip()), sublime.\n TRANSIENT)\n", "print('unable to open ' + VAR_8[0])\n", "self.return_to_left(VAR_10, VAR_5)\n", "VAR_10.set_scratch(True)\n" ]
[ "import sublime\n", "import sublime_plugin\n", "import os\n", "import re\n", "import Urtext.urtext as Urtext\n", "def run(self, edit):...\n", "if self.view.settings().has('traverse'):\n", "if self.view.settings().get('traverse') == 'true':\n", "self.view.settings().set('traverse', 'true')\n", "self.view.settings().set('traverse', 'false')\n", "self.view.set_status('traverse', 'Traverse: On')\n", "self.view.set_status('traverse', 'Traverse: Off')\n", "self.view.window().set_layout({'cols': [0, 0.4, 1], 'rows': [0, 1], 'cells':\n [[0, 0, 1, 1], [1, 0, 2, 1]]})\n", "return\n", "views = self.view.window().views()\n", "index = 0\n", "for view in views:\n", "if view != self.view:\n", "self.view.window().focus_group(0)\n", "self.view.window().set_view_index(view, 1, index)\n", "def on_selection_modified(self, view):...\n", "index += 1\n", "if view.settings().get('traverse') == 'true':\n", "tree_view = view\n", "def return_to_left(self, view, return_view):...\n", "window = view.window()\n", "if not view.is_loading():\n", "full_line = view.substr(view.line(view.sel()[0]))\n", "view.window().focus_view(return_view)\n", "sublime.set_timeout(lambda : self.return_to_left(view, return_view), 10)\n", "link = re.findall('->\\\\s+([^\\\\|]+)', full_line)\n", "view.window().focus_group(0)\n", "if len(link) > 0:\n", "path = Urtext.get_path(view.window())\n", "window.focus_group(1)\n", "file_view = window.open_file(os.path.join(path, link[0].strip()), sublime.\n TRANSIENT)\n", "print('unable to open ' + link[0])\n", "self.return_to_left(file_view, tree_view)\n", "file_view.set_scratch(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, 1, 0, 1, 1, 0, 1, 1, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "FunctionDef'", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'", "Assign'", "Assign'", "For", "Condition", "Expr'", "Expr'", "FunctionDef'", "AugAssign'", "Condition", "Assign'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]