lines
listlengths
1
444
raw_lines
listlengths
1
444
label
listlengths
1
444
type
listlengths
1
444
[ "import psycopg2\n", "import datetime\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = psycopg2.connect('dbname=forum')\n", "VAR_2 = VAR_1.cursor()\n", "VAR_2.execute('select content, time from posts order by time desc')\n", "VAR_3 = VAR_2.fetchall()\n", "VAR_1.close()\n", "return VAR_3\n" ]
[ "import psycopg2\n", "import datetime\n", "def get_posts():...\n", "\"\"\"docstring\"\"\"\n", "conn = psycopg2.connect('dbname=forum')\n", "cursor = conn.cursor()\n", "cursor.execute('select content, time from posts order by time desc')\n", "all_posts = cursor.fetchall()\n", "conn.close()\n", "return all_posts\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def __eq__(self, VAR_35):...\n", "return self.__class__ == VAR_35.__class__ and self.name == VAR_35.name and self.type == VAR_35.type\n" ]
[ "def __eq__(self, other):...\n", "return self.__class__ == other.__class__ and self.name == other.name and self.type == other.type\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_3 = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "VAR_4 = 'fake_snap_name'\n", "self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'create-now').AndReturn(['Snapshot name is %s' % VAR_4])\n", "self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'rename', VAR_4, VAR_3['name'])\n", "self.mox.ReplayAll()\n", "self.driver.create_snapshot(VAR_3)\n" ]
[ "def test_create_snapshot(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "snap_name = 'fake_snap_name'\n", "self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'create-now').AndReturn(['Snapshot name is %s' % snap_name])\n", "self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'rename', snap_name, snapshot['name'])\n", "self.mox.ReplayAll()\n", "self.driver.create_snapshot(snapshot)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_10(self, VAR_5=False, VAR_6=False):...\n", "\"\"\"docstring\"\"\"\n", "assert self._raylet_socket_name is None\n", "self._raylet_socket_name = (self._ray_params.raylet_socket_name or\n get_raylet_socket_name())\n", "self.prepare_socket_file(self._raylet_socket_name)\n", "VAR_14, VAR_15 = new_raylet_log_file(redirect_output=self._ray_params.\n redirect_worker_output)\n", "VAR_16 = ray.services.start_raylet(self._redis_address, self.\n _node_ip_address, self._raylet_socket_name, self.\n _plasma_store_socket_name, self._ray_params.worker_path, self.\n _ray_params.num_cpus, self._ray_params.num_gpus, self._ray_params.\n resources, self._ray_params.object_manager_port, self._ray_params.\n node_manager_port, self._ray_params.redis_password, VAR_5=use_valgrind,\n VAR_6=use_profiler, VAR_14=stdout_file, VAR_15=stderr_file, config=self\n ._config, include_java=self._ray_params.include_java,\n java_worker_options=self._ray_params.java_worker_options)\n", "assert VAR_13.PROCESS_TYPE_RAYLET not in self.all_processes\n", "self.all_processes[VAR_13.PROCESS_TYPE_RAYLET] = [VAR_16]\n" ]
[ "def start_raylet(self, use_valgrind=False, use_profiler=False):...\n", "\"\"\"docstring\"\"\"\n", "assert self._raylet_socket_name is None\n", "self._raylet_socket_name = (self._ray_params.raylet_socket_name or\n get_raylet_socket_name())\n", "self.prepare_socket_file(self._raylet_socket_name)\n", "stdout_file, stderr_file = new_raylet_log_file(redirect_output=self.\n _ray_params.redirect_worker_output)\n", "process_info = ray.services.start_raylet(self._redis_address, self.\n _node_ip_address, self._raylet_socket_name, self.\n _plasma_store_socket_name, self._ray_params.worker_path, self.\n _ray_params.num_cpus, self._ray_params.num_gpus, self._ray_params.\n resources, self._ray_params.object_manager_port, self._ray_params.\n node_manager_port, self._ray_params.redis_password, use_valgrind=\n use_valgrind, use_profiler=use_profiler, stdout_file=stdout_file,\n stderr_file=stderr_file, config=self._config, include_java=self.\n _ray_params.include_java, java_worker_options=self._ray_params.\n java_worker_options)\n", "assert ray_constants.PROCESS_TYPE_RAYLET not in self.all_processes\n", "self.all_processes[ray_constants.PROCESS_TYPE_RAYLET] = [process_info]\n" ]
[ 0, 0, 0, 0, 0, 6, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assign'", "Expr'", "Assign'", "Assign'", "Assert'", "Assign'" ]
[ "def FUNC_17(*VAR_20, **VAR_7):...\n", "return DebugAdapter.start_wrapper_script(VAR_10, *VAR_20, **kwargs)\n" ]
[ "def start(*args, **kwargs):...\n", "return DebugAdapter.start_wrapper_script(script, *args, **kwargs)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_14=errors.USER_DOESNT_EXIST, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_7, VAR_14, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, error=errors.USER_DOESNT_EXIST, *a, **kw):...\n", "VRequired.__init__(self, param, error, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_4(self, VAR_9=None):...\n", "if VAR_9 is None:\n", "VAR_9 = self\n", "VAR_21 = VAR_20.path.join(self.parlai_home, 'data')\n", "VAR_9.add_argument('-dp', '--datapath', default=default_data_path, help=\n 'path to datasets, defaults to {parlai_dir}/data')\n" ]
[ "def add_parlai_data_path(self, argument_group=None):...\n", "if argument_group is None:\n", "argument_group = self\n", "default_data_path = os.path.join(self.parlai_home, 'data')\n", "argument_group.add_argument('-dp', '--datapath', default=default_data_path,\n help='path to datasets, defaults to {parlai_dir}/data')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_2='EmuNAND Recommendation')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n \"If you want to set up an EmuNAND the first thing to know is that you probably don't need it; if you don't know what an EmuNAND is, you don't need one.\"\n , title='EmuNAND Recommendation')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_1(self):...\n", "return self.session.query(self.model)\n" ]
[ "def get_query(self):...\n", "return self.session.query(self.model)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_27(self, VAR_75):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.threads = VAR_75\n", "return VAR_101\n" ]
[ "def threads(self, threads):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.threads = threads\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "@VAR_0.route('/index', methods=['POST'])...\n", "print(request.form)\n", "VAR_9 = {}\n", "VAR_9['document_id'] = random.randint(1, 10000)\n", "VAR_9['pagerank'] = random.random()\n", "VAR_9['position'] = random.random()\n", "VAR_9['frequency'] = random.random()\n", "VAR_9['section'] = 'body'\n", "VAR_9['date_created'] = '2018-11-05T16:18:03+0000'\n", "VAR_10 = {}\n", "VAR_10['documents'] = []\n", "VAR_10['documents'].append(VAR_9)\n", "return jsonify(VAR_10)\n" ]
[ "@app.route('/index', methods=['POST'])...\n", "print(request.form)\n", "spoofFeatures = {}\n", "spoofFeatures['document_id'] = random.randint(1, 10000)\n", "spoofFeatures['pagerank'] = random.random()\n", "spoofFeatures['position'] = random.random()\n", "spoofFeatures['frequency'] = random.random()\n", "spoofFeatures['section'] = 'body'\n", "spoofFeatures['date_created'] = '2018-11-05T16:18:03+0000'\n", "spoofDocuments = {}\n", "spoofDocuments['documents'] = []\n", "spoofDocuments['documents'].append(spoofFeatures)\n", "return jsonify(spoofDocuments)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self):...\n", "self.login_url = VAR_1\n", "self.login_api = VAR_2\n", "self.login_data = VAR_3.copy()\n", "self.session = requests.session()\n", "self.session.headers = VAR_0.copy()\n", "self.session.cookies = cookiejar.LWPCookieJar(filename='./cookies.txt')\n" ]
[ "def __init__(self):...\n", "self.login_url = LOGIN_URL\n", "self.login_api = LOGIN_API\n", "self.login_data = FORM_DATA.copy()\n", "self.session = requests.session()\n", "self.session.headers = HEADERS.copy()\n", "self.session.cookies = cookiejar.LWPCookieJar(filename='./cookies.txt')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(self, VAR_4, *VAR_5, **VAR_6):...\n", "VAR_12 = None\n", "VAR_13 = None\n", "VAR_14 = False\n", "VAR_15 = False\n", "VAR_16 = False\n", "VAR_17 = []\n", "VAR_18 = [self.profile]\n", "if self.exercise.is_submittable:\n", "VAR_27 = self.exercise.SUBMIT_STATUS\n", "if self.exercise.status == LearningObject.STATUS.MAINTENANCE or self.module.status == CourseModule.STATUS.MAINTENANCE:\n", "VAR_21, VAR_14, VAR_17, VAR_18 = self.submission_check()\n", "if self.is_course_staff:\n", "if hasattr(self.exercise, 'generate_table_of_contents'\n", "self.get_summary_submissions()\n", "VAR_28 = _('Exercise is in maintenance and content is hidden from students.')\n", "VAR_19 = ExercisePage(self.exercise)\n", "self.toc = self.content.children_hierarchy(self.exercise)\n", "VAR_19 = self.exercise.as_leaf_class().load(VAR_4, VAR_18, url_name=self.\n post_url_name)\n", "VAR_15 = VAR_21 in [VAR_27.CANNOT_ENROLL, VAR_27.NOT_ENROLLED]\n", "messages.error(VAR_4, VAR_28)\n", "VAR_19.content = _(\n 'Unfortunately this exercise is currently under maintenance.')\n", "self.note('toc')\n", "if self.profile:\n", "VAR_16 = VAR_21 == VAR_27.NOT_ENROLLED\n", "VAR_17.append(VAR_28)\n", "return super().get(VAR_4, *VAR_5, VAR_19=page, VAR_18=students, **kwargs)\n", "LearningObjectDisplay.objects.create(learning_object=self.exercise, profile\n =self.profile)\n", "if isinstance(self.exercise, ExerciseCollection):\n", "VAR_12, VAR_13 = self.__load_exercisecollection(VAR_4)\n", "return super().get(VAR_4, *VAR_5, VAR_19=page, VAR_18=students, VAR_14=\n submission_allowed, VAR_15=disable_submit, VAR_16=should_enroll, VAR_17\n =issues, VAR_12=exercisecollection, VAR_13=exercisecollection_title, **\n kwargs)\n" ]
[ "def get(self, request, *args, **kwargs):...\n", "exercisecollection = None\n", "exercisecollection_title = None\n", "submission_allowed = False\n", "disable_submit = False\n", "should_enroll = False\n", "issues = []\n", "students = [self.profile]\n", "if self.exercise.is_submittable:\n", "SUBMIT_STATUS = self.exercise.SUBMIT_STATUS\n", "if self.exercise.status == LearningObject.STATUS.MAINTENANCE or self.module.status == CourseModule.STATUS.MAINTENANCE:\n", "submission_status, submission_allowed, issues, students = (self.\n submission_check())\n", "if self.is_course_staff:\n", "if hasattr(self.exercise, 'generate_table_of_contents'\n", "self.get_summary_submissions()\n", "issue = _('Exercise is in maintenance and content is hidden from students.')\n", "page = ExercisePage(self.exercise)\n", "self.toc = self.content.children_hierarchy(self.exercise)\n", "page = self.exercise.as_leaf_class().load(request, students, url_name=self.\n post_url_name)\n", "disable_submit = submission_status in [SUBMIT_STATUS.CANNOT_ENROLL,\n SUBMIT_STATUS.NOT_ENROLLED]\n", "messages.error(request, issue)\n", "page.content = _('Unfortunately this exercise is currently under maintenance.')\n", "self.note('toc')\n", "if self.profile:\n", "should_enroll = submission_status == SUBMIT_STATUS.NOT_ENROLLED\n", "issues.append(issue)\n", "return super().get(request, *args, page=page, students=students, **kwargs)\n", "LearningObjectDisplay.objects.create(learning_object=self.exercise, profile\n =self.profile)\n", "if isinstance(self.exercise, ExerciseCollection):\n", "exercisecollection, exercisecollection_title = self.__load_exercisecollection(\n request)\n", "return super().get(request, *args, page=page, students=students,\n submission_allowed=submission_allowed, disable_submit=disable_submit,\n should_enroll=should_enroll, issues=issues, exercisecollection=\n exercisecollection, exercisecollection_title=exercisecollection_title,\n **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'", "Return'", "Expr'", "Condition", "Assign'", "Return'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "from api.models import Key\n", "from api.utils import fingerprint\n", "VAR_0 = 'string'\n", "VAR_1 = 'string'\n", "\"\"\"Tests cloud provider credentials\"\"\"\n", "VAR_2 = ['tests.json']\n", "def FUNC_0(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "def FUNC_1(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': 'mykey@box.local', 'public': VAR_3}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_7 = VAR_6.data['id']\n", "VAR_6 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "VAR_4 = '/api/keys/{key_id}'.format(**locals())\n", "VAR_6 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(VAR_5['id'], VAR_6.data['id'])\n", "self.assertEqual(VAR_5['public'], VAR_6.data['public'])\n", "VAR_6 = self.client.delete(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 204)\n", "def FUNC_2(self):...\n", "self._check_key(VAR_0)\n", "def FUNC_3(self):...\n", "self._check_key(VAR_1)\n", "def FUNC_4(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': 'mykey@box.local', 'public': VAR_3}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 400)\n", "def FUNC_5(self):...\n", "self._check_duplicate_key(VAR_0)\n", "def FUNC_6(self):...\n", "self._check_duplicate_key(VAR_1)\n", "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': 'autotest', 'public': 'string'}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_8 = Key.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(VAR_8),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN autotest@deis.io')\n", "def FUNC_8(self):...\n", "VAR_9 = fingerprint(VAR_0)\n", "self.assertEquals(VAR_9, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "from api.models import Key\n", "from api.utils import fingerprint\n", "RSA_PUBKEY = (\n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfQkkUUoxpvcNMkvv7jqnfodgs37M2eBOAPgLK+KNBMaZaaKB4GF1QhTCMfFhoiTW3rqa0J75bHJcdkoobtTHlK8XUrFqsquWyg3XhsTYr/3RQQXvO86e2sF7SVDJqVtpnbQGc5SgNrHCeHJmf5HTbXSIjCO/AJSvIjnituT/SIAMGeBw0Nq/iSltwYAek1hiKO7wSmLcIQ8U4A00KEUtalaumf2aHOcfjgPfzlbZGP0S0cuBwSqLr8b5XGPmkASNdUiuJY4MJOce7bFU14B7oMAy2xacODUs1momUeYtGI9T7X2WMowJaO7tP3GlsgBMP81VfYTfYChAyJpKp2yoP autotest@autotesting comment'\n )\n", "ECDSA_PUBKEY = (\n 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCGB0x9lmubbLJTF5NekCI0Cgjyip6jJh/t/qQQi1LAZisbREBJ8Wy+hwSn3tnbf/Imh9X+MQnrrza0jaQ3QUAQ= autotest@autotesting comment'\n )\n", "\"\"\"Tests cloud provider credentials\"\"\"\n", "fixtures = ['tests.json']\n", "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "def _check_key(self, pubkey):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': 'mykey@box.local', 'public': pubkey}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "key_id = response.data['id']\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "url = '/api/keys/{key_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(body['id'], response.data['id'])\n", "self.assertEqual(body['public'], response.data['public'])\n", "response = self.client.delete(url)\n", "self.assertEqual(response.status_code, 204)\n", "def test_rsa_key(self):...\n", "self._check_key(RSA_PUBKEY)\n", "def test_ecdsa_key(self):...\n", "self._check_key(ECDSA_PUBKEY)\n", "def _check_duplicate_key(self, pubkey):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': 'mykey@box.local', 'public': pubkey}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 400)\n", "def test_rsa_duplicate_key(self):...\n", "self._check_duplicate_key(RSA_PUBKEY)\n", "def test_ecdsa_duplicate_key(self):...\n", "self._check_duplicate_key(ECDSA_PUBKEY)\n", "def test_rsa_key_str(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': 'autotest', 'public':\n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzqPAwHN70xsB0LXG//KzOgcPikyhdN/KRc4x3j/RA0pmFj63Ywv0PJ2b1LcMSqfR8F11WBlrW8c9xFua0ZAKzI+gEk5uqvOR78bs/SITOtKPomW4e/1d2xEkJqOmYH30u94+NZZYwEBqYaRb34fhtrnJS70XeGF0RhXE5Qea5eh7DBbeLxPfSYd8rfHgzMSb/wmx3h2vmHdQGho20pfJktNu7DxeVkTHn9REMUphf85su7slTgTlWKq++3fASE8PdmFGzb6PkOR4c+LS5WWXd2oM6HyBQBxxiwXbA2lSgQxOdgDiM2FzT0GVSFMUklkUHMdsaG6/HJDw9QckTS0vN autotest@deis.io'\n }\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "key = Key.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(key),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN autotest@deis.io')\n", "def test_rsa_key_fingerprint(self):...\n", "fp = fingerprint(RSA_PUBKEY)\n", "self.assertEquals(fp, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = f.read().split('\\n')\n", "VAR_18 = VAR_17[4].split('=')[1].strip('\"')\n", "return VAR_18\n" ]
[ "def get_osversion():...\n", "\"\"\"docstring\"\"\"\n", "osfilecontent = f.read().split('\\n')\n", "version = osfilecontent[4].split('=')[1].strip('\"')\n", "return version\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_5(self, VAR_13, VAR_14=1):...\n", "utils.check_ssh_injection(VAR_13)\n", "VAR_11 = ' '.join(VAR_13)\n", "if not self.sshpool:\n", "VAR_39 = self.configuration.san_password\n", "VAR_43 = VAR_14\n", "VAR_0.error(_('Error running SSH command: %s') % VAR_11)\n", "VAR_40 = self.configuration.san_private_key\n", "while VAR_14 > 0:\n", "VAR_41 = self.configuration.ssh_min_pool_conn\n", "VAR_14 -= 1\n", "VAR_49 = _(\n \"SSH Command failed after '%(total_attempts)r' attempts : '%(command)s'\"\n ) % {'total_attempts': VAR_43, 'command': VAR_11}\n", "VAR_42 = self.configuration.ssh_max_pool_conn\n", "VAR_0.info(_('EQL-driver: executing \"%s\"') % VAR_11)\n", "VAR_0.exception(e)\n", "self.sshpool = utils.SSHPool(self.configuration.san_ip, self.configuration.\n san_ssh_port, self.configuration.ssh_conn_timeout, self.configuration.\n san_login, VAR_39=password, VAR_40=privatekey, VAR_41=min_size, VAR_42=\n max_size)\n", "return self._ssh_execute(VAR_10, VAR_11, VAR_23=self.configuration.\n eqlx_cli_timeout)\n", "greenthread.sleep(random.randint(20, 500) / 100.0)\n" ]
[ "def _run_ssh(self, cmd_list, attempts=1):...\n", "utils.check_ssh_injection(cmd_list)\n", "command = ' '.join(cmd_list)\n", "if not self.sshpool:\n", "password = self.configuration.san_password\n", "total_attempts = attempts\n", "LOG.error(_('Error running SSH command: %s') % command)\n", "privatekey = self.configuration.san_private_key\n", "while attempts > 0:\n", "min_size = self.configuration.ssh_min_pool_conn\n", "attempts -= 1\n", "msg = _(\n \"SSH Command failed after '%(total_attempts)r' attempts : '%(command)s'\"\n ) % {'total_attempts': total_attempts, 'command': command}\n", "max_size = self.configuration.ssh_max_pool_conn\n", "LOG.info(_('EQL-driver: executing \"%s\"') % command)\n", "LOG.exception(e)\n", "self.sshpool = utils.SSHPool(self.configuration.san_ip, self.configuration.\n san_ssh_port, self.configuration.ssh_conn_timeout, self.configuration.\n san_login, password=password, privatekey=privatekey, min_size=min_size,\n max_size=max_size)\n", "return self._ssh_execute(ssh, command, timeout=self.configuration.\n eqlx_cli_timeout)\n", "greenthread.sleep(random.randint(20, 500) / 100.0)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "AugAssign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_16(self, VAR_2, VAR_3, VAR_4, VAR_26, VAR_6, VAR_7):...\n", "VAR_2.execute(\n 'SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id in %s GROUP BY task_id'\n , (tuple(VAR_4),))\n", "VAR_41 = dict(VAR_2.fetchall())\n", "VAR_34 = {}\n", "for VAR_23 in self.browse(VAR_2, VAR_3, VAR_4, VAR_7=context):\n", "VAR_34[VAR_23.id] = {}\n", "return VAR_34\n", "VAR_34[VAR_23.id]['effective_hours'] = VAR_41.get(VAR_23.id, 0.0)\n", "VAR_34[VAR_23.id]['total_hours'] = VAR_23.remaining_hours + VAR_41.get(VAR_23\n .id, 0.0)\n", "if VAR_23.remaining_hours + VAR_41.get(VAR_23.id, 0.0):\n", "VAR_34[VAR_23.id]['progress'] = round(min(100.0 * VAR_41.get(VAR_23.id, 0.0\n ) / VAR_34[VAR_23.id]['total_hours'], 100), 2)\n", "VAR_34[VAR_23.id]['progress'] = 0.0\n", "VAR_34[VAR_23.id]['delay_hours'] = VAR_34[VAR_23.id]['total_hours'\n ] - VAR_23.planned_hours\n" ]
[ "def _hours_get(self, cr, uid, ids, field_names, args, context):...\n", "cr.execute(\n 'SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id in %s GROUP BY task_id'\n , (tuple(ids),))\n", "hours = dict(cr.fetchall())\n", "res = {}\n", "for task in self.browse(cr, uid, ids, context=context):\n", "res[task.id] = {}\n", "return res\n", "res[task.id]['effective_hours'] = hours.get(task.id, 0.0)\n", "res[task.id]['total_hours'] = task.remaining_hours + hours.get(task.id, 0.0)\n", "if task.remaining_hours + hours.get(task.id, 0.0):\n", "res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[\n task.id]['total_hours'], 100), 2)\n", "res[task.id]['progress'] = 0.0\n", "res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_17(VAR_25):...\n", "\"\"\"docstring\"\"\"\n", "VAR_43 = subprocess.check_output(['vmstat', '-s'])\n", "VAR_25 = VAR_25.encode('ascii')\n", "for VAR_54 in VAR_43.split(b'\\n'):\n", "VAR_54 = VAR_54.strip()\n", "if VAR_25 in VAR_54:\n", "return int(VAR_54.split(b' ')[0])\n" ]
[ "def vmstat(stat):...\n", "\"\"\"docstring\"\"\"\n", "out = subprocess.check_output(['vmstat', '-s'])\n", "stat = stat.encode('ascii')\n", "for line in out.split(b'\\n'):\n", "line = line.strip()\n", "if stat in line:\n", "return int(line.split(b' ')[0])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Assign'", "Condition", "Return'" ]
[ "def FUNC_23(VAR_31, VAR_32, VAR_3, VAR_33, VAR_34=apply_wildcards, VAR_35=None...\n", "for VAR_10, VAR_9 in VAR_32.allitems():\n", "VAR_48 = len(VAR_31)\n", "VAR_49 = True\n", "if callable(VAR_9):\n", "if not_iterable(VAR_9):\n", "VAR_9 = VAR_9(VAR_33)\n", "if not_iterable(VAR_9):\n", "VAR_9 = [VAR_9]\n", "for item_ in VAR_9:\n", "VAR_9 = [VAR_9]\n", "for item_ in VAR_9:\n", "VAR_49 = False\n", "VAR_53 = VAR_34(item_, VAR_3)\n", "if VAR_10:\n", "VAR_49 = False\n", "if not isinstance(item_, str):\n", "VAR_31.append(VAR_53)\n", "VAR_31.set_name(VAR_10, VAR_48, end=len(newitems) if is_iterable else None)\n", "VAR_53 = VAR_34(item_, VAR_3)\n", "if VAR_35 is not None:\n", "VAR_31.append(VAR_53)\n", "VAR_35[VAR_53] = item_\n", "if VAR_35 is not None:\n", "VAR_35[VAR_53] = item_\n" ]
[ "def _apply_wildcards(newitems, olditems, wildcards, wildcards_obj,...\n", "for name, item in olditems.allitems():\n", "start = len(newitems)\n", "is_iterable = True\n", "if callable(item):\n", "if not_iterable(item):\n", "item = item(wildcards_obj)\n", "if not_iterable(item):\n", "item = [item]\n", "for item_ in item:\n", "item = [item]\n", "for item_ in item:\n", "is_iterable = False\n", "concrete = concretize(item_, wildcards)\n", "if name:\n", "is_iterable = False\n", "if not isinstance(item_, str):\n", "newitems.append(concrete)\n", "newitems.set_name(name, start, end=len(newitems) if is_iterable else None)\n", "concrete = concretize(item_, wildcards)\n", "if ruleio is not None:\n", "newitems.append(concrete)\n", "ruleio[concrete] = item_\n", "if ruleio is not None:\n", "ruleio[concrete] = item_\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", "For", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "For", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_2='How to clear Home Menu extdata')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n \"\"\"1. Navigate to the following folder on your SD card: `/Nintendo 3DS/(32 Character ID)/(32 Character ID)/extdata/00000000/`\n2. Delete the corresponding folder for your region:\n USA: `0000008f`\n EUR: `00000098`\n JPN: `00000082`\n KOR: `000000A9`\"\"\"\n , title='How to clear Home Menu extdata')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_17(self):...\n", "VAR_7 = [('x', 'y'), (1, 2)]\n", "VAR_8 = [('key', 'filename', 'file data')]\n", "VAR_9, VAR_10 = url_helper.EncodeMultipartFormData()\n", "self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n", "self.assertEqual('', VAR_10)\n", "VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_7=fields)\n", "self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in VAR_10, VAR_10)\n", "self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in VAR_10, VAR_10)\n", "VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_8=files)\n", "self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"key\"; filename=\"filename\"' in VAR_10, VAR_10)\n", "self.assertTrue('file data' in VAR_10, VAR_10)\n", "VAR_9, VAR_10 = url_helper.EncodeMultipartFormData(VAR_7=fields, VAR_8=files)\n", "self.assertTrue(VAR_9.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in VAR_10, VAR_10)\n", "self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in VAR_10, VAR_10)\n" ]
[ "def testEncodeMultipartFormData(self):...\n", "fields = [('x', 'y'), (1, 2)]\n", "files = [('key', 'filename', 'file data')]\n", "content_type, body = url_helper.EncodeMultipartFormData()\n", "self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n", "self.assertEqual('', body)\n", "content_type, body = url_helper.EncodeMultipartFormData(fields=fields)\n", "self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in body, body)\n", "self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in body, body)\n", "content_type, body = url_helper.EncodeMultipartFormData(files=files)\n", "self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"key\"; filename=\"filename\"' in body, body)\n", "self.assertTrue('file data' in body, body)\n", "content_type, body = url_helper.EncodeMultipartFormData(fields=fields,\n files=files)\n", "self.assertTrue(content_type.startswith('multipart/form-data; boundary='))\n", "self.assertTrue('name=\"x\"\\r\\n\\r\\ny' in body, body)\n", "self.assertTrue('name=\"1\"\\r\\n\\r\\n2' in body, body)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "VAR_0 = 'pos.open.statement'\n", "VAR_1 = 'Open Statements'\n", "def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = []\n", "VAR_7 = self.pool.get('ir.model.data')\n", "VAR_8 = self.pool.get('res.users').browse(VAR_2, VAR_3, VAR_3).company_id.id\n", "VAR_9 = self.pool.get('account.bank.statement')\n", "VAR_10 = self.pool.get('ir.sequence')\n", "VAR_11 = self.pool.get('account.journal')\n", "VAR_2.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % VAR_3)\n", "VAR_12 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "VAR_2.execute('string' % ','.join(map(lambda x: \"'\" + str(x) + \"'\", VAR_12)))\n", "VAR_13 = map(lambda x1: x1[0], VAR_2.fetchall())\n", "for journal in VAR_11.browse(VAR_2, VAR_3, VAR_13):\n", "VAR_4 = VAR_9.search(VAR_2, VAR_3, [('state', '!=', 'confirm'), ('user_id',\n '=', VAR_3), ('journal_id', '=', journal.id)])\n", "VAR_14 = self.pool.get('ir.model.data')\n", "if len(VAR_4):\n", "VAR_15 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_tree')\n", "VAR_17 = ''\n", "VAR_16 = VAR_14._get_id(VAR_2, VAR_3, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if VAR_15:\n", "VAR_17 = VAR_10.get_id(VAR_2, VAR_3, journal.sequence_id.id)\n", "VAR_17 = VAR_10.get(VAR_2, VAR_3, 'account.bank.statement')\n", "VAR_15 = VAR_14.browse(VAR_2, VAR_3, VAR_15, VAR_5=context).res_id\n", "if VAR_16:\n", "VAR_18 = VAR_9.create(VAR_2, VAR_3, {'journal_id': journal.id, 'company_id':\n VAR_8, 'user_id': VAR_3, 'state': 'open', 'name': VAR_17,\n 'starting_details_ids': VAR_9._get_cash_close_box_lines(VAR_2, VAR_3, [])})\n", "VAR_16 = VAR_14.browse(VAR_2, VAR_3, VAR_16, VAR_5=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(VAR_15, 'tree'), (VAR_16, 'form')],\n 'type': 'ir.actions.act_window'}\n", "VAR_9.button_open(VAR_2, VAR_3, [VAR_18], VAR_5)\n" ]
[ "from osv import osv\n", "from tools.translate import _\n", "import time\n", "_name = 'pos.open.statement'\n", "_description = 'Open Statements'\n", "def open_statement(self, cr, uid, ids, context):...\n", "\"\"\"docstring\"\"\"\n", "list_statement = []\n", "mod_obj = self.pool.get('ir.model.data')\n", "company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id\n", "statement_obj = self.pool.get('account.bank.statement')\n", "sequence_obj = self.pool.get('ir.sequence')\n", "journal_obj = self.pool.get('account.journal')\n", "cr.execute(\n 'select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id'\n % uid)\n", "j_ids = map(lambda x1: x1[0], cr.fetchall())\n", "cr.execute(\n \"\"\" select id from account_journal\n where auto_cash='True' and type='cash'\n and id in (%s)\"\"\"\n % ','.join(map(lambda x: \"'\" + str(x) + \"'\", j_ids)))\n", "journal_ids = map(lambda x1: x1[0], cr.fetchall())\n", "for journal in journal_obj.browse(cr, uid, journal_ids):\n", "ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id',\n '=', uid), ('journal_id', '=', journal.id)])\n", "data_obj = self.pool.get('ir.model.data')\n", "if len(ids):\n", "id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')\n", "number = ''\n", "id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')\n", "if journal.sequence_id:\n", "if id2:\n", "number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)\n", "number = sequence_obj.get(cr, uid, 'account.bank.statement')\n", "id2 = data_obj.browse(cr, uid, id2, context=context).res_id\n", "if id3:\n", "statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id,\n 'company_id': company_id, 'user_id': uid, 'state': 'open', 'name':\n number, 'starting_details_ids': statement_obj._get_cash_close_box_lines\n (cr, uid, [])})\n", "id3 = data_obj.browse(cr, uid, id3, context=context).res_id\n", "return {'domain': \"[('state','=','open')]\", 'name': 'Open Statement',\n 'view_type': 'form', 'view_mode': 'tree,form', 'res_model':\n 'account.bank.statement', 'views': [(id2, 'tree'), (id3, 'form')],\n 'type': 'ir.actions.act_window'}\n", "statement_obj.button_open(cr, uid, [statement_id], context)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_4(self, VAR_14=VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "self.check_app_installed()\n", "self._do_start_app()\n", "for _ in range(VAR_14):\n", "time.sleep(1)\n", "if self._is_app_running():\n", "self._log.debug('Successfully started %s', self.app_name)\n", "return\n" ]
[ "def start_app(self, wait_time=APP_START_WAIT_TIME):...\n", "\"\"\"docstring\"\"\"\n", "self.check_app_installed()\n", "self._do_start_app()\n", "for _ in range(wait_time):\n", "time.sleep(1)\n", "if self._is_app_running():\n", "self._log.debug('Successfully started %s', self.app_name)\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "For", "Expr'", "Condition", "Expr'", "Return'" ]
[ "@detail_route(methods=['get'])...\n", "\"\"\"docstring\"\"\"\n", "get_and_check_project(VAR_9, VAR_11)\n", "VAR_28 = self.queryset.get(VAR_10=pk, VAR_1=project_pk)\n", "VAR_23 = max(0, int(VAR_9.query_params.get('line', 0)))\n", "VAR_24 = VAR_28.console_output or ''\n", "return Response('\\n'.join(VAR_24.split('\\n')[VAR_23:]))\n" ]
[ "@detail_route(methods=['get'])...\n", "\"\"\"docstring\"\"\"\n", "get_and_check_project(request, project_pk)\n", "task = self.queryset.get(pk=pk, project=project_pk)\n", "line_num = max(0, int(request.query_params.get('line', 0)))\n", "output = task.console_output or ''\n", "return Response('\\n'.join(output.split('\\n')[line_num:]))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_10, VAR_11):...\n", "VAR_7 = VAR_10.find_where({'session_name': VAR_11})\n", "VAR_7.kill_session()\n" ]
[ "def kill_session_by_name(server, name):...\n", "session = server.find_where({'session_name': name})\n", "session.kill_session()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@click.command(help='Update an existing monitor')...\n", "if VAR_13['no_validation_string']:\n", "if VAR_13['validation_string']:\n", "if VAR_13['validation_string']:\n", "VAR_13['validation_string'] = False\n", "VAR_13['bypass_head_request'] = True\n", "if VAR_13['clear_locations'] and not VAR_13['add_locations']:\n", "VAR_23, VAR_30, VAR_12 = newrelic.update_monitor(VAR_0.obj['ACCOUNT'],\n VAR_12, **kwargs)\n", "if VAR_13['raw']:\n", "print(json.dumps(VAR_12))\n", "if VAR_23 == 0:\n", "return\n", "print(click.style(u'OK', fg='green', bold=True))\n", "print(click.style(u'Error', fg='red', bold=True))\n", "print('Monitor: ' + VAR_30)\n" ]
[ "@click.command(help='Update an existing monitor')...\n", "if kwargs['no_validation_string']:\n", "if kwargs['validation_string']:\n", "if kwargs['validation_string']:\n", "kwargs['validation_string'] = False\n", "kwargs['bypass_head_request'] = True\n", "if kwargs['clear_locations'] and not kwargs['add_locations']:\n", "status, message, monitor = newrelic.update_monitor(ctx.obj['ACCOUNT'],\n monitor, **kwargs)\n", "if kwargs['raw']:\n", "print(json.dumps(monitor))\n", "if status == 0:\n", "return\n", "print(click.style(u'OK', fg='green', bold=True))\n", "print(click.style(u'Error', fg='red', bold=True))\n", "print('Monitor: ' + message)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Expr'" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.RESTART, *VAR_13, **kwargs)\n" ]
[ "@detail_route(methods=['post'])...\n", "return self.set_pending_action(pending_actions.RESTART, *args, **kwargs)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_2(self):...\n", "self.uut.output_regex = 'string'\n", "self.uut.severity_map = {'I': RESULT_SEVERITY.INFO}\n", "VAR_1 = list(self.uut.process_output(['info_msg|1.0|2.3|I: Info message\\n'],\n 'a/file.py', ['original_file_lines_placeholder']))\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].affected_code[0].start.line, 1)\n", "self.assertEqual(VAR_1[0].affected_code[0].start.column, 0)\n", "self.assertEqual(VAR_1[0].affected_code[0].end.line, 2)\n", "self.assertEqual(VAR_1[0].affected_code[0].end.column, 3)\n", "self.assertEqual(VAR_1[0].severity, RESULT_SEVERITY.INFO)\n", "self.assertEqual(VAR_1[0].origin, 'Lint (info_msg)')\n" ]
[ "def test_custom_regex(self):...\n", "self.uut.output_regex = (\n '(?P<origin>\\\\w+)\\\\|(?P<line>\\\\d+)\\\\.(?P<column>\\\\d+)\\\\|(?P<end_line>\\\\d+)\\\\.(?P<end_column>\\\\d+)\\\\|(?P<severity>\\\\w+): (?P<message>.*)'\n )\n", "self.uut.severity_map = {'I': RESULT_SEVERITY.INFO}\n", "out = list(self.uut.process_output(['info_msg|1.0|2.3|I: Info message\\n'],\n 'a/file.py', ['original_file_lines_placeholder']))\n", "self.assertEqual(len(out), 1)\n", "self.assertEqual(out[0].affected_code[0].start.line, 1)\n", "self.assertEqual(out[0].affected_code[0].start.column, 0)\n", "self.assertEqual(out[0].affected_code[0].end.line, 2)\n", "self.assertEqual(out[0].affected_code[0].end.column, 3)\n", "self.assertEqual(out[0].severity, RESULT_SEVERITY.INFO)\n", "self.assertEqual(out[0].origin, 'Lint (info_msg)')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, VAR_5):...\n", "VAR_9 = []\n", "for question in entry_form_config:\n", "VAR_10 = VAR_5.cleaned_data.get(str(question['id']), False)\n", "return self.render_to_response({'form': VAR_5, 'submitted': True,\n 'claimable_benefits': Benefit.objects.find_claimable(VAR_9)})\n", "if VAR_10:\n", "VAR_9.append(getattr(BenefitRequirement.flags, build_question_flag(question)))\n" ]
[ "def form_valid(self, form):...\n", "selected_flags = []\n", "for question in entry_form_config:\n", "flag = form.cleaned_data.get(str(question['id']), False)\n", "return self.render_to_response({'form': form, 'submitted': True,\n 'claimable_benefits': Benefit.objects.find_claimable(selected_flags)})\n", "if flag:\n", "selected_flags.append(getattr(BenefitRequirement.flags, build_question_flag\n (question)))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_8(self):...\n", "VAR_21 = self.agent.type_to_payload('deleteGoogleLoadBalancerDescription',\n {'region': self.bindings['TEST_GCE_REGION'], 'credentials': self.\n bindings['GCE_CREDENTIALS'], 'loadBalancerName': self.__use_lb_name})\n", "VAR_20 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_20.new_clause_builder('Health Check Removed').list_resources(\n 'http-health-checks').excludes_path_value('name', self.__use_lb_hc_name)\n", "VAR_20.new_clause_builder('Target Pool Removed').list_resources('target-pools'\n ).excludes_path_value('name', self.__use_lb_tp_name)\n", "VAR_20.new_clause_builder('Forwarding Rule Removed').list_resources(\n 'forwarding-rules').excludes_path_value('name', self.__use_lb_name)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer', data=payload, VAR_29='ops'), contract=builder.\n build())\n" ]
[ "def delete_load_balancer(self):...\n", "payload = self.agent.type_to_payload('deleteGoogleLoadBalancerDescription',\n {'region': self.bindings['TEST_GCE_REGION'], 'credentials': self.\n bindings['GCE_CREDENTIALS'], 'loadBalancerName': self.__use_lb_name})\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Health Check Removed').list_resources(\n 'http-health-checks').excludes_path_value('name', self.__use_lb_hc_name)\n", "builder.new_clause_builder('Target Pool Removed').list_resources('target-pools'\n ).excludes_path_value('name', self.__use_lb_tp_name)\n", "builder.new_clause_builder('Forwarding Rule Removed').list_resources(\n 'forwarding-rules').excludes_path_value('name', self.__use_lb_name)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer', data=payload, path='ops'), contract=builder.build()\n )\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_11(VAR_4):...\n", "VAR_12 = FUNC_10(VAR_4)\n", "VAR_9 = FUNC_0()\n", "VAR_10 = VAR_9.cursor()\n", "if VAR_12 is None:\n", "VAR_12 = VAR_12 + 1\n", "VAR_10.execute(\n \"\"\"\n INSERT INTO people(name,karma,shame) VALUES('{}',0,1)\n \"\"\"\n .format(VAR_4))\n", "VAR_2.error('Execution failed with error: {}'.format(e))\n", "VAR_10.execute(\n \"\"\"\n UPDATE people SET shame = {0} WHERE name = '{1}'\n \"\"\"\n .format(VAR_12, VAR_4))\n", "VAR_2.error('Execution failed with error: {}'.format(e))\n", "VAR_9.commit()\n", "VAR_9.commit()\n", "VAR_2.debug('Inserted into karmadb 1 shame for {}'.format(VAR_4))\n", "VAR_2.debug('Inserted into karmadb {} shame for {}'.format(VAR_12, VAR_4))\n", "VAR_9.close()\n", "VAR_9.close()\n", "return 1\n", "return VAR_12\n" ]
[ "def shame_add(name):...\n", "shame = shame_ask(name)\n", "db = db_connect()\n", "cursor = db.cursor()\n", "if shame is None:\n", "shame = shame + 1\n", "cursor.execute(\n \"\"\"\n INSERT INTO people(name,karma,shame) VALUES('{}',0,1)\n \"\"\"\n .format(name))\n", "logger.error('Execution failed with error: {}'.format(e))\n", "cursor.execute(\n \"\"\"\n UPDATE people SET shame = {0} WHERE name = '{1}'\n \"\"\"\n .format(shame, name))\n", "logger.error('Execution failed with error: {}'.format(e))\n", "db.commit()\n", "db.commit()\n", "logger.debug('Inserted into karmadb 1 shame for {}'.format(name))\n", "logger.debug('Inserted into karmadb {} shame for {}'.format(shame, name))\n", "db.close()\n", "db.close()\n", "return 1\n", "return shame\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'", "Return'" ]
[ "def __init__(self):...\n", "self.connect()\n", "VAR_7.signal(VAR_7.SIGTERM, self.exit)\n", "log.info('Worker starting')\n" ]
[ "def __init__(self):...\n", "self.connect()\n", "signal.signal(signal.SIGTERM, self.exit)\n", "log.info('Worker starting')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_2):...\n", "return getHTML(VAR_2)\n" ]
[ "def get(self, name):...\n", "return getHTML(name)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from flask import Flask\n", "from flask import redirect\n", "from flask import url_for\n", "from routes.topic_routes import topic_routes\n", "from routes.auth_routes import auth_routes\n", "from routes.reply_routes import reply_routes\n", "VAR_0 = Flask(__name__)\n", "VAR_0.secret_key = 'for test'\n", "@VAR_0.route('/', methods=['GET'])...\n", "return redirect(url_for('auth.login'))\n" ]
[ "from flask import Flask\n", "from flask import redirect\n", "from flask import url_for\n", "from routes.topic_routes import topic_routes\n", "from routes.auth_routes import auth_routes\n", "from routes.reply_routes import reply_routes\n", "app = Flask(__name__)\n", "app.secret_key = 'for test'\n", "@app.route('/', methods=['GET'])...\n", "return redirect(url_for('auth.login'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def __repr__(self):...\n", "return super().__repr__() + 'Backend: ' + self.backend + '\\n'\n" ]
[ "def __repr__(self):...\n", "return super().__repr__() + 'Backend: ' + self.backend + '\\n'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, *VAR_11, **VAR_12):...\n", "if 'health' not in VAR_12 and 'infohash' in VAR_12:\n", "VAR_12['health'] = VAR_0.TorrentState.get(VAR_2=kwargs['infohash']\n ) or VAR_0.TorrentState(VAR_2=kwargs['infohash'])\n", "if 'xxx' not in VAR_12:\n", "VAR_12['xxx'] = default_xxx_filter.isXXXTorrentMetadataDict(VAR_12)\n", "super(CLASS_0, self).__init__(*VAR_11, **kwargs)\n", "if 'tracker_info' in VAR_12:\n", "self.add_tracker(VAR_12['tracker_info'])\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "if 'health' not in kwargs and 'infohash' in kwargs:\n", "kwargs['health'] = db.TorrentState.get(infohash=kwargs['infohash']\n ) or db.TorrentState(infohash=kwargs['infohash'])\n", "if 'xxx' not in kwargs:\n", "kwargs['xxx'] = default_xxx_filter.isXXXTorrentMetadataDict(kwargs)\n", "super(TorrentMetadata, self).__init__(*args, **kwargs)\n", "if 'tracker_info' in kwargs:\n", "self.add_tracker(kwargs['tracker_info'])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_0():...\n", "VAR_12 = f'string{VAR_0}\\n '\n", "VAR_14 = create_connection()\n", "VAR_14.close()\n", "VAR_15 = VAR_14.cursor()\n", "VAR_15.execute(VAR_12)\n", "return VAR_15.fetchall()\n" ]
[ "def get_users():...\n", "sql_query = f\"\"\"\n SELECT id, first_name, last_name, username, email, password, INET_NTOA(ip_address)\n as ip_address, registration_date, activated\n FROM {USERS_TABLE}\n \"\"\"\n", "connection = create_connection()\n", "connection.close()\n", "cursor = connection.cursor()\n", "cursor.execute(sql_query)\n", "return cursor.fetchall()\n" ]
[ 0, 4, 0, 0, 0, 4, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@FUNC_5...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Check how many users also have this feature: %s...', VAR_5)\n", "VAR_17 = (\"SELECT DISTINCT chat_id FROM photo_queries_table2 WHERE {}='{}'\"\n .format(VAR_6, VAR_5))\n", "VAR_42 = db.execute_query(VAR_17)\n", "log.error('Cannot check how many users also have this feature: %s...', VAR_5)\n", "if not VAR_42.rowcount:\n", "return None\n", "log.debug('There were no users with %s...', VAR_5)\n", "log.debug('There is %d users with %s', VAR_42.rowcount, VAR_5)\n", "return None\n", "return VAR_42.rowcount - 1\n" ]
[ "@cache_number_users_with_same_feature...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Check how many users also have this feature: %s...', feature)\n", "query = (\"SELECT DISTINCT chat_id FROM photo_queries_table2 WHERE {}='{}'\".\n format(feature_type, feature))\n", "cursor = db.execute_query(query)\n", "log.error('Cannot check how many users also have this feature: %s...', feature)\n", "if not cursor.rowcount:\n", "return None\n", "log.debug('There were no users with %s...', feature)\n", "log.debug('There is %d users with %s', cursor.rowcount, feature)\n", "return None\n", "return cursor.rowcount - 1\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Return'", "Return'" ]
[ "@app.route('/achievements/updateMultiple', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = request.json['player_id']\n", "VAR_7 = request.json['updates']\n", "VAR_8 = dict(updated_achievements=[])\n", "for update in VAR_7:\n", "VAR_1 = update['achievement_id']\n", "return VAR_8\n", "VAR_12 = update['update_type']\n", "VAR_13 = dict(VAR_1=achievement_id)\n", "if VAR_12 == 'REVEAL':\n", "VAR_18 = FUNC_12(VAR_1, VAR_2)\n", "if VAR_12 == 'UNLOCK':\n", "VAR_13['current_state'] = VAR_18['current_state']\n", "VAR_19 = FUNC_11(VAR_1, VAR_2)\n", "if VAR_12 == 'INCREMENT':\n", "VAR_13['current_state'] = 'REVEALED'\n", "VAR_13['newly_unlocked'] = VAR_19['newly_unlocked']\n", "VAR_20 = FUNC_8(VAR_1, VAR_2, update['steps'])\n", "if VAR_12 == 'SET_STEPS_AT_LEAST':\n", "VAR_8['updated_achievements'].append(VAR_13)\n", "VAR_13['current_state'] = 'UNLOCKED'\n", "VAR_13['current_steps'] = VAR_20['current_steps']\n", "VAR_21 = FUNC_9(VAR_1, VAR_2, update['steps'])\n", "VAR_13['current_state'] = VAR_20['current_state']\n", "VAR_13['current_steps'] = VAR_21['current_steps']\n", "VAR_13['newly_unlocked'] = VAR_20['newly_unlocked']\n", "VAR_13['current_state'] = VAR_21['current_state']\n", "VAR_13['newly_unlocked'] = VAR_21['newly_unlocked']\n" ]
[ "@app.route('/achievements/updateMultiple', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "player_id = request.json['player_id']\n", "updates = request.json['updates']\n", "result = dict(updated_achievements=[])\n", "for update in updates:\n", "achievement_id = update['achievement_id']\n", "return result\n", "update_type = update['update_type']\n", "update_result = dict(achievement_id=achievement_id)\n", "if update_type == 'REVEAL':\n", "reveal_result = reveal_achievement(achievement_id, player_id)\n", "if update_type == 'UNLOCK':\n", "update_result['current_state'] = reveal_result['current_state']\n", "unlock_result = unlock_achievement(achievement_id, player_id)\n", "if update_type == 'INCREMENT':\n", "update_result['current_state'] = 'REVEALED'\n", "update_result['newly_unlocked'] = unlock_result['newly_unlocked']\n", "increment_result = increment_achievement(achievement_id, player_id, update[\n 'steps'])\n", "if update_type == 'SET_STEPS_AT_LEAST':\n", "result['updated_achievements'].append(update_result)\n", "update_result['current_state'] = 'UNLOCKED'\n", "update_result['current_steps'] = increment_result['current_steps']\n", "set_steps_at_least_result = set_steps_at_least(achievement_id, player_id,\n update['steps'])\n", "update_result['current_state'] = increment_result['current_state']\n", "update_result['current_steps'] = set_steps_at_least_result['current_steps']\n", "update_result['newly_unlocked'] = increment_result['newly_unlocked']\n", "update_result['current_state'] = set_steps_at_least_result['current_state']\n", "update_result['newly_unlocked'] = set_steps_at_least_result['newly_unlocked']\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_7, VAR_71=20, **VAR_16):...\n", "self.num = VAR_71\n", "CLASS_0.__init__(self, VAR_7=param, **kw)\n" ]
[ "def __init__(self, param, num=20, **kw):...\n", "self.num = num\n", "Validator.__init__(self, param=param, **kw)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ "def test_filters_3(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['like', 'J%']}))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11, VAR_16={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n", "VAR_30 = get_tile_json(VAR_28.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}}/{{x}}/{{y}}.png'.format(VAR_28.\n project.id, VAR_28.id)], VAR_28.orthophoto_area.extent)\n", "return Response(VAR_30)\n" ]
[ "def get(self, request, pk=None, project_pk=None):...\n", "\"\"\"docstring\"\"\"\n", "task = self.get_and_check_task(request, pk, project_pk, annotate={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n", "json = get_tile_json(task.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}}/{{x}}/{{y}}.png'.format(task.\n project.id, task.id)], task.orthophoto_area.extent)\n", "return Response(json)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "@staticmethod...\n", "return ['|id', \"=cmd|'cmd'!''\", ';id', '\\n\\rid', '`id`', '${id}', '\\x00`id`']\n" ]
[ "@staticmethod...\n", "return ['|id', \"=cmd|'cmd'!''\", ';id', '\\n\\rid', '`id`', '${id}', '\\x00`id`']\n" ]
[ 2, 2 ]
[ "Condition", "Return'" ]
[ "def FUNC_2(self):...\n", "return self.HandlePost()\n" ]
[ "def HandleGet(self):...\n", "return self.HandlePost()\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self):...\n", "" ]
[ "def solve(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_0(self, *VAR_4, **VAR_5):...\n", "VAR_11 = self.REQUEST\n", "VAR_12 = VAR_11.RESPONSE\n", "return self.getBodyContent(VAR_11)\n" ]
[ "def zmi_body_content(self, *args, **kwargs):...\n", "request = self.REQUEST\n", "response = request.RESPONSE\n", "return self.getBodyContent(request)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_27(self, *VAR_33):...\n", "self._run_tracker.log(Report.DEBUG, *VAR_33)\n" ]
[ "def debug(self, *msg_elements):...\n", "self._run_tracker.log(Report.DEBUG, *msg_elements)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_5(VAR_3, VAR_7, VAR_8=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {'currentProvider': None, 'providers': [], 'secondaryProviders': [],\n 'finishAuthUrl': None, 'errorMessage': None}\n", "if third_party_auth.is_enabled():\n", "if not enterprise_customer_for_request(VAR_3):\n", "return VAR_5\n", "for enabled in third_party_auth.provider.Registry.displayed_for_login(VAR_8\n", "VAR_41 = pipeline.get(VAR_3)\n", "VAR_49 = {'id': enabled.provider_id, 'name': enabled.name, 'iconClass': \n enabled.icon_class or None, 'iconImage': enabled.icon_image.url if\n enabled.icon_image else None, 'loginUrl': pipeline.get_login_url(\n enabled.provider_id, pipeline.AUTH_ENTRY_LOGIN, redirect_url=\n redirect_to), 'registerUrl': pipeline.get_login_url(enabled.provider_id,\n pipeline.AUTH_ENTRY_REGISTER, redirect_url=redirect_to)}\n", "if VAR_41 is not None:\n", "VAR_5['providers' if not enabled.secondary else 'secondaryProviders'].append(\n VAR_49)\n", "VAR_46 = third_party_auth.provider.Registry.get_from_pipeline(VAR_41)\n", "for msg in messages.get_messages(VAR_3):\n", "if VAR_46 is not None:\n", "if msg.extra_tags.split()[0] == 'social-auth':\n", "VAR_5['currentProvider'] = VAR_46.name\n", "VAR_5['errorMessage'] = _(unicode(msg))\n", "VAR_5['finishAuthUrl'] = pipeline.get_complete_url(VAR_46.backend_name)\n", "if VAR_46.skip_registration_form:\n", "VAR_5['autoSubmitRegForm'] = True\n" ]
[ "def _third_party_auth_context(request, redirect_to, tpa_hint=None):...\n", "\"\"\"docstring\"\"\"\n", "context = {'currentProvider': None, 'providers': [], 'secondaryProviders':\n [], 'finishAuthUrl': None, 'errorMessage': None}\n", "if third_party_auth.is_enabled():\n", "if not enterprise_customer_for_request(request):\n", "return context\n", "for enabled in third_party_auth.provider.Registry.displayed_for_login(tpa_hint\n", "running_pipeline = pipeline.get(request)\n", "info = {'id': enabled.provider_id, 'name': enabled.name, 'iconClass': \n enabled.icon_class or None, 'iconImage': enabled.icon_image.url if\n enabled.icon_image else None, 'loginUrl': pipeline.get_login_url(\n enabled.provider_id, pipeline.AUTH_ENTRY_LOGIN, redirect_url=\n redirect_to), 'registerUrl': pipeline.get_login_url(enabled.provider_id,\n pipeline.AUTH_ENTRY_REGISTER, redirect_url=redirect_to)}\n", "if running_pipeline is not None:\n", "context['providers' if not enabled.secondary else 'secondaryProviders'].append(\n info)\n", "current_provider = third_party_auth.provider.Registry.get_from_pipeline(\n running_pipeline)\n", "for msg in messages.get_messages(request):\n", "if current_provider is not None:\n", "if msg.extra_tags.split()[0] == 'social-auth':\n", "context['currentProvider'] = current_provider.name\n", "context['errorMessage'] = _(unicode(msg))\n", "context['finishAuthUrl'] = pipeline.get_complete_url(current_provider.\n backend_name)\n", "if current_provider.skip_registration_form:\n", "context['autoSubmitRegForm'] = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Return'", "For", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "For", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "For", "Assign'" ]
[ "def FUNC_3(self, VAR_10, VAR_11):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = {}\n", "if not int(VAR_11['simulated-human-interaction']):\n", "VAR_17['human'] = int(VAR_11['simulated-human-interaction'])\n", "return emit_options(VAR_17)\n" ]
[ "def translate_options(self, info, options):...\n", "\"\"\"docstring\"\"\"\n", "ret = {}\n", "if not int(options['simulated-human-interaction']):\n", "ret['human'] = int(options['simulated-human-interaction'])\n", "return emit_options(ret)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@app.route('/achievements/updateMultiple', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = request.json['player_id']\n", "VAR_7 = request.json['updates']\n", "VAR_8 = dict(updated_achievements=[])\n", "for update in VAR_7:\n", "VAR_1 = update['achievement_id']\n", "return VAR_8\n", "VAR_12 = update['update_type']\n", "VAR_13 = dict(VAR_1=achievement_id)\n", "if VAR_12 == 'REVEAL':\n", "VAR_18 = FUNC_12(VAR_1, VAR_2)\n", "if VAR_12 == 'UNLOCK':\n", "VAR_13['current_state'] = VAR_18['current_state']\n", "VAR_19 = FUNC_11(VAR_1, VAR_2)\n", "if VAR_12 == 'INCREMENT':\n", "VAR_13['current_state'] = 'REVEALED'\n", "VAR_13['newly_unlocked'] = VAR_19['newly_unlocked']\n", "VAR_20 = FUNC_8(VAR_1, VAR_2, update['steps'])\n", "if VAR_12 == 'SET_STEPS_AT_LEAST':\n", "VAR_8['updated_achievements'].append(VAR_13)\n", "VAR_13['current_state'] = 'UNLOCKED'\n", "VAR_13['current_steps'] = VAR_20['current_steps']\n", "VAR_21 = FUNC_9(VAR_1, VAR_2, update['steps'])\n", "VAR_13['current_state'] = VAR_20['current_state']\n", "VAR_13['current_steps'] = VAR_21['current_steps']\n", "VAR_13['newly_unlocked'] = VAR_20['newly_unlocked']\n", "VAR_13['current_state'] = VAR_21['current_state']\n", "VAR_13['newly_unlocked'] = VAR_21['newly_unlocked']\n" ]
[ "@app.route('/achievements/updateMultiple', methods=['POST'])...\n", "\"\"\"docstring\"\"\"\n", "player_id = request.json['player_id']\n", "updates = request.json['updates']\n", "result = dict(updated_achievements=[])\n", "for update in updates:\n", "achievement_id = update['achievement_id']\n", "return result\n", "update_type = update['update_type']\n", "update_result = dict(achievement_id=achievement_id)\n", "if update_type == 'REVEAL':\n", "reveal_result = reveal_achievement(achievement_id, player_id)\n", "if update_type == 'UNLOCK':\n", "update_result['current_state'] = reveal_result['current_state']\n", "unlock_result = unlock_achievement(achievement_id, player_id)\n", "if update_type == 'INCREMENT':\n", "update_result['current_state'] = 'REVEALED'\n", "update_result['newly_unlocked'] = unlock_result['newly_unlocked']\n", "increment_result = increment_achievement(achievement_id, player_id, update[\n 'steps'])\n", "if update_type == 'SET_STEPS_AT_LEAST':\n", "result['updated_achievements'].append(update_result)\n", "update_result['current_state'] = 'UNLOCKED'\n", "update_result['current_steps'] = increment_result['current_steps']\n", "set_steps_at_least_result = set_steps_at_least(achievement_id, player_id,\n update['steps'])\n", "update_result['current_state'] = increment_result['current_state']\n", "update_result['current_steps'] = set_steps_at_least_result['current_steps']\n", "update_result['newly_unlocked'] = increment_result['newly_unlocked']\n", "update_result['current_state'] = set_steps_at_least_result['current_state']\n", "update_result['newly_unlocked'] = set_steps_at_least_result['newly_unlocked']\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2):...\n", "super(CLASS_4, self).__init__(VAR_0, VAR_1, VAR_2, 'PUT')\n" ]
[ "def __init__(self, connection, args, logger):...\n", "super(HttpPut, self).__init__(connection, args, logger, 'PUT')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_18(self, VAR_11, VAR_12, VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "VAR_15 = '/usr/bin/tmsh create net route {0}/{1} gw {2}'.format(VAR_11,\n VAR_12, VAR_13)\n", "return shellutil.run(VAR_15, VAR_8=False)\n" ]
[ "def route_add(self, net, mask, gateway):...\n", "\"\"\"docstring\"\"\"\n", "cmd = '/usr/bin/tmsh create net route {0}/{1} gw {2}'.format(net, mask, gateway\n )\n", "return shellutil.run(cmd, chk_err=False)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_19(self, VAR_6, VAR_17=180, VAR_18=False, VAR_19=False):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_6.startswith('sosreport'):\n", "VAR_6 = VAR_6.replace('sosreport', self.host.sos_bin_path)\n", "if VAR_19:\n", "VAR_19 = True\n", "VAR_18 = True\n", "self.log_debug('Running command %s' % VAR_6)\n", "VAR_6 = self._format_cmd(VAR_6)\n", "if 'atomic' in VAR_6:\n", "VAR_18 = True\n", "if not self.local:\n", "VAR_51 = time.time()\n", "VAR_54 = Popen(VAR_6, shell=True, stdin=PIPE, VAR_7=PIPE, VAR_8=PIPE)\n", "VAR_52, VAR_32, VAR_53 = self.client.exec_command(VAR_6, VAR_17=timeout,\n VAR_18=get_pty)\n", "if self.config['become_root'] and VAR_19:\n", "while time.time() < VAR_51 + VAR_17:\n", "VAR_7, VAR_8 = VAR_54.communicate(input=self.config['root_password'] + '\\n')\n", "if self.config['need_sudo'] and VAR_19:\n", "if not VAR_32.channel.exit_status_ready():\n", "VAR_9 = VAR_54.returncode\n", "VAR_7, VAR_8 = VAR_54.communicate(input=self.config['sudo_pw'] + '\\n')\n", "VAR_7, VAR_8 = VAR_54.communicate()\n", "time.sleep(0.1)\n", "if VAR_32.channel.exit_status_ready():\n", "return self._fmt_output(VAR_7=stdout, VAR_8=stderr, VAR_9=rc)\n", "if self.config['become_root'] and VAR_19:\n", "VAR_9 = VAR_32.channel.recv_exit_status()\n", "VAR_52.write(self.config['root_password'] + '\\n')\n", "if self.config['sudo_pw'] and VAR_19:\n", "return self._fmt_output(VAR_32, VAR_53, VAR_9)\n", "VAR_52.flush()\n", "VAR_52.write(self.config['sudo_pw'] + '\\n')\n", "VAR_19 = False\n", "VAR_52.flush()\n", "VAR_19 = False\n" ]
[ "def run_command(self, cmd, timeout=180, get_pty=False, need_root=False):...\n", "\"\"\"docstring\"\"\"\n", "if cmd.startswith('sosreport'):\n", "cmd = cmd.replace('sosreport', self.host.sos_bin_path)\n", "if need_root:\n", "need_root = True\n", "get_pty = True\n", "self.log_debug('Running command %s' % cmd)\n", "cmd = self._format_cmd(cmd)\n", "if 'atomic' in cmd:\n", "get_pty = True\n", "if not self.local:\n", "now = time.time()\n", "proc = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)\n", "sin, sout, serr = self.client.exec_command(cmd, timeout=timeout, get_pty=\n get_pty)\n", "if self.config['become_root'] and need_root:\n", "while time.time() < now + timeout:\n", "stdout, stderr = proc.communicate(input=self.config['root_password'] + '\\n')\n", "if self.config['need_sudo'] and need_root:\n", "if not sout.channel.exit_status_ready():\n", "rc = proc.returncode\n", "stdout, stderr = proc.communicate(input=self.config['sudo_pw'] + '\\n')\n", "stdout, stderr = proc.communicate()\n", "time.sleep(0.1)\n", "if sout.channel.exit_status_ready():\n", "return self._fmt_output(stdout=stdout, stderr=stderr, rc=rc)\n", "if self.config['become_root'] and need_root:\n", "rc = sout.channel.recv_exit_status()\n", "sin.write(self.config['root_password'] + '\\n')\n", "if self.config['sudo_pw'] and need_root:\n", "return self._fmt_output(sout, serr, rc)\n", "sin.flush()\n", "sin.write(self.config['sudo_pw'] + '\\n')\n", "need_root = False\n", "sin.flush()\n", "need_root = False\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 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Condition", "Assign'", "Expr'", "Condition", "Return'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'" ]
[ "@VAR_0.route('/profiles')...\n", "return jsonify(db_getProfilesInfo())\n" ]
[ "@profile_module.route('/profiles')...\n", "return jsonify(db_getProfilesInfo())\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_8(self, VAR_1, VAR_2):...\n", "return self.stateMap[VAR_1][VAR_2]\n" ]
[ "def getUnit(self, x, y):...\n", "return self.stateMap[x][y]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_29(VAR_13):...\n", "" ]
[ "def failing(request):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_2(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.enabled:\n", "FUNC_0(VAR_2)\n", "if VAR_1.use_tls:\n", "VAR_3 = FTP_TLS(VAR_1.server)\n", "VAR_3 = FTP(VAR_1.server)\n", "VAR_3.login(VAR_1.username, VAR_1.password)\n", "VAR_3.login(VAR_1.username, VAR_1.password)\n", "VAR_3.prot_p()\n", "if not VAR_1.files:\n", "FUNC_3(VAR_3=ftp, VAR_2=local_directory, VAR_4=ftp_config.directory)\n", "VAR_3.cwd(VAR_1.directory)\n", "VAR_3.close()\n", "VAR_19 = 1\n", "VAR_20 = len(VAR_1.files)\n", "for remote_filename in VAR_1.files:\n", "VAR_46 = remote_filename\n", "VAR_47 = os.path.join(VAR_2, VAR_46)\n", "if not os.path.exists(VAR_47):\n", "print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n VAR_19, VAR_20, VAR_47))\n", "VAR_3.retrbinary('RETR %s' % remote_filename, VAR_7.write)\n", "print('[Setup][FTP] ({}/{}) Error downloading file. Skipping: {}'.format(\n VAR_19, VAR_20, VAR_47))\n", "VAR_19 = VAR_19 + 1\n", "print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(VAR_19, VAR_20, VAR_47)\n )\n", "VAR_7.close()\n", "os.remove(VAR_47)\n" ]
[ "def fetch_data_via_ftp(ftp_config, local_directory):...\n", "\"\"\"docstring\"\"\"\n", "if ftp_config.enabled:\n", "create_directory_tree(local_directory)\n", "if ftp_config.use_tls:\n", "ftp = FTP_TLS(ftp_config.server)\n", "ftp = FTP(ftp_config.server)\n", "ftp.login(ftp_config.username, ftp_config.password)\n", "ftp.login(ftp_config.username, ftp_config.password)\n", "ftp.prot_p()\n", "if not ftp_config.files:\n", "fetch_data_via_ftp_recursive(ftp=ftp, local_directory=local_directory,\n remote_directory=ftp_config.directory)\n", "ftp.cwd(ftp_config.directory)\n", "ftp.close()\n", "file_counter = 1\n", "file_list_total = len(ftp_config.files)\n", "for remote_filename in ftp_config.files:\n", "local_filename = remote_filename\n", "filepath = os.path.join(local_directory, local_filename)\n", "if not os.path.exists(filepath):\n", "print('[Setup][FTP] ({}/{}) File already exists. Skipping: {}'.format(\n file_counter, file_list_total, filepath))\n", "ftp.retrbinary('RETR %s' % remote_filename, local_file.write)\n", "print('[Setup][FTP] ({}/{}) Error downloading file. Skipping: {}'.format(\n file_counter, file_list_total, filepath))\n", "file_counter = file_counter + 1\n", "print('[Setup][FTP] ({}/{}) File downloaded: {}'.format(file_counter,\n file_list_total, filepath))\n", "local_file.close()\n", "os.remove(filepath)\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'", "Docstring", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_65, VAR_7, *VAR_15, **VAR_16):...\n", "self.cache_prefix = VAR_65\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, cache_prefix, param, *a, **kw):...\n", "self.cache_prefix = cache_prefix\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_9(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_3 = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'delete', VAR_3['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_snapshot(VAR_3)\n" ]
[ "def test_delete_snapshot(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'delete', snapshot['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_snapshot(snapshot)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_48):...\n", "VAR_80 = CLASS_5.run(self, VAR_48)\n", "if VAR_80 and not (VAR_101.user_is_loggedin and VAR_80.can_submit(VAR_101.user)\n", "abort(403, 'forbidden')\n", "return VAR_80\n" ]
[ "def run(self, link_name):...\n", "link = VLink.run(self, link_name)\n", "if link and not (c.user_is_loggedin and link.can_submit(c.user)):\n", "abort(403, 'forbidden')\n", "return link\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_5(VAR_12):...\n", "def FUNC_9(self, *VAR_15, **VAR_75):...\n", "for validator in VAR_0:\n", "if VAR_102.method == 'POST' and hasattr(self, 'ajax_login_redirect'):\n", "return FUNC_9\n", "validator(VAR_75)\n", "VAR_16 = self.build_arg_list(VAR_12, VAR_75)\n", "return self.ajax_login_redirect('/')\n", "return self.intermediate_redirect('/login')\n", "for VAR_110, validator in VAR_1.iteritems():\n", "VAR_16[VAR_110] = validator(VAR_75)\n", "return VAR_12(self, *VAR_15, **kw)\n" ]
[ "def val(fn):...\n", "def newfn(self, *a, **env):...\n", "for validator in simple_vals:\n", "if request.method == 'POST' and hasattr(self, 'ajax_login_redirect'):\n", "return newfn\n", "validator(env)\n", "kw = self.build_arg_list(fn, env)\n", "return self.ajax_login_redirect('/')\n", "return self.intermediate_redirect('/login')\n", "for var, validator in param_vals.iteritems():\n", "kw[var] = validator(env)\n", "return fn(self, *a, **kw)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "For", "Condition", "Return'", "Expr'", "Assign'", "Return'", "Return'", "For", "Assign'", "Return'" ]
[ "def FUNC_8(self):...\n", "user_should_have_perm(self.tester, self.permission)\n" ]
[ "def setUp(self):...\n", "user_should_have_perm(self.tester, self.permission)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_4():...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = FUNC_0()\n", "VAR_7 = VAR_6.cursor()\n", "VAR_7.execute('SELECT COUNT(*) from players;')\n", "VAR_8 = VAR_7.fetchone()[0]\n", "VAR_6.close()\n", "return VAR_8\n" ]
[ "def countPlayers():...\n", "\"\"\"docstring\"\"\"\n", "c = connect()\n", "cur = c.cursor()\n", "cur.execute('SELECT COUNT(*) from players;')\n", "res = cur.fetchone()[0]\n", "c.close()\n", "return res\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_5():...\n", "self.set_status(404, 'Not Found')\n", "self._headers = tornado.httputil.HTTPHeaders()\n", "self.add_header('Content-Length', '0')\n", "self.flush()\n", "return\n" ]
[ "def invoke_404():...\n", "self.set_status(404, 'Not Found')\n", "self._headers = tornado.httputil.HTTPHeaders()\n", "self.add_header('Content-Length', '0')\n", "self.flush()\n", "return\n" ]
[ 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = tldextract.extract(VAR_4)\n", "return VAR_17.subdomain not in ('', 'www')\n" ]
[ "def validate_subdomain(url):...\n", "\"\"\"docstring\"\"\"\n", "parsed_domain = tldextract.extract(url)\n", "return parsed_domain.subdomain not in ('', 'www')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "@tornado.web.authenticated...\n", "VAR_9 = get_json_request_body(self)\n", "self.write(api.user.generate_token(VAR_9))\n" ]
[ "@tornado.web.authenticated...\n", "data = get_json_request_body(self)\n", "self.write(api.user.generate_token(data))\n" ]
[ 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'" ]
[ "def FUNC_8(self):...\n", "clear_cache('writers')\n" ]
[ "def on_update(self):...\n", "clear_cache('writers')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_6(self, VAR_16):...\n", "for line in filter(lambda error: bool(error.strip()), VAR_16):\n", "self.warn(line)\n" ]
[ "def _print_errors(self, errors):...\n", "for line in filter(lambda error: bool(error.strip()), errors):\n", "self.warn(line)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'" ]
[ "def FUNC_2(VAR_4, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = VAR_4.encode('ascii', 'replace')\n", "VAR_4 = re.sub('[^- a-zA-Z0-9]', '_', VAR_4)\n", "VAR_4 = VAR_4.replace(u' ', u'-')\n", "VAR_4 = re.sub('([-_])[-_]+', '\\\\1', VAR_4)\n", "return VAR_4\n" ]
[ "def _gitiles_slugify(value, _separator):...\n", "\"\"\"docstring\"\"\"\n", "value = value.encode('ascii', 'replace')\n", "value = re.sub('[^- a-zA-Z0-9]', '_', value)\n", "value = value.replace(u' ', u'-')\n", "value = re.sub('([-_])[-_]+', '\\\\1', value)\n", "return value\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_13.whitelist()...\n", "FUNC_2(VAR_1, VAR_2, VAR_3, VAR_0=searchfield, VAR_5=page_length, VAR_4=filters\n )\n", "VAR_13.response['results'] = FUNC_4(VAR_13.response['values'])\n" ]
[ "@frappe.whitelist()...\n", "search_widget(doctype, txt, query, searchfield=searchfield, page_length=\n page_length, filters=filters)\n", "frappe.response['results'] = build_for_autosuggest(frappe.response['values'])\n" ]
[ 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_3=discord.Color.red())\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n 'While on 2.1, **NEVER** shut the N3DS lid, update any model, format a 2DS or attempt to play a game on a cartridge. Doing any of these things *will* brick your system.'\n , color=discord.Color.red())\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "@VAR_0.route('/api/issue/<int:id>', methods=['DELETE'])...\n", "return 'Not implemented.', 501\n" ]
[ "@app.route('/api/issue/<int:id>', methods=['DELETE'])...\n", "return 'Not implemented.', 501\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_1(self):...\n", "logging.debug('Parsing SSH config file {}'.format(str(self.file)))\n", "if not self.file.is_file():\n", "logging.debug('SSH config does not exist')\n", "VAR_2 = self.new_host()\n", "return\n", "for line in ssh_config.readlines():\n", "VAR_11 = line.strip(' \\t\\n')\n", "if VAR_2['host'] != '' and VAR_2['hostname'] != '':\n", "if VAR_11 != '' and VAR_11[:1] != '#':\n", "self.hosts.append(VAR_2)\n", "VAR_12 = VAR_11.split()\n", "if VAR_12[0].lower() == 'host' and len(VAR_12) > 1:\n", "if VAR_2['host'] != '' and VAR_2['hostname'] != '':\n", "if VAR_12[0].lower() == 'hostname' and len(VAR_12) > 1:\n", "self.hosts.append(VAR_2)\n", "VAR_2 = self.new_host()\n", "VAR_2['hostname'] = VAR_12[1]\n", "if VAR_12[0].lower() == 'port' and len(VAR_12) > 1:\n", "VAR_2['host'] = VAR_12[1]\n", "VAR_2['port'] = int(VAR_12[1])\n", "if VAR_12[0].lower() == 'user' and len(VAR_12) > 1:\n", "VAR_2['username'] = VAR_12[1]\n" ]
[ "def parse(self):...\n", "logging.debug('Parsing SSH config file {}'.format(str(self.file)))\n", "if not self.file.is_file():\n", "logging.debug('SSH config does not exist')\n", "host = self.new_host()\n", "return\n", "for line in ssh_config.readlines():\n", "stripped_line = line.strip(' \\t\\n')\n", "if host['host'] != '' and host['hostname'] != '':\n", "if stripped_line != '' and stripped_line[:1] != '#':\n", "self.hosts.append(host)\n", "tokens = stripped_line.split()\n", "if tokens[0].lower() == 'host' and len(tokens) > 1:\n", "if host['host'] != '' and host['hostname'] != '':\n", "if tokens[0].lower() == 'hostname' and len(tokens) > 1:\n", "self.hosts.append(host)\n", "host = self.new_host()\n", "host['hostname'] = tokens[1]\n", "if tokens[0].lower() == 'port' and len(tokens) > 1:\n", "host['host'] = tokens[1]\n", "host['port'] = int(tokens[1])\n", "if tokens[0].lower() == 'user' and len(tokens) > 1:\n", "host['username'] = tokens[1]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Expr'", "Assign'", "Return'", "For", "Assign'", "Condition", "Condition", "Expr'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_37(self, VAR_29):...\n", "VAR_12.append('authorization_error')\n", "super(CLASS_7, self).authorization_error(VAR_29)\n" ]
[ "def authorization_error(self, err):...\n", "calls.append('authorization_error')\n", "super(Handler, self).authorization_error(err)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_37 = os.path.join(self._leap_home, self._uuid)\n", "shutil.rmtree(VAR_37)\n" ]
[ "def cleanup(self):...\n", "soledad_test_folder = os.path.join(self._leap_home, self._uuid)\n", "shutil.rmtree(soledad_test_folder)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_5):...\n", "VAR_10 = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n", "VAR_11 = self._doc['rules']['ROOT']\n", "VAR_12 = self\n", "return ds._traverse(VAR_5, VAR_11, VAR_10, VAR_12)\n" ]
[ "def traverse(self, searcher):...\n", "ctx = ds.PathTraversalContext({}, {}, self._root, {}, None, None, None)\n", "rule = self._doc['rules']['ROOT']\n", "client = self\n", "return ds._traverse(searcher, rule, ctx, client)\n" ]
[ 0, 1, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(self, VAR_4='done'):...\n", "self.finished.callback(self.json_buffer[1:])\n" ]
[ "def connectionLost(self, reason='done'):...\n", "self.finished.callback(self.json_buffer[1:])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_9(self, VAR_9, VAR_12, VAR_13, VAR_6, VAR_4):...\n", "VAR_21 = generate_password_hash(VAR_4)\n", "VAR_14 = (\n \"INSERT INTO `testdb`.`user` (`ID`, `FName`, `LName`, `Email`, `Pass`, `Role`) VALUES ('\"\n + VAR_9 + \"', '\" + VAR_12 + \"', '\" + VAR_13 + \"', '\" + VAR_6 + \"', '\" +\n VAR_21 + \"', '1')\")\n", "self.cursor.execute(VAR_14)\n", "self.connection.commit()\n" ]
[ "def create_faculty_user(self, userID, fName, lName, email, password):...\n", "password2 = generate_password_hash(password)\n", "query = (\n \"INSERT INTO `testdb`.`user` (`ID`, `FName`, `LName`, `Email`, `Pass`, `Role`) VALUES ('\"\n + userID + \"', '\" + fName + \"', '\" + lName + \"', '\" + email + \"', '\" +\n password2 + \"', '1')\")\n", "self.cursor.execute(query)\n", "self.connection.commit()\n" ]
[ 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, VAR_3, VAR_4, VAR_8):...\n", "if not isinstance(VAR_8, CourseModule):\n", "return True\n", "if VAR_8.status == CourseModule.STATUS.HIDDEN:\n", "return False\n", "if not VAR_8.is_after_open():\n", "self.error_msg(_('The module will open for submissions at {date}.'), format\n ={'date': module.opening_time}, delim=' ')\n", "if VAR_8.requirements.count() > 0:\n", "return False\n", "VAR_16 = CachedPoints(VAR_8.course_instance, VAR_3.user, VAR_4.content)\n", "return True\n", "return VAR_8.are_requirements_passed(VAR_16)\n" ]
[ "def has_object_permission(self, request, view, module):...\n", "if not isinstance(module, CourseModule):\n", "return True\n", "if module.status == CourseModule.STATUS.HIDDEN:\n", "return False\n", "if not module.is_after_open():\n", "self.error_msg(_('The module will open for submissions at {date}.'), format\n ={'date': module.opening_time}, delim=' ')\n", "if module.requirements.count() > 0:\n", "return False\n", "points = CachedPoints(module.course_instance, request.user, view.content)\n", "return True\n", "return module.are_requirements_passed(points)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Condition", "Expr'", "Condition", "Return'", "Assign'", "Return'", "Return'" ]
[ "\"\"\"\nVarious utilities.\n\"\"\"\n", "import functools\n", "from django.dispatch import receiver\n", "from django.conf import settings\n", "from django.core.mail import send_mail\n", "from django.template import loader, Context\n", "from core.common.mongo import c_onboarding_status, c_onboarding_settings\n", "from core.common import onboarding\n", "def FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = Context(VAR_0)\n", "VAR_13 = loader.get_template(VAR_3)\n", "VAR_14 = VAR_13.render(VAR_12)\n", "VAR_15 = loader.get_template(VAR_4)\n", "VAR_16 = VAR_15.render(VAR_12)\n", "send_mail(VAR_14, VAR_16, VAR_1, VAR_2, fail_silently=True)\n", "def FUNC_1(VAR_5, **VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_7(VAR_17):...\n", "@receiver(VAR_5, **decorator_kwargs)...\n", "if settings.SUSPEND_SIGNALS:\n", "return\n", "return VAR_17(VAR_23, **kwargs)\n" ]
[ "\"\"\"\nVarious utilities.\n\"\"\"\n", "import functools\n", "from django.dispatch import receiver\n", "from django.conf import settings\n", "from django.core.mail import send_mail\n", "from django.template import loader, Context\n", "from core.common.mongo import c_onboarding_status, c_onboarding_settings\n", "from core.common import onboarding\n", "def send_email(context_data, from_email, to_email, template_subject,...\n", "\"\"\"docstring\"\"\"\n", "context = Context(context_data)\n", "subj_template = loader.get_template(template_subject)\n", "rendered_subj = subj_template.render(context)\n", "text_template = loader.get_template(template_text)\n", "rendered_text = text_template.render(context)\n", "send_mail(rendered_subj, rendered_text, from_email, to_email, fail_silently\n =True)\n", "def suspending_receiver(signal, **decorator_kwargs):...\n", "\"\"\"docstring\"\"\"\n", "def our_wrapper(func):...\n", "@receiver(signal, **decorator_kwargs)...\n", "if settings.SUSPEND_SIGNALS:\n", "return\n", "return func(sender, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Docstring", "FunctionDef'", "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_14(self):...\n", "self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n" ]
[ "def test_z_delete_app(self):...\n", "self.run_test_case(self.scenario.delete_app(), retry_interval_secs=8,\n max_retries=8)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "from django.conf.urls import url, include\n", "from .projects import ProjectViewSet\n", "from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n", "from .processingnodes import ProcessingNodeViewSet\n", "from rest_framework_nested import routers\n", "VAR_0 = routers.DefaultRouter()\n", "VAR_0.register('projects', ProjectViewSet)\n", "VAR_0.register('processingnodes', ProcessingNodeViewSet)\n", "VAR_1 = routers.NestedSimpleRouter(VAR_0, 'projects', lookup='project')\n", "VAR_1.register('tasks', TaskViewSet, base_name='projects-tasks')\n", "VAR_2 = [url('^', include(VAR_0.urls)), url('^', include(VAR_1.urls)), url(\n 'string', TaskTiles.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles\\\\.json$',\n TaskTilesJson.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/download/(?P<asset>[^/.]+)/$'\n , TaskAssets.as_view()), url('^auth/', include('rest_framework.urls'))]\n" ]
[ "from django.conf.urls import url, include\n", "from .projects import ProjectViewSet\n", "from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n", "from .processingnodes import ProcessingNodeViewSet\n", "from rest_framework_nested import routers\n", "router = routers.DefaultRouter()\n", "router.register('projects', ProjectViewSet)\n", "router.register('processingnodes', ProcessingNodeViewSet)\n", "tasks_router = routers.NestedSimpleRouter(router, 'projects', lookup='project')\n", "tasks_router.register('tasks', TaskViewSet, base_name='projects-tasks')\n", "urlpatterns = [url('^', include(router.urls)), url('^', include(\n tasks_router.urls)), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles/(?P<z>[\\\\d]+)/(?P<x>[\\\\d]+)/(?P<y>[\\\\d]+)\\\\.png$'\n , TaskTiles.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/tiles\\\\.json$',\n TaskTilesJson.as_view()), url(\n 'projects/(?P<project_pk>[^/.]+)/tasks/(?P<pk>[^/.]+)/download/(?P<asset>[^/.]+)/$'\n , TaskAssets.as_view()), url('^auth/', include('rest_framework.urls'))]\n" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.obj.__name__\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "@api_view(['GET'])...\n", "return FUNC_7(VAR_0, 'stp')\n" ]
[ "@api_view(['GET'])...\n", "return _measure_by_org(request, 'stp')\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_18(self, VAR_4, VAR_5, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_11 is None:\n", "VAR_11 = {}\n", "return self.proxy_class(self._data, VAR_4, VAR_5, **options)\n" ]
[ "def make_proxy(self, accessor, relationship_direction, options=None):...\n", "\"\"\"docstring\"\"\"\n", "if options is None:\n", "options = {}\n", "return self.proxy_class(self._data, accessor, relationship_direction, **options\n )\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'" ]
[ "def FUNC_4(self):...\n", "self.assertIn('USER', os.environ)\n", "VAR_18 = subprocess.check_output('env', shell=True).decode('utf-8')\n", "self.assertNotIn('USER=', VAR_18)\n", "self.assertIn('AAA', os.environ)\n", "self.assertEqual(os.environ['AAA'], '333')\n", "self.assertIn('USER', os.environ)\n", "self.assertNotIn('AAA', os.environ)\n" ]
[ "def test_hermetic_environment_subprocesses(self):...\n", "self.assertIn('USER', os.environ)\n", "output = subprocess.check_output('env', shell=True).decode('utf-8')\n", "self.assertNotIn('USER=', output)\n", "self.assertIn('AAA', os.environ)\n", "self.assertEqual(os.environ['AAA'], '333')\n", "self.assertIn('USER', os.environ)\n", "self.assertNotIn('AAA', os.environ)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_12):...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = self.env['stock.quant']\n", "return VAR_21.search([('product_tmpl_id', '=', VAR_12.id), (\n 'location_id.usage', '=', 'internal')], order='in_date', limit=1)\n" ]
[ "def oldest_quant(self, prod):...\n", "\"\"\"docstring\"\"\"\n", "quant_obj = self.env['stock.quant']\n", "return quant_obj.search([('product_tmpl_id', '=', prod.id), (\n 'location_id.usage', '=', 'internal')], order='in_date', limit=1)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "@functools.wraps(VAR_9)...\n", "VAR_19 = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n", "if VAR_3:\n", "VAR_19['definitions']['issue']['required'].append('id')\n", "VAR_19 = {**VAR_19, **{'type': 'object', 'properties': {'data': {'type':\n 'array', 'minItems': 1, 'items': {'$ref': '#/definitions/issue'}}}}}\n", "VAR_19['definitions']['issue']['properties']['id'] = {'type': ['integer',\n 'string']}\n", "VAR_20 = request.get_json()\n", "validate(instance=request_payload, schema=request_schema)\n", "return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n", "return VAR_9(*VAR_17, **kwargs)\n" ]
[ "@functools.wraps(func)...\n", "request_schema = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n", "if require_id:\n", "request_schema['definitions']['issue']['required'].append('id')\n", "request_schema = {**request_schema, **{'type': 'object', 'properties': {\n 'data': {'type': 'array', 'minItems': 1, 'items': {'$ref':\n '#/definitions/issue'}}}}}\n", "request_schema['definitions']['issue']['properties']['id'] = {'type': [\n 'integer', 'string']}\n", "request_payload = request.get_json()\n", "validate(instance=request_payload, schema=request_schema)\n", "return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n", "return func(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def __hash__(self):...\n", "return self._hash\n" ]
[ "def __hash__(self):...\n", "return self._hash\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2(self):...\n", "return self.name\n" ]
[ "def get_name(self):...\n", "return self.name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = VAR_5[:]\n", "for request in VAR_5:\n", "self.assertEqual(tuple, request.__class__)\n", "self.assertEqual([], self._requests)\n", "self.assertIn(len(request), (3, 4))\n", "self._requests = VAR_5\n" ]
[ "def expected_requests(self, requests):...\n", "\"\"\"docstring\"\"\"\n", "requests = requests[:]\n", "for request in requests:\n", "self.assertEqual(tuple, request.__class__)\n", "self.assertEqual([], self._requests)\n", "self.assertIn(len(request), (3, 4))\n", "self._requests = requests\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_11(self):...\n", "VAR_20 = []\n", "for VAR_2 in self.query_order.split('.'):\n", "VAR_23 = VAR_2.replace('-', '')\n", "return self.get_url_with_query_params({self.ordering_query_param: '.'.join(\n VAR_20)})\n", "if not int(VAR_23) == self.column_id:\n", "VAR_20.append(VAR_2)\n" ]
[ "def get_remove_sort_by(self):...\n", "new_query = []\n", "for column in self.query_order.split('.'):\n", "c = column.replace('-', '')\n", "return self.get_url_with_query_params({self.ordering_query_param: '.'.join(\n new_query)})\n", "if not int(c) == self.column_id:\n", "new_query.append(column)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_2):...\n", "VAR_4 = 'delete from post where post.postid=%d' % VAR_2\n", "VAR_5 = sql.deleteDB(self.conn, VAR_4)\n", "return VAR_5\n" ]
[ "def deletePost(self, postid):...\n", "sqlText = 'delete from post where post.postid=%d' % postid\n", "result = sql.deleteDB(self.conn, sqlText)\n", "return result\n" ]
[ 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_16(VAR_12):...\n", "VAR_16 = JarDependency('missing spec', ' //:{}'.format(VAR_12))\n", "VAR_4.register_jvm_tool(VAR_8, VAR_4._key_for_tool_version(VAR_12, 'custom'\n ), VAR_15=[dummy_jardep])\n" ]
[ "def register_custom_tool(key):...\n", "dummy_jardep = JarDependency('missing spec', ' //:{}'.format(key))\n", "cls.register_jvm_tool(register, cls._key_for_tool_version(key, 'custom'),\n classpath=[dummy_jardep])\n" ]
[ 0, 0, 7 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_1():...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = getattr(g, 'database', None)\n", "if VAR_10 is None:\n", "g.database = sqlite3.connect(VAR_1)\n", "return VAR_10\n", "VAR_10 = g.database\n", "VAR_10.row_factory = sqlite3.Row\n" ]
[ "def get_database_connection():...\n", "\"\"\"docstring\"\"\"\n", "connection = getattr(g, 'database', None)\n", "if connection is None:\n", "g.database = sqlite3.connect(DATABASE_FILE)\n", "return connection\n", "connection = g.database\n", "connection.row_factory = sqlite3.Row\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_9(self, VAR_9, VAR_11=None):...\n", "VAR_1 = get_and_check_project(VAR_9, VAR_11, ('change_project',))\n", "VAR_27 = [VAR_35 for filesList in map(lambda key: VAR_9.FILES.getlist(key),\n [keys for keys in VAR_9.FILES]) for VAR_35 in filesList]\n", "VAR_28 = models.Task.create_from_images(VAR_27, VAR_1)\n", "if VAR_28 is not None:\n", "return Response({'id': VAR_28.id}, status=status.HTTP_201_CREATED)\n" ]
[ "def create(self, request, project_pk=None):...\n", "project = get_and_check_project(request, project_pk, ('change_project',))\n", "files = [file for filesList in map(lambda key: request.FILES.getlist(key),\n [keys for keys in request.FILES]) for file in filesList]\n", "task = models.Task.create_from_images(files, project)\n", "if task is not None:\n", "return Response({'id': task.id}, status=status.HTTP_201_CREATED)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_14(VAR_1, VAR_3, VAR_7):...\n", "VAR_21 = VAR_3 + '-' + VAR_7\n", "VAR_18 = \"UPDATE {} SET count=count+1 WHERE name_option = '{}';\".format(CFG\n ('options_table_name'), VAR_21)\n", "VAR_1.execute(VAR_18)\n" ]
[ "def incrementOption(cursor, poll_name, option):...\n", "key = poll_name + '-' + option\n", "req = \"UPDATE {} SET count=count+1 WHERE name_option = '{}';\".format(CFG(\n 'options_table_name'), key)\n", "cursor.execute(req)\n" ]
[ 0, 0, 4, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "\"\"\" Views for a student's account information. \"\"\"\n", "import json\n", "import logging\n", "import urlparse\n", "from datetime import datetime\n", "from django.conf import settings\n", "from django.contrib import messages\n", "from django.contrib.auth import get_user_model\n", "from django.contrib.auth.decorators import login_required\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\n", "from django.shortcuts import redirect\n", "from django.utils.translation import ugettext as _\n", "from django.views.decorators.csrf import ensure_csrf_cookie\n", "from django.views.decorators.http import require_http_methods\n", "from django_countries import countries\n", "import third_party_auth\n", "from commerce.models import CommerceConfiguration\n", "from edxmako.shortcuts import render_to_response\n", "from lms.djangoapps.commerce.utils import EcommerceService\n", "from openedx.core.djangoapps.commerce.utils import ecommerce_api_client\n", "from openedx.core.djangoapps.external_auth.login_and_register import login as external_auth_login\n", "from openedx.core.djangoapps.external_auth.login_and_register import register as external_auth_register\n", "from openedx.core.djangoapps.lang_pref.api import all_languages, released_languages\n", "from openedx.core.djangoapps.programs.models import ProgramsApiConfig\n", "from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers\n", "from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site\n", "from openedx.core.djangoapps.user_api.accounts.api import request_password_change\n", "from openedx.core.djangoapps.user_api.api import RegistrationFormFactory, get_login_session_form, get_password_reset_form\n", "from openedx.core.djangoapps.user_api.errors import UserNotFound\n", "from openedx.core.lib.edx_api_utils import get_edx_api_data\n", "from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES\n", "from openedx.features.enterprise_support.api import enterprise_customer_for_request\n", "from student.helpers import destroy_oauth_tokens, get_next_url_for_login_page\n", "from student.models import UserProfile\n", "from student.views import register_user as old_register_view\n", "from student.views import signin_user as old_login_view\n", "from third_party_auth import pipeline\n", "from third_party_auth.decorators import xframe_allow_whitelisted\n", "from util.bad_request_rate_limiter import BadRequestRateLimiter\n", "from util.date_utils import strftime_localized\n", "VAR_0 = logging.getLogger('audit')\n", "VAR_1 = logging.getLogger(__name__)\n", "VAR_2 = get_user_model()\n", "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = get_next_url_for_login_page(VAR_3)\n", "if VAR_3.user.is_authenticated():\n", "return redirect(VAR_7)\n", "VAR_11 = FUNC_6(VAR_3)\n", "VAR_12 = None\n", "if '?' in VAR_7:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "VAR_38 = urlparse.parse_qs(urlparse.urlparse(VAR_7).query)\n", "if VAR_4 == 'login':\n", "VAR_13 = FUNC_7(VAR_3, VAR_4)\n", "VAR_39 = VAR_38['tpa_hint'][0]\n", "return old_login_view(VAR_3)\n", "if VAR_4 == 'register':\n", "if VAR_13 is not None:\n", "VAR_40 = third_party_auth.provider.Registry.get(VAR_39=provider_id)\n", "return old_register_view(VAR_3)\n", "return VAR_13\n", "VAR_14 = [{'message': message.message, 'tags': message.tags} for message in\n messages.get_messages(VAR_3) if 'account-activation' in message.tags]\n", "if VAR_40:\n", "VAR_5 = {'data': {'login_redirect_url': VAR_7, 'initial_mode': VAR_4,\n 'third_party_auth': FUNC_5(VAR_3, VAR_7, VAR_12),\n 'third_party_auth_hint': VAR_12 or '', 'platform_name':\n configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME\n ), 'support_link': configuration_helpers.get_value('SUPPORT_SITE_LINK',\n settings.SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': VAR_14, 'login_form_desc': json.loads(\n VAR_11['login']), 'registration_form_desc': json.loads(VAR_11[\n 'registration']), 'password_reset_form_desc': json.loads(VAR_11[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url': VAR_7,\n 'responsive': True, 'allow_iframing': True, 'disable_courseware_js': \n True, 'combined_login_and_register': True, 'disable_footer': not\n configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if VAR_40.skip_hinted_login_dialog:\n", "VAR_5 = FUNC_2(VAR_3, VAR_5)\n", "return redirect(pipeline.get_login_url(VAR_39, pipeline.AUTH_ENTRY_LOGIN,\n redirect_url=redirect_to))\n", "VAR_12 = VAR_39\n", "VAR_15 = render_to_response('student_account/login_and_register.html', VAR_5)\n", "VAR_4 = 'hinted_login'\n", "VAR_15.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return VAR_15\n" ]
[ "\"\"\" Views for a student's account information. \"\"\"\n", "import json\n", "import logging\n", "import urlparse\n", "from datetime import datetime\n", "from django.conf import settings\n", "from django.contrib import messages\n", "from django.contrib.auth import get_user_model\n", "from django.contrib.auth.decorators import login_required\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\n", "from django.shortcuts import redirect\n", "from django.utils.translation import ugettext as _\n", "from django.views.decorators.csrf import ensure_csrf_cookie\n", "from django.views.decorators.http import require_http_methods\n", "from django_countries import countries\n", "import third_party_auth\n", "from commerce.models import CommerceConfiguration\n", "from edxmako.shortcuts import render_to_response\n", "from lms.djangoapps.commerce.utils import EcommerceService\n", "from openedx.core.djangoapps.commerce.utils import ecommerce_api_client\n", "from openedx.core.djangoapps.external_auth.login_and_register import login as external_auth_login\n", "from openedx.core.djangoapps.external_auth.login_and_register import register as external_auth_register\n", "from openedx.core.djangoapps.lang_pref.api import all_languages, released_languages\n", "from openedx.core.djangoapps.programs.models import ProgramsApiConfig\n", "from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers\n", "from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site\n", "from openedx.core.djangoapps.user_api.accounts.api import request_password_change\n", "from openedx.core.djangoapps.user_api.api import RegistrationFormFactory, get_login_session_form, get_password_reset_form\n", "from openedx.core.djangoapps.user_api.errors import UserNotFound\n", "from openedx.core.lib.edx_api_utils import get_edx_api_data\n", "from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES\n", "from openedx.features.enterprise_support.api import enterprise_customer_for_request\n", "from student.helpers import destroy_oauth_tokens, get_next_url_for_login_page\n", "from student.models import UserProfile\n", "from student.views import register_user as old_register_view\n", "from student.views import signin_user as old_login_view\n", "from third_party_auth import pipeline\n", "from third_party_auth.decorators import xframe_allow_whitelisted\n", "from util.bad_request_rate_limiter import BadRequestRateLimiter\n", "from util.date_utils import strftime_localized\n", "AUDIT_LOG = logging.getLogger('audit')\n", "log = logging.getLogger(__name__)\n", "User = get_user_model()\n", "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "redirect_to = get_next_url_for_login_page(request)\n", "if request.user.is_authenticated():\n", "return redirect(redirect_to)\n", "form_descriptions = _get_form_descriptions(request)\n", "third_party_auth_hint = None\n", "if '?' in redirect_to:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "next_args = urlparse.parse_qs(urlparse.urlparse(redirect_to).query)\n", "if initial_mode == 'login':\n", "ext_auth_response = _external_auth_intercept(request, initial_mode)\n", "provider_id = next_args['tpa_hint'][0]\n", "return old_login_view(request)\n", "if initial_mode == 'register':\n", "if ext_auth_response is not None:\n", "tpa_hint_provider = third_party_auth.provider.Registry.get(provider_id=\n provider_id)\n", "return old_register_view(request)\n", "return ext_auth_response\n", "account_activation_messages = [{'message': message.message, 'tags': message\n .tags} for message in messages.get_messages(request) if \n 'account-activation' in message.tags]\n", "if tpa_hint_provider:\n", "context = {'data': {'login_redirect_url': redirect_to, 'initial_mode':\n initial_mode, 'third_party_auth': _third_party_auth_context(request,\n redirect_to, third_party_auth_hint), 'third_party_auth_hint': \n third_party_auth_hint or '', 'platform_name': configuration_helpers.\n get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'support_link':\n configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.\n SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': account_activation_messages,\n 'login_form_desc': json.loads(form_descriptions['login']),\n 'registration_form_desc': json.loads(form_descriptions['registration']),\n 'password_reset_form_desc': json.loads(form_descriptions[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url':\n redirect_to, 'responsive': True, 'allow_iframing': True,\n 'disable_courseware_js': True, 'combined_login_and_register': True,\n 'disable_footer': not configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if tpa_hint_provider.skip_hinted_login_dialog:\n", "context = update_context_for_enterprise(request, context)\n", "return redirect(pipeline.get_login_url(provider_id, pipeline.\n AUTH_ENTRY_LOGIN, redirect_url=redirect_to))\n", "third_party_auth_hint = provider_id\n", "response = render_to_response('student_account/login_and_register.html',\n context)\n", "initial_mode = 'hinted_login'\n", "response.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Condition", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Condition", "Assign'", "Return'", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_10(self):...\n", "" ]
[ "def local_edit(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self):...\n", "return self.title\n" ]
[ "def get_feed(self):...\n", "return self.title\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]