lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_3(*VAR_17, **VAR_18):...\n", "return {'id': uuidutils.generate_uuid()}\n" ]
[ "def _return_id_key(*args, **kwargs):...\n", "return {'id': uuidutils.generate_uuid()}\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@app.route('/api/indi_profiles', methods=['POST'])...\n", "" ]
[ "@app.route('/api/indi_profiles', methods=['POST'])...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_22(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n", "self.write_data({'type': 'shutdown', 'event': VAR_5[0]})\n" ]
[ "def on_shutdown(self, subject, changetype, objectID, *args):...\n", "self.write_data({'type': 'shutdown', 'event': args[0]})\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_0(self):...\n", "super(CLASS_0, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\n" ]
[ "def setUp(self):...\n", "super(DellEQLSanISCSIDriverTestCase, self).setUp()\n", "self.configuration = mox.MockObject(conf.Configuration)\n", "self.configuration.append_config_values(mox.IgnoreArg())\n", "self.configuration.san_is_local = False\n", "self.configuration.san_ip = '10.0.0.1'\n", "self.configuration.san_login = 'foo'\n", "self.configuration.san_password = 'bar'\n", "self.configuration.san_ssh_port = 16022\n", "self.configuration.san_thin_provision = True\n", "self.configuration.eqlx_pool = 'non-default'\n", "self.configuration.eqlx_use_chap = True\n", "self.configuration.eqlx_group_name = 'group-0'\n", "self.configuration.eqlx_cli_timeout = 30\n", "self.configuration.eqlx_cli_max_retries = 5\n", "self.configuration.eqlx_chap_login = 'admin'\n", "self.configuration.eqlx_chap_password = 'password'\n", "self.configuration.volume_name_template = 'volume_%s'\n", "self._context = context.get_admin_context()\n", "self.driver = eqlx.DellEQLSanISCSIDriver(configuration=self.configuration)\n", "self.volume_name = 'fakevolume'\n", "self.volid = 'fakeid'\n", "self.connector = {'ip': '10.0.0.2', 'initiator':\n 'iqn.1993-08.org.debian:01:222', 'host': 'fakehost'}\n", "self.fake_iqn = 'iqn.2003-10.com.equallogic:group01:25366:fakev'\n", "self.driver._group_ip = '10.0.1.6'\n", "self.properties = {'target_discoverd': True, 'target_portal': '%s:3260' %\n self.driver._group_ip, 'target_iqn': self.fake_iqn, 'volume_id': 1}\n", "self._model_update = {'provider_location': '%s:3260,1 %s 0' % (self.driver.\n _group_ip, self.fake_iqn), 'provider_auth': 'CHAP %s %s' % (self.\n configuration.eqlx_chap_login, self.configuration.eqlx_chap_password)}\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'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_1(self, VAR_1):...\n", "self.__init__()\n", "self.name = VAR_1.get('name')\n", "self.vars = VAR_1.get('vars', dict())\n", "self.depth = VAR_1.get('depth', 0)\n", "self.hosts = VAR_1.get('hosts', [])\n", "self._hosts = None\n", "VAR_7 = VAR_1.get('parent_groups', [])\n", "for parent_data in VAR_7:\n", "VAR_12 = CLASS_0()\n", "VAR_12.deserialize(parent_data)\n", "self.parent_groups.append(VAR_12)\n" ]
[ "def deserialize(self, data):...\n", "self.__init__()\n", "self.name = data.get('name')\n", "self.vars = data.get('vars', dict())\n", "self.depth = data.get('depth', 0)\n", "self.hosts = data.get('hosts', [])\n", "self._hosts = None\n", "parent_groups = data.get('parent_groups', [])\n", "for parent_data in parent_groups:\n", "g = Group()\n", "g.deserialize(parent_data)\n", "self.parent_groups.append(g)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Expr'", "Expr'" ]
[ "@VAR_1.route('/register', methods=['GET', 'POST'])...\n", "if VAR_14.g.user:\n", "return VAR_14.redirect(FUNC_5())\n", "VAR_4 = forms.RegisterForm(VAR_14.request.form)\n", "if VAR_14.request.method == 'POST' and VAR_4.validate():\n", "VAR_3 = models.User(VAR_12=form.username.data.strip(), email=form.email.\n data.strip(), VAR_13=form.password.data)\n", "return VAR_14.render_template('register.html', VAR_4=form)\n", "VAR_3.registration_ip = ip_address(VAR_14.request.remote_addr).packed\n", "VAR_3.last_login_ip = VAR_3.registration_ip\n", "db.session.add(VAR_3)\n", "db.session.commit()\n", "if models.RangeBan.is_rangebanned(VAR_3.registration_ip):\n", "VAR_14.flash(VAR_14.Markup('string'.format(VAR_14.url_for('site.help') +\n '#irchelp', VAR_14.url_for('users.view_user', user_name=user.username),\n VAR_3.username)), 'warning')\n", "if VAR_0.config['USE_EMAIL_VERIFICATION']:\n", "FUNC_6(VAR_3)\n", "VAR_3.status = models.UserStatusType.ACTIVE\n", "return VAR_14.render_template('waiting.html')\n", "db.session.add(VAR_3)\n", "db.session.commit()\n", "VAR_14.g.user = VAR_3\n", "VAR_14.session['user_id'] = VAR_3.id\n", "VAR_14.session.permanent = True\n", "VAR_14.session.modified = True\n", "return VAR_14.redirect(FUNC_5())\n" ]
[ "@bp.route('/register', methods=['GET', 'POST'])...\n", "if flask.g.user:\n", "return flask.redirect(redirect_url())\n", "form = forms.RegisterForm(flask.request.form)\n", "if flask.request.method == 'POST' and form.validate():\n", "user = models.User(username=form.username.data.strip(), email=form.email.\n data.strip(), password=form.password.data)\n", "return flask.render_template('register.html', form=form)\n", "user.registration_ip = ip_address(flask.request.remote_addr).packed\n", "user.last_login_ip = user.registration_ip\n", "db.session.add(user)\n", "db.session.commit()\n", "if models.RangeBan.is_rangebanned(user.registration_ip):\n", "flask.flash(flask.Markup(\n 'Your IP is blocked from creating new accounts. Please <a href=\"{}\">ask a moderator</a> to manually activate your account <a href=\"{}\">\\'{}\\'</a>.'\n .format(flask.url_for('site.help') + '#irchelp', flask.url_for(\n 'users.view_user', user_name=user.username), user.username)), 'warning')\n", "if app.config['USE_EMAIL_VERIFICATION']:\n", "send_verification_email(user)\n", "user.status = models.UserStatusType.ACTIVE\n", "return flask.render_template('waiting.html')\n", "db.session.add(user)\n", "db.session.commit()\n", "flask.g.user = user\n", "flask.session['user_id'] = user.id\n", "flask.session.permanent = True\n", "flask.session.modified = True\n", "return flask.redirect(redirect_url())\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 ]
[ "Condition", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Return'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_16(self, VAR_14):...\n", "" ]
[ "def is_datetime(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_7(self, VAR_17=None):...\n", "if not VAR_17:\n", "VAR_17 = self._error\n", "if VAR_17:\n", "VAR_101.errors.add(VAR_17)\n" ]
[ "def error(self, e=None):...\n", "if not e:\n", "e = self._error\n", "if e:\n", "c.errors.add(e)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_36(self, VAR_14):...\n", "return self.__class__(self.get_related_model(VAR_14), self.session)\n" ]
[ "def get_related_interface(self, col_name):...\n", "return self.__class__(self.get_related_model(col_name), self.session)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_13(self):...\n", "self._tab_after('ls --help')\n", "eq_(self.terminal.method_calls, [('write', (' ',), {})])\n", "self._tab_after('-')\n", "assert 'help' not in self.terminal.method_calls[2][1][0]\n", "assert '-h' not in self.terminal.method_calls[2][1][0]\n" ]
[ "def test_complete_consumed_switches(self):...\n", "self._tab_after('ls --help')\n", "eq_(self.terminal.method_calls, [('write', (' ',), {})])\n", "self._tab_after('-')\n", "assert 'help' not in self.terminal.method_calls[2][1][0]\n", "assert '-h' not in self.terminal.method_calls[2][1][0]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assert'", "Assert'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.output = VAR_69, VAR_70\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.output = paths, kwpaths\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_12(self):...\n", "return self._omnicomp\n" ]
[ "def GetOmniCompleter(self):...\n", "return self._omnicomp\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@user_passes_test(user_is_staff)...\n", "if VAR_0.method == 'GET':\n", "VAR_4 = {'form': TestrailConfigurationForm()}\n", "if VAR_0.method == 'POST':\n", "return render(VAR_0, 'testcases/tc_testrails_new.html', VAR_4)\n", "VAR_19 = get_object_or_404(TestRailInstance, username='[email protected]')\n", "VAR_20 = get_projects_from_testrail(VAR_19)\n", "VAR_21 = TestrailConfigurationForm(VAR_0.POST)\n", "if VAR_21.is_valid():\n", "VAR_11 = []\n", "messages.error(VAR_0, VAR_21.errors)\n", "VAR_23 = VAR_21.save(commit=False)\n", "VAR_4 = context_project_dashboard(VAR_0)\n", "VAR_24 = next(item for item in VAR_20 if item['name'] == VAR_23.project_name)\n", "VAR_4['last_tab'] = 'test_rails'\n", "VAR_23.project_id = VAR_24['id']\n", "return render(VAR_0, 'projects/project_dashboard.html', VAR_4)\n", "VAR_12 = APIClient(VAR_23.instance.host)\n", "VAR_12.user = VAR_23.instance.username\n", "VAR_12.password = VAR_23.instance.password\n", "VAR_13 = VAR_12.send_get('get_suites/' + str(VAR_23.project_id))\n", "for suite in VAR_13:\n", "VAR_11.append(suite['name'])\n", "VAR_23.test_suite = VAR_11\n", "VAR_23.save()\n" ]
[ "@user_passes_test(user_is_staff)...\n", "if request.method == 'GET':\n", "context = {'form': TestrailConfigurationForm()}\n", "if request.method == 'POST':\n", "return render(request, 'testcases/tc_testrails_new.html', context)\n", "instance = get_object_or_404(TestRailInstance, username='[email protected]')\n", "testrail_projects = get_projects_from_testrail(instance)\n", "form = TestrailConfigurationForm(request.POST)\n", "if form.is_valid():\n", "suites = []\n", "messages.error(request, form.errors)\n", "testrail_new = form.save(commit=False)\n", "context = context_project_dashboard(request)\n", "testrail_find = next(item for item in testrail_projects if item['name'] ==\n testrail_new.project_name)\n", "context['last_tab'] = 'test_rails'\n", "testrail_new.project_id = testrail_find['id']\n", "return render(request, 'projects/project_dashboard.html', context)\n", "client = APIClient(testrail_new.instance.host)\n", "client.user = testrail_new.instance.username\n", "client.password = testrail_new.instance.password\n", "testrail_find_suites = client.send_get('get_suites/' + str(testrail_new.\n project_id))\n", "for suite in testrail_find_suites:\n", "suites.append(suite['name'])\n", "testrail_new.test_suite = suites\n", "testrail_new.save()\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 ]
[ "Condition", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_3, VAR_4, VAR_1=(), VAR_2={}, VAR_5=None, VAR_6=None,...\n", "super().__init__(*VAR_8, **pkvargs)\n", "self.name = VAR_5 if VAR_5 else type(self).__name__\n", "self.start_timer = VAR_6\n", "self.poll_timeout = VAR_7 if VAR_7 else 5 * 1000\n", "self.call = VAR_4, VAR_1, VAR_2\n", "self.wz_addr = VAR_3\n", "self.wz_auth_requests = []\n", "self.wz_bind_methods = []\n", "self.wz_poll_timeout = 30\n" ]
[ "def __init__(self, wz_addr, fun, args=(), kvargs={}, name=None, start_timer...\n", "super().__init__(*pargs, **pkvargs)\n", "self.name = name if name else type(self).__name__\n", "self.start_timer = start_timer\n", "self.poll_timeout = poll_timeout if poll_timeout else 5 * 1000\n", "self.call = fun, args, kvargs\n", "self.wz_addr = wz_addr\n", "self.wz_auth_requests = []\n", "self.wz_bind_methods = []\n", "self.wz_poll_timeout = 30\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_14(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return partial(FUNC_5, VAR_1)\n" ]
[ "def make_token_getter(remote):...\n", "\"\"\"docstring\"\"\"\n", "return partial(token_getter, remote)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@integration_synonym_api...\n", "FUNC_2(VAR_2)\n", "FUNC_3(VAR_2, 'PSYCHO', VAR_7='1')\n", "FUNC_5(VAR_4, VAR_5, VAR_11='SYCHO', VAR_10=[{'name': '----SYCHO'}, {'name':\n 'PSYCHO'}])\n" ]
[ "@integration_synonym_api...\n", "clean_database(solr)\n", "seed_database_with(solr, 'PSYCHO', id='1')\n", "verify_results(client, jwt, query='SYCHO', expected=[{'name': '----SYCHO'},\n {'name': 'PSYCHO'}])\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_12, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "if not isinstance(VAR_12, str) or not isinstance(VAR_8, str):\n", "self.extra_data[VAR_12] = VAR_8\n" ]
[ "def set_attribute(self, key, value):...\n", "\"\"\"docstring\"\"\"\n", "if not isinstance(key, str) or not isinstance(value, str):\n", "self.extra_data[key] = value\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'" ]
[ "def FUNC_0(VAR_0):...\n", "VAR_1 = []\n", "VAR_2 = FUNC_1(VAR_0)\n", "if VAR_2:\n", "VAR_1.append(VAR_2)\n", "VAR_3 = os.listdir(VAR_0)\n", "VAR_3 = []\n", "for name in VAR_3:\n", "return VAR_1\n", "VAR_4 = os.path.join(VAR_0, name)\n", "if not os.path.isdir(VAR_4):\n", "VAR_1 += FUNC_0(VAR_4)\n" ]
[ "def find_repositories(path):...\n", "repos = []\n", "client = get_vcs_client(path)\n", "if client:\n", "repos.append(client)\n", "listdir = os.listdir(path)\n", "listdir = []\n", "for name in listdir:\n", "return repos\n", "subpath = os.path.join(path, name)\n", "if not os.path.isdir(subpath):\n", "repos += find_repositories(subpath)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "For", "Return'", "Assign'", "Condition", "AugAssign'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_47 = re.compile('^.*[,();].*')\n", "VAR_48 = ['select', 'create', 'insert', 'delete', 'drop', 'update', 'case']\n", "VAR_49 = ['concat', 'concat_ws', 'if', 'ifnull', 'nullif', 'coalesce',\n 'connection_id', 'current_user', 'database', 'last_insert_id',\n 'session_user', 'system_user', 'user', 'version']\n", "def FUNC_26():...\n", "frappe.throw(_('Use of sub-query or function is restricted'), frappe.DataError)\n", "def FUNC_27(VAR_50):...\n", "if re.compile('^(select|delete|update|drop|create)\\\\s').match(VAR_50):\n", "FUNC_26()\n", "if re.compile('\\\\s*[a-zA-z]*\\\\s*( from | group by | order by | where | join )'\n", "for VAR_50 in self.fields:\n", "FUNC_26()\n", "if VAR_47.match(VAR_50):\n", "if any(keyword in VAR_50.lower().split() for keyword in VAR_48):\n", "if re.compile(\"[a-zA-Z]+\\\\s*'\").match(VAR_50):\n", "FUNC_26()\n", "if any('({0}'.format(keyword) in VAR_50.lower() for keyword in VAR_48):\n", "FUNC_26()\n", "if re.compile('[a-zA-Z]+\\\\s*,').match(VAR_50):\n", "FUNC_26()\n", "if any('{0}('.format(keyword) in VAR_50.lower() for keyword in VAR_49):\n", "FUNC_26()\n", "FUNC_27(VAR_50)\n", "FUNC_26()\n" ]
[ "def sanitize_fields(self):...\n", "\"\"\"docstring\"\"\"\n", "sub_query_regex = re.compile('^.*[,();].*')\n", "blacklisted_keywords = ['select', 'create', 'insert', 'delete', 'drop',\n 'update', 'case']\n", "blacklisted_functions = ['concat', 'concat_ws', 'if', 'ifnull', 'nullif',\n 'coalesce', 'connection_id', 'current_user', 'database',\n 'last_insert_id', 'session_user', 'system_user', 'user', 'version']\n", "def _raise_exception():...\n", "frappe.throw(_('Use of sub-query or function is restricted'), frappe.DataError)\n", "def _is_query(field):...\n", "if re.compile('^(select|delete|update|drop|create)\\\\s').match(field):\n", "_raise_exception()\n", "if re.compile('\\\\s*[a-zA-z]*\\\\s*( from | group by | order by | where | join )'\n", "for field in self.fields:\n", "_raise_exception()\n", "if sub_query_regex.match(field):\n", "if any(keyword in field.lower().split() for keyword in blacklisted_keywords):\n", "if re.compile(\"[a-zA-Z]+\\\\s*'\").match(field):\n", "_raise_exception()\n", "if any('({0}'.format(keyword) in field.lower() for keyword in\n", "_raise_exception()\n", "if re.compile('[a-zA-Z]+\\\\s*,').match(field):\n", "_raise_exception()\n", "if any('{0}('.format(keyword) in field.lower() for keyword in\n", "_raise_exception()\n", "_is_query(field)\n", "_raise_exception()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Condition", "Expr'", "Condition", "For", "Expr'", "Condition", "For", "Condition", "Expr'", "For", "Expr'", "Condition", "Expr'", "For", "Expr'", "Expr'", "Expr'" ]
[ "from __future__ import absolute_import, division, print_function, unicode_literals\n", "import os\n", "from builtins import open\n", "from future.utils import text_type\n", "from pants.backend.graph_info.subsystems.cloc_binary import ClocBinary\n", "from pants.base.workunit import WorkUnitLabel\n", "from pants.engine.fs import FilesContent, PathGlobs, PathGlobsAndRoot\n", "from pants.engine.isolated_process import ExecuteProcessRequest\n", "from pants.task.console_task import ConsoleTask\n", "from pants.util.contextutil import temporary_dir\n", "\"\"\"Print counts of lines of code.\"\"\"\n", "@classmethod...\n", "return super(CLASS_0, VAR_0).subsystem_dependencies() + (ClocBinary,)\n" ]
[ "from __future__ import absolute_import, division, print_function, unicode_literals\n", "import os\n", "from builtins import open\n", "from future.utils import text_type\n", "from pants.backend.graph_info.subsystems.cloc_binary import ClocBinary\n", "from pants.base.workunit import WorkUnitLabel\n", "from pants.engine.fs import FilesContent, PathGlobs, PathGlobsAndRoot\n", "from pants.engine.isolated_process import ExecuteProcessRequest\n", "from pants.task.console_task import ConsoleTask\n", "from pants.util.contextutil import temporary_dir\n", "\"\"\"Print counts of lines of code.\"\"\"\n", "@classmethod...\n", "return super(CountLinesOfCode, cls).subsystem_dependencies() + (ClocBinary,)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Condition", "Return'" ]
[ "import sys\n", "import logging\n", "import sqlalchemy as sa\n", "from . import filters\n", "from sqlalchemy.orm import joinedload\n", "from sqlalchemy.exc import IntegrityError\n", "from sqlalchemy import func\n", "from sqlalchemy.orm.properties import SynonymProperty\n", "from ..base import BaseInterface\n", "from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n", "from ..mixins import FileColumn, ImageColumn\n", "from ...filemanager import FileManager, ImageManager\n", "from ..._compat import as_unicode\n", "from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n", "VAR_0 = logging.getLogger(__name__)\n", "def FUNC_0(VAR_1):...\n", "for key in VAR_6.__all__:\n", "if not hasattr(VAR_1, key):\n", "\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n", "setattr(VAR_1, key, getattr(VAR_6, key))\n", "VAR_3 = None\n", "VAR_4 = VAR_6.SQLAFilterConverter\n", "def __init__(self, VAR_1, VAR_3=None):...\n", "FUNC_0(self)\n", "self.list_columns = dict()\n", "self.list_properties = dict()\n", "self.session = VAR_3\n", "for VAR_36 in sa.orm.class_mapper(VAR_1).iterate_properties:\n", "if type(VAR_36) != SynonymProperty:\n", "for VAR_14 in VAR_1.__mapper__.columns.keys():\n", "self.list_properties[VAR_36.key] = VAR_36\n", "if VAR_14 in self.list_properties:\n", "super(CLASS_0, self).__init__(VAR_1)\n", "self.list_columns[VAR_14] = VAR_1.__mapper__.columns[VAR_14]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ "import sys\n", "import logging\n", "import sqlalchemy as sa\n", "from . import filters\n", "from sqlalchemy.orm import joinedload\n", "from sqlalchemy.exc import IntegrityError\n", "from sqlalchemy import func\n", "from sqlalchemy.orm.properties import SynonymProperty\n", "from ..base import BaseInterface\n", "from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n", "from ..mixins import FileColumn, ImageColumn\n", "from ...filemanager import FileManager, ImageManager\n", "from ..._compat import as_unicode\n", "from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n", "log = logging.getLogger(__name__)\n", "def _include_filters(obj):...\n", "for key in filters.__all__:\n", "if not hasattr(obj, key):\n", "\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n", "setattr(obj, key, getattr(filters, key))\n", "session = None\n", "filter_converter_class = filters.SQLAFilterConverter\n", "def __init__(self, obj, session=None):...\n", "_include_filters(self)\n", "self.list_columns = dict()\n", "self.list_properties = dict()\n", "self.session = session\n", "for prop in sa.orm.class_mapper(obj).iterate_properties:\n", "if type(prop) != SynonymProperty:\n", "for col_name in obj.__mapper__.columns.keys():\n", "self.list_properties[prop.key] = prop\n", "if col_name in self.list_properties:\n", "super(SQLAInterface, self).__init__(obj)\n", "self.list_columns[col_name] = obj.__mapper__.columns[col_name]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\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 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "For", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Condition", "For", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Docstring", "Return'" ]
[ "def FUNC_0(self):...\n", "super(CLASS_0, self).setUp()\n", "self.count = 0\n", "self.initialize(GigaChannelCommunity, 2)\n" ]
[ "def setUp(self):...\n", "super(TestGigaChannelUnits, self).setUp()\n", "self.count = 0\n", "self.initialize(GigaChannelCommunity, 2)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_6(self):...\n", "VAR_91 = Subreddit._by_fullname(VAR_102.post.keys())\n", "return VAR_91.values()\n" ]
[ "def run(self):...\n", "subreddits = Subreddit._by_fullname(request.post.keys())\n", "return subreddits.values()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_0(self):...\n", "self._mox = mox.Mox()\n", "self.mock(logging, 'error', lambda *_: None)\n", "self.mock(logging, 'exception', lambda *_: None)\n", "self.mock(logging, 'info', lambda *_: None)\n", "self.mock(logging, 'warning', lambda *_: None)\n", "self._mox.StubOutWithMock(time, 'sleep')\n", "self._mox.StubOutWithMock(urllib2, 'urlopen')\n" ]
[ "def setUp(self):...\n", "self._mox = mox.Mox()\n", "self.mock(logging, 'error', lambda *_: None)\n", "self.mock(logging, 'exception', lambda *_: None)\n", "self.mock(logging, 'info', lambda *_: None)\n", "self.mock(logging, 'warning', lambda *_: None)\n", "self._mox.StubOutWithMock(time, 'sleep')\n", "self._mox.StubOutWithMock(urllib2, 'urlopen')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_6, VAR_7=None):...\n", "super().__init__(VAR_6, VAR_7)\n", "self.type = 'port'\n" ]
[ "def __init__(self, name, display_name=None):...\n", "super().__init__(name, display_name)\n", "self.type = 'port'\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'" ]
[ "@VAR_2.user_loader...\n", "return User.get(VAR_6)\n" ]
[ "@login_manager.user_loader...\n", "return User.get(user_id)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __eq__(self, VAR_10):...\n", "if VAR_10:\n", "return vars(self) == vars(VAR_10)\n", "return False\n" ]
[ "def __eq__(self, other):...\n", "if other:\n", "return vars(self) == vars(other)\n", "return False\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(VAR_6):...\n", "VAR_7 = HttpResponse(VAR_6)\n", "VAR_7['Access-Control-Allow-Origin'] = '*'\n", "return VAR_7\n" ]
[ "def respond_text(text):...\n", "response = HttpResponse(text)\n", "response['Access-Control-Allow-Origin'] = '*'\n", "return response\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_41(self):...\n", "self.compilation_ko(\"\"\"\nmacommande \"Toto\";\n\"\"\")\n" ]
[ "def test_unknown_control(self):...\n", "self.compilation_ko(\"\"\"\nmacommande \"Toto\";\n\"\"\")\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_23(self, VAR_21, VAR_27, VAR_28):...\n", "\"\"\"docstring\"\"\"\n", "VAR_57 = self.getfile(VAR_21)\n", "if VAR_57 == False:\n", "if VAR_27 != -1:\n", "VAR_57[VAR_3] = VAR_27\n", "if VAR_28 != -1:\n", "VAR_57[VAR_4] = VAR_28\n" ]
[ "def chown(self, path, uid, gid):...\n", "\"\"\"docstring\"\"\"\n", "p = self.getfile(path)\n", "if p == False:\n", "if uid != -1:\n", "p[A_UID] = uid\n", "if gid != -1:\n", "p[A_GID] = gid\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = {'TEST_STACK': str(CLASS_0.DEFAULT_TEST_ID), 'TEST_APP': \n 'smoketest' + CLASS_0.DEFAULT_TEST_ID}\n", "return st.ScenarioTestRunner.main(CLASS_0, default_binding_overrides=\n defaults, test_case_list=[AwsSmokeTest])\n" ]
[ "def main():...\n", "\"\"\"docstring\"\"\"\n", "defaults = {'TEST_STACK': str(AwsSmokeTestScenario.DEFAULT_TEST_ID),\n 'TEST_APP': 'smoketest' + AwsSmokeTestScenario.DEFAULT_TEST_ID}\n", "return st.ScenarioTestRunner.main(AwsSmokeTestScenario,\n default_binding_overrides=defaults, test_case_list=[AwsSmokeTest])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_59 = defer.Deferred()\n", "self.account = IMAPAccount(self._user_id, self.soledad, VAR_59)\n", "return VAR_59\n" ]
[ "def _initialize_imap_account(self):...\n", "account_ready_cb = defer.Deferred()\n", "self.account = IMAPAccount(self._user_id, self.soledad, account_ready_cb)\n", "return account_ready_cb\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_48(self, VAR_22, VAR_6=None):...\n", "if VAR_6:\n", "VAR_5 = VAR_5 = self.session.query(self.obj)\n", "return self.session.query(self.obj).get(VAR_22)\n", "VAR_35 = VAR_6.copy()\n", "VAR_35.add_filter(self.get_pk_name(), self.FilterEqual, VAR_22)\n", "VAR_5 = self._get_base_query(VAR_5=query, VAR_6=_filters)\n", "return VAR_5.first()\n" ]
[ "def get(self, id, filters=None):...\n", "if filters:\n", "query = query = self.session.query(self.obj)\n", "return self.session.query(self.obj).get(id)\n", "_filters = filters.copy()\n", "_filters.add_filter(self.get_pk_name(), self.FilterEqual, id)\n", "query = self._get_base_query(query=query, filters=_filters)\n", "return query.first()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "@atomic...\n", "\"\"\"docstring\"\"\"\n", "VAR_5, VAR_6 = self.common()\n", "VAR_19 = Path('head')\n", "VAR_20 = []\n", "while True:\n", "VAR_31 = self.get_mfs_path(VAR_5, VAR_6, branch_info=curr_commit)\n", "VAR_32 = VAR_31 / 'metadata'\n", "VAR_21 = self.ipfs.files_stat(VAR_31)['Hash']\n", "VAR_33 = self.mfs_read_json(VAR_32)\n", "return VAR_20\n", "VAR_42 = self.ipfs.files_stat(VAR_31 / 'bundle/files')['Hash']\n", "if len(VAR_33) == 0:\n", "VAR_34, VAR_35, VAR_36 = VAR_21[:6], VAR_33['timestamp'], VAR_33['message']\n", "VAR_37 = make_len(VAR_33['author'] or '', 30)\n", "if not self.quiet:\n", "if VAR_9:\n", "VAR_20.append(VAR_21)\n", "print(f'* {VAR_42} {VAR_35} {VAR_37} {VAR_36}')\n", "print(f'* {VAR_35} {VAR_37} {VAR_36}')\n", "VAR_19 = VAR_19 / 'parent1'\n" ]
[ "@atomic...\n", "\"\"\"docstring\"\"\"\n", "fs_repo_root, branch = self.common()\n", "curr_commit = Path('head')\n", "commits = []\n", "while True:\n", "mfs_commit = self.get_mfs_path(fs_repo_root, branch, branch_info=curr_commit)\n", "mfs_commit_meta = mfs_commit / 'metadata'\n", "mfs_commit_hash = self.ipfs.files_stat(mfs_commit)['Hash']\n", "meta = self.mfs_read_json(mfs_commit_meta)\n", "return commits\n", "mfs_commit_ref_hash = self.ipfs.files_stat(mfs_commit / 'bundle/files')['Hash']\n", "if len(meta) == 0:\n", "h, ts, msg = mfs_commit_hash[:6], meta['timestamp'], meta['message']\n", "auth = make_len(meta['author'] or '', 30)\n", "if not self.quiet:\n", "if show_hash:\n", "commits.append(mfs_commit_hash)\n", "print(f'* {mfs_commit_ref_hash} {ts} {auth} {msg}')\n", "print(f'* {ts} {auth} {msg}')\n", "curr_commit = curr_commit / 'parent1'\n" ]
[ 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Assign'" ]
[ "import itertools\n", "from django.core.exceptions import ValidationError\n", "from django.db import models, connection\n", "from django.db.models import Q, F, Case, When\n", "from django.utils import translation\n", "from django.utils.functional import cached_property\n", "from django.utils.translation import ugettext_lazy as _\n", "from ordered_model.models import OrderedModel\n", "from reversion.admin import VersionAdmin\n", "from backoffice.settings.base import LANGUAGE_CODE_EN\n", "from base.models import education_group_type, education_group_year\n", "from base.models.education_group_type import GROUP_TYPE_OPTION\n", "from base.models.education_group_year import EducationGroupYear\n", "from base.models.enums import education_group_categories, link_type, quadrimesters\n", "from base.models.enums.link_type import LinkTypes\n", "from base.models.learning_component_year import LearningComponentYear, volume_total_verbose\n", "from base.models.learning_unit_year import LearningUnitYear\n", "from osis_common.models.osis_model_admin import OsisModelAdmin\n", "VAR_17 = 'parent', 'child_branch', 'child_leaf'\n", "VAR_18 = 'order',\n", "VAR_19 = ['child_branch__acronym', 'child_branch__partial_acronym',\n 'child_leaf__acronym', 'parent__acronym', 'parent__partial_acronym']\n", "VAR_20 = ('is_mandatory', 'access_condition', 'quadrimester_derogation',\n 'parent__academic_year')\n", "VAR_0 = 'string'\n", "def FUNC_14(self):...\n", "return super().get_queryset().filter(Q(child_branch__isnull=False) | Q(\n child_leaf__learning_container_year__isnull=False))\n" ]
[ "import itertools\n", "from django.core.exceptions import ValidationError\n", "from django.db import models, connection\n", "from django.db.models import Q, F, Case, When\n", "from django.utils import translation\n", "from django.utils.functional import cached_property\n", "from django.utils.translation import ugettext_lazy as _\n", "from ordered_model.models import OrderedModel\n", "from reversion.admin import VersionAdmin\n", "from backoffice.settings.base import LANGUAGE_CODE_EN\n", "from base.models import education_group_type, education_group_year\n", "from base.models.education_group_type import GROUP_TYPE_OPTION\n", "from base.models.education_group_year import EducationGroupYear\n", "from base.models.enums import education_group_categories, link_type, quadrimesters\n", "from base.models.enums.link_type import LinkTypes\n", "from base.models.learning_component_year import LearningComponentYear, volume_total_verbose\n", "from base.models.learning_unit_year import LearningUnitYear\n", "from osis_common.models.osis_model_admin import OsisModelAdmin\n", "list_display = 'parent', 'child_branch', 'child_leaf'\n", "readonly_fields = 'order',\n", "search_fields = ['child_branch__acronym', 'child_branch__partial_acronym',\n 'child_leaf__acronym', 'parent__acronym', 'parent__partial_acronym']\n", "list_filter = ('is_mandatory', 'access_condition',\n 'quadrimester_derogation', 'parent__academic_year')\n", "SQL_RECURSIVE_QUERY_EDUCATION_GROUP = \"\"\"WITH RECURSIVE group_element_year_parent AS (\n\n SELECT id, child_branch_id, child_leaf_id, parent_id, 0 AS level\n FROM base_groupelementyear\n WHERE parent_id IN ({list_root_ids})\n\n UNION ALL\n\n SELECT child.id,\n child.child_branch_id,\n child.child_leaf_id,\n child.parent_id,\n parent.level + 1\n\n FROM base_groupelementyear AS child\n INNER JOIN group_element_year_parent AS parent on parent.child_branch_id = child.parent_id\n\n )\n\nSELECT * FROM group_element_year_parent ;\n\"\"\"\n", "def get_queryset(self):...\n", "return super().get_queryset().filter(Q(child_branch__isnull=False) | Q(\n child_leaf__learning_container_year__isnull=False))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_3(VAR_9):...\n", "VAR_13, VAR_14, VAR_14, VAR_14 = VAR_3.find(VAR_9)\n", "return VAR_13['passed']\n" ]
[ "def is_passed(model):...\n", "entry, _, _, _ = cached_points.find(model)\n", "return entry['passed']\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_0=None):...\n", "VAR_9 = frappe._dict(template='templates/includes/blog/blog.html', get_list\n =get_blog_list, hide_filters=True, children=get_children(), title=_('Blog')\n )\n", "VAR_10 = (frappe.local.form_dict.blog_category or frappe.local.form_dict.\n category)\n", "if VAR_10:\n", "VAR_15 = FUNC_3(VAR_10)\n", "if frappe.local.form_dict.blogger:\n", "VAR_9.sub_title = _('Posts filed under {0}').format(VAR_15)\n", "VAR_16 = frappe.db.get_value('Blogger', {'name': frappe.local.form_dict.\n blogger}, 'full_name')\n", "if frappe.local.form_dict.txt:\n", "VAR_9.title = VAR_15\n", "VAR_9.sub_title = _('Posts by {0}').format(VAR_16)\n", "VAR_9.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)\n", "if VAR_9.sub_title:\n", "VAR_9.title = VAR_16\n", "VAR_9.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}]\n", "VAR_9.parents = [{'name': _('Home'), 'route': '/'}]\n", "VAR_9.update(frappe.get_doc('Blog Settings', 'Blog Settings').as_dict(\n no_default_fields=True))\n", "return VAR_9\n" ]
[ "def get_list_context(context=None):...\n", "list_context = frappe._dict(template='templates/includes/blog/blog.html',\n get_list=get_blog_list, hide_filters=True, children=get_children(),\n title=_('Blog'))\n", "category = (frappe.local.form_dict.blog_category or frappe.local.form_dict.\n category)\n", "if category:\n", "category_title = get_blog_category(category)\n", "if frappe.local.form_dict.blogger:\n", "list_context.sub_title = _('Posts filed under {0}').format(category_title)\n", "blogger = frappe.db.get_value('Blogger', {'name': frappe.local.form_dict.\n blogger}, 'full_name')\n", "if frappe.local.form_dict.txt:\n", "list_context.title = category_title\n", "list_context.sub_title = _('Posts by {0}').format(blogger)\n", "list_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.\n form_dict.txt)\n", "if list_context.sub_title:\n", "list_context.title = blogger\n", "list_context.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}]\n", "list_context.parents = [{'name': _('Home'), 'route': '/'}]\n", "list_context.update(frappe.get_doc('Blog Settings', 'Blog Settings').\n as_dict(no_default_fields=True))\n", "return list_context\n" ]
[ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = 'string'\n", "self.console.info(\"\"\"\nsos-collector (version %s)\n\"\"\" % __version__)\n", "VAR_22 = self._fmt_msg(VAR_21 % self.config['tmp_dir'])\n", "self.console.info(VAR_22)\n", "VAR_23 = \"\"\"\nPress ENTER to continue, or CTRL-C to quit\n\"\"\"\n", "if not self.config['batch']:\n", "input(VAR_23)\n", "if not self.config['password']:\n", "self.log_debug('password not specified, assuming SSH keys')\n", "if self.config['password']:\n", "VAR_1 = 'string'\n", "self.log_debug('password specified, not using SSH keys')\n", "if self.config['need_sudo'] and not self.config['insecure_sudo']:\n", "self.console.info(self._fmt_msg(VAR_1))\n", "VAR_1 = 'Provide the SSH password for user %s: ' % self.config['ssh_user']\n", "if not self.config['password']:\n", "if self.config['become_root']:\n", "self.config['password'] = getpass(VAR_23=msg)\n", "self.log_debug('non-root user specified, will request sudo password')\n", "if not self.config['insecure_sudo']:\n", "if not self.config['ssh_user'] == 'root':\n", "if self.config['master']:\n", "VAR_1 = (\n 'A non-root user has been provided. Provide sudo password for %s on remote nodes: '\n % self.config['ssh_user'])\n", "self.config['sudo_pw'] = self.config['password']\n", "self.log_debug('non-root user asking to become root remotely')\n", "self.log_info(\n 'Option to become root but ssh user is root. Ignoring request to change user on node'\n )\n", "self.connect_to_master()\n", "self.master = SosNode('localhost', self.config)\n", "self.log_debug('Unable to determine local installation: %s' % err)\n", "if self.config['cluster_type']:\n", "self.config['sudo_pw'] = getpass(VAR_23=msg)\n", "VAR_1 = ('User %s will attempt to become root. Provide root password: ' %\n self.config['ssh_user'])\n", "self.config['become_root'] = False\n", "self.config['no_local'] = True\n", "self._exit('string', 1)\n", "self.config['cluster'] = self.clusters[self.config['cluster_type']]\n", "self.determine_cluster()\n", "self.config['root_password'] = getpass(VAR_23=msg)\n", "self.config['cluster'].master = self.master\n", "if self.config['cluster'] is None and not self.config['nodes']:\n", "self.config['need_sudo'] = False\n", "VAR_1 = \"\"\"Cluster type could not be determined and no nodes provided\nAborting...\"\"\"\n", "if self.config['cluster']:\n", "self._exit(VAR_1, 1)\n", "self.config['cluster'].setup()\n", "self.get_nodes()\n", "self.config['cluster'].modify_sos_cmd()\n", "self.intro()\n", "self.configure_sos_cmd()\n" ]
[ "def prep(self):...\n", "\"\"\"docstring\"\"\"\n", "disclaimer = \"\"\"This utility is used to collect sosreports from multiple nodes simultaneously. It uses the python-paramiko library to manage the SSH connections to remote systems. If this library is not acceptable for use in your environment, you should not use this utility.\n\nAn archive of sosreport tarballs collected from the nodes will be generated in %s and may be provided to an appropriate support representative.\n\nThe generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.\n\nNo configuration changes will be made to the system running this utility or remote systems that it connects to.\n\"\"\"\n", "self.console.info(\"\"\"\nsos-collector (version %s)\n\"\"\" % __version__)\n", "intro_msg = self._fmt_msg(disclaimer % self.config['tmp_dir'])\n", "self.console.info(intro_msg)\n", "prompt = \"\"\"\nPress ENTER to continue, or CTRL-C to quit\n\"\"\"\n", "if not self.config['batch']:\n", "input(prompt)\n", "if not self.config['password']:\n", "self.log_debug('password not specified, assuming SSH keys')\n", "if self.config['password']:\n", "msg = \"\"\"sos-collector ASSUMES that SSH keys are installed on all nodes unless the --password option is provided.\n\"\"\"\n", "self.log_debug('password specified, not using SSH keys')\n", "if self.config['need_sudo'] and not self.config['insecure_sudo']:\n", "self.console.info(self._fmt_msg(msg))\n", "msg = 'Provide the SSH password for user %s: ' % self.config['ssh_user']\n", "if not self.config['password']:\n", "if self.config['become_root']:\n", "self.config['password'] = getpass(prompt=msg)\n", "self.log_debug('non-root user specified, will request sudo password')\n", "if not self.config['insecure_sudo']:\n", "if not self.config['ssh_user'] == 'root':\n", "if self.config['master']:\n", "msg = (\n 'A non-root user has been provided. Provide sudo password for %s on remote nodes: '\n % self.config['ssh_user'])\n", "self.config['sudo_pw'] = self.config['password']\n", "self.log_debug('non-root user asking to become root remotely')\n", "self.log_info(\n 'Option to become root but ssh user is root. Ignoring request to change user on node'\n )\n", "self.connect_to_master()\n", "self.master = SosNode('localhost', self.config)\n", "self.log_debug('Unable to determine local installation: %s' % err)\n", "if self.config['cluster_type']:\n", "self.config['sudo_pw'] = getpass(prompt=msg)\n", "msg = ('User %s will attempt to become root. Provide root password: ' %\n self.config['ssh_user'])\n", "self.config['become_root'] = False\n", "self.config['no_local'] = True\n", "self._exit(\n \"\"\"Unable to determine local installation. Use the --no-local option if localhost should not be included.\nAborting...\n\"\"\"\n , 1)\n", "self.config['cluster'] = self.clusters[self.config['cluster_type']]\n", "self.determine_cluster()\n", "self.config['root_password'] = getpass(prompt=msg)\n", "self.config['cluster'].master = self.master\n", "if self.config['cluster'] is None and not self.config['nodes']:\n", "self.config['need_sudo'] = False\n", "msg = \"\"\"Cluster type could not be determined and no nodes provided\nAborting...\"\"\"\n", "if self.config['cluster']:\n", "self._exit(msg, 1)\n", "self.config['cluster'].setup()\n", "self.get_nodes()\n", "self.config['cluster'].modify_sos_cmd()\n", "self.intro()\n", "self.configure_sos_cmd()\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 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "Assign'", "Expr'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self):...\n", "self.client = Client()\n" ]
[ "def setUp(self):...\n", "self.client = Client()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_19(self, VAR_6):...\n", "VAR_49 = self.nodes.get(VAR_6['name'])\n", "VAR_50 = []\n", "VAR_51 = []\n", "dep_resolve(VAR_49, VAR_50, VAR_51)\n", "for VAR_49 in VAR_50:\n", "self.logger.debug(\"node name '%s' vs. comp name '%s'\" % (VAR_49.comp_name,\n VAR_6['name']))\n", "self.logger.debug(\"All dependencies satisfied, starting '%s'\" % VAR_6['name'])\n", "if VAR_49.comp_name != VAR_6['name']:\n", "VAR_52 = self.check_component(VAR_49.component)\n", "self.logger.debug('Checking and starting %s' % VAR_49.comp_name)\n", "if VAR_52 is CLASS_0.STARTED_BY_HAND or VAR_52 is CLASS_0.RUNNING:\n", "VAR_52 = self.check_component(VAR_49.component)\n", "self.logger.debug('Component %s is already running. Skipping start' % VAR_6\n ['name'])\n", "self.start_component_without_deps(VAR_6)\n", "if VAR_52 is CLASS_0.STOPPED_BUT_SUCCESSFUL or VAR_52 is CLASS_0.STARTED_BY_HAND or VAR_52 is CLASS_0.RUNNING:\n", "return True\n", "self.logger.debug(\n 'Component %s is already running, skipping to next in line' % VAR_6['name']\n )\n", "self.logger.debug(\"Start component '%s' as dependency of '%s'\" % (VAR_49.\n comp_name, VAR_6['name']))\n", "self.start_component_without_deps(VAR_49.component)\n", "VAR_62 = 0\n", "while True:\n", "self.logger.debug('Checking %s resulted in checkstate %s' % (VAR_49.\n comp_name, VAR_52))\n", "VAR_52 = self.check_component(VAR_49.component)\n", "if VAR_52 is not CLASS_0.RUNNING or VAR_52 is not CLASS_0.STOPPED_BUT_SUCCESSFUL:\n", "if VAR_62 > 100:\n", "return False\n", "VAR_62 = VAR_62 + 1\n", "sleep(0.5)\n" ]
[ "def start_component(self, comp):...\n", "node = self.nodes.get(comp['name'])\n", "res = []\n", "unres = []\n", "dep_resolve(node, res, unres)\n", "for node in res:\n", "self.logger.debug(\"node name '%s' vs. comp name '%s'\" % (node.comp_name,\n comp['name']))\n", "self.logger.debug(\"All dependencies satisfied, starting '%s'\" % comp['name'])\n", "if node.comp_name != comp['name']:\n", "state = self.check_component(node.component)\n", "self.logger.debug('Checking and starting %s' % node.comp_name)\n", "if state is CheckState.STARTED_BY_HAND or state is CheckState.RUNNING:\n", "state = self.check_component(node.component)\n", "self.logger.debug('Component %s is already running. Skipping start' % comp[\n 'name'])\n", "self.start_component_without_deps(comp)\n", "if state is CheckState.STOPPED_BUT_SUCCESSFUL or state is CheckState.STARTED_BY_HAND or state is CheckState.RUNNING:\n", "return True\n", "self.logger.debug(\n 'Component %s is already running, skipping to next in line' % comp['name'])\n", "self.logger.debug(\"Start component '%s' as dependency of '%s'\" % (node.\n comp_name, comp['name']))\n", "self.start_component_without_deps(node.component)\n", "tries = 0\n", "while True:\n", "self.logger.debug('Checking %s resulted in checkstate %s' % (node.comp_name,\n state))\n", "state = self.check_component(node.component)\n", "if state is not CheckState.RUNNING or state is not CheckState.STOPPED_BUT_SUCCESSFUL:\n", "if tries > 100:\n", "return False\n", "tries = tries + 1\n", "sleep(0.5)\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "For", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_47):...\n", "if VAR_101.user_is_admin:\n", "return True\n", "if VAR_101.user_is_loggedin:\n", "VAR_18 = Thing._by_fullname(VAR_47, data=True)\n", "abort(403, 'forbidden')\n", "VAR_109 = VAR_18.subreddit_slow\n", "if VAR_109.is_special(VAR_101.user):\n", "return True\n" ]
[ "def run(self, thing_name):...\n", "if c.user_is_admin:\n", "return True\n", "if c.user_is_loggedin:\n", "item = Thing._by_fullname(thing_name, data=True)\n", "abort(403, 'forbidden')\n", "subreddit = item.subreddit_slow\n", "if subreddit.is_special(c.user):\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Assign'", "Expr'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_15(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_52 = VAR_0.GET.copy()\n", "VAR_12 = VAR_52.get('target', None)\n", "VAR_11 = VAR_52.get('p_ids', None)\n", "VAR_72 = VAR_52.get('sep', None)\n", "if VAR_12 and VAR_11 and VAR_72:\n", "VAR_11 = [k for k in VAR_11.split(VAR_72) if k]\n", "VAR_93 = []\n", "VAR_93 = FUNC_14(VAR_11, VAR_12)\n", "return HttpResponse(json.dumps(VAR_93))\n" ]
[ "def get_prod_related_obj_json(request):...\n", "\"\"\"docstring\"\"\"\n", "data = request.GET.copy()\n", "target = data.get('target', None)\n", "p_pks = data.get('p_ids', None)\n", "sep = data.get('sep', None)\n", "if target and p_pks and sep:\n", "p_pks = [k for k in p_pks.split(sep) if k]\n", "res = []\n", "res = get_prod_related_objs(p_pks, target)\n", "return HttpResponse(json.dumps(res))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_18(self):...\n", "" ]
[ "def view_action(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_11(self, VAR_17):...\n", "\"\"\"docstring\"\"\"\n", "VAR_44 = 'confirmation', 'paging', 'events', 'formatoutput'\n", "VAR_0.error(_('Failed to setup the Dell EqualLogic driver'))\n", "for feature in VAR_44:\n", "self._eql_execute('cli-settings', feature, 'off')\n", "for line in self._eql_execute('grpparams', 'show'):\n", "if line.startswith('Group-Ipaddress:'):\n", "VAR_0.info(_('EQL-driver: Setup is complete, group IP is %s'), self._group_ip)\n", "VAR_50 = line.rstrip().partition(' ')\n", "self._group_ip = VAR_50[-1]\n" ]
[ "def do_setup(self, context):...\n", "\"\"\"docstring\"\"\"\n", "disabled_cli_features = 'confirmation', 'paging', 'events', 'formatoutput'\n", "LOG.error(_('Failed to setup the Dell EqualLogic driver'))\n", "for feature in disabled_cli_features:\n", "self._eql_execute('cli-settings', feature, 'off')\n", "for line in self._eql_execute('grpparams', 'show'):\n", "if line.startswith('Group-Ipaddress:'):\n", "LOG.info(_('EQL-driver: Setup is complete, group IP is %s'), self._group_ip)\n", "out_tup = line.rstrip().partition(' ')\n", "self._group_ip = out_tup[-1]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "For", "Expr'", "For", "Condition", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_7(self, VAR_12, VAR_13):...\n", "self._credentials[VAR_12] = VAR_13\n" ]
[ "def add_user(self, username, password):...\n", "self._credentials[username] = password\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_4(self):...\n", "return MySQLdb\n" ]
[ "def dbapiModule(self):...\n", "return MySQLdb\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ "def test_fields(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(VAR_14, VAR_15=None):...\n", "VAR_13 = '{}/getUpdates?timeout={}'.format(VAR_1, VAR_14)\n", "if VAR_15:\n", "VAR_13 += '&offset={}'.format(VAR_15)\n", "return FUNC_0(VAR_13)\n" ]
[ "def get_updates(timeout, offset=None):...\n", "url = '{}/getUpdates?timeout={}'.format(base_url, timeout)\n", "if offset:\n", "url += '&offset={}'.format(offset)\n", "return get_json_from_url(url)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "AugAssign'", "Return'" ]
[ "def FUNC_3(self):...\n", "GenericRequest._prepare(self)\n", "VAR_15, VAR_16 = tempfile.mkstemp()\n", "self.files = list(zip(self.submission_format, self.filenames)) + [('input',\n VAR_16)]\n" ]
[ "def _prepare(self):...\n", "GenericRequest._prepare(self)\n", "_, temp_filename = tempfile.mkstemp()\n", "self.files = list(zip(self.submission_format, self.filenames)) + [('input',\n temp_filename)]\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "self.objects.gt.code = 'HP'\n", "self.objects.gt.save()\n", "VAR_2, VAR_3 = create_detail_formset(self.objects.doc)\n", "VAR_4 = {'habits-TOTAL_FORMS': '2', 'habits-INITIAL_FORMS': '1',\n 'habits-MIN_NUM_FORMS': '0', 'habits-MAX_NUM_FORMS': '1000',\n 'habits-0-id': self.objects.ehp.pk, 'habits-0-product_surveyed': ''}\n", "VAR_5 = VAR_3(VAR_4, prefix='habits')\n", "self.assertFalse(VAR_5.is_valid())\n", "VAR_4 = {'habits-TOTAL_FORMS': '2', 'habits-INITIAL_FORMS': '1',\n 'habits-MIN_NUM_FORMS': '0', 'habits-MAX_NUM_FORMS': '1000',\n 'habits-0-id': self.objects.ehp.pk, 'habits-0-product_surveyed':\n 'monster trucks'}\n", "VAR_5 = VAR_3(VAR_4, prefix='habits')\n", "self.assertTrue(VAR_5.is_valid())\n" ]
[ "def test_product_surveyed_field(self):...\n", "self.objects.gt.code = 'HP'\n", "self.objects.gt.save()\n", "_, HnPFormSet = create_detail_formset(self.objects.doc)\n", "data = {'habits-TOTAL_FORMS': '2', 'habits-INITIAL_FORMS': '1',\n 'habits-MIN_NUM_FORMS': '0', 'habits-MAX_NUM_FORMS': '1000',\n 'habits-0-id': self.objects.ehp.pk, 'habits-0-product_surveyed': ''}\n", "hp_formset = HnPFormSet(data, prefix='habits')\n", "self.assertFalse(hp_formset.is_valid())\n", "data = {'habits-TOTAL_FORMS': '2', 'habits-INITIAL_FORMS': '1',\n 'habits-MIN_NUM_FORMS': '0', 'habits-MAX_NUM_FORMS': '1000',\n 'habits-0-id': self.objects.ehp.pk, 'habits-0-product_surveyed':\n 'monster trucks'}\n", "hp_formset = HnPFormSet(data, prefix='habits')\n", "self.assertTrue(hp_formset.is_valid())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = request.args.get('virkningFra', None)\n", "VAR_12 = request.args.get('virkningTil', None)\n", "VAR_13 = request.args.get('registreretFra', None)\n", "VAR_14 = request.args.get('registreretTil', None)\n", "VAR_5 = request.args.get('uuid', None)\n", "if VAR_5 is None:\n", "VAR_5 = []\n", "VAR_5 = VAR_5.split(',')\n", "VAR_15 = db.list_objects(VAR_2.__name__, VAR_5, VAR_11, VAR_12, VAR_13, VAR_14)\n", "if VAR_15 is None:\n", "VAR_15 = []\n", "return jsonify({'results': VAR_15})\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "virkning_fra = request.args.get('virkningFra', None)\n", "virkning_til = request.args.get('virkningTil', None)\n", "registreret_fra = request.args.get('registreretFra', None)\n", "registreret_til = request.args.get('registreretTil', None)\n", "uuid = request.args.get('uuid', None)\n", "if uuid is None:\n", "uuid = []\n", "uuid = uuid.split(',')\n", "results = db.list_objects(cls.__name__, uuid, virkning_fra, virkning_til,\n registreret_fra, registreret_til)\n", "if results is None:\n", "results = []\n", "return jsonify({'results': results})\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "from flask import Flask, render_template, redirect, session, url_for\n", "from database import conn, cursor\n", "VAR_0 = Flask(__name__)\n", "from views import users, message, comment, like_msg, like_cmt\n", "VAR_0.register_blueprint(users.mod)\n", "VAR_0.register_blueprint(VAR_5.mod)\n", "VAR_0.register_blueprint(comment.mod)\n", "VAR_0.register_blueprint(like_msg.mod)\n", "VAR_0.register_blueprint(like_cmt.mod)\n", "@VAR_0.route('/')...\n", "if not session.get('logged_in'):\n", "return redirect(url_for('users.login'))\n", "VAR_1 = session['logged_id']\n", "VAR_2 = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' % VAR_1\n", "cursor.execute(VAR_2)\n", "VAR_3 = cursor.fetchall()\n", "VAR_4 = list(VAR_3)\n", "for VAR_8, VAR_5 in enumerate(VAR_4):\n", "VAR_5 = list(VAR_5)\n", "return render_template('show_entries.html', entries=messages)\n", "VAR_1 = VAR_5[1]\n", "VAR_2 = 'SELECT nickname FROM users where user_id = %d' % VAR_1\n", "cursor.execute(VAR_2)\n", "VAR_6 = cursor.fetchone()\n", "VAR_5.append(VAR_6[0])\n", "VAR_2 = 'SELECT * FROM like_msg where msg_id = %d AND user_id = %d' % (VAR_5\n [0], VAR_1)\n", "cursor.execute(VAR_2)\n", "VAR_7 = cursor.fetchone()\n", "if VAR_7 is not None:\n", "VAR_9 = 1\n", "VAR_9 = 0\n", "VAR_5.append(VAR_9)\n", "VAR_4[VAR_8] = VAR_5\n" ]
[ "from flask import Flask, render_template, redirect, session, url_for\n", "from database import conn, cursor\n", "app = Flask(__name__)\n", "from views import users, message, comment, like_msg, like_cmt\n", "app.register_blueprint(users.mod)\n", "app.register_blueprint(message.mod)\n", "app.register_blueprint(comment.mod)\n", "app.register_blueprint(like_msg.mod)\n", "app.register_blueprint(like_cmt.mod)\n", "@app.route('/')...\n", "if not session.get('logged_in'):\n", "return redirect(url_for('users.login'))\n", "user_id = session['logged_id']\n", "sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' % user_id\n", "cursor.execute(sql)\n", "m = cursor.fetchall()\n", "messages = list(m)\n", "for i, message in enumerate(messages):\n", "message = list(message)\n", "return render_template('show_entries.html', entries=messages)\n", "user_id = message[1]\n", "sql = 'SELECT nickname FROM users where user_id = %d' % user_id\n", "cursor.execute(sql)\n", "u = cursor.fetchone()\n", "message.append(u[0])\n", "sql = 'SELECT * FROM like_msg where msg_id = %d AND user_id = %d' % (message\n [0], user_id)\n", "cursor.execute(sql)\n", "like = cursor.fetchone()\n", "if like is not None:\n", "like_flag = 1\n", "like_flag = 0\n", "message.append(like_flag)\n", "messages[i] = message\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "ImportFrom'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "@frappe.whitelist()...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = date.today()\n", "VAR_11 = 'string' % VAR_15.isoformat()\n", "frappe.db.sql(VAR_11, auto_commit=True)\n", "print('Unexpected error setting first listed date.')\n" ]
[ "@frappe.whitelist()...\n", "\"\"\"docstring\"\"\"\n", "date_today = date.today()\n", "sql = (\n \"\"\"\n update `tabItem` it\n set it.on_sale_from_date = '%s'\n where it.on_sale_from_date is NULL\n and it.ebay_id REGEXP '^[0-9]+$';\n \"\"\"\n % date_today.isoformat())\n", "frappe.db.sql(sql, auto_commit=True)\n", "print('Unexpected error setting first listed date.')\n" ]
[ 0, 0, 0, 4, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_51(self):...\n", "self.cursor.execute('create table t1(n int, s varchar(20))')\n", "self.cursor.execute(\"insert into t1 values (1, 'test1')\")\n", "self.cursor.execute(\"insert into t1 values (1, 'test2')\")\n", "VAR_29 = self.cursor.execute('select n, s from t1 order by s').fetchall()\n", "self.assertTrue(VAR_29[0] < VAR_29[1])\n", "self.assertTrue(VAR_29[0] <= VAR_29[1])\n", "self.assertTrue(VAR_29[1] > VAR_29[0])\n", "self.assertTrue(VAR_29[1] >= VAR_29[0])\n", "self.assertTrue(VAR_29[0] != VAR_29[1])\n", "VAR_29 = list(VAR_29)\n", "VAR_29.sort()\n" ]
[ "def test_row_gtlt(self):...\n", "self.cursor.execute('create table t1(n int, s varchar(20))')\n", "self.cursor.execute(\"insert into t1 values (1, 'test1')\")\n", "self.cursor.execute(\"insert into t1 values (1, 'test2')\")\n", "rows = self.cursor.execute('select n, s from t1 order by s').fetchall()\n", "self.assertTrue(rows[0] < rows[1])\n", "self.assertTrue(rows[0] <= rows[1])\n", "self.assertTrue(rows[1] > rows[0])\n", "self.assertTrue(rows[1] >= rows[0])\n", "self.assertTrue(rows[0] != rows[1])\n", "rows = list(rows)\n", "rows.sort()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_22(VAR_30, VAR_3):...\n", "if not isinstance(VAR_30, _IOFile):\n", "return IOFile(VAR_30, VAR_16=self)\n", "return VAR_30.apply_wildcards(VAR_3, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n" ]
[ "def concretize_iofile(f, wildcards):...\n", "if not isinstance(f, _IOFile):\n", "return IOFile(f, rule=self)\n", "return f.apply_wildcards(wildcards, fill_missing=f in self.dynamic_input,\n fail_dynamic=self.dynamic_output)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "VAR_19 = self.common.get_volume_stats(VAR_5)\n", "VAR_19['storage_protocol'] = 'iSCSI'\n", "VAR_20 = self.configuration.safe_get('volume_backend_name')\n", "VAR_19['volume_backend_name'] = VAR_20 or self.__class__.__name__\n", "self.common.client_logout()\n", "return VAR_19\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "stats = self.common.get_volume_stats(refresh)\n", "stats['storage_protocol'] = 'iSCSI'\n", "backend_name = self.configuration.safe_get('volume_backend_name')\n", "stats['volume_backend_name'] = backend_name or self.__class__.__name__\n", "self.common.client_logout()\n", "return stats\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_3(self, VAR_6, VAR_7):...\n", "self.model.reset()\n", "self.load_channels(1, 50)\n" ]
[ "def _on_view_sort(self, column, ascending):...\n", "self.model.reset()\n", "self.load_channels(1, 50)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_7, **VAR_8):...\n", "if 'user' not in VAR_8:\n", "if 'password' not in VAR_8:\n", "VAR_8['backend'] = 'IBMBackend'\n", "super().__init__(VAR_7, **kwargs)\n" ]
[ "def __init__(self, wires, **kwargs):...\n", "if 'user' not in kwargs:\n", "if 'password' not in kwargs:\n", "kwargs['backend'] = 'IBMBackend'\n", "super().__init__(wires, **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Assign'", "Expr'" ]
[ "@app.route('/api/server/devices/<name>/properties', methods=['GET'])...\n", "VAR_6 = controller.indi_server.device(VAR_5=name)\n", "return [p.to_map() for p in VAR_6.properties()]\n" ]
[ "@app.route('/api/server/devices/<name>/properties', methods=['GET'])...\n", "device = controller.indi_server.device(name=name)\n", "return [p.to_map() for p in device.properties()]\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Return'" ]
[ "import sys\n", "import logging\n", "import sqlalchemy as sa\n", "from . import filters\n", "from sqlalchemy.orm import joinedload\n", "from sqlalchemy.exc import IntegrityError\n", "from sqlalchemy import func\n", "from sqlalchemy.orm.properties import SynonymProperty\n", "from ..base import BaseInterface\n", "from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n", "from ..mixins import FileColumn, ImageColumn\n", "from ...filemanager import FileManager, ImageManager\n", "from ..._compat import as_unicode\n", "from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n", "VAR_0 = logging.getLogger(__name__)\n", "def FUNC_0(VAR_1):...\n", "for key in VAR_6.__all__:\n", "if not hasattr(VAR_1, key):\n", "\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n", "setattr(VAR_1, key, getattr(VAR_6, key))\n", "VAR_3 = None\n", "VAR_4 = VAR_6.SQLAFilterConverter\n", "def __init__(self, VAR_1, VAR_3=None):...\n", "FUNC_0(self)\n", "self.list_columns = dict()\n", "self.list_properties = dict()\n", "self.session = VAR_3\n", "for VAR_36 in sa.orm.class_mapper(VAR_1).iterate_properties:\n", "if type(VAR_36) != SynonymProperty:\n", "for VAR_14 in VAR_1.__mapper__.columns.keys():\n", "self.list_properties[VAR_36.key] = VAR_36\n", "if VAR_14 in self.list_properties:\n", "super(CLASS_0, self).__init__(VAR_1)\n", "self.list_columns[VAR_14] = VAR_1.__mapper__.columns[VAR_14]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ "import sys\n", "import logging\n", "import sqlalchemy as sa\n", "from . import filters\n", "from sqlalchemy.orm import joinedload\n", "from sqlalchemy.exc import IntegrityError\n", "from sqlalchemy import func\n", "from sqlalchemy.orm.properties import SynonymProperty\n", "from ..base import BaseInterface\n", "from ..group import GroupByDateYear, GroupByDateMonth, GroupByCol\n", "from ..mixins import FileColumn, ImageColumn\n", "from ...filemanager import FileManager, ImageManager\n", "from ..._compat import as_unicode\n", "from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRITY, LOGMSG_WAR_DBI_DEL_INTEGRITY\n", "log = logging.getLogger(__name__)\n", "def _include_filters(obj):...\n", "for key in filters.__all__:\n", "if not hasattr(obj, key):\n", "\"\"\"\n SQLAModel\n Implements SQLA support methods for views\n \"\"\"\n", "setattr(obj, key, getattr(filters, key))\n", "session = None\n", "filter_converter_class = filters.SQLAFilterConverter\n", "def __init__(self, obj, session=None):...\n", "_include_filters(self)\n", "self.list_columns = dict()\n", "self.list_properties = dict()\n", "self.session = session\n", "for prop in sa.orm.class_mapper(obj).iterate_properties:\n", "if type(prop) != SynonymProperty:\n", "for col_name in obj.__mapper__.columns.keys():\n", "self.list_properties[prop.key] = prop\n", "if col_name in self.list_properties:\n", "super(SQLAInterface, self).__init__(obj)\n", "self.list_columns[col_name] = obj.__mapper__.columns[col_name]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\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 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "For", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "For", "Condition", "For", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Docstring", "Return'" ]
[ "def FUNC_5(self, VAR_20=None, VAR_18=None, **VAR_3):...\n", "self.__execute(self.__prepare(VAR_20, VAR_18), VAR_3)\n" ]
[ "def execute(self, sql=None, filename=None, **kwargs):...\n", "self.__execute(self.__prepare(sql, filename), kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "import argparse, sys, tld\n", "import urllib.parse, os\n", "from files import config\n", "from core.colors import R, G\n", "from core.updater import updater\n", "VAR_0 = argparse.ArgumentParser('python3 xsrfprobe.py')\n", "VAR_0._action_groups.pop()\n", "VAR_1 = VAR_0.add_argument_group('Required Arguments')\n", "VAR_2 = VAR_0.add_argument_group('Optional Arguments')\n", "VAR_1.add_argument('-u', '--url', help='Main URL to test', dest='url')\n", "VAR_2.add_argument('-c', '--cookie', help=\n 'Cookie value to be requested with each successive request. If there are multiple cookies, separate them with commas. For example: `-c PHPSESSID=i837c5n83u4, _gid=jdhfbuysf`.'\n , dest='cookie')\n", "VAR_2.add_argument('-o', '--output', help=\n 'Output directory where files to be stored. Default is the`files` folder where all files generated will be stored.'\n , dest='output')\n", "VAR_2.add_argument('-d', '--delay', help=\n 'Time delay between requests in seconds. Default is zero.', dest=\n 'delay', type=float)\n", "VAR_2.add_argument('-q', '--quiet', help=\n 'Set the DEBUG mode to quiet. Report only when vulnerabilities are found. Minimal output will be printed on screen. '\n , dest='quiet', action='store_true')\n", "VAR_2.add_argument('-v', '--verbose', help=\n 'Increase the verbosity of the output (e.g., -vv is more than -v). ',\n dest='verbose', action='store_true')\n", "VAR_2.add_argument('--user-agent', help=\n 'Custom user-agent to be used. Only one user-agent can be specified.',\n dest='user_agent', type=str)\n", "VAR_2.add_argument('--headers', help=\n 'Comma separated list of custom headers you\\'d want to use. For example: ``--headers \"Accept=text/php, X-Requested-With=Dumb\"``.'\n , dest='headers', type=str)\n", "VAR_2.add_argument('--exclude', help=\n \"Comma separated list of paths or directories to be excluded which are not in scope. These paths/dirs won't be scanned. For example: `--exclude somepage/, sensitive-dir/, pleasedontscan/`\"\n , dest='exclude', type=str)\n", "VAR_2.add_argument('--timeout', help=\n 'HTTP request timeout value in seconds. The entered value must be in floating point decimal. Example: ``--timeout 10.0``'\n , dest='timeout', type=float)\n", "VAR_2.add_argument('--max-chars', help=\n 'Maximum allowed character length for the custom token value to be generated. For example: `--max-chars 5`. Default value is 6.'\n , dest='maxchars', type=int)\n", "VAR_2.add_argument('--crawl', help=\n 'Crawl the whole site and simultaneously test all discovered endpoints for CSRF.'\n , dest='crawl', action='store_true')\n", "VAR_2.add_argument('--skip-analysis', help=\n 'Skip the Post-Scan Analysis of Tokens which were gathered during requests'\n , dest='skipal', action='store_true')\n", "VAR_2.add_argument('--skip-poc', help=\n 'Skip the PoC Form Generation of POST-Based Cross Site Request Forgeries.',\n dest='skippoc', action='store_true')\n", "VAR_2.add_argument('--update', help=\n 'Update XSRFProbe to latest version on GitHub via git.', dest='update',\n action='store_true')\n", "VAR_2.add_argument('--random-agent', help=\n 'Use random user-agents for making requests.', dest='randagent', action\n ='store_true')\n", "VAR_2.add_argument('--version', help=\n 'Display the version of XSRFProbe and exit.', dest='version', action=\n 'store_true')\n", "VAR_3 = VAR_0.parse_args()\n", "if not len(sys.argv) > 1:\n", "print(\n \"\"\"\n \u001b[1;91mXSRFProbe\u001b[0m, \u001b[1;97mA \u001b[1;93mCross Site Request Forgery \u001b[1;97mAudit Toolkit\u001b[0m\n\"\"\"\n )\n", "if VAR_3.update:\n", "VAR_0.print_help()\n", "updater()\n", "if VAR_3.version:\n", "quit('')\n", "quit('')\n", "print(\"\"\"\n\u001b[1;97m [+] \u001b[1;91mXSRFProbe Version\u001b[0m : \u001b[1;97m\"\"\" + open(\n 'files/VersionNum').read())\n", "if VAR_3.maxchars:\n", "quit()\n", "VAR_6.TOKEN_GENERATION_LENGTH = VAR_3.maxchars\n", "if VAR_3.user_agent:\n", "VAR_6.USER_AGENT = VAR_3.user_agent\n", "if VAR_3.skipal:\n", "VAR_6.SCAN_ANALYSIS = False\n", "if VAR_3.skippoc:\n", "VAR_6.POC_GENERATION = False\n", "if not VAR_3.version and not VAR_3.update:\n", "if VAR_3.url:\n", "if VAR_3.crawl:\n", "if 'http' in VAR_3.url:\n", "print(R + 'You must supply a url/endpoint.')\n", "VAR_6.CRAWL_SITE = True\n", "if VAR_3.cookie:\n", "VAR_6.SITE_URL = VAR_3.url\n", "VAR_6.SITE_URL = 'http://' + VAR_3.url\n", "if ',' in VAR_3.cookie:\n", "if VAR_3.timeout:\n", "for cook in VAR_3.cookie.split(','):\n", "VAR_6.TIMEOUT_VALUE = VAR_3.timeout\n", "if VAR_3.headers:\n", "VAR_6.COOKIE_VALUE.append(cook.strip())\n", "for VAR_5 in VAR_3.headers.split(','):\n", "if VAR_3.exclude:\n", "VAR_6.USER_AGENT_RANDOM = False\n", "VAR_6.HEADER_VALUES[VAR_5.split('=')[0]] = VAR_5.split('=')[1]\n", "VAR_4 = VAR_3.exclude\n", "if VAR_3.randagent:\n", "VAR_5 = VAR_4.split(',').strip()\n", "VAR_6.USER_AGENT_RANDOM = True\n", "if VAR_6.SITE_URL:\n", "for s in VAR_5:\n", "VAR_6.USER_AGENT = ''\n", "if VAR_3.output:\n", "if VAR_3.quiet:\n", "VAR_6.EXCLUDE_DIRS.append(urllib.parse.urljoin(VAR_6.SITE_URL, s))\n", "if not os.path.exists(VAR_3.output + tld.get_fld(VAR_6.SITE_URL)):\n", "VAR_6.OUTPUT_DIR = VAR_3.output + tld.get_fld(VAR_6.SITE_URL) + '/'\n", "os.makedirs(tld.get_fld(VAR_6.SITE_URL))\n", "VAR_6.OUTPUT_DIR = tld.get_fld(VAR_6.SITE_URL) + '/'\n", "VAR_6.DEBUG = False\n", "os.makedirs(VAR_3.output + tld.get_fld(VAR_6.SITE_URL))\n" ]
[ "import argparse, sys, tld\n", "import urllib.parse, os\n", "from files import config\n", "from core.colors import R, G\n", "from core.updater import updater\n", "parser = argparse.ArgumentParser('python3 xsrfprobe.py')\n", "parser._action_groups.pop()\n", "required = parser.add_argument_group('Required Arguments')\n", "optional = parser.add_argument_group('Optional Arguments')\n", "required.add_argument('-u', '--url', help='Main URL to test', dest='url')\n", "optional.add_argument('-c', '--cookie', help=\n 'Cookie value to be requested with each successive request. If there are multiple cookies, separate them with commas. For example: `-c PHPSESSID=i837c5n83u4, _gid=jdhfbuysf`.'\n , dest='cookie')\n", "optional.add_argument('-o', '--output', help=\n 'Output directory where files to be stored. Default is the`files` folder where all files generated will be stored.'\n , dest='output')\n", "optional.add_argument('-d', '--delay', help=\n 'Time delay between requests in seconds. Default is zero.', dest=\n 'delay', type=float)\n", "optional.add_argument('-q', '--quiet', help=\n 'Set the DEBUG mode to quiet. Report only when vulnerabilities are found. Minimal output will be printed on screen. '\n , dest='quiet', action='store_true')\n", "optional.add_argument('-v', '--verbose', help=\n 'Increase the verbosity of the output (e.g., -vv is more than -v). ',\n dest='verbose', action='store_true')\n", "optional.add_argument('--user-agent', help=\n 'Custom user-agent to be used. Only one user-agent can be specified.',\n dest='user_agent', type=str)\n", "optional.add_argument('--headers', help=\n 'Comma separated list of custom headers you\\'d want to use. For example: ``--headers \"Accept=text/php, X-Requested-With=Dumb\"``.'\n , dest='headers', type=str)\n", "optional.add_argument('--exclude', help=\n \"Comma separated list of paths or directories to be excluded which are not in scope. These paths/dirs won't be scanned. For example: `--exclude somepage/, sensitive-dir/, pleasedontscan/`\"\n , dest='exclude', type=str)\n", "optional.add_argument('--timeout', help=\n 'HTTP request timeout value in seconds. The entered value must be in floating point decimal. Example: ``--timeout 10.0``'\n , dest='timeout', type=float)\n", "optional.add_argument('--max-chars', help=\n 'Maximum allowed character length for the custom token value to be generated. For example: `--max-chars 5`. Default value is 6.'\n , dest='maxchars', type=int)\n", "optional.add_argument('--crawl', help=\n 'Crawl the whole site and simultaneously test all discovered endpoints for CSRF.'\n , dest='crawl', action='store_true')\n", "optional.add_argument('--skip-analysis', help=\n 'Skip the Post-Scan Analysis of Tokens which were gathered during requests'\n , dest='skipal', action='store_true')\n", "optional.add_argument('--skip-poc', help=\n 'Skip the PoC Form Generation of POST-Based Cross Site Request Forgeries.',\n dest='skippoc', action='store_true')\n", "optional.add_argument('--update', help=\n 'Update XSRFProbe to latest version on GitHub via git.', dest='update',\n action='store_true')\n", "optional.add_argument('--random-agent', help=\n 'Use random user-agents for making requests.', dest='randagent', action\n ='store_true')\n", "optional.add_argument('--version', help=\n 'Display the version of XSRFProbe and exit.', dest='version', action=\n 'store_true')\n", "args = parser.parse_args()\n", "if not len(sys.argv) > 1:\n", "print(\n \"\"\"\n \u001b[1;91mXSRFProbe\u001b[0m, \u001b[1;97mA \u001b[1;93mCross Site Request Forgery \u001b[1;97mAudit Toolkit\u001b[0m\n\"\"\"\n )\n", "if args.update:\n", "parser.print_help()\n", "updater()\n", "if args.version:\n", "quit('')\n", "quit('')\n", "print(\"\"\"\n\u001b[1;97m [+] \u001b[1;91mXSRFProbe Version\u001b[0m : \u001b[1;97m\"\"\" + open(\n 'files/VersionNum').read())\n", "if args.maxchars:\n", "quit()\n", "config.TOKEN_GENERATION_LENGTH = args.maxchars\n", "if args.user_agent:\n", "config.USER_AGENT = args.user_agent\n", "if args.skipal:\n", "config.SCAN_ANALYSIS = False\n", "if args.skippoc:\n", "config.POC_GENERATION = False\n", "if not args.version and not args.update:\n", "if args.url:\n", "if args.crawl:\n", "if 'http' in args.url:\n", "print(R + 'You must supply a url/endpoint.')\n", "config.CRAWL_SITE = True\n", "if args.cookie:\n", "config.SITE_URL = args.url\n", "config.SITE_URL = 'http://' + args.url\n", "if ',' in args.cookie:\n", "if args.timeout:\n", "for cook in args.cookie.split(','):\n", "config.TIMEOUT_VALUE = args.timeout\n", "if args.headers:\n", "config.COOKIE_VALUE.append(cook.strip())\n", "for m in args.headers.split(','):\n", "if args.exclude:\n", "config.USER_AGENT_RANDOM = False\n", "config.HEADER_VALUES[m.split('=')[0]] = m.split('=')[1]\n", "exc = args.exclude\n", "if args.randagent:\n", "m = exc.split(',').strip()\n", "config.USER_AGENT_RANDOM = True\n", "if config.SITE_URL:\n", "for s in m:\n", "config.USER_AGENT = ''\n", "if args.output:\n", "if args.quiet:\n", "config.EXCLUDE_DIRS.append(urllib.parse.urljoin(config.SITE_URL, s))\n", "if not os.path.exists(args.output + tld.get_fld(config.SITE_URL)):\n", "config.OUTPUT_DIR = args.output + tld.get_fld(config.SITE_URL) + '/'\n", "os.makedirs(tld.get_fld(config.SITE_URL))\n", "config.OUTPUT_DIR = tld.get_fld(config.SITE_URL) + '/'\n", "config.DEBUG = False\n", "os.makedirs(args.output + tld.get_fld(config.SITE_URL))\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, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "For", "Assign'", "Condition", "Expr'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "For", "Assign'", "Condition", "Condition", "Expr'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute('string' + VAR_1 + \"';\")\n" ]
[ "def query_signed_intromember(member):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute(\n \"\"\"\n SELECT DISTINCT packet.freshman_username AS username, signature_fresh.signed AS signed FROM packet \n INNER JOIN signature_fresh ON packet.id = signature_fresh.packet_id \n WHERE signature_fresh.freshman_username = '\"\"\"\n + member + \"';\")\n" ]
[ 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "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_15(VAR_38):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_38:\n", "return None\n", "if isinstance(VAR_38, basestring):\n", "for d in self.doc_types:\n", "if not any(d['name'] == VAR_38['name'] for d in VAR_27):\n", "if d['name'] == VAR_38:\n", "VAR_38 = VAR_38.copy()\n", "return VAR_38['name']\n", "VAR_38 = d\n", "VAR_38['example'] = json.dumps(VAR_38['example'], sort_keys=True,\n separators=(', ', ': '), indent=2)\n", "VAR_27.append(VAR_38)\n" ]
[ "def add_doc_type(tp):...\n", "\"\"\"docstring\"\"\"\n", "if not tp:\n", "return None\n", "if isinstance(tp, basestring):\n", "for d in self.doc_types:\n", "if not any(d['name'] == tp['name'] for d in doc_types):\n", "if d['name'] == tp:\n", "tp = tp.copy()\n", "return tp['name']\n", "tp = d\n", "tp['example'] = json.dumps(tp['example'], sort_keys=True, separators=(', ',\n ': '), indent=2)\n", "doc_types.append(tp)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "For", "For", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(self):...\n", "if not VAR_101.user_is_sponsor:\n", "abort(403, 'forbidden')\n" ]
[ "def run(self):...\n", "if not c.user_is_sponsor:\n", "abort(403, 'forbidden')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'" ]
[ "def FUNC_0():...\n", "if 'DATABASE_URL' in os.environ and os.environ['DATABASE_URL']:\n", "urllib.parse.uses_netloc.append('postgres')\n", "VAR_12 = psycopg2.connect(database='expenses')\n", "VAR_18 = urllib.parse.urlparse(os.environ['DATABASE_URL'])\n", "return VAR_12\n", "VAR_12 = psycopg2.connect(database=url.path[1:], user=url.username,\n password=url.password, host=url.hostname, port=url.port)\n", "return VAR_12\n" ]
[ "def check_heroku_db():...\n", "if 'DATABASE_URL' in os.environ and os.environ['DATABASE_URL']:\n", "urllib.parse.uses_netloc.append('postgres')\n", "conn = psycopg2.connect(database='expenses')\n", "url = urllib.parse.urlparse(os.environ['DATABASE_URL'])\n", "return conn\n", "conn = psycopg2.connect(database=url.path[1:], user=url.username, password=\n url.password, host=url.hostname, port=url.port)\n", "return conn\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "Return'", "Assign'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._webui_url\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._webui_url\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def __init__(self, VAR_1, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "super(CLASS_0, self).__init__(VAR_1, VAR_4)\n", "VAR_1 = self.bindings\n", "VAR_1['TEST_APP_COMPONENT_NAME'] = '{app}-{stack}-{detail}'.format(app=\n bindings['TEST_APP'], stack=bindings['TEST_STACK'], detail=bindings[\n 'TEST_COMPONENT_DETAIL'])\n", "self.TEST_APP = VAR_1['TEST_APP']\n" ]
[ "def __init__(self, bindings, agent=None):...\n", "\"\"\"docstring\"\"\"\n", "super(GoogleSmokeTestScenario, self).__init__(bindings, agent)\n", "bindings = self.bindings\n", "bindings['TEST_APP_COMPONENT_NAME'] = '{app}-{stack}-{detail}'.format(app=\n bindings['TEST_APP'], stack=bindings['TEST_STACK'], detail=bindings[\n 'TEST_COMPONENT_DETAIL'])\n", "self.TEST_APP = bindings['TEST_APP']\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_1(VAR_0, VAR_2, VAR_3, VAR_4, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = False\n", "VAR_18 = sql.connect('./resources/users.db')\n", "VAR_20 = 'string'\n", "VAR_21 = VAR_18.cursor()\n", "print(''.join(traceback.format_exception(etype=type(e), value=e, tb=e.\n __traceback__)))\n", "VAR_18.close()\n", "VAR_21.execute(VAR_20, (new_bio, new_password))\n", "VAR_18.rollback()\n", "return VAR_24\n", "VAR_18.commit()\n", "VAR_24 = False\n", "VAR_24 = True\n" ]
[ "def add_user(username, firstname, lastname, bio, password):...\n", "\"\"\"docstring\"\"\"\n", "added = False\n", "con = sql.connect('./resources/users.db')\n", "cmd = \"\"\"INSERT INTO users (username, firstname, lastname, bio, password)\n VALUES (?, ?, ?, ?, ?);\n \"\"\"\n", "cur = con.cursor()\n", "print(''.join(traceback.format_exception(etype=type(e), value=e, tb=e.\n __traceback__)))\n", "con.close()\n", "cur.execute(cmd, (new_bio, new_password))\n", "con.rollback()\n", "return added\n", "con.commit()\n", "added = False\n", "added = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_12(self, VAR_9):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "VAR_20 = self.send_cmd('list_repo_issues{} {}'.format(self.insecure_mode,\n VAR_9))\n", "return\n", "print(VAR_20)\n" ]
[ "def do_list_repo_issues(self, line):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "response = self.send_cmd('list_repo_issues{} {}'.format(self.insecure_mode,\n line))\n", "return\n", "print(response)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "@VAR_0.route('/getSession')...\n", "if 'username' in VAR_19:\n", "return VAR_19['user']\n", "return 'No Session avalibale!'\n" ]
[ "@app.route('/getSession')...\n", "if 'username' in session:\n", "return session['user']\n", "return 'No Session avalibale!'\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "@login_required...\n", "\"\"\"docstring\"\"\"\n", "return render_to_response('student_account/account_settings.html', FUNC_11(\n VAR_3))\n" ]
[ "@login_required...\n", "\"\"\"docstring\"\"\"\n", "return render_to_response('student_account/account_settings.html',\n account_settings_context(request))\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_1():...\n", "VAR_4 = VAR_6.get('modtokens', [])\n", "VAR_5 = None\n", "if len(VAR_4) < 100:\n", "VAR_5 = hashlib.sha1(str(random.random())).hexdigest()\n", "VAR_5 = VAR_4[-1]\n", "VAR_4.append(VAR_5)\n", "VAR_6['modtokens'] = VAR_4\n", "VAR_6.save()\n", "return VAR_5\n" ]
[ "def make_token():...\n", "tokens = session.get('modtokens', [])\n", "token = None\n", "if len(tokens) < 100:\n", "token = hashlib.sha1(str(random.random())).hexdigest()\n", "token = tokens[-1]\n", "tokens.append(token)\n", "session['modtokens'] = tokens\n", "session.save()\n", "return token\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_7(*VAR_15, **VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_0(VAR_1, *VAR_15, **kwargs)\n" ]
[ "def new_object(*args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "return cls(name, *args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "import base64\n", "import collections\n", "import datetime\n", "import hmac\n", "import json\n", "import os\n", "import re\n", "import subprocess\n", "import time\n", "import psycopg2\n", "import requests\n", "import unidiff\n", "import yaml\n", "from flask import abort\n", "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "if os.environ.get('OVER_HEROKU', False) is not False:\n", "VAR_30 = (\"INSERT INTO Users (repository, created_at) VALUES ('{}', now());\"\n .format(VAR_0))\n", "def FUNC_1(VAR_1):...\n", "cursor.execute(VAR_30)\n", "conn.rollback()\n", "\"\"\"docstring\"\"\"\n", "conn.commit()\n", "VAR_8 = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN'],\n 'Content-Length': '0'}\n", "VAR_9 = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n", "VAR_10 = 'https://api.github.com/user/following/{}'\n", "VAR_10 = VAR_10.format(VAR_1)\n", "VAR_11 = requests.put(VAR_10, VAR_8=headers, VAR_9=auth)\n", "def FUNC_2(VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_61, value in VAR_3.items():\n", "if isinstance(VAR_2, collections.Mapping):\n", "return VAR_2\n", "if isinstance(value, collections.Mapping):\n", "VAR_2 = {VAR_61: VAR_3[VAR_61]}\n", "VAR_2[VAR_61] = FUNC_2(VAR_2.get(VAR_61, {}), value)\n", "VAR_2[VAR_61] = VAR_3[VAR_61]\n" ]
[ "import base64\n", "import collections\n", "import datetime\n", "import hmac\n", "import json\n", "import os\n", "import re\n", "import subprocess\n", "import time\n", "import psycopg2\n", "import requests\n", "import unidiff\n", "import yaml\n", "from flask import abort\n", "def update_users(repository):...\n", "\"\"\"docstring\"\"\"\n", "if os.environ.get('OVER_HEROKU', False) is not False:\n", "query = (\"INSERT INTO Users (repository, created_at) VALUES ('{}', now());\"\n .format(repository))\n", "def follow_user(user):...\n", "cursor.execute(query)\n", "conn.rollback()\n", "\"\"\"docstring\"\"\"\n", "conn.commit()\n", "headers = {'Authorization': 'token ' + os.environ['GITHUB_TOKEN'],\n 'Content-Length': '0'}\n", "auth = os.environ['BOT_USERNAME'], os.environ['BOT_PASSWORD']\n", "url = 'https://api.github.com/user/following/{}'\n", "url = url.format(user)\n", "r = requests.put(url, headers=headers, auth=auth)\n", "def update_dict(base, head):...\n", "\"\"\"docstring\"\"\"\n", "for key, value in head.items():\n", "if isinstance(base, collections.Mapping):\n", "return base\n", "if isinstance(value, collections.Mapping):\n", "base = {key: head[key]}\n", "base[key] = update_dict(base.get(key, {}), value)\n", "base[key] = head[key]\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 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "FunctionDef'", "Docstring", "Condition", "Assign'", "FunctionDef'", "Expr'", "Expr'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "For", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self, VAR_7):...\n", "VAR_25 = ''\n", "VAR_26 = '%s> ' % self.configuration.eqlx_group_name\n", "while not VAR_25.endswith(VAR_26):\n", "VAR_25 += VAR_7.recv(102400)\n", "VAR_0.debug(_('CLI output\\n%s'), VAR_25)\n", "return VAR_25.splitlines()\n" ]
[ "def _get_output(self, chan):...\n", "out = ''\n", "ending = '%s> ' % self.configuration.eqlx_group_name\n", "while not out.endswith(ending):\n", "out += chan.recv(102400)\n", "LOG.debug(_('CLI output\\n%s'), out)\n", "return out.splitlines()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "AugAssign'", "Expr'", "Return'" ]
[ "def FUNC_17(self):...\n", "VAR_7 = Pa11yCrawler('')\n", "VAR_7.generate_html_reports()\n", "self._mock_sh.assert_has_calls([call(\n 'pa11ycrawler json-to-html --pa11ycrawler-reports-dir={}'.format(VAR_7.\n pa11y_report_dir))])\n" ]
[ "def test_generate_html_reports(self):...\n", "suite = Pa11yCrawler('')\n", "suite.generate_html_reports()\n", "self._mock_sh.assert_has_calls([call(\n 'pa11ycrawler json-to-html --pa11ycrawler-reports-dir={}'.format(suite.\n pa11y_report_dir))])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_12():...\n", "\"\"\"docstring\"\"\"\n", "VAR_39 = VAR_40.environ.get('CUDA_VISIBLE_DEVICES', None)\n", "if VAR_39 is None:\n", "return None\n", "if VAR_39 == '':\n", "return []\n", "return [int(i) for i in VAR_39.split(',')]\n" ]
[ "def get_cuda_visible_devices():...\n", "\"\"\"docstring\"\"\"\n", "gpu_ids_str = os.environ.get('CUDA_VISIBLE_DEVICES', None)\n", "if gpu_ids_str is None:\n", "return None\n", "if gpu_ids_str == '':\n", "return []\n", "return [int(i) for i in gpu_ids_str.split(',')]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(VAR_0, VAR_3):...\n", "VAR_4 = VAR_0.cursor()\n", "VAR_5 = 'ALTER TABLE Presets DROP COLUMN id;'\n", "VAR_4.execute(VAR_5)\n", "VAR_5 = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "VAR_4.execute(VAR_5)\n", "VAR_6 = Table('Presets')\n", "VAR_7 = MySQLQuery.from_(VAR_6).select(VAR_6.description).where(VAR_6.id ==\n VAR_3)\n", "print(VAR_7)\n", "VAR_5 = str(VAR_7)\n", "VAR_4.execute(VAR_5)\n", "VAR_8 = VAR_4.fetchone()\n", "VAR_9 = str(VAR_8)\n", "return VAR_9[2:-3]\n" ]
[ "def get_descriptin(conn, key):...\n", "cursor = conn.cursor()\n", "quer = 'ALTER TABLE Presets DROP COLUMN id;'\n", "cursor.execute(quer)\n", "quer = (\n 'ALTER TABLE Presets ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY NOT NULL FIRST;'\n )\n", "cursor.execute(quer)\n", "extable = Table('Presets')\n", "q = MySQLQuery.from_(extable).select(extable.description).where(extable.id ==\n key)\n", "print(q)\n", "quer = str(q)\n", "cursor.execute(quer)\n", "row = cursor.fetchone()\n", "strrow = str(row)\n", "return strrow[2:-3]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_30(self):...\n", "VAR_0 = [SleepCheck(1), SleepCheck(1), SleepCheck(1),\n KeyboardInterruptCheck(phase='setup')]\n", "self._run_checks(VAR_0, 2)\n" ]
[ "def test_kbd_interrupt_in_setup_with_limited_concurrency(self):...\n", "checks = [SleepCheck(1), SleepCheck(1), SleepCheck(1),\n KeyboardInterruptCheck(phase='setup')]\n", "self._run_checks(checks, 2)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_3(self, VAR_3, VAR_6, VAR_7):...\n", "VAR_14 = 0\n", "VAR_15 = 1\n", "VAR_16 = 2\n", "VAR_17 = 3\n", "VAR_18 = 4\n", "VAR_8 = \"SELECT * FROM ranks WHERE scene = '{}' AND date='{}';\".format(str(\n VAR_3), VAR_7)\n", "VAR_11 = self.db.exec(VAR_8)\n", "if len(VAR_11) > 0:\n", "VAR_0.info('We have already calculated ranks for {} on date {}. SKipping'.\n format(VAR_3, VAR_7))\n", "VAR_19 = bracket_utils.get_matches_from_urls(self.db, VAR_6)\n", "return\n", "VAR_0.info('About to start processing ranks for scene {} on {}'.format(\n VAR_3, VAR_7))\n", "VAR_20 = {}\n", "for match in VAR_19:\n", "VAR_32 = match[VAR_14]\n", "VAR_21 = get_ranks(VAR_20)\n", "VAR_33 = match[VAR_15]\n", "VAR_22 = {}\n", "VAR_34 = match[VAR_16]\n", "for i, x in enumerate(VAR_21):\n", "VAR_35 = match[VAR_17]\n", "VAR_36, VAR_26 = x\n", "player_web.update_ranks(VAR_22)\n", "if VAR_32 not in VAR_20:\n", "VAR_37 = len(VAR_21) - i\n", "VAR_20[VAR_32] = {}\n", "if VAR_33 not in VAR_20[VAR_32]:\n", "VAR_8 = (\n \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{}', '{}', '{}', '{}', '{}');\"\n .format(str(VAR_3), str(VAR_26), int(VAR_37), str(VAR_36), str(VAR_7)))\n", "VAR_20[VAR_32][VAR_33] = []\n", "VAR_20[VAR_32][VAR_33].append((VAR_35, VAR_34 == VAR_32))\n", "self.db.exec(VAR_8)\n", "if VAR_33 not in VAR_20:\n", "VAR_8 = \"SELECT scene FROM players WHERE tag='{}';\".format(VAR_26)\n", "VAR_20[VAR_33] = {}\n", "if VAR_32 not in VAR_20[VAR_33]:\n", "VAR_11 = self.db.exec(VAR_8)\n", "VAR_20[VAR_33][VAR_32] = []\n", "VAR_20[VAR_33][VAR_32].append((VAR_35, VAR_34 == VAR_33))\n", "if len(VAR_11) == 0 or VAR_11[0][0] == VAR_3:\n", "VAR_41 = {'rank': VAR_37, 'total_ranked': len(VAR_21)}\n", "VAR_22[VAR_26] = VAR_41\n" ]
[ "def process_ranks(self, scene, urls, recent_date):...\n", "PLAYER1 = 0\n", "PLAYER2 = 1\n", "WINNER = 2\n", "DATE = 3\n", "SCENE = 4\n", "sql = \"SELECT * FROM ranks WHERE scene = '{}' AND date='{}';\".format(str(\n scene), recent_date)\n", "res = self.db.exec(sql)\n", "if len(res) > 0:\n", "LOG.info('We have already calculated ranks for {} on date {}. SKipping'.\n format(scene, recent_date))\n", "matches = bracket_utils.get_matches_from_urls(self.db, urls)\n", "return\n", "LOG.info('About to start processing ranks for scene {} on {}'.format(scene,\n recent_date))\n", "win_loss_dict = {}\n", "for match in matches:\n", "p1 = match[PLAYER1]\n", "ranks = get_ranks(win_loss_dict)\n", "p2 = match[PLAYER2]\n", "tag_rank_map = {}\n", "winner = match[WINNER]\n", "for i, x in enumerate(ranks):\n", "date = match[DATE]\n", "points, player = x\n", "player_web.update_ranks(tag_rank_map)\n", "if p1 not in win_loss_dict:\n", "rank = len(ranks) - i\n", "win_loss_dict[p1] = {}\n", "if p2 not in win_loss_dict[p1]:\n", "sql = (\n \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{}', '{}', '{}', '{}', '{}');\"\n .format(str(scene), str(player), int(rank), str(points), str(recent_date)))\n", "win_loss_dict[p1][p2] = []\n", "win_loss_dict[p1][p2].append((date, winner == p1))\n", "self.db.exec(sql)\n", "if p2 not in win_loss_dict:\n", "sql = \"SELECT scene FROM players WHERE tag='{}';\".format(player)\n", "win_loss_dict[p2] = {}\n", "if p1 not in win_loss_dict[p2]:\n", "res = self.db.exec(sql)\n", "win_loss_dict[p2][p1] = []\n", "win_loss_dict[p2][p1].append((date, winner == p2))\n", "if len(res) == 0 or res[0][0] == scene:\n", "map = {'rank': rank, 'total_ranked': len(ranks)}\n", "tag_rank_map[player] = map\n" ]
[ 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, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'" ]
[ "\"\"\"string\"\"\"\n", "import cookielib\n", "import logging\n", "import os\n", "import re\n", "import signal\n", "import socket\n", "import subprocess\n", "import tempfile\n", "import time\n", "import sys\n", "import urllib\n", "import urllib2\n", "VAR_0 = os.path.dirname(os.path.abspath(__file__))\n", "VAR_1 = None\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1:\n", "return\n", "VAR_3 = VAR_0\n", "while True:\n", "if os.path.isfile(os.path.join(VAR_3, 'google_appengine', 'VERSION')):\n", "VAR_14 = os.path.dirname(VAR_3)\n", "VAR_1 = os.path.realpath(os.path.join(VAR_3, 'google_appengine'))\n", "if VAR_14 == VAR_3:\n", "VAR_4 = os.path.realpath(os.path.join(VAR_1, 'lib'))\n", "VAR_3 = VAR_14\n", "sys.path.insert(0, os.path.realpath(os.path.join(VAR_4, 'yaml', 'lib')))\n", "def FUNC_1(VAR_2):...\n", "VAR_5 = socket.socket()\n", "return VAR_5.connect_ex(('127.0.0.1', VAR_2)) == 0\n", "VAR_5.close()\n", "def FUNC_2():...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = 8080\n", "VAR_6 = 2 << 16\n", "while FUNC_1(VAR_2) and VAR_2 < VAR_6:\n", "VAR_2 += 1\n", "if VAR_2 == VAR_6:\n", "return VAR_2\n" ]
[ "\"\"\"Setups a local GAE instance to test against a live server for integration\ntests.\n\nIt makes sure Google AppEngine SDK is found and starts the server on a free\ninbound TCP port.\n\"\"\"\n", "import cookielib\n", "import logging\n", "import os\n", "import re\n", "import signal\n", "import socket\n", "import subprocess\n", "import tempfile\n", "import time\n", "import sys\n", "import urllib\n", "import urllib2\n", "BASE_DIR = os.path.dirname(os.path.abspath(__file__))\n", "GAE_SDK = None\n", "def _load_modules():...\n", "\"\"\"docstring\"\"\"\n", "if GAE_SDK:\n", "return\n", "root_dir = BASE_DIR\n", "while True:\n", "if os.path.isfile(os.path.join(root_dir, 'google_appengine', 'VERSION')):\n", "next_root = os.path.dirname(root_dir)\n", "GAE_SDK = os.path.realpath(os.path.join(root_dir, 'google_appengine'))\n", "if next_root == root_dir:\n", "gae_sdk_lib = os.path.realpath(os.path.join(GAE_SDK, 'lib'))\n", "root_dir = next_root\n", "sys.path.insert(0, os.path.realpath(os.path.join(gae_sdk_lib, 'yaml', 'lib')))\n", "def test_port(port):...\n", "s = socket.socket()\n", "return s.connect_ex(('127.0.0.1', port)) == 0\n", "s.close()\n", "def find_free_port():...\n", "\"\"\"docstring\"\"\"\n", "port = 8080\n", "max_val = 2 << 16\n", "while test_port(port) and port < max_val:\n", "port += 1\n", "if port == max_val:\n", "return port\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, 5, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Return'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "AugAssign'", "Condition", "Return'" ]
[ "def FUNC_3(VAR_2):...\n", "if not VAR_2:\n", "return []\n", "VAR_9 = []\n", "VAR_10 = frappe.db.get_value('Department', {'name': VAR_2}, ['lft', 'rgt'],\n as_dict=True)\n", "VAR_11 = frappe.db.sql(\n \"\"\"select name from `tabDepartment`\n\t\twhere lft >= %s and rgt <= %s order by lft desc\n\t\t\"\"\"\n , (VAR_10.lft, VAR_10.rgt), as_list=True)\n", "for d in VAR_11:\n", "VAR_9.extend([l.leave_approver for l in frappe.db.sql('string', d, as_dict=\n True)])\n", "return VAR_9\n" ]
[ "def get_approvers(department):...\n", "if not department:\n", "return []\n", "approvers = []\n", "department_details = frappe.db.get_value('Department', {'name': department},\n ['lft', 'rgt'], as_dict=True)\n", "department_list = frappe.db.sql(\n \"\"\"select name from `tabDepartment`\n\t\twhere lft >= %s and rgt <= %s order by lft desc\n\t\t\"\"\"\n , (department_details.lft, department_details.rgt), as_list=True)\n", "for d in department_list:\n", "approvers.extend([l.leave_approver for l in frappe.db.sql(\n \"select approver from `tabDepartment Approver` \\t\\t\\twhere parent = %s and parentfield = 'leave_approvers'\"\n , d, as_dict=True)])\n", "return approvers\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_15 = '/usr/bin/tmsh save sys config'\n", "VAR_16 = shellutil.run(VAR_15)\n", "if VAR_16 != 0:\n", "logger.error('WARNING: Cannot save sys config on 1st boot.')\n", "return VAR_16\n" ]
[ "def _save_sys_config(self):...\n", "cmd = '/usr/bin/tmsh save sys config'\n", "rc = shellutil.run(cmd)\n", "if rc != 0:\n", "logger.error('WARNING: Cannot save sys config on 1st boot.')\n", "return rc\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = VAR_0[:]\n", "if self.user is not None:\n", "VAR_11.append((Allow, self.user.login, ('view', 'view.file')))\n", "return VAR_11\n" ]
[ "def get_userdatas_acl(self):...\n", "\"\"\"docstring\"\"\"\n", "acl = DEFAULT_PERM[:]\n", "if self.user is not None:\n", "acl.append((Allow, self.user.login, ('view', 'view.file')))\n", "return acl\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_0(VAR_3):...\n", "VAR_3 = FUNC_1(VAR_3)\n", "VAR_4 = (\n 'SELECT barnivore_product_name, barnivore_status, barnivore_country ' +\n 'FROM barnivore_product ' +\n \"WHERE lower(barnivore_product_name) like lower('% \\\\%s %')\")\n", "VAR_1 = psycopg2.connect(VAR_0)\n", "print('Error %s' % e)\n", "if VAR_1:\n", "return VAR_2\n", "VAR_5 = VAR_1.cursor()\n", "VAR_1.close()\n", "VAR_5.execute(VAR_4, VAR_3)\n", "VAR_2 = VAR_5.fetchall()\n" ]
[ "def getAlcoholByName(name):...\n", "name = fixTypingErrors(name)\n", "QUERY = (\n 'SELECT barnivore_product_name, barnivore_status, barnivore_country ' +\n 'FROM barnivore_product ' +\n \"WHERE lower(barnivore_product_name) like lower('% \\\\%s %')\")\n", "conn = psycopg2.connect(connectionString)\n", "print('Error %s' % e)\n", "if conn:\n", "return result\n", "cur = conn.cursor()\n", "conn.close()\n", "cur.execute(QUERY, name)\n", "result = cur.fetchall()\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "def __getattribute__(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "abort_thread()\n", "if VAR_3 == 'write':\n", "return self.write_both\n", "if VAR_3 == 'close':\n", "return super(CLASS_0, self).__getattribute__(VAR_3)\n", "VAR_5 = super(CLASS_0, self).__getattribute__('redirection_source')\n", "if hasattr(VAR_5, VAR_3):\n", "return getattr(VAR_5, VAR_3)\n", "return super(CLASS_0, self).__getattribute__(VAR_3)\n" ]
[ "def __getattribute__(self, item):...\n", "\"\"\"docstring\"\"\"\n", "abort_thread()\n", "if item == 'write':\n", "return self.write_both\n", "if item == 'close':\n", "return super(RedirectBuffer, self).__getattribute__(item)\n", "source = super(RedirectBuffer, self).__getattribute__('redirection_source')\n", "if hasattr(source, item):\n", "return getattr(source, item)\n", "return super(RedirectBuffer, self).__getattribute__(item)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_13(self):...\n", "VAR_19 = list(filter(lambda VAR_28: VAR_28.protected, self.expanded_output))\n", "if VAR_19:\n" ]
[ "def check_protected_output(self):...\n", "protected = list(filter(lambda f: f.protected, self.expanded_output))\n", "if protected:\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition" ]
[ "@VAR_0.route('/email/unsubscribe/', defaults={'email': None}, methods=[...\n", "VAR_12 = True\n", "if not request.form.get('email') == None:\n", "VAR_6 = request.form.get('email')\n", "if VAR_6 == None:\n", "VAR_7 = 'You need to enter your email address to unsubscribe'\n", "VAR_17 = User.query.filter_by(VAR_6=email)\n", "return render_template('unsubscribe.html', VAR_7=msg, VAR_12=show_form)\n", "if VAR_17.count() != 1:\n", "VAR_7 = 'The given email address was not in our system'\n", "VAR_12 = False\n", "VAR_17.first().subscribed = False\n", "db.session.commit()\n", "VAR_7 = \"We'll stop pestering you at \" + VAR_6\n" ]
[ "@app.route('/email/unsubscribe/', defaults={'email': None}, methods=['GET',...\n", "show_form = True\n", "if not request.form.get('email') == None:\n", "email = request.form.get('email')\n", "if email == None:\n", "msg = 'You need to enter your email address to unsubscribe'\n", "results = User.query.filter_by(email=email)\n", "return render_template('unsubscribe.html', msg=msg, show_form=show_form)\n", "if results.count() != 1:\n", "msg = 'The given email address was not in our system'\n", "show_form = False\n", "results.first().subscribed = False\n", "db.session.commit()\n", "msg = \"We'll stop pestering you at \" + email\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "def __init__(self):...\n", "" ]
[ "def __init__(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_7(VAR_7, VAR_8):...\n", "VAR_4 = input(FUNC_3(VAR_7, VAR_2='blue'))\n", "if int(VAR_4) > VAR_8 or int(VAR_4) < 0:\n", "print(FUNC_3('out of range!', VAR_2='red'))\n", "return int(VAR_4)\n", "FUNC_7(VAR_7, VAR_8)\n" ]
[ "def selection(hint, range):...\n", "index = input(rainbow(hint, color='blue'))\n", "if int(index) > range or int(index) < 0:\n", "print(rainbow('out of range!', color='red'))\n", "return int(index)\n", "selection(hint, range)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'", "Expr'" ]
[ "def FUNC_3(self, VAR_9):...\n", "if not users.get_current_user():\n", "self.redirect(users.create_login_url(self.request.url))\n", "if not users.is_current_user_admin():\n", "return\n", "self.response.set_status(403)\n", "VAR_0[VAR_9](self).get()\n", "return\n" ]
[ "def get(self, command):...\n", "if not users.get_current_user():\n", "self.redirect(users.create_login_url(self.request.url))\n", "if not users.is_current_user_admin():\n", "return\n", "self.response.set_status(403)\n", "commands[command](self).get()\n", "return\n" ]
[ 0, 5, 5, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_14(self, VAR_15):...\n", "self.username = VAR_15\n" ]
[ "def setUsername(self, username):...\n", "self.username = username\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_2(VAR_0, VAR_1, VAR_2):...\n", "VAR_9 = {'class': DT, 'results': {start_url: [{'endpoint': VAR_0, 'params':\n VAR_1, 'method': VAR_2}]}}\n", "VAR_4 = ''\n", "if VAR_2 == 'GET':\n", "VAR_4 = FUNC_0(VAR_0, VAR_1)\n", "return VAR_9, VAR_4\n" ]
[ "def genDT(endpoint, params, method):...\n", "scope = {'class': DT, 'results': {start_url: [{'endpoint': endpoint,\n 'params': params, 'method': method}]}}\n", "script = ''\n", "if method == 'GET':\n", "script = createGetScript(endpoint, params)\n", "return scope, script\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_4(self, **VAR_6):...\n", "VAR_14 = super().get_context_data(**kwargs)\n", "return VAR_14\n" ]
[ "def get_context_data(self, **kwargs):...\n", "context = super().get_context_data(**kwargs)\n", "return context\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_15(self, VAR_17, VAR_18):...\n", "if VAR_6 in VAR_18.bookmarks:\n", "VAR_29 = ((x, None) if x not in VAR_17.collections else (x, VAR_17.\n collections[x]) for x in VAR_17.parameters.keys())\n", "self._store.append(dict(VAR_29))\n" ]
[ "def test(self, pathctx, levelctx):...\n", "if bookmark in levelctx.bookmarks:\n", "found = ((x, None) if x not in pathctx.collections else (x, pathctx.\n collections[x]) for x in pathctx.parameters.keys())\n", "self._store.append(dict(found))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_19(self, VAR_3=None):...\n", "if not VAR_3:\n", "VAR_3 = self.make_reqid()\n", "return b'Router', b'auth-clear', [], VAR_3\n" ]
[ "def make_auth_clear_data(self, reqid=None):...\n", "if not reqid:\n", "reqid = self.make_reqid()\n", "return b'Router', b'auth-clear', [], reqid\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_21(VAR_16):...\n", "return (VAR_16.input, VAR_16.dynamic_input) if VAR_4 else (VAR_16.output,\n VAR_16.dynamic_output)\n" ]
[ "def get_io(rule):...\n", "return (rule.input, rule.dynamic_input) if input else (rule.output, rule.\n dynamic_output)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(VAR_17):...\n", "if os.path.isfile(VAR_17):\n", "os.remove(VAR_17)\n" ]
[ "def clear_log(file_path):...\n", "if os.path.isfile(file_path):\n", "os.remove(file_path)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'" ]