lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_2(self, VAR_1):...\n", "VAR_2 = self.connect()\n", "VAR_3 = \"INSERT INTO crimes (description) VALUES ('{}');\".format(VAR_1)\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "VAR_2.commit()\n" ]
[ "def add_input(self, data):...\n", "connection = self.connect()\n", "query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n", "connection.close()\n", "cursor.execute(query)\n", "connection.commit()\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(VAR_0):...\n", "return VAR_0.scheme in ['http', 'https']\n" ]
[ "def is_host(parsed_uri):...\n", "return parsed_uri.scheme in ['http', 'https']\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_13(self):...\n", "VAR_5 = self.current_course_instance.get_edit_url()\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 302)\n", "self.client.login(username='testUser', password='testPassword')\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 403)\n", "self.current_course_instance.assistants.add(self.grader.userprofile)\n", "self.client.login(username='grader', password='graderPassword')\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 403)\n", "VAR_4 = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n", "self.assertEqual(VAR_4.status_code, 200)\n", "self.assertTrue(VAR_4.context['is_assistant'])\n", "self.assertFalse(VAR_4.context['is_teacher'])\n", "self.current_course_instance.assistants.clear()\n", "self.course.teachers.add(self.grader.userprofile)\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 200)\n", "VAR_4 = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n", "self.assertEqual(VAR_4.status_code, 200)\n", "self.assertFalse(VAR_4.context['is_assistant'])\n", "self.assertTrue(VAR_4.context['is_teacher'])\n", "self.client.logout()\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 302)\n", "self.client.login(username='staff', password='staffPassword')\n", "VAR_4 = self.client.get(VAR_5)\n", "self.assertEqual(VAR_4.status_code, 200)\n", "self.assertFalse(VAR_4.context['is_assistant'])\n", "self.assertTrue(VAR_4.context['is_teacher'])\n" ]
[ "def test_course_teacher_views(self):...\n", "url = self.current_course_instance.get_edit_url()\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 302)\n", "self.client.login(username='testUser', password='testPassword')\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 403)\n", "self.current_course_instance.assistants.add(self.grader.userprofile)\n", "self.client.login(username='grader', password='graderPassword')\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 403)\n", "response = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertTrue(response.context['is_assistant'])\n", "self.assertFalse(response.context['is_teacher'])\n", "self.current_course_instance.assistants.clear()\n", "self.course.teachers.add(self.grader.userprofile)\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "response = self.client.get(self.current_course_instance.get_absolute_url(),\n follow=True)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertFalse(response.context['is_assistant'])\n", "self.assertTrue(response.context['is_teacher'])\n", "self.client.logout()\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 302)\n", "self.client.login(username='staff', password='staffPassword')\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertFalse(response.context['is_assistant'])\n", "self.assertTrue(response.context['is_teacher'])\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_9(VAR_10):...\n", "for VAR_7, VAR_6 in VAR_10.items():\n", "if VAR_6 == -1:\n", "print('{0:3} (0x{0:X}): {1}'.format(VAR_6, VAR_7))\n" ]
[ "def print_all_syscalls(syscalls):...\n", "for syscall_name, syscall_number in syscalls.items():\n", "if syscall_number == -1:\n", "print('{0:3} (0x{0:X}): {1}'.format(syscall_number, syscall_name))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Expr'" ]
[ "def FUNC_20(self, VAR_21, VAR_22, VAR_4=None, VAR_23=None, VAR_24=None, **...\n", "\"\"\"docstring\"\"\"\n", "VAR_37 = VAR_4 or VAR_21.spec_path\n", "VAR_38 = os.path.join(get_buildroot(), VAR_37)\n", "if not os.path.exists(VAR_38):\n", "os.makedirs(VAR_38)\n", "if not self.source_roots.find_by_path(VAR_37):\n", "self.source_roots.add_source_root(VAR_37)\n", "if VAR_23:\n", "VAR_23 = [dep.address for dep in VAR_23]\n", "self.build_graph.inject_synthetic_target(VAR_21=address, VAR_22=target_type,\n VAR_23=dependencies, VAR_24=derived_from, **kwargs)\n", "VAR_39 = self.build_graph.get_target(VAR_21)\n", "return VAR_39\n" ]
[ "def add_new_target(self, address, target_type, target_base=None,...\n", "\"\"\"docstring\"\"\"\n", "rel_target_base = target_base or address.spec_path\n", "abs_target_base = os.path.join(get_buildroot(), rel_target_base)\n", "if not os.path.exists(abs_target_base):\n", "os.makedirs(abs_target_base)\n", "if not self.source_roots.find_by_path(rel_target_base):\n", "self.source_roots.add_source_root(rel_target_base)\n", "if dependencies:\n", "dependencies = [dep.address for dep in dependencies]\n", "self.build_graph.inject_synthetic_target(address=address, target_type=\n target_type, dependencies=dependencies, derived_from=derived_from, **kwargs\n )\n", "new_target = self.build_graph.get_target(address)\n", "return new_target\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_18(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_47 = self.auth_method\n", "if not VAR_47:\n", "for VAR_47 in self.get_auth_methods(config.ensure_configured()):\n", "if VAR_47 not in VAR_4:\n", "if VAR_47 in VAR_4:\n", "return VAR_4[VAR_47]\n" ]
[ "def _get_users_api(self):...\n", "\"\"\"docstring\"\"\"\n", "method = self.auth_method\n", "if not method:\n", "for method in self.get_auth_methods(config.ensure_configured()):\n", "if method not in _METHOD_TO_USERS_API:\n", "if method in _METHOD_TO_USERS_API:\n", "return _METHOD_TO_USERS_API[method]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Condition", "Condition", "Return'" ]
[ "def FUNC_3(VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "return FUNC_2(*VAR_6)\n" ]
[ "def wrap_diff(x):...\n", "\"\"\"docstring\"\"\"\n", "return diff(*x)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_0(*VAR_0, **VAR_1):...\n", "def FUNC_5(VAR_12):...\n", "def FUNC_9(self, *VAR_15, **VAR_75):...\n", "for validator in VAR_0:\n", "if VAR_102.method == 'POST' and hasattr(self, 'ajax_login_redirect'):\n", "return FUNC_9\n", "validator(VAR_75)\n", "VAR_16 = self.build_arg_list(VAR_12, VAR_75)\n", "return self.ajax_login_redirect('/')\n", "return self.intermediate_redirect('/login')\n", "for VAR_110, validator in VAR_1.iteritems():\n", "VAR_16[VAR_110] = validator(VAR_75)\n", "return VAR_12(self, *VAR_15, **kw)\n" ]
[ "def validate(*simple_vals, **param_vals):...\n", "def val(fn):...\n", "def newfn(self, *a, **env):...\n", "for validator in simple_vals:\n", "if request.method == 'POST' and hasattr(self, 'ajax_login_redirect'):\n", "return newfn\n", "validator(env)\n", "kw = self.build_arg_list(fn, env)\n", "return self.ajax_login_redirect('/')\n", "return self.intermediate_redirect('/login')\n", "for var, validator in param_vals.iteritems():\n", "kw[var] = validator(env)\n", "return fn(self, *a, **kw)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "FunctionDef'", "For", "Condition", "Return'", "Expr'", "Assign'", "Return'", "Return'", "For", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_13):...\n", "return VAR_13.name in self._localrules or VAR_13.norun\n" ]
[ "def is_local(self, rule):...\n", "return rule.name in self._localrules or rule.norun\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(VAR_0):...\n", "return 'Meetup : %s' % VAR_0.title\n" ]
[ "def meetup_article_title(meetup):...\n", "return 'Meetup : %s' % meetup.title\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import pymysql\n", "import dbconfig\n", "def FUNC_0(self, VAR_0='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ "import pymysql\n", "import dbconfig\n", "def connect(self, database='crimemap'):...\n", "return pymysql.connect(host='localhost', user=dbconfig.db_user, password=\n dbconfig.db_password, db=database)\n" ]
[ 0, 0, 0, 0 ]
[ "Import'", "Import'", "FunctionDef'", "Return'" ]
[ "def FUNC_8(self, VAR_13):...\n", "self.cursor.execute(\"SELECT * FROM brand WHERE name ILIKE '%\" + VAR_13 + \"%';\")\n", "return self.cursor.fetchall()\n" ]
[ "def find_brand_by_name(self, brand_name):...\n", "self.cursor.execute(\"SELECT * FROM brand WHERE name ILIKE '%\" + brand_name +\n \"%';\")\n", "return self.cursor.fetchall()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_7(self, VAR_14):...\n", "" ]
[ "def is_image(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_15(self):...\n", "VAR_33 = self.ref\n", "if '/' in VAR_33:\n", "VAR_33 = VAR_33.split('/', 1)[1]\n", "return VAR_33\n" ]
[ "def noremote_ref(self):...\n", "nr_ref = self.ref\n", "if '/' in nr_ref:\n", "nr_ref = nr_ref.split('/', 1)[1]\n", "return nr_ref\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_15(self):...\n", "" ]
[ "def testDownloadFileDownloadError(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_13(self, VAR_10, VAR_11, VAR_12, VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.common._cli_run('createhost -persona %s -domain %s %s %s' % (\n VAR_13, VAR_12, VAR_10, ' '.join(VAR_11)), None)\n", "if VAR_24 and len(VAR_24) > 1:\n", "return self.common.parse_create_host_error(VAR_10, VAR_24)\n", "return VAR_10\n" ]
[ "def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):...\n", "\"\"\"docstring\"\"\"\n", "out = self.common._cli_run('createhost -persona %s -domain %s %s %s' % (\n persona_id, domain, hostname, ' '.join(wwn)), None)\n", "if out and len(out) > 1:\n", "return self.common.parse_create_host_error(hostname, out)\n", "return hostname\n" ]
[ 0, 0, 2, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_20(VAR_3):...\n", "VAR_18 = \"SELECT token FROM {} WHERE name='{}'\".format(CFG(\n 'tokens_table_name'), VAR_3)\n", "VAR_0, VAR_10 = FUNC_0()\n", "VAR_19 = FUNC_2(VAR_10, VAR_18)\n", "VAR_0.close()\n", "return VAR_19\n" ]
[ "def getTokensExternal(poll_name):...\n", "req = \"SELECT token FROM {} WHERE name='{}'\".format(CFG('tokens_table_name'\n ), poll_name)\n", "conn, c = connectDB()\n", "tmp = queryAll(c, req)\n", "conn.close()\n", "return tmp\n" ]
[ 0, 4, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "" ]
[ "def book_ride(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self):...\n", "super(CLASS_0, self).setUp()\n", "self.shard = os.environ.get('SHARD')\n", "self.env_var_override = EnvironmentVarGuard()\n" ]
[ "def setUp(self):...\n", "super(TestPaverBokChoyCmd, self).setUp()\n", "self.shard = os.environ.get('SHARD')\n", "self.env_var_override = EnvironmentVarGuard()\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_6(self, VAR_10):...\n", "VAR_27 = self.builder.get_object('password_unlock_entry')\n", "if VAR_27.get_text() != '':\n", "self.database_manager = DatabaseManager(self.database_filepath, VAR_27.\n get_text())\n", "self.show_unlock_failed_revealer()\n", "self.open_database_page()\n", "VAR_27.grab_focus()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "VAR_27.get_style_context().add_class('error')\n", "self.clear_input_fields()\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n" ]
[ "def on_password_unlock_button_clicked(self, widget):...\n", "password_unlock_entry = self.builder.get_object('password_unlock_entry')\n", "if password_unlock_entry.get_text() != '':\n", "self.database_manager = DatabaseManager(self.database_filepath,\n password_unlock_entry.get_text())\n", "self.show_unlock_failed_revealer()\n", "self.open_database_page()\n", "password_unlock_entry.grab_focus()\n", "self.logging_manager.log_debug('Opening of database was successfull')\n", "password_unlock_entry.get_style_context().add_class('error')\n", "self.clear_input_fields()\n", "self.logging_manager.log_debug('Could not open database, wrong password')\n" ]
[ 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.create_snapshot(VAR_9)\n", "self.common.client_logout()\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.create_snapshot(snapshot)\n", "self.common.client_logout()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_3, **VAR_6):...\n", "logging.warn('url_read_json(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n", "if not self._requests:\n", "return None\n", "VAR_6.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == VAR_3:\n", "self.fail('Unknown request %s' % VAR_3)\n", "VAR_9 = self._requests.pop(i)\n", "if len(VAR_9) != 3:\n", "self.fail('Expected json request, got normal data; %s' % VAR_3)\n", "VAR_10, VAR_11, VAR_12 = VAR_9\n", "if callable(VAR_11):\n", "VAR_11(VAR_6)\n", "self.assertEqual(VAR_11, VAR_6)\n", "if VAR_12 is not None:\n", "return VAR_12\n", "return None\n" ]
[ "def _url_read_json(self, url, **kwargs):...\n", "logging.warn('url_read_json(%s, %s)', url[:500], str(kwargs)[:500])\n", "if not self._requests:\n", "return None\n", "kwargs.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == url:\n", "self.fail('Unknown request %s' % url)\n", "data = self._requests.pop(i)\n", "if len(data) != 3:\n", "self.fail('Expected json request, got normal data; %s' % url)\n", "_, expected_kwargs, result = data\n", "if callable(expected_kwargs):\n", "expected_kwargs(kwargs)\n", "self.assertEqual(expected_kwargs, kwargs)\n", "if result is not None:\n", "return result\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Return'", "Expr'", "For", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Return'", "Return'" ]
[ "@staticmethod...\n", "VAR_25 = '%s.cfg' % VAR_9\n", "if VAR_25 != os.path.basename(VAR_25):\n", "VAR_30 = 'Directory traversal attempt detected for host name %r'\n", "return VAR_25\n" ]
[ "@staticmethod...\n", "name = '%s.cfg' % hostname\n", "if name != os.path.basename(name):\n", "msg = 'Directory traversal attempt detected for host name %r'\n", "return name\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@event.listens_for(Engine, 'before_cursor_execute', retval=True)...\n", "VAR_4.info.setdefault('query_start_time', []).append(datetime.now())\n", "VAR_28 = inspect.stack()[1:-1]\n", "if sys.version_info.major == 3:\n", "VAR_28 = [(x.filename, x.lineno, x.function) for x in VAR_28]\n", "VAR_28 = [(x[1], x[2], x[3]) for x in VAR_28]\n", "VAR_29 = [x[0] for x in VAR_28]\n", "VAR_30 = next((x for x in VAR_29 if lore.env.project in x), None)\n", "if VAR_30 is None:\n", "VAR_30 = next((x for x in VAR_29 if 'sqlalchemy' not in x), None)\n", "if VAR_30 is None:\n", "VAR_30 = VAR_29[0]\n", "VAR_31 = next(x for x in VAR_28 if x[0] == VAR_30)\n", "VAR_6 = '/* %s | %s:%d in %s */\\n' % (lore.env.project, VAR_31[0], VAR_31[1\n ], VAR_31[2]) + VAR_6\n", "VAR_0.debug(VAR_6)\n", "return VAR_6, VAR_7\n" ]
[ "@event.listens_for(Engine, 'before_cursor_execute', retval=True)...\n", "conn.info.setdefault('query_start_time', []).append(datetime.now())\n", "stack = inspect.stack()[1:-1]\n", "if sys.version_info.major == 3:\n", "stack = [(x.filename, x.lineno, x.function) for x in stack]\n", "stack = [(x[1], x[2], x[3]) for x in stack]\n", "paths = [x[0] for x in stack]\n", "origin = next((x for x in paths if lore.env.project in x), None)\n", "if origin is None:\n", "origin = next((x for x in paths if 'sqlalchemy' not in x), None)\n", "if origin is None:\n", "origin = paths[0]\n", "caller = next(x for x in stack if x[0] == origin)\n", "statement = '/* %s | %s:%d in %s */\\n' % (lore.env.project, caller[0],\n caller[1], caller[2]) + statement\n", "logger.debug(statement)\n", "return statement, parameters\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "For", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@auth.route('/logout')...\n", "logout_user()\n", "return redirect(url_for('auth.test'))\n" ]
[ "@auth.route('/logout')...\n", "logout_user()\n", "return redirect(url_for('auth.test'))\n" ]
[ 0, 0, 6 ]
[ "Condition", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_2):...\n", "print('username: ', end='')\n", "VAR_3 = input()\n", "while len(VAR_3) == 0:\n", "print(\"\"\"username must exceed zero characters.\nusername: \"\"\", end='')\n", "return FUNC_3(VAR_3, VAR_2)\n", "VAR_3 = input()\n" ]
[ "def get_customer_id(query):...\n", "print('username: ', end='')\n", "username = input()\n", "while len(username) == 0:\n", "print(\"\"\"username must exceed zero characters.\nusername: \"\"\", end='')\n", "return username_to_id(username, query)\n", "username = input()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Expr'", "Return'", "Assign'" ]
[ "def FUNC_0(self, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = 'string'.format(VAR_5=' '.join(start_urls), VAR_4=report_dir)\n", "return VAR_6\n" ]
[ "def _expected_command(self, report_dir, start_urls):...\n", "\"\"\"docstring\"\"\"\n", "expected_statement = (\n 'pa11ycrawler run {start_urls} --pa11ycrawler-allowed-domains=localhost --pa11ycrawler-reports-dir={report_dir} --pa11ycrawler-deny-url-matcher=logout --pa11y-reporter=\"1.0-json\" --depth-limit=6 '\n .format(start_urls=' '.join(start_urls), report_dir=report_dir))\n", "return expected_statement\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "import logging\n", "import traceback\n", "from ..anagonda.context.autocomplete import AutoComplete\n", "from commands.base import Command\n", "\"\"\"Run GoCode\n \"\"\"\n", "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6):...\n", "self.vid = VAR_2\n", "self.path = VAR_4\n", "self.code = VAR_3\n", "self.path = VAR_4\n", "self.offset = VAR_5\n", "self.go_env = VAR_6\n", "super(CLASS_0, self).__init__(VAR_0, VAR_1)\n", "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "self.callback({'success': True, 'completions': comps, 'uid': self.uid,\n 'vid': self.vid})\n", "logging.error(error)\n", "logging.debug(traceback.format_exc())\n", "self.callback({'success': False, 'error': str(error), 'uid': self.uid,\n 'vid': self.vid})\n" ]
[ "import logging\n", "import traceback\n", "from ..anagonda.context.autocomplete import AutoComplete\n", "from commands.base import Command\n", "\"\"\"Run GoCode\n \"\"\"\n", "def __init__(self, callback, uid, vid, code, path, offset, go_env):...\n", "self.vid = vid\n", "self.path = path\n", "self.code = code\n", "self.path = path\n", "self.offset = offset\n", "self.go_env = go_env\n", "super(Gocode, self).__init__(callback, uid)\n", "def run(self):...\n", "\"\"\"docstring\"\"\"\n", "self.callback({'success': True, 'completions': comps, 'uid': self.uid,\n 'vid': self.vid})\n", "logging.error(error)\n", "logging.debug(traceback.format_exc())\n", "self.callback({'success': False, 'error': str(error), 'uid': self.uid,\n 'vid': self.vid})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "from django.db import models, migrations\n", "VAR_0 = [('userprofile', '0001_initial'), ('course', '0001_initial')]\n", "VAR_1 = [migrations.CreateModel(name='Notification', fields=[('id', models.\n AutoField(verbose_name='ID', serialize=False, auto_created=True,\n primary_key=True)), ('subject', models.CharField(max_length=255)), (\n 'notification', models.TextField()), ('timestamp', models.DateTimeField\n (auto_now_add=True)), ('seen', models.BooleanField(default=False)), (\n 'course_instance', models.ForeignKey(to='course.CourseInstance')), (\n 'recipient', models.ForeignKey(related_name='received_notifications',\n to='userprofile.UserProfile')), ('sender', models.ForeignKey(\n related_name='sent_notifications', to='userprofile.UserProfile'))],\n options={'ordering': ['-timestamp']}, bases=(models.Model,))]\n" ]
[ "from django.db import models, migrations\n", "dependencies = [('userprofile', '0001_initial'), ('course', '0001_initial')]\n", "operations = [migrations.CreateModel(name='Notification', fields=[('id',\n models.AutoField(verbose_name='ID', serialize=False, auto_created=True,\n primary_key=True)), ('subject', models.CharField(max_length=255)), (\n 'notification', models.TextField()), ('timestamp', models.DateTimeField\n (auto_now_add=True)), ('seen', models.BooleanField(default=False)), (\n 'course_instance', models.ForeignKey(to='course.CourseInstance')), (\n 'recipient', models.ForeignKey(related_name='received_notifications',\n to='userprofile.UserProfile')), ('sender', models.ForeignKey(\n related_name='sent_notifications', to='userprofile.UserProfile'))],\n options={'ordering': ['-timestamp']}, bases=(models.Model,))]\n" ]
[ 0, 0, 4 ]
[ "ImportFrom'", "Assign'", "Assign'" ]
[ "def FUNC_4(self, VAR_11='', VAR_12=None, VAR_13=None, VAR_6=None):...\n", "VAR_5 = self.session.query(self.obj)\n", "VAR_5 = self._get_base_query(VAR_5=query, VAR_6=filters)\n", "VAR_25 = VAR_5.all()\n", "VAR_26 = GroupByCol(VAR_11, 'Group by')\n", "return VAR_26.apply(VAR_25)\n" ]
[ "def query_simple_group(self, group_by='', aggregate_func=None,...\n", "query = self.session.query(self.obj)\n", "query = self._get_base_query(query=query, filters=filters)\n", "query_result = query.all()\n", "group = GroupByCol(group_by, 'Group by')\n", "return group.apply(query_result)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_6(VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_8 = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN']}\n", "VAR_16 = VAR_8.copy()\n", "VAR_16['Accept'] = 'application/vnd.github.VERSION.diff'\n", "VAR_9 = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n", "VAR_0 = VAR_5['repository']\n", "VAR_17 = VAR_5['after_commit_hash']\n", "VAR_18 = VAR_5['author']\n", "VAR_19 = 'https://api.github.com/repos/{}/pulls/{}'\n", "VAR_19 = VAR_19.format(VAR_0, str(VAR_5['pr_number']))\n", "VAR_11 = requests.get(VAR_19, VAR_8=diff_headers, VAR_9=auth)\n", "VAR_20 = unidiff.PatchSet(VAR_11.content.splitlines(), encoding=r.encoding)\n", "VAR_12 = {}\n", "for patchset in VAR_20:\n", "VAR_47 = patchset.target_file[1:]\n", "return VAR_12\n", "VAR_12[VAR_47] = []\n", "for hunk in patchset:\n", "for VAR_66 in hunk.target_lines():\n", "if VAR_66.is_added:\n", "VAR_12[VAR_47].append(VAR_66.target_line_no)\n" ]
[ "def get_files_involved_in_pr(data):...\n", "\"\"\"docstring\"\"\"\n", "headers = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN']}\n", "diff_headers = headers.copy()\n", "diff_headers['Accept'] = 'application/vnd.github.VERSION.diff'\n", "auth = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n", "repository = data['repository']\n", "after_commit_hash = data['after_commit_hash']\n", "author = data['author']\n", "diff_url = 'https://api.github.com/repos/{}/pulls/{}'\n", "diff_url = diff_url.format(repository, str(data['pr_number']))\n", "r = requests.get(diff_url, headers=diff_headers, auth=auth)\n", "patch = unidiff.PatchSet(r.content.splitlines(), encoding=r.encoding)\n", "files = {}\n", "for patchset in patch:\n", "file = patchset.target_file[1:]\n", "return files\n", "files[file] = []\n", "for hunk in patchset:\n", "for line in hunk.target_lines():\n", "if line.is_added:\n", "files[file].append(line.target_line_no)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "For", "For", "Condition", "Expr'" ]
[ "from datetime import datetime\n", "import pyodbc\n", "import sys\n", "import subprocess as sp\n", "from os import system\n", "def FUNC_0():...\n", "system('cls')\n", "def FUNC_1():...\n", "print('-' * 70)\n", "VAR_0 = 'laserInv'\n", "VAR_1 = False\n", "VAR_2 = False\n", "VAR_3 = None\n", "VAR_4 = None\n", "while VAR_2 == False:\n", "sys.exit()\n", "FUNC_0()\n", "if VAR_1 == True:\n", "if VAR_1 == True:\n", "print('Update the key inventory by entering the key resupply info below.')\n", "VAR_7.close()\n", "FUNC_1()\n", "VAR_7.close()\n", "FUNC_1()\n", "VAR_1 = False\n", "FUNC_1()\n", "VAR_1 = False\n", "VAR_5 = input('Key # used (i.e. Key #29): #')\n", "input('Press enter to close...')\n", "VAR_6 = input('# of keys to add to inventory: ')\n", "sys.exit()\n", "FUNC_0()\n", "while VAR_3 != 'yes':\n", "FUNC_1()\n", "VAR_3 = 'no'\n", "print(\"\"\"Adding {} key {}'s to the inventory. \nIs this correct?\"\"\".format(\n VAR_6, VAR_5))\n", "VAR_5 = int(VAR_5)\n", "FUNC_1()\n", "VAR_6 = int(VAR_6)\n", "VAR_3 = input('Please enter yes or no: ')\n", "print('Connecting to database...')\n", "if VAR_3 == 'yes':\n", "VAR_7 = pyodbc.connect(Driver='{SQL Server Native Client 11.0}', Server=\n '(LocalDB)\\\\LocalDB Laser', Database=DBNAME, trusted_connection='yes')\n", "FUNC_0()\n", "if VAR_3 == 'no':\n", "VAR_1 = True\n", "FUNC_0()\n", "FUNC_0()\n", "VAR_8 = VAR_7.cursor()\n", "print('Re-enter the information.')\n", "print(\"Must answer yes or no, it's case sensitive because I'm lazy!\")\n", "VAR_8.execute(\"SELECT invCount FROM keyInventory WHERE keyNum = '%s';\" % VAR_5)\n", "VAR_5 = input('Key # used (i.e. Key #29): #')\n", "VAR_13 = VAR_8.fetchall()[0][0]\n", "FUNC_1()\n", "VAR_9 = datetime.now()\n", "VAR_6 = input('# of keys to add to inventory:')\n", "print(\n \"ERROR: The key number you entered doesn't exist in the keyInventory table.\"\n )\n", "VAR_10 = VAR_13 + VAR_6\n", "print(\n \"TIP: If you know you've typed it correctly, you'll have to add it to the Database with newKey.py\"\n )\n", "VAR_11 = VAR_7.cursor()\n", "FUNC_1()\n", "VAR_11.execute(\n 'INSERT INTO resupply (submit_time, keyNum, keysAdded, preCount, postCount) VALUES (?, ?, ?, ?, ?);'\n , (VAR_9, VAR_5, VAR_6, VAR_13, VAR_10))\n", "input('Press enter to close...')\n", "VAR_11.commit()\n", "if VAR_1 == True:\n", "VAR_12 = VAR_7.cursor()\n", "VAR_7.close()\n", "sys.exit()\n", "VAR_12.execute('UPDATE keyInventory SET invCount = ? WHERE keyNum = ?;', (\n VAR_10, VAR_5))\n", "VAR_1 = False\n", "if VAR_1 == True:\n", "VAR_12.commit()\n", "VAR_7.close()\n", "FUNC_1()\n", "print('Success! Database has been updated.')\n", "VAR_1 = False\n", "FUNC_1()\n", "FUNC_1()\n", "input('Press enter to close...')\n", "VAR_4 = None\n", "sys.exit()\n", "while VAR_4 != 'yes' and VAR_4 != 'no':\n", "VAR_4 = input('Would you like to add more keys to the inventory? ')\n", "if VAR_4 == 'yes':\n", "if VAR_1 == True:\n", "if VAR_4 == 'no':\n", "VAR_7.close()\n", "VAR_2 = True\n", "FUNC_0()\n", "VAR_1 = False\n", "print('Okay, bye!')\n", "print(\"Must answer yes or no, it's case sensitive because I'm lazy!\")\n" ]
[ "from datetime import datetime\n", "import pyodbc\n", "import sys\n", "import subprocess as sp\n", "from os import system\n", "def clear():...\n", "system('cls')\n", "def divider():...\n", "print('-' * 70)\n", "DBNAME = 'laserInv'\n", "openConn = False\n", "resupplyComplete = False\n", "confirmed = None\n", "addMore = None\n", "while resupplyComplete == False:\n", "sys.exit()\n", "clear()\n", "if openConn == True:\n", "if openConn == True:\n", "print('Update the key inventory by entering the key resupply info below.')\n", "db.close()\n", "divider()\n", "db.close()\n", "divider()\n", "openConn = False\n", "divider()\n", "openConn = False\n", "u_keyNum = input('Key # used (i.e. Key #29): #')\n", "input('Press enter to close...')\n", "u_keysAdded = input('# of keys to add to inventory: ')\n", "sys.exit()\n", "clear()\n", "while confirmed != 'yes':\n", "divider()\n", "confirmed = 'no'\n", "print(\"\"\"Adding {} key {}'s to the inventory. \nIs this correct?\"\"\".format(\n u_keysAdded, u_keyNum))\n", "u_keyNum = int(u_keyNum)\n", "divider()\n", "u_keysAdded = int(u_keysAdded)\n", "confirmed = input('Please enter yes or no: ')\n", "print('Connecting to database...')\n", "if confirmed == 'yes':\n", "db = pyodbc.connect(Driver='{SQL Server Native Client 11.0}', Server=\n '(LocalDB)\\\\LocalDB Laser', Database=DBNAME, trusted_connection='yes')\n", "clear()\n", "if confirmed == 'no':\n", "openConn = True\n", "clear()\n", "clear()\n", "c1 = db.cursor()\n", "print('Re-enter the information.')\n", "print(\"Must answer yes or no, it's case sensitive because I'm lazy!\")\n", "c1.execute(\"SELECT invCount FROM keyInventory WHERE keyNum = '%s';\" % u_keyNum)\n", "u_keyNum = input('Key # used (i.e. Key #29): #')\n", "u_preCount = c1.fetchall()[0][0]\n", "divider()\n", "u_date = datetime.now()\n", "u_keysAdded = input('# of keys to add to inventory:')\n", "print(\n \"ERROR: The key number you entered doesn't exist in the keyInventory table.\"\n )\n", "u_postCount = u_preCount + u_keysAdded\n", "print(\n \"TIP: If you know you've typed it correctly, you'll have to add it to the Database with newKey.py\"\n )\n", "c2 = db.cursor()\n", "divider()\n", "c2.execute(\n 'INSERT INTO resupply (submit_time, keyNum, keysAdded, preCount, postCount) VALUES (?, ?, ?, ?, ?);'\n , (u_date, u_keyNum, u_keysAdded, u_preCount, u_postCount))\n", "input('Press enter to close...')\n", "c2.commit()\n", "if openConn == True:\n", "c3 = db.cursor()\n", "db.close()\n", "sys.exit()\n", "c3.execute('UPDATE keyInventory SET invCount = ? WHERE keyNum = ?;', (\n u_postCount, u_keyNum))\n", "openConn = False\n", "if openConn == True:\n", "c3.commit()\n", "db.close()\n", "divider()\n", "print('Success! Database has been updated.')\n", "openConn = False\n", "divider()\n", "divider()\n", "input('Press enter to close...')\n", "addMore = None\n", "sys.exit()\n", "while addMore != 'yes' and addMore != 'no':\n", "addMore = input('Would you like to add more keys to the inventory? ')\n", "if addMore == 'yes':\n", "if openConn == True:\n", "if addMore == 'no':\n", "db.close()\n", "resupplyComplete = True\n", "clear()\n", "openConn = False\n", "print('Okay, bye!')\n", "print(\"Must answer yes or no, it's case sensitive because I'm lazy!\")\n" ]
[ 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, 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, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_46=50, VAR_47=100):...\n", "\"\"\"docstring\"\"\"\n", "self.regex = re.compile(\n '((?P<value>.+)(?P=value){{{min_repeat},{max_repeat}}})$'.format(VAR_46\n =min_repeat - 1, VAR_47=max_repeat - 1))\n" ]
[ "def __init__(self, min_repeat=50, max_repeat=100):...\n", "\"\"\"docstring\"\"\"\n", "self.regex = re.compile(\n '((?P<value>.+)(?P=value){{{min_repeat},{max_repeat}}})$'.format(\n min_repeat=min_repeat - 1, max_repeat=max_repeat - 1))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'" ]
[ "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_3(self, VAR_3):...\n", "self.total += VAR_3.total\n", "self.success += VAR_3.success\n", "self.failure += VAR_3.failure\n", "self.error += VAR_3.error\n", "self.undecided += VAR_3.undecided\n", "self.total_time += VAR_3.total_time\n", "self.max_time = max(self.max_time, VAR_3.max_time)\n" ]
[ "def merge(self, log2):...\n", "self.total += log2.total\n", "self.success += log2.success\n", "self.failure += log2.failure\n", "self.error += log2.error\n", "self.undecided += log2.undecided\n", "self.total_time += log2.total_time\n", "self.max_time = max(self.max_time, log2.max_time)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "Assign'" ]
[ "@validate(VUser(), VCreateMeetup(), VAR_4=ValueOrBlank('title'), VAR_8=...\n", "return BoringPage(pagename='New Meetup', VAR_27=NewMeetup(*a, **kw)).render()\n" ]
[ "@validate(VUser(), VCreateMeetup(), title=ValueOrBlank('title'),...\n", "return BoringPage(pagename='New Meetup', content=NewMeetup(*a, **kw)).render()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_7(self, VAR_8):...\n", "VAR_9 = 'iSCSI target name is '\n", "VAR_29 = self._get_prefixed_value(VAR_8, VAR_9)[:-1]\n", "VAR_30 = '%s:%s,1 %s 0' % (self._group_ip, '3260', VAR_29)\n", "VAR_31 = {}\n", "VAR_31['provider_location'] = VAR_30\n", "if self.configuration.eqlx_use_chap:\n", "VAR_31['provider_auth'] = 'CHAP %s %s' % (self.configuration.\n eqlx_chap_login, self.configuration.eqlx_chap_password)\n", "return VAR_31\n" ]
[ "def _get_volume_data(self, lines):...\n", "prefix = 'iSCSI target name is '\n", "target_name = self._get_prefixed_value(lines, prefix)[:-1]\n", "lun_id = '%s:%s,1 %s 0' % (self._group_ip, '3260', target_name)\n", "model_update = {}\n", "model_update['provider_location'] = lun_id\n", "if self.configuration.eqlx_use_chap:\n", "model_update['provider_auth'] = 'CHAP %s %s' % (self.configuration.\n eqlx_chap_login, self.configuration.eqlx_chap_password)\n", "return model_update\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "self.check_xsrf()\n", "VAR_4 = self.get_arg('email')\n", "VAR_4 = VAR_4.strip()\n", "VAR_5 = self.get_arg('password')\n", "VAR_6 = self.get_arg('password2')\n", "VAR_7 = dbapi.User()\n", "VAR_0 = ''\n", "if VAR_4 and VAR_5 == VAR_6:\n", "if VAR_7.get_user(VAR_4) == 0:\n", "if VAR_5 != VAR_6:\n", "VAR_0 = 'user already exist'\n", "VAR_8 = VAR_7.insert_user(VAR_4, VAR_5)\n", "VAR_0 = 'password inconsistent'\n", "VAR_0 = 'missing argument'\n", "return self.get(VAR_0)\n", "if VAR_8 != -1:\n", "VAR_9 = hashlib.md5()\n", "VAR_0 = 'insert falure, try again later'\n", "VAR_9.update(VAR_4)\n", "VAR_10 = VAR_9.hexdigest()\n", "self.session['email'] = VAR_4\n", "self.session['email_md5'] = VAR_10\n", "self.set_secure_cookie('sid', self.session.session_id)\n", "return self.redirect('/user')\n" ]
[ "def post(self):...\n", "self.check_xsrf()\n", "email = self.get_arg('email')\n", "email = email.strip()\n", "password = self.get_arg('password')\n", "password2 = self.get_arg('password2')\n", "user = dbapi.User()\n", "error = ''\n", "if email and password == password2:\n", "if user.get_user(email) == 0:\n", "if password != password2:\n", "error = 'user already exist'\n", "result = user.insert_user(email, password)\n", "error = 'password inconsistent'\n", "error = 'missing argument'\n", "return self.get(error)\n", "if result != -1:\n", "m = hashlib.md5()\n", "error = 'insert falure, try again later'\n", "m.update(email)\n", "email_md5 = m.hexdigest()\n", "self.session['email'] = email\n", "self.session['email_md5'] = email_md5\n", "self.set_secure_cookie('sid', self.session.session_id)\n", "return self.redirect('/user')\n" ]
[ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "__packagename__ = 'dwave-hybrid'\n", "__title__ = 'D-Wave Hybrid'\n", "__version__ = '0.1.4'\n", "__author__ = 'D-Wave Systems Inc.'\n", "__authoremail__ = '[email protected]'\n", "__description__ = 'Hybrid Asynchronous Decomposition Solver Framework'\n", "__url__ = 'https://github.com/dwavesystems/dwave-hybrid'\n", "__license__ = 'Apache 2.0'\n", "__copyright__ = '2018, D-Wave Systems Inc.'\n" ]
[ "__packagename__ = 'dwave-hybrid'\n", "__title__ = 'D-Wave Hybrid'\n", "__version__ = '0.1.4'\n", "__author__ = 'D-Wave Systems Inc.'\n", "__authoremail__ = '[email protected]'\n", "__description__ = 'Hybrid Asynchronous Decomposition Solver Framework'\n", "__url__ = 'https://github.com/dwavesystems/dwave-hybrid'\n", "__license__ = 'Apache 2.0'\n", "__copyright__ = '2018, D-Wave Systems Inc.'\n" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self, VAR_9, VAR_10):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def ensure_export(self, context, volume):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_18(self):...\n", "return FUNC_18.dumps(self.properties())\n" ]
[ "def json(self):...\n", "return json.dumps(self.properties())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_5(self):...\n", "if not hasattr(self, '_app_css_hash'):\n", "self._app_css_hash = hashlib.sha1(open(os.path.join(str(VAR_0),\n 'datasette/static/app.css')).read().encode('utf8')).hexdigest()[:6]\n", "return self._app_css_hash\n" ]
[ "def app_css_hash(self):...\n", "if not hasattr(self, '_app_css_hash'):\n", "self._app_css_hash = hashlib.sha1(open(os.path.join(str(app_root),\n 'datasette/static/app.css')).read().encode('utf8')).hexdigest()[:6]\n", "return self._app_css_hash\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_14(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer(VAR_5=True),\n max_retries=5)\n" ]
[ "def test_y_delete_load_balancer_vpc(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer(use_vpc=True),\n max_retries=5)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(VAR_2, VAR_3):...\n", "from configparser import ConfigParser, ExtendedInterpolation\n", "VAR_64 = FUNC_0() + '/haproxy-wi.cfg'\n", "print('Content-type: text/html\\n')\n", "return VAR_65.get(VAR_2, VAR_3)\n", "print('Content-type: text/html\\n')\n", "VAR_65 = ConfigParser(interpolation=ExtendedInterpolation())\n", "print('string')\n", "print('string' % (VAR_2, VAR_3))\n", "VAR_65.read(VAR_64)\n" ]
[ "def get_config_var(sec, var):...\n", "from configparser import ConfigParser, ExtendedInterpolation\n", "path_config = get_app_dir() + '/haproxy-wi.cfg'\n", "print('Content-type: text/html\\n')\n", "return config.get(sec, var)\n", "print('Content-type: text/html\\n')\n", "config = ConfigParser(interpolation=ExtendedInterpolation())\n", "print(\n '<center><div class=\"alert alert-danger\">Check the config file, whether it exists and the path. Must be: app/haproxy-webintarface.config</div>'\n )\n", "print(\n '<center><div class=\"alert alert-danger\">Check the config file. Presence section %s and parameter %s</div>'\n % (sec, var))\n", "config.read(path_config)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Assign'", "Expr'", "Return'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_10(self, VAR_14):...\n", "self.lasttok = None\n", "self.lastid = None\n", "self.parser.parse(VAR_14, lexer=self.lexer)\n" ]
[ "def parse(self, expr):...\n", "self.lasttok = None\n", "self.lastid = None\n", "self.parser.parse(expr, lexer=self.lexer)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_13 = []\n", "if not isinstance(self['cluster_options'], list):\n", "self['cluster_options'] = [self['cluster_options']]\n", "if self['cluster_options']:\n", "for option in self['cluster_options']:\n", "self['cluster_options'] = VAR_13\n", "VAR_9 = option.split('.')[0]\n", "VAR_6 = option.split('.')[1].split('=')[0]\n", "VAR_7 = pipes.quote(option.split('=')[1].split()[0])\n", "VAR_7 = 'True'\n", "VAR_13.append(CLASS_1(VAR_6, VAR_7, VAR_7.__class__, VAR_9))\n" ]
[ "def parse_cluster_options(self):...\n", "opts = []\n", "if not isinstance(self['cluster_options'], list):\n", "self['cluster_options'] = [self['cluster_options']]\n", "if self['cluster_options']:\n", "for option in self['cluster_options']:\n", "self['cluster_options'] = opts\n", "cluster = option.split('.')[0]\n", "name = option.split('.')[1].split('=')[0]\n", "value = pipes.quote(option.split('=')[1].split()[0])\n", "value = 'True'\n", "opts.append(ClusterOption(name, value, value.__class__, cluster))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "self.mock(time, 'time', lambda : 126.0)\n", "VAR_6 = os_utilities.get_state()\n", "VAR_6['sleep_streak'] = 12\n", "for disk in VAR_6['disks'].itervalues():\n", "self.assertGreater(disk.pop('free_mb'), 1.0)\n", "VAR_8 = bot_main.get_state(None, 12)\n", "for disk in VAR_8['disks'].itervalues():\n", "self.assertGreater(disk.pop('free_mb'), 1.0)\n", "self.assertGreater(VAR_8.pop('nb_files_in_temp'), 0)\n", "self.assertGreater(VAR_6.pop('nb_files_in_temp'), 0)\n", "self.assertGreater(VAR_8.pop('uptime'), 0)\n", "self.assertGreater(VAR_6.pop('uptime'), 0)\n", "self.assertEqual(sorted(VAR_6.pop('temp', {})), sorted(VAR_8.pop('temp', {})))\n", "self.assertEqual(VAR_6, VAR_8)\n" ]
[ "def test_get_state(self):...\n", "self.mock(time, 'time', lambda : 126.0)\n", "expected = os_utilities.get_state()\n", "expected['sleep_streak'] = 12\n", "for disk in expected['disks'].itervalues():\n", "self.assertGreater(disk.pop('free_mb'), 1.0)\n", "actual = bot_main.get_state(None, 12)\n", "for disk in actual['disks'].itervalues():\n", "self.assertGreater(disk.pop('free_mb'), 1.0)\n", "self.assertGreater(actual.pop('nb_files_in_temp'), 0)\n", "self.assertGreater(expected.pop('nb_files_in_temp'), 0)\n", "self.assertGreater(actual.pop('uptime'), 0)\n", "self.assertGreater(expected.pop('uptime'), 0)\n", "self.assertEqual(sorted(expected.pop('temp', {})), sorted(actual.pop('temp',\n {})))\n", "self.assertEqual(expected, actual)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_2 is None:\n", "if 'access_token' in VAR_2:\n", "return FUNC_3(VAR_1, VAR_2)\n", "if 'oauth_token' in VAR_2 and 'oauth_token_secret' in VAR_2:\n", "return FUNC_2(VAR_1, VAR_2)\n", "if 'error' in VAR_2:\n" ]
[ "def response_token_setter(remote, resp):...\n", "\"\"\"docstring\"\"\"\n", "if resp is None:\n", "if 'access_token' in resp:\n", "return oauth2_token_setter(remote, resp)\n", "if 'oauth_token' in resp and 'oauth_token_secret' in resp:\n", "return oauth1_token_setter(remote, resp)\n", "if 'error' in resp:\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'", "Condition", "Return'", "Condition" ]
[ "def FUNC_6(self):...\n", "VAR_4 = 'autotest-errors'\n", "VAR_2 = '/api/apps'\n", "VAR_5 = {'id': 'camelCase'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertContains(VAR_3, 'App IDs can only contain [a-z0-9-]',\n status_code=400)\n", "VAR_2 = '/api/apps'\n", "VAR_5 = {'id': 'deis'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertContains(VAR_3, \"App IDs cannot be 'deis'\", status_code=400)\n", "VAR_5 = {'id': VAR_4}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "VAR_2 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_3 = self.client.delete(VAR_2)\n", "self.assertEquals(VAR_3.status_code, 204)\n", "for endpoint in ('containers', 'config', 'releases', 'builds'):\n", "VAR_2 = '/api/apps/{app_id}/{endpoint}'.format(**locals())\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEquals(VAR_3.status_code, 404)\n" ]
[ "def test_app_errors(self):...\n", "app_id = 'autotest-errors'\n", "url = '/api/apps'\n", "body = {'id': 'camelCase'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertContains(response, 'App IDs can only contain [a-z0-9-]',\n status_code=400)\n", "url = '/api/apps'\n", "body = {'id': 'deis'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertContains(response, \"App IDs cannot be 'deis'\", status_code=400)\n", "body = {'id': app_id}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.delete(url)\n", "self.assertEquals(response.status_code, 204)\n", "for endpoint in ('containers', 'config', 'releases', 'builds'):\n", "url = '/api/apps/{app_id}/{endpoint}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEquals(response.status_code, 404)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Assign'", "Assign'", "Expr'" ]
[ "__packagename__ = 'dwave-hybrid'\n", "__title__ = 'D-Wave Hybrid'\n", "__version__ = '0.1.4'\n", "__author__ = 'D-Wave Systems Inc.'\n", "__authoremail__ = '[email protected]'\n", "__description__ = 'Hybrid Asynchronous Decomposition Solver Framework'\n", "__url__ = 'https://github.com/dwavesystems/dwave-hybrid'\n", "__license__ = 'Apache 2.0'\n", "__copyright__ = '2018, D-Wave Systems Inc.'\n" ]
[ "__packagename__ = 'dwave-hybrid'\n", "__title__ = 'D-Wave Hybrid'\n", "__version__ = '0.1.4'\n", "__author__ = 'D-Wave Systems Inc.'\n", "__authoremail__ = '[email protected]'\n", "__description__ = 'Hybrid Asynchronous Decomposition Solver Framework'\n", "__url__ = 'https://github.com/dwavesystems/dwave-hybrid'\n", "__license__ = 'Apache 2.0'\n", "__copyright__ = '2018, D-Wave Systems Inc.'\n" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_31():...\n", "VAR_24 = vim.eval('tagfiles()')\n", "VAR_25 = VAR_0.getcwd()\n", "return [VAR_0.path.join(VAR_25, x) for x in VAR_24]\n" ]
[ "def GetTagFiles():...\n", "tag_files = vim.eval('tagfiles()')\n", "current_working_directory = os.getcwd()\n", "return [os.path.join(current_working_directory, x) for x in tag_files]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_4(self, *VAR_4, **VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_9 in VAR_4:\n", "self._set_inoutput_item(VAR_9)\n", "for VAR_10, VAR_9 in VAR_6.items():\n", "self._set_inoutput_item(VAR_9, VAR_10=name)\n" ]
[ "def set_input(self, *input, **kwinput):...\n", "\"\"\"docstring\"\"\"\n", "for item in input:\n", "self._set_inoutput_item(item)\n", "for name, item in kwinput.items():\n", "self._set_inoutput_item(item, name=name)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'", "For", "Expr'" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "import django.db.models.deletion\n", "import diploma.models\n", "import lib.models\n", "import lib.fields\n", "VAR_0 = [('exercise', '0024_auto_20160919_1951'), ('course',\n '0030_auto_20160912_1341'), ('userprofile', '0003_auto_20160728_1139')]\n", "VAR_1 = [migrations.CreateModel(name='CourseDiplomaDesign', fields=[('id',\n models.AutoField(auto_created=True, serialize=False, primary_key=True,\n verbose_name='ID')), ('logo', models.ImageField(null=True, blank=True,\n upload_to=diploma.models.build_upload_dir)), ('title', models.TextField\n (blank=True)), ('body', models.TextField(blank=True)), ('date', models.\n CharField(max_length=256)), ('signature_name', models.CharField(blank=\n True, max_length=256)), ('signature_title', models.CharField(blank=True,\n max_length=256)), ('small_print', models.TextField(blank=True)), (\n 'point_limits', lib.fields.JSONField(blank=True, help_text=\n 'A list of length 5 where each element is the required points for n:th grade.The element can be a list of 2-tuples [[difficulty_level_a, points],[difficulty_level_b, points]].'\n )), ('pad_points', models.BooleanField(help_text=\n 'If difficulty levels are used the lower level can be padded with higher level points.'\n , default=False)), ('course', models.OneToOneField(on_delete=django.db.\n models.deletion.SET_NULL, to='course.CourseInstance', null=True)), (\n 'exercises_to_pass', models.ManyToManyField(blank=True, to=\n 'exercise.BaseExercise')), ('modules_to_pass', models.ManyToManyField(\n blank=True, to='course.CourseModule'))], options={}, bases=(models.\n Model,)), migrations.CreateModel(name='StudentDiploma', fields=[('id',\n models.AutoField(auto_created=True, serialize=False, primary_key=True,\n verbose_name='ID')), ('created', models.DateTimeField(auto_now=True)),\n ('hashkey', models.CharField(unique=True, max_length=32)), ('name',\n models.CharField(max_length=255)), ('grade', models.\n PositiveIntegerField(default=0)), ('design', models.ForeignKey(to=\n 'diploma.CourseDiplomaDesign')), ('profile', models.ForeignKey(\n on_delete=django.db.models.deletion.SET_NULL, to=\n 'userprofile.UserProfile', null=True))], options={}, bases=(lib.models.\n UrlMixin, models.Model))]\n" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "import django.db.models.deletion\n", "import diploma.models\n", "import lib.models\n", "import lib.fields\n", "dependencies = [('exercise', '0024_auto_20160919_1951'), ('course',\n '0030_auto_20160912_1341'), ('userprofile', '0003_auto_20160728_1139')]\n", "operations = [migrations.CreateModel(name='CourseDiplomaDesign', fields=[(\n 'id', models.AutoField(auto_created=True, serialize=False, primary_key=\n True, verbose_name='ID')), ('logo', models.ImageField(null=True, blank=\n True, upload_to=diploma.models.build_upload_dir)), ('title', models.\n TextField(blank=True)), ('body', models.TextField(blank=True)), ('date',\n models.CharField(max_length=256)), ('signature_name', models.CharField(\n blank=True, max_length=256)), ('signature_title', models.CharField(\n blank=True, max_length=256)), ('small_print', models.TextField(blank=\n True)), ('point_limits', lib.fields.JSONField(blank=True, help_text=\n 'A list of length 5 where each element is the required points for n:th grade.The element can be a list of 2-tuples [[difficulty_level_a, points],[difficulty_level_b, points]].'\n )), ('pad_points', models.BooleanField(help_text=\n 'If difficulty levels are used the lower level can be padded with higher level points.'\n , default=False)), ('course', models.OneToOneField(on_delete=django.db.\n models.deletion.SET_NULL, to='course.CourseInstance', null=True)), (\n 'exercises_to_pass', models.ManyToManyField(blank=True, to=\n 'exercise.BaseExercise')), ('modules_to_pass', models.ManyToManyField(\n blank=True, to='course.CourseModule'))], options={}, bases=(models.\n Model,)), migrations.CreateModel(name='StudentDiploma', fields=[('id',\n models.AutoField(auto_created=True, serialize=False, primary_key=True,\n verbose_name='ID')), ('created', models.DateTimeField(auto_now=True)),\n ('hashkey', models.CharField(unique=True, max_length=32)), ('name',\n models.CharField(max_length=255)), ('grade', models.\n PositiveIntegerField(default=0)), ('design', models.ForeignKey(to=\n 'diploma.CourseDiplomaDesign')), ('profile', models.ForeignKey(\n on_delete=django.db.models.deletion.SET_NULL, to=\n 'userprofile.UserProfile', null=True))], options={}, bases=(lib.models.\n UrlMixin, models.Model))]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Assign'", "Assign'" ]
[ "async def FUNC_8(VAR_6):...\n", "VAR_14 = await FUNC_9(VAR_6, '/leaders')\n", "assert VAR_14 == '0'\n" ]
[ "async def test_show_leaders(test_client):...\n", "text = await _get(test_client, '/leaders')\n", "assert text == '0'\n" ]
[ 0, 0, 0 ]
[ "AsyncFunctionDef'", "Assign'", "Assert'" ]
[ "def FUNC_8(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.config_file = lambda : ['config line1']\n", "VAR_6 = self.uut.generate_config_file()\n", "self.assertTrue(os.path.isfile(VAR_6))\n", "os.remove(VAR_6)\n", "self.uut.lint('filename')\n" ]
[ "def test_config_file_generator(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.config_file = lambda : ['config line1']\n", "config_filename = self.uut.generate_config_file()\n", "self.assertTrue(os.path.isfile(config_filename))\n", "os.remove(config_filename)\n", "self.uut.lint('filename')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_24(self):...\n", "self.compilation_ko(\n \"\"\"\n/* this is a comment /* with a nested comment inside */\nit is allowed by the RFC :p */\n\"\"\"\n )\n" ]
[ "def test_nested_comments(self):...\n", "self.compilation_ko(\n \"\"\"\n/* this is a comment /* with a nested comment inside */\nit is allowed by the RFC :p */\n\"\"\"\n )\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_21(self):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('CurrentIdentifierFinished')\n" ]
[ "def OnCurrentIdentifierFinished(self):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('CurrentIdentifierFinished')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'" ]
[ "@staticmethod...\n", "return mongo.db.analysis.find_one({'info.id': int(VAR_1)}, sort=[('_id',\n pymongo.DESCENDING)])\n" ]
[ "@staticmethod...\n", "return mongo.db.analysis.find_one({'info.id': int(task_id)}, sort=[('_id',\n pymongo.DESCENDING)])\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_9(self):...\n", "self.test_strings = ('normal_string', 'string with spaces',\n 'string with quotes\"a', \"string with s-quotes'b\", 'bsn \\n A',\n 'unrecognized \\\\q escape')\n" ]
[ "def setUp(self):...\n", "self.test_strings = ('normal_string', 'string with spaces',\n 'string with quotes\"a', \"string with s-quotes'b\", 'bsn \\n A',\n 'unrecognized \\\\q escape')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_9(self):...\n", "VAR_17 = []\n", "VAR_18 = threading.Event()\n", "self.mock(VAR_18, 'wait', VAR_17.append)\n", "self.mock(bot_main, 'run_manifest', self.fail)\n", "self.mock(bot_main, 'update_bot', self.fail)\n", "self.expected_requests([(\n 'https://localhost:1/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'xsrf_token': 'token'}), (\n 'https://localhost:1/swarming/api/v1/bot/poll', {'data': self.\n attributes, 'headers': {'X-XSRF-Token': 'token'}}, {'cmd': 'sleep',\n 'duration': 1.24})])\n", "self.assertFalse(bot_main.poll_server(self.bot, VAR_18))\n", "self.assertEqual([1.24], VAR_17)\n" ]
[ "def test_poll_server_sleep(self):...\n", "slept = []\n", "bit = threading.Event()\n", "self.mock(bit, 'wait', slept.append)\n", "self.mock(bot_main, 'run_manifest', self.fail)\n", "self.mock(bot_main, 'update_bot', self.fail)\n", "self.expected_requests([(\n 'https://localhost:1/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'xsrf_token': 'token'}), (\n 'https://localhost:1/swarming/api/v1/bot/poll', {'data': self.\n attributes, 'headers': {'X-XSRF-Token': 'token'}}, {'cmd': 'sleep',\n 'duration': 1.24})])\n", "self.assertFalse(bot_main.poll_server(self.bot, bit))\n", "self.assertEqual([1.24], slept)\n" ]
[ 0, 0, 0, 0, 0, 0, 5, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertFalse(Script.objects.get(VAR_2=5).qa_begun,\n 'The Script should have qa_begun of False at the beginning')\n", "VAR_1 = self.client.get('/qa/extractionscript/5/')\n", "self.assertTrue(Script.objects.get(VAR_2=5).qa_begun,\n 'qa_begun should now be true')\n" ]
[ "def test_qa_begin(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertFalse(Script.objects.get(pk=5).qa_begun,\n 'The Script should have qa_begun of False at the beginning')\n", "response = self.client.get('/qa/extractionscript/5/')\n", "self.assertTrue(Script.objects.get(pk=5).qa_begun,\n 'qa_begun should now be true')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_4(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = jc.Contract()\n", "return st.OperationContract(self.agent.make_delete_app_operation(VAR_1=self\n .bindings, application=self.TEST_APP), VAR_5=contract)\n" ]
[ "def delete_app(self):...\n", "\"\"\"docstring\"\"\"\n", "contract = jc.Contract()\n", "return st.OperationContract(self.agent.make_delete_app_operation(bindings=\n self.bindings, application=self.TEST_APP), contract=contract)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_11(self, VAR_14=None, VAR_15=False, VAR_16=False, VAR_17=1, VAR_18...\n", "self.global_resources = dict() if VAR_52 is None else VAR_52\n", "self.global_resources['_cores'] = VAR_17\n", "self.global_resources['_nodes'] = VAR_18\n", "def FUNC_2(VAR_87):...\n", "return map(self._rules.__getitem__, filter(self.is_rule, VAR_87))\n" ]
[ "def execute(self, targets=None, dryrun=False, touch=False, cores=1, nodes=1,...\n", "self.global_resources = dict() if resources is None else resources\n", "self.global_resources['_cores'] = cores\n", "self.global_resources['_nodes'] = nodes\n", "def rules(items):...\n", "return map(self._rules.__getitem__, filter(self.is_rule, items))\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_7(self, VAR_6):...\n", "for tgt in VAR_6:\n", "for type_constraint, target_predicate in self._native_target_matchers.items():\n", "return False\n", "if type_constraint.satisfied_by(tgt) and target_predicate(tgt):\n", "return True\n" ]
[ "def _any_targets_have_native_sources(self, targets):...\n", "for tgt in targets:\n", "for type_constraint, target_predicate in self._native_target_matchers.items():\n", "return False\n", "if type_constraint.satisfied_by(tgt) and target_predicate(tgt):\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "For", "Return'", "Condition", "Return'" ]
[ "def FUNC_7():...\n", "return FUNC_8(RegisterForm())\n" ]
[ "def render_register():...\n", "return render_registerForm(RegisterForm())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "\"\"\"\nCreated on Sat Dec 23 13:43:09 2017\n\n@author: Adam\n\"\"\"\n", "import sys\n", "import os\n", "import time\n", "import warnings\n", "import getpass\n", "import sqlite3\n", "from importlib import import_module\n", "import pymysql\n", "from cryptography.fernet import Fernet\n", "from .core import TABLE, DATA_DIRE, KEY_FILE\n", "from .tools import db_check, db_insert, parse_settings\n", "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = VAR_0['sensors']\n", "if 'column_fmt' in VAR_0:\n", "VAR_21 = VAR_0['column_fmt']\n", "VAR_3 = ('TIMESTAMP',) + tuple([str(sen).strip() for sen in VAR_10])\n", "VAR_3 = ('TIMESTAMP',) + tuple([VAR_21.replace('{sensor}', str(sen).strip()\n ) for sen in VAR_10])\n", "return VAR_3\n" ]
[ "\"\"\"\nCreated on Sat Dec 23 13:43:09 2017\n\n@author: Adam\n\"\"\"\n", "import sys\n", "import os\n", "import time\n", "import warnings\n", "import getpass\n", "import sqlite3\n", "from importlib import import_module\n", "import pymysql\n", "from cryptography.fernet import Fernet\n", "from .core import TABLE, DATA_DIRE, KEY_FILE\n", "from .tools import db_check, db_insert, parse_settings\n", "def get_columns(settings):...\n", "\"\"\"docstring\"\"\"\n", "sensors = settings['sensors']\n", "if 'column_fmt' in settings:\n", "column_fmt = settings['column_fmt']\n", "columns = ('TIMESTAMP',) + tuple([str(sen).strip() for sen in sensors])\n", "columns = ('TIMESTAMP',) + tuple([column_fmt.replace('{sensor}', str(sen).\n strip()) for sen in sensors])\n", "return columns\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@eqlx.with_timeout...\n", "time.sleep(1)\n" ]
[ "@eqlx.with_timeout...\n", "time.sleep(1)\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_12():...\n", "VAR_18 = requests.get(FUNC_2('healthy'))\n", "VAR_18.raise_for_status()\n", "return VAR_18.json()\n" ]
[ "def _ServerIsHealthy():...\n", "response = requests.get(_BuildUri('healthy'))\n", "response.raise_for_status()\n", "return response.json()\n" ]
[ 0, 7, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_11(self):...\n", "self.compilation_ok(\"\"\"\nif true {\n\n}\n\"\"\")\n", "self.representation_is(\"\"\"\nif (type: control)\n true (type: test)\n\"\"\")\n" ]
[ "def test_true_test(self):...\n", "self.compilation_ok(\"\"\"\nif true {\n\n}\n\"\"\")\n", "self.representation_is(\"\"\"\nif (type: control)\n true (type: test)\n\"\"\")\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = request.args.get('group_by')\n", "if not VAR_4:\n", "VAR_4 = ''\n", "return VAR_4\n" ]
[ "def get_group_by_args():...\n", "\"\"\"docstring\"\"\"\n", "group_by = request.args.get('group_by')\n", "if not group_by:\n", "group_by = ''\n", "return group_by\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_1():...\n", "VAR_1 = [{'fieldname': 'territory', 'fieldtype': 'Link', 'label': _(\n 'Territory'), 'options': 'Territory', 'width': 100}, {'fieldname':\n 'item_group', 'fieldtype': 'Link', 'label': _('Item Group'), 'options':\n 'Item Group', 'width': 150}, {'fieldname': 'item_name', 'fieldtype':\n 'Link', 'options': 'Item', 'label': 'Item', 'width': 150}, {'fieldname':\n 'item_name', 'fieldtype': 'Data', 'label': _('Item Name'), 'width': 150\n }, {'fieldname': 'customer', 'fieldtype': 'Link', 'label': _('Customer'\n ), 'options': 'Customer', 'width': 100}, {'fieldname':\n 'last_order_date', 'fieldtype': 'Date', 'label': _('Last Order Date'),\n 'width': 100}, {'fieldname': 'qty', 'fieldtype': 'Float', 'label': _(\n 'Quantity'), 'width': 100}, {'fieldname': 'days_since_last_order',\n 'fieldtype': 'Int', 'label': _('Days Since Last Order'), 'width': 100}]\n", "return VAR_1\n" ]
[ "def get_columns():...\n", "columns = [{'fieldname': 'territory', 'fieldtype': 'Link', 'label': _(\n 'Territory'), 'options': 'Territory', 'width': 100}, {'fieldname':\n 'item_group', 'fieldtype': 'Link', 'label': _('Item Group'), 'options':\n 'Item Group', 'width': 150}, {'fieldname': 'item_name', 'fieldtype':\n 'Link', 'options': 'Item', 'label': 'Item', 'width': 150}, {'fieldname':\n 'item_name', 'fieldtype': 'Data', 'label': _('Item Name'), 'width': 150\n }, {'fieldname': 'customer', 'fieldtype': 'Link', 'label': _('Customer'\n ), 'options': 'Customer', 'width': 100}, {'fieldname':\n 'last_order_date', 'fieldtype': 'Date', 'label': _('Last Order Date'),\n 'width': 100}, {'fieldname': 'qty', 'fieldtype': 'Float', 'label': _(\n 'Quantity'), 'width': 100}, {'fieldname': 'days_since_last_order',\n 'fieldtype': 'Int', 'label': _('Days Since Last Order'), 'width': 100}]\n", "return columns\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@property...\n", "return self._log\n" ]
[ "@property...\n", "return self._log\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@api.public...\n", "self.response.write('OK')\n" ]
[ "@api.public...\n", "self.response.write('OK')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_10(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_20 = kijiji_api.KijijiApi()\n", "VAR_20.login(VAR_0.username, VAR_0.password)\n", "VAR_22 = ''\n", "for line in open(VAR_0.inf_file, 'rt'):\n", "[VAR_24, VAR_25] = line.strip().rstrip('\\n').split('=')\n", "VAR_23 = VAR_20.get_all_ads()\n", "if VAR_24 == 'postAdForm.title':\n", "return [t for t, i in VAR_23 if t == VAR_22]\n", "VAR_22 = VAR_25\n" ]
[ "def check_ad(args):...\n", "\"\"\"docstring\"\"\"\n", "api = kijiji_api.KijijiApi()\n", "api.login(args.username, args.password)\n", "AdName = ''\n", "for line in open(args.inf_file, 'rt'):\n", "[key, val] = line.strip().rstrip('\\n').split('=')\n", "allAds = api.get_all_ads()\n", "if key == 'postAdForm.title':\n", "return [t for t, i in allAds if t == AdName]\n", "AdName = val\n" ]
[ 0, 0, 0, 0, 5, 0, 0, 5, 0, 5, 5 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Return'", "Assign'" ]
[ "@staticmethod...\n", "return False\n" ]
[ "@staticmethod...\n", "return False\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_1(self, VAR_0):...\n", "return static_file(VAR_0, self.get_base_path())\n" ]
[ "def get(self, path):...\n", "return static_file(path, self.get_base_path())\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "@cache(VAR_3 % ('{user_id}', '{self.id}'), ONE_HOUR)...\n", "VAR_20 = [VAR_19.id for VAR_19 in await self.comments]\n", "if not VAR_20:\n", "return []\n", "VAR_21 = await ReactItem.filter(Q(VAR_5=user_id), Q(target_id__in=cids), Q(\n target_kind=K_COMMENT))\n", "return [item.target_id for item in VAR_21]\n" ]
[ "@cache(MC_KEY_COMMNET_IDS_LIKED_BY_USER % ('{user_id}', '{self.id}'), ONE_HOUR)...\n", "cids = [c.id for c in await self.comments]\n", "if not cids:\n", "return []\n", "queryset = await ReactItem.filter(Q(user_id=user_id), Q(target_id__in=cids),\n Q(target_kind=K_COMMENT))\n", "return [item.target_id for item in queryset]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Assign'", "Return'" ]
[ "def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None, VAR_20=''):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11)\n", "VAR_31 = {'all': 'all.zip', 'geotiff': os.path.join('odm_orthophoto',\n 'odm_orthophoto.tif'), 'las': os.path.join('odm_georeferencing',\n 'odm_georeferenced_model.ply.las'), 'ply': os.path.join(\n 'odm_georeferencing', 'odm_georeferenced_model.ply'), 'csv': os.path.\n join('odm_georeferencing', 'odm_georeferenced_model.csv')}\n", "if VAR_20 in VAR_31:\n", "VAR_33 = VAR_28.assets_path(VAR_31[VAR_20])\n", "if not os.path.exists(VAR_33):\n", "VAR_34 = os.path.basename(VAR_33)\n", "VAR_35 = open(VAR_33, 'rb')\n", "VAR_36 = HttpResponse(FileWrapper(VAR_35), content_type=mimetypes.\n guess_type(asset_filename)[0] or 'application/zip')\n", "VAR_36['Content-Disposition'] = 'attachment; filename={}'.format(VAR_34)\n", "return VAR_36\n" ]
[ "def get(self, request, pk=None, project_pk=None, asset=''):...\n", "\"\"\"docstring\"\"\"\n", "task = self.get_and_check_task(request, pk, project_pk)\n", "allowed_assets = {'all': 'all.zip', 'geotiff': os.path.join(\n 'odm_orthophoto', 'odm_orthophoto.tif'), 'las': os.path.join(\n 'odm_georeferencing', 'odm_georeferenced_model.ply.las'), 'ply': os.\n path.join('odm_georeferencing', 'odm_georeferenced_model.ply'), 'csv':\n os.path.join('odm_georeferencing', 'odm_georeferenced_model.csv')}\n", "if asset in allowed_assets:\n", "asset_path = task.assets_path(allowed_assets[asset])\n", "if not os.path.exists(asset_path):\n", "asset_filename = os.path.basename(asset_path)\n", "file = open(asset_path, 'rb')\n", "response = HttpResponse(FileWrapper(file), content_type=mimetypes.\n guess_type(asset_filename)[0] or 'application/zip')\n", "response['Content-Disposition'] = 'attachment; filename={}'.format(\n asset_filename)\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self):...\n", "VAR_15 = self.env['event.event'].search([('fit_repetition_enabled', '=', True)]\n )\n", "for repeating_event in VAR_15:\n", "VAR_0.info('Found repeating event: ' + repeating_event.name)\n", "if repeating_event.fit_repetition == 'daily':\n", "self._handle_daily_event_repetition(repeating_event)\n", "if repeating_event.fit_repetition == 'weekly':\n", "self._handle_weekly_event_repetition(repeating_event)\n", "if repeating_event.fit_repetition == 'monthly':\n", "self._handle_montly_event_repetition(repeating_event)\n" ]
[ "def start_automatic_event_creation(self):...\n", "repeating_event_ids = self.env['event.event'].search([(\n 'fit_repetition_enabled', '=', True)])\n", "for repeating_event in repeating_event_ids:\n", "_logger.info('Found repeating event: ' + repeating_event.name)\n", "if repeating_event.fit_repetition == 'daily':\n", "self._handle_daily_event_repetition(repeating_event)\n", "if repeating_event.fit_repetition == 'weekly':\n", "self._handle_weekly_event_repetition(repeating_event)\n", "if repeating_event.fit_repetition == 'monthly':\n", "self._handle_montly_event_repetition(repeating_event)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def __init__(self, VAR_65, VAR_7, *VAR_15, **VAR_16):...\n", "self.cache_prefix = VAR_65\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, cache_prefix, param, *a, **kw):...\n", "self.cache_prefix = cache_prefix\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_29(self):...\n", "VAR_18 = self._get_explicit_jdk_paths()\n", "VAR_38 = CLASS_6(CLASS_5(*VAR_18), CLASS_6(CLASS_2(), CLASS_4.standard(),\n CLASS_3.standard()))\n", "return CLASS_7(VAR_38, self.get_options().minimum_version, self.get_options\n ().maximum_version)\n" ]
[ "def _create_locator(self):...\n", "homes = self._get_explicit_jdk_paths()\n", "environment = _UnknownEnvironment(_ExplicitEnvironment(*homes),\n _UnknownEnvironment(_EnvVarEnvironment(), _LinuxEnvironment.standard(),\n _OSXEnvironment.standard()))\n", "return _Locator(environment, self.get_options().minimum_version, self.\n get_options().maximum_version)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_23(self):...\n", "if self.limit_page_length:\n", "return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n", "return ''\n" ]
[ "def add_limit(self):...\n", "if self.limit_page_length:\n", "return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n", "return ''\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1.value = beamr.interpreters.Url(VAR_1.value[1:-1])\n", "return VAR_1\n" ]
[ "def t_URL(t):...\n", "\"\"\"docstring\"\"\"\n", "t.value = beamr.interpreters.Url(t.value[1:-1])\n", "return t\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_21(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'MEDIUM': 4}, 'CONFIDENCE': {'HIGH': 4}}\n", "self.check_example('mktemp.py', VAR_2)\n" ]
[ "def test_mktemp(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'MEDIUM': 4}, 'CONFIDENCE': {'HIGH': 4}}\n", "self.check_example('mktemp.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_14(self, VAR_32, VAR_33, VAR_30):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_33 & os.O_WRONLY == os.O_WRONLY or VAR_33 & os.O_RDWR == os.O_RDWR:\n", "VAR_68 = VAR_30 & ~111\n", "if VAR_33 & os.O_RDONLY == os.O_RDONLY:\n", "VAR_69 = '%s/%s_sftp_%s' % (self.cfg.get('honeypot', 'download_path'), time\n .strftime('%Y%m%d-%H%M%S'), re.sub('[^A-Za-z0-9]', '_', VAR_32))\n", "return None\n", "return None\n", "self.mkfile(VAR_32, 0, 0, 0, FUNC_30.S_IFREG | VAR_30)\n", "VAR_34 = os.open(VAR_69, VAR_33, VAR_68)\n", "self.update_realfile(self.getfile(VAR_32), VAR_69)\n", "self.tempfiles[VAR_34] = VAR_69\n", "self.filenames[VAR_34] = VAR_32\n", "return VAR_34\n" ]
[ "def open(self, filename, openFlags, mode):...\n", "\"\"\"docstring\"\"\"\n", "if openFlags & os.O_WRONLY == os.O_WRONLY or openFlags & os.O_RDWR == os.O_RDWR:\n", "hostmode = mode & ~111\n", "if openFlags & os.O_RDONLY == os.O_RDONLY:\n", "hostfile = '%s/%s_sftp_%s' % (self.cfg.get('honeypot', 'download_path'),\n time.strftime('%Y%m%d-%H%M%S'), re.sub('[^A-Za-z0-9]', '_', filename))\n", "return None\n", "return None\n", "self.mkfile(filename, 0, 0, 0, stat.S_IFREG | mode)\n", "fd = os.open(hostfile, openFlags, hostmode)\n", "self.update_realfile(self.getfile(filename), hostfile)\n", "self.tempfiles[fd] = hostfile\n", "self.filenames[fd] = filename\n", "return fd\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Return'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_20(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['hostname'] in self.node_list and self.config['no_local']:\n", "self.node_list.remove(self.config['hostname'])\n", "for i in self.config['ip_addrs']:\n", "if i in self.node_list:\n", "if self.config['master']:\n", "self.node_list.remove(i)\n", "for n in self.node_list:\n", "self.node_list = list(set(n for n in self.node_list if n))\n", "if n == self.master.hostname or n == self.config['master']:\n", "self.log_debug('Node list reduced to %s' % self.node_list)\n", "self.node_list.remove(n)\n" ]
[ "def reduce_node_list(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.config['hostname'] in self.node_list and self.config['no_local']:\n", "self.node_list.remove(self.config['hostname'])\n", "for i in self.config['ip_addrs']:\n", "if i in self.node_list:\n", "if self.config['master']:\n", "self.node_list.remove(i)\n", "for n in self.node_list:\n", "self.node_list = list(set(n for n in self.node_list if n))\n", "if n == self.master.hostname or n == self.config['master']:\n", "self.log_debug('Node list reduced to %s' % self.node_list)\n", "self.node_list.remove(n)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "For", "Condition", "Condition", "Expr'", "For", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_49):...\n", "" ]
[ "def run(self, sr_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = ['hp3par_api_url', 'hp3par_username', 'hp3par_password', 'san_ip',\n 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, VAR_18)\n" ]
[ "def _check_flags(self):...\n", "\"\"\"docstring\"\"\"\n", "required_flags = ['hp3par_api_url', 'hp3par_username', 'hp3par_password',\n 'san_ip', 'san_login', 'san_password']\n", "self.common.check_flags(self.configuration, required_flags)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_38(VAR_65, VAR_66):...\n", "VAR_79 = ElementTree.parse(VAR_66).getroot()\n", "if VAR_79.tag != 'plugin':\n", "return VAR_79.find('name').text\n" ]
[ "def process_info_file(cp_elem, info_file):...\n", "plugin_info = ElementTree.parse(info_file).getroot()\n", "if plugin_info.tag != 'plugin':\n", "return plugin_info.find('name').text\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_56(self):...\n", "self.run_example('binding.py')\n", "VAR_10 = self.b_mgr.get_issue_list()\n", "VAR_11 = VAR_10[0].get_code().splitlines()\n", "VAR_12 = VAR_10[0].lineno\n", "self.assertEqual('%i ' % (VAR_12 - 1), VAR_11[0][:2])\n", "self.assertEqual('%i ' % VAR_12, VAR_11[1][:2])\n", "self.assertEqual('%i ' % (VAR_12 + 1), VAR_11[2][:2])\n" ]
[ "def test_code_line_numbers(self):...\n", "self.run_example('binding.py')\n", "issues = self.b_mgr.get_issue_list()\n", "code_lines = issues[0].get_code().splitlines()\n", "lineno = issues[0].lineno\n", "self.assertEqual('%i ' % (lineno - 1), code_lines[0][:2])\n", "self.assertEqual('%i ' % lineno, code_lines[1][:2])\n", "self.assertEqual('%i ' % (lineno + 1), code_lines[2][:2])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_0.add_cog(CLASS_0(VAR_0))\n" ]
[ "def setup(bot):...\n", "bot.add_cog(Assistance(bot))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(self, VAR_3, VAR_7, VAR_8, VAR_6):...\n", "if VAR_8 == wzrpc.status.success:\n", "self.p.log.debug('Keepalive was successfull')\n", "if VAR_8 == wzrpc.status.e_req_denied:\n", "self.p.log.warn('Keepalive status {0}, reauthentificating and rebinding'.\n format(wzrpc.name_status(VAR_8)))\n", "if VAR_8 == wzrpc.status.e_timeout:\n", "self.p.auth_requests()\n", "self.p.log.warn('Keepalive timeout')\n", "self.p.log.warn('Keepalive status {0}'.format(wzrpc.name_status(VAR_8)))\n", "self.p.bind_methods()\n" ]
[ "def handle_keepalive_reply(self, reqid, seqnum, status, data):...\n", "if status == wzrpc.status.success:\n", "self.p.log.debug('Keepalive was successfull')\n", "if status == wzrpc.status.e_req_denied:\n", "self.p.log.warn('Keepalive status {0}, reauthentificating and rebinding'.\n format(wzrpc.name_status(status)))\n", "if status == wzrpc.status.e_timeout:\n", "self.p.auth_requests()\n", "self.p.log.warn('Keepalive timeout')\n", "self.p.log.warn('Keepalive status {0}'.format(wzrpc.name_status(status)))\n", "self.p.bind_methods()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_18(self):...\n", "self._test_strtype('blob', None, 4000)\n" ]
[ "def test_large_null_blob(self):...\n", "self._test_strtype('blob', None, 4000)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(self, VAR_0, VAR_1, *VAR_2, **VAR_3):...\n", "VAR_11 = CounterCountingForm()\n", "VAR_12 = JustURL.objects.get(VAR_1=pk)\n", "return render(VAR_0, 'url-detail-view.html', {'object': VAR_12, 'form': VAR_11}\n )\n" ]
[ "def get(self, request, pk, *args, **kwargs):...\n", "form = CounterCountingForm()\n", "object = JustURL.objects.get(pk=pk)\n", "return render(request, 'url-detail-view.html', {'object': object, 'form': form}\n )\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "from flask import Flask, request, jsonify\n", "import time\n", "import requests\n", "import json\n", "from TextProcessing import makeNGrams\n", "from Ranking import Ranking\n", "import psycopg2\n", "import pprint\n", "import random\n", "random.seed(500)\n", "VAR_0 = Flask(__name__)\n", "VAR_1 = (\n \"host='green-z.cs.rpi.edu' dbname='index' user='ranking' password='ranking'\"\n )\n", "VAR_2 = psycopg2.connect(VAR_1)\n", "VAR_2.autocommit = True\n", "VAR_3 = VAR_2.cursor()\n", "@VAR_0.route('/search', methods=['GET'])...\n", "print('in rec query')\n", "VAR_7 = {}\n", "VAR_7['pages'] = []\n", "print(request.args.get('query'))\n", "VAR_4 = request.args.get('query')\n", "if not VAR_4:\n", "return jsonify(VAR_7)\n", "VAR_4 = VAR_4.lower()\n", "VAR_8 = FUNC_2(VAR_4)\n", "return jsonify(VAR_8)\n" ]
[ "from flask import Flask, request, jsonify\n", "import time\n", "import requests\n", "import json\n", "from TextProcessing import makeNGrams\n", "from Ranking import Ranking\n", "import psycopg2\n", "import pprint\n", "import random\n", "random.seed(500)\n", "app = Flask(__name__)\n", "conn_string = (\n \"host='green-z.cs.rpi.edu' dbname='index' user='ranking' password='ranking'\"\n )\n", "conn = psycopg2.connect(conn_string)\n", "conn.autocommit = True\n", "cursor = conn.cursor()\n", "@app.route('/search', methods=['GET'])...\n", "print('in rec query')\n", "emptyRes = {}\n", "emptyRes['pages'] = []\n", "print(request.args.get('query'))\n", "query = request.args.get('query')\n", "if not query:\n", "return jsonify(emptyRes)\n", "query = query.lower()\n", "rankedList = getRanking(query)\n", "return jsonify(rankedList)\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 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_21(VAR_18, VAR_29, VAR_30=60):...\n", "VAR_50 = re.compile(\n 'Compiling\\\\.\\\\.\\\\.|Evaluating\\\\.\\\\.\\\\.|Scoring\\\\.\\\\.\\\\.|Evaluated')\n", "VAR_51 = re.compile('Compilation failed|Evaluated \\\\(|Scored \\\\(')\n", "VAR_34 = FUNC_0()\n", "VAR_52 = 0.1\n", "while VAR_30 > 0:\n", "VAR_30 -= VAR_52\n", "VAR_49 = AWSSubmissionViewRequest(VAR_34, VAR_29, base_url=AWS_BASE_URL)\n", "VAR_49.execute()\n", "VAR_63 = VAR_49.get_submission_info()\n", "VAR_64 = VAR_63['status']\n", "if VAR_51.search(VAR_64):\n", "return VAR_63\n", "if VAR_50.search(VAR_64):\n", "time.sleep(VAR_52)\n" ]
[ "def get_evaluation_result(contest_id, submission_id, timeout=60):...\n", "WAITING_STATUSES = re.compile(\n 'Compiling\\\\.\\\\.\\\\.|Evaluating\\\\.\\\\.\\\\.|Scoring\\\\.\\\\.\\\\.|Evaluated')\n", "COMPLETED_STATUS = re.compile('Compilation failed|Evaluated \\\\(|Scored \\\\(')\n", "browser = get_aws_browser()\n", "sleep_interval = 0.1\n", "while timeout > 0:\n", "timeout -= sleep_interval\n", "sr = AWSSubmissionViewRequest(browser, submission_id, base_url=AWS_BASE_URL)\n", "sr.execute()\n", "result = sr.get_submission_info()\n", "status = result['status']\n", "if COMPLETED_STATUS.search(status):\n", "return result\n", "if WAITING_STATUSES.search(status):\n", "time.sleep(sleep_interval)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Expr'" ]
[ "def __init__(self, VAR_24=None, VAR_31=False, VAR_32=False):...\n", "self.kill_mode = VAR_31\n", "self.check_mode = VAR_32\n", "self.logger = logging.getLogger(__name__)\n", "self.logger.setLevel(logging.DEBUG)\n", "self.config = None\n", "self.session = None\n", "if VAR_31:\n", "self.logger.info('started slave with kill mode')\n", "if VAR_32:\n", "self.logger.info('started slave with check mode')\n", "self.server = Server()\n", "if self.server.has_session('slave-session'):\n", "self.session = self.server.find_where({'session_name': 'slave-session'})\n", "if not VAR_31 and not VAR_32:\n", "self.logger.info('found running slave session on server')\n", "self.logger.info('starting new slave session on server')\n", "self.logger.info('No slave session found on server. Aborting')\n", "if VAR_24:\n", "self.session = self.server.new_session(VAR_30='slave-session')\n", "exit(CLASS_0.STOPPED)\n", "self.load_config(VAR_24)\n", "self.logger.error('No slave component config provided')\n", "self.window_name = self.config['name']\n", "self.flag_path = '/tmp/Hyperion/slaves/%s' % self.window_name\n", "self.log_file = '/tmp/Hyperion/log/%s' % self.window_name\n", "FUNC_10(self.log_file)\n" ]
[ "def __init__(self, configfile=None, kill_mode=False, check_mode=False):...\n", "self.kill_mode = kill_mode\n", "self.check_mode = check_mode\n", "self.logger = logging.getLogger(__name__)\n", "self.logger.setLevel(logging.DEBUG)\n", "self.config = None\n", "self.session = None\n", "if kill_mode:\n", "self.logger.info('started slave with kill mode')\n", "if check_mode:\n", "self.logger.info('started slave with check mode')\n", "self.server = Server()\n", "if self.server.has_session('slave-session'):\n", "self.session = self.server.find_where({'session_name': 'slave-session'})\n", "if not kill_mode and not check_mode:\n", "self.logger.info('found running slave session on server')\n", "self.logger.info('starting new slave session on server')\n", "self.logger.info('No slave session found on server. Aborting')\n", "if configfile:\n", "self.session = self.server.new_session(session_name='slave-session')\n", "exit(CheckState.STOPPED)\n", "self.load_config(configfile)\n", "self.logger.error('No slave component config provided')\n", "self.window_name = self.config['name']\n", "self.flag_path = '/tmp/Hyperion/slaves/%s' % self.window_name\n", "self.log_file = '/tmp/Hyperion/log/%s' % self.window_name\n", "ensure_dir(self.log_file)\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'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_8(self):...\n", "" ]
[ "def describe(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@auth.route('/confirm')...\n", "VAR_0 = current_user.generate_confirmation_token()\n", "send_email(current_user.email, 'Confirm Your Account', 'auth/email/confirm',\n VAR_2=current_user, VAR_0=token)\n", "flash('A new confirmation email has been sent.')\n", "return redirect(url_for('main.index'))\n" ]
[ "@auth.route('/confirm')...\n", "token = current_user.generate_confirmation_token()\n", "send_email(current_user.email, 'Confirm Your Account', 'auth/email/confirm',\n user=current_user, token=token)\n", "flash('A new confirmation email has been sent.')\n", "return redirect(url_for('main.index'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_7(VAR_0):...\n", "VAR_3 = {'origin': '127.0.0.1', 'args': {}}\n", "VAR_1 = VAR_0.url + '/get'\n", "VAR_2 = load_source(VAR_1)\n", "assert isinstance(VAR_2, collections.Mapping)\n", "VAR_2.pop('headers')\n", "VAR_2.pop('url')\n", "assert VAR_2 == VAR_3\n" ]
[ "def test_url(httpbin):...\n", "native = {'origin': '127.0.0.1', 'args': {}}\n", "source = httpbin.url + '/get'\n", "result = load_source(source)\n", "assert isinstance(result, collections.Mapping)\n", "result.pop('headers')\n", "result.pop('url')\n", "assert result == native\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assert'", "Expr'", "Expr'", "Assert'" ]