lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_7(self, VAR_18):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_18.isdigit():\n", "return CLASS_0.INVALID_ID\n", "VAR_19 = self.__con.cursor()\n", "return CLASS_0.SUCCESS if VAR_19.execute(\n 'UPDATE tasks SET completed=TRUE WHERE taskid=%d' % int(VAR_18)\n ) else CLASS_0.DOES_NOT_EXIST\n" ]
[ "def complete_task(self, taskid):...\n", "\"\"\"docstring\"\"\"\n", "if not taskid.isdigit():\n", "return Database.INVALID_ID\n", "cur = self.__con.cursor()\n", "return Database.SUCCESS if cur.execute(\n 'UPDATE tasks SET completed=TRUE WHERE taskid=%d' % int(taskid)\n ) else Database.DOES_NOT_EXIST\n" ]
[ 0, 0, 0, 0, 0, 2 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Return'" ]
[ "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_11(self, VAR_9, VAR_10=None):...\n", "if isinstance(VAR_9, str) or callable(VAR_9):\n", "self.params.append(VAR_9)\n", "VAR_48 = len(self.params)\n", "if VAR_10:\n", "for VAR_51 in VAR_9:\n", "self.params.add_name(VAR_10)\n", "self._set_params_item(VAR_51)\n", "if VAR_10:\n", "self.params.set_name(VAR_10, VAR_48, end=len(self.params))\n" ]
[ "def _set_params_item(self, item, name=None):...\n", "if isinstance(item, str) or callable(item):\n", "self.params.append(item)\n", "start = len(self.params)\n", "if name:\n", "for i in item:\n", "self.params.add_name(name)\n", "self._set_params_item(i)\n", "if name:\n", "self.params.set_name(name, start, end=len(self.params))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "For", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "@Endpoint('GET', '/lsdir')...\n", "if VAR_19 is None:\n", "VAR_19 = '/'\n", "VAR_20 = int(VAR_20)\n", "if VAR_20 > 5:\n", "logger.warning('[NFS] Limiting depth to maximum value of 5: input depth=%s',\n VAR_20)\n", "VAR_19 = '{}/'.format(VAR_19) if not VAR_19.endswith('/') else VAR_19\n", "VAR_20 = 5\n", "VAR_28 = CephFS()\n", "return {'paths': []}\n", "VAR_29 = VAR_28.get_dir_list(VAR_19, VAR_20)\n", "VAR_29 = [p[:-1] for p in VAR_29 if p != VAR_19]\n", "return {'paths': VAR_29}\n" ]
[ "@Endpoint('GET', '/lsdir')...\n", "if root_dir is None:\n", "root_dir = '/'\n", "depth = int(depth)\n", "if depth > 5:\n", "logger.warning('[NFS] Limiting depth to maximum value of 5: input depth=%s',\n depth)\n", "root_dir = '{}/'.format(root_dir) if not root_dir.endswith('/') else root_dir\n", "depth = 5\n", "cfs = CephFS()\n", "return {'paths': []}\n", "paths = cfs.get_dir_list(root_dir, depth)\n", "paths = [p[:-1] for p in paths if p != root_dir]\n", "return {'paths': paths}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_9(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_19 = VAR_9.split()\n", "if not len(VAR_19) == 1:\n", "print('register: incorrect arguments; input only your username')\n", "VAR_15 = VAR_19[0]\n", "return\n", "VAR_20 = FUNC_0('check_username_exists {}'.format(VAR_15))\n", "if VAR_20 == 'True':\n", "print(\"Sorry, that username's already taken.\")\n", "VAR_21 = getpass.getpass(VAR_4='New shrub password: ')\n", "return\n", "VAR_22 = getpass.getpass(VAR_4='Github password: ')\n", "VAR_20 = FUNC_0('register{} {} {} {}'.format(self.insecure_mode, VAR_15,\n VAR_21, VAR_22))\n", "print(VAR_20)\n" ]
[ "def do_register(self, line):...\n", "\"\"\"docstring\"\"\"\n", "linesplit = line.split()\n", "if not len(linesplit) == 1:\n", "print('register: incorrect arguments; input only your username')\n", "username = linesplit[0]\n", "return\n", "response = send_unauthenticated_cmd('check_username_exists {}'.format(username)\n )\n", "if response == 'True':\n", "print(\"Sorry, that username's already taken.\")\n", "shrub_pass = getpass.getpass(prompt='New shrub password: ')\n", "return\n", "github_pass = getpass.getpass(prompt='Github password: ')\n", "response = send_unauthenticated_cmd('register{} {} {} {}'.format(self.\n insecure_mode, username, shrub_pass, github_pass))\n", "print(response)\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "@validate(VUser(), VAR_0=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', VAR_27=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tzoffset=meetup.tzoffset)).render()\n" ]
[ "@validate(VUser(), meetup=VEditMeetup('id'))...\n", "return BoringPage(pagename='Edit Meetup', content=EditMeetup(meetup, title=\n meetup.title, description=meetup.description, location=meetup.location,\n latitude=meetup.latitude, longitude=meetup.longitude, timestamp=int(\n meetup.timestamp * 1000), tzoffset=meetup.tzoffset)).render()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_23(VAR_38, VAR_39):...\n", "\"\"\"docstring\"\"\"\n", "VAR_65 = cmp(len(VAR_39[1][0]), len(VAR_38[1][0]))\n", "if VAR_65:\n", "return VAR_65\n", "if VAR_38[0].isComposite() and VAR_39[0].isComposite():\n", "VAR_85 = sum(VAR_38[1][1]) / len(VAR_38[1][1])\n", "return cmp(len(str(VAR_39[0])), len(str(VAR_38[0])))\n", "VAR_86 = sum(VAR_39[1][1]) / len(VAR_39[1][1])\n", "VAR_87 = cmp(VAR_86, VAR_85)\n", "if VAR_87:\n", "return VAR_87\n" ]
[ "def _skw_matches_comparator(kw0, kw1):...\n", "\"\"\"docstring\"\"\"\n", "list_comparison = cmp(len(kw1[1][0]), len(kw0[1][0]))\n", "if list_comparison:\n", "return list_comparison\n", "if kw0[0].isComposite() and kw1[0].isComposite():\n", "component_avg0 = sum(kw0[1][1]) / len(kw0[1][1])\n", "return cmp(len(str(kw1[0])), len(str(kw0[0])))\n", "component_avg1 = sum(kw1[1][1]) / len(kw1[1][1])\n", "component_comparison = cmp(component_avg1, component_avg0)\n", "if component_comparison:\n", "return component_comparison\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_6(self, VAR_3):...\n", "if VAR_3.address == self.master.address:\n", "return 'manager'\n", "if VAR_3.is_installed('ovirt-node-ng-nodectl'):\n", "return 'rhvh'\n", "return 'rhelh'\n" ]
[ "def set_node_label(self, node):...\n", "if node.address == self.master.address:\n", "return 'manager'\n", "if node.is_installed('ovirt-node-ng-nodectl'):\n", "return 'rhvh'\n", "return 'rhelh'\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_14(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return partial(FUNC_5, VAR_1)\n" ]
[ "def make_token_getter(remote):...\n", "\"\"\"docstring\"\"\"\n", "return partial(token_getter, remote)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_38(self):...\n", "" ]
[ "def _update_default_tester(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@VAR_2.route('/entrants')...\n", "if VAR_0 == None:\n", "FUNC_16()\n", "VAR_8 = 'SELECT base_url FROM analyzed;'\n", "VAR_30 = VAR_0.exec(VAR_8, debug=False)\n", "if VAR_4 == None:\n", "VAR_4 = []\n", "for p in VAR_4:\n", "for p in request.args:\n", "VAR_33 = \"url = '{}' \".format(VAR_30[0][0]) + ' '.join([\"OR url = '{}'\".\n format(url[0]) for url in VAR_30[1:]])\n", "return json.dumps(VAR_30)\n", "VAR_4.append(request.args[p])\n", "VAR_8 = 'string'.format(p, p, VAR_33)\n", "VAR_30 = VAR_0.exec(VAR_8)\n", "if len(VAR_30) == 0:\n", "return json.dumps([])\n" ]
[ "@endpoints.route('/entrants')...\n", "if db == None:\n", "init()\n", "sql = 'SELECT base_url FROM analyzed;'\n", "urls = db.exec(sql, debug=False)\n", "if players == None:\n", "players = []\n", "for p in players:\n", "for p in request.args:\n", "or_clause = \"url = '{}' \".format(urls[0][0]) + ' '.join([\"OR url = '{}'\".\n format(url[0]) for url in urls[1:]])\n", "return json.dumps(urls)\n", "players.append(request.args[p])\n", "sql = (\n \"SELECT url, min(scene) scene, min(display_name) display_name, min(date) date FROM matches WHERE (player1='{}' or player2='{}') AND ({}) GROUP BY url ORDER BY date DESC;\"\n .format(p, p, or_clause))\n", "urls = db.exec(sql)\n", "if len(urls) == 0:\n", "return json.dumps([])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "For", "For", "Assign'", "Return'", "Expr'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_28(self):...\n", "if not self._normalized_jdk_paths:\n", "return ()\n", "VAR_37 = normalize_os_name(os.uname()[0].lower())\n", "if VAR_37 not in self._normalized_jdk_paths:\n", "VAR_0.warning(\n '--jvm-distributions-paths was specified, but has no entry for \"{}\".'.\n format(VAR_37))\n", "return self._normalized_jdk_paths.get(VAR_37, ())\n" ]
[ "def _get_explicit_jdk_paths(self):...\n", "if not self._normalized_jdk_paths:\n", "return ()\n", "os_name = normalize_os_name(os.uname()[0].lower())\n", "if os_name not in self._normalized_jdk_paths:\n", "logger.warning(\n '--jvm-distributions-paths was specified, but has no entry for \"{}\".'.\n format(os_name))\n", "return self._normalized_jdk_paths.get(os_name, ())\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "" ]
[ "@utils.synchronized('3par', external=True)...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_14(self, VAR_14):...\n", "" ]
[ "def is_boolean(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_7(self):...\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndRaise(urllib2.URLError('url'))\n", "time.sleep(mox.IgnoreArg())\n", "VAR_2 = 'True'\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndReturn(StringIO.StringIO(VAR_2))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=2), VAR_2)\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenSuccessAfterFailure(self):...\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndRaise(urllib2.URLError('url'))\n", "time.sleep(mox.IgnoreArg())\n", "response = 'True'\n", "url_helper.urllib2.urlopen(mox.IgnoreArg(), mox.IgnoreArg(), timeout=mox.\n IgnoreArg()).AndReturn(StringIO.StringIO(response))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen('url', max_tries=2), response)\n", "self._mox.VerifyAll()\n" ]
[ 0, 5, 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_9, str):\n", "return VAR_9\n", "if isinstance(VAR_9, unicode):\n", "return VAR_9.encode('utf-8')\n", "return str(VAR_9)\n" ]
[ "def _ConvertToAscii(value):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(value, str):\n", "return value\n", "if isinstance(value, unicode):\n", "return value.encode('utf-8')\n", "return str(value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_9(VAR_19):...\n", "VAR_33 = []\n", "for cur_root, _subdirs, files in os.walk(VAR_19):\n", "for f in files:\n", "return VAR_33\n", "VAR_46 = os.path.join(cur_root, f), os.path.join(FUNC_10(VAR_19, cur_root), f)\n", "VAR_33.append(VAR_46)\n" ]
[ "def template_paths(root):...\n", "res = []\n", "for cur_root, _subdirs, files in os.walk(root):\n", "for f in files:\n", "return res\n", "inout = os.path.join(cur_root, f), os.path.join(strip_prefix(root, cur_root), f\n )\n", "res.append(inout)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "For", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_17(self, VAR_14):...\n", "" ]
[ "def is_relation(self, col_name):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = self.bindings['TEST_APP_COMPONENT_NAME']\n", "VAR_1 = self.bindings\n", "VAR_9 = self.agent.make_json_payload_from_kwargs(job=[{'type':\n 'deleteLoadBalancer', 'cloudProvider': 'gce', 'loadBalancerName':\n load_balancer_name, 'region': bindings['TEST_GCE_REGION'], 'regions': [\n bindings['TEST_GCE_REGION']], 'credentials': bindings['GCE_CREDENTIALS'\n ], 'user': '[anonymous]'}], description=\n 'Delete Load Balancer: {0} in {1}:{2}'.format(load_balancer_name,\n bindings['GCE_CREDENTIALS'], bindings['TEST_GCE_REGION']), application=\n self.TEST_APP)\n", "VAR_10 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_10.new_clause_builder('Health Check Removed', retryable_for_secs=30\n ).list_resources('http-health-checks').excludes_path_value('name', \n '%s-hc' % VAR_6)\n", "VAR_10.new_clause_builder('TargetPool Removed').list_resources('target-pools'\n ).excludes_path_value('name', '%s-tp' % VAR_6)\n", "VAR_10.new_clause_builder('Forwarding Rule Removed').list_resources(\n 'forwarding-rules').excludes_path_value('name', VAR_6)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer', data=payload, path='tasks'), VAR_5=builder.build())\n" ]
[ "def delete_load_balancer(self):...\n", "\"\"\"docstring\"\"\"\n", "load_balancer_name = self.bindings['TEST_APP_COMPONENT_NAME']\n", "bindings = self.bindings\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'type':\n 'deleteLoadBalancer', 'cloudProvider': 'gce', 'loadBalancerName':\n load_balancer_name, 'region': bindings['TEST_GCE_REGION'], 'regions': [\n bindings['TEST_GCE_REGION']], 'credentials': bindings['GCE_CREDENTIALS'\n ], 'user': '[anonymous]'}], description=\n 'Delete Load Balancer: {0} in {1}:{2}'.format(load_balancer_name,\n bindings['GCE_CREDENTIALS'], bindings['TEST_GCE_REGION']), application=\n self.TEST_APP)\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Health Check Removed', retryable_for_secs=30\n ).list_resources('http-health-checks').excludes_path_value('name', \n '%s-hc' % load_balancer_name)\n", "builder.new_clause_builder('TargetPool Removed').list_resources('target-pools'\n ).excludes_path_value('name', '%s-tp' % load_balancer_name)\n", "builder.new_clause_builder('Forwarding Rule Removed').list_resources(\n 'forwarding-rules').excludes_path_value('name', load_balancer_name)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_load_balancer', data=payload, path='tasks'), contract=builder.\n build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "@defer.inlineCallbacks...\n", "yield self._services_factory.create_services_from(VAR_13)\n", "if VAR_13.fresh_account:\n", "yield add_welcome_mail(VAR_13.mail_store)\n" ]
[ "@defer.inlineCallbacks...\n", "yield self._services_factory.create_services_from(leap_session)\n", "if leap_session.fresh_account:\n", "yield add_welcome_mail(leap_session.mail_store)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_21(self, VAR_1):...\n", "VAR_16 = [VAR_25.fieldname for VAR_25 in self.meta.get_table_fields() if \n VAR_25.options == VAR_1]\n", "return VAR_16[0] if VAR_16 else None\n" ]
[ "def get_parentfield_of_doctype(self, doctype):...\n", "fieldname = [df.fieldname for df in self.meta.get_table_fields() if df.\n options == doctype]\n", "return fieldname[0] if fieldname else None\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "from copy import copy\n", "def FUNC_0(VAR_0, VAR_1, VAR_2):...\n", "VAR_5 = VAR_0['points']\n", "VAR_6 = copy(VAR_0['points_by_difficulty'])\n", "def FUNC_2(VAR_7):...\n", "if isinstance(VAR_7, list):\n", "VAR_15, VAR_16 = zip(*VAR_7)\n", "return VAR_5 >= VAR_7\n", "for i, VAR_21 in enumerate(VAR_15):\n", "if VAR_2:\n", "return True\n", "VAR_17 = VAR_6.get(VAR_21, 0)\n", "if VAR_6.get(VAR_21, 0) < VAR_16[i]:\n", "VAR_18 = VAR_16[i]\n", "return False\n", "if VAR_17 < VAR_18:\n", "for j in range(i + 1, len(VAR_15)):\n", "VAR_19 = VAR_15[j]\n", "VAR_20 = VAR_6.get(VAR_19, 0)\n", "if VAR_20 > VAR_18 - VAR_17:\n", "VAR_6[VAR_19] -= VAR_18 - VAR_17\n", "VAR_17 += VAR_20\n", "VAR_6[VAR_21] = VAR_18\n", "VAR_6[VAR_21] = VAR_17\n", "VAR_6[VAR_19] = 0\n" ]
[ "from copy import copy\n", "def calculate_grade(total_points, point_limits, pad_points):...\n", "points = total_points['points']\n", "d_points = copy(total_points['points_by_difficulty'])\n", "def pass_limit(bound):...\n", "if isinstance(bound, list):\n", "ds, ls = zip(*bound)\n", "return points >= bound\n", "for i, d in enumerate(ds):\n", "if pad_points:\n", "return True\n", "p = d_points.get(d, 0)\n", "if d_points.get(d, 0) < ls[i]:\n", "l = ls[i]\n", "return False\n", "if p < l:\n", "for j in range(i + 1, len(ds)):\n", "jd = ds[j]\n", "jp = d_points.get(jd, 0)\n", "if jp > l - p:\n", "d_points[jd] -= l - p\n", "p += jp\n", "d_points[d] = l\n", "d_points[d] = p\n", "d_points[jd] = 0\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 ]
[ "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Condition", "Assign'", "Return'", "For", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Return'", "Condition", "For", "Assign'", "Assign'", "Condition", "AugAssign'", "AugAssign'", "Assign'", "Assign'", "Assign'" ]
[ "@staticmethod...\n", "return 1\n" ]
[ "@staticmethod...\n", "return 1\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_snapshot(VAR_9)\n", "self.common.client_logout()\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "self.common.client_login()\n", "self.common.delete_snapshot(snapshot)\n", "self.common.client_logout()\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_7 = Pa11yCrawler('')\n", "self.assertEqual(VAR_7.cmd, self._expected_command(VAR_7.pa11y_report_dir,\n VAR_7.start_urls))\n" ]
[ "def test_default(self):...\n", "suite = Pa11yCrawler('')\n", "self.assertEqual(suite.cmd, self._expected_command(suite.pa11y_report_dir,\n suite.start_urls))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_28(self, VAR_5):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "VAR_18 = vimsupport.CurrentFiletypes()[0]\n", "if VAR_18 in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(VAR_18)\n", "VAR_5['syntax_keywords'] = list(syntax_parse.SyntaxKeywordsForCurrentBuffer())\n" ]
[ "def _AddSyntaxDataIfNeeded(self, extra_data):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "filetype = vimsupport.CurrentFiletypes()[0]\n", "if filetype in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(filetype)\n", "extra_data['syntax_keywords'] = list(syntax_parse.\n SyntaxKeywordsForCurrentBuffer())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "import tornado.ioloop\n", "import tornado.web\n", "import tornado.websocket\n", "import tornado.httpclient\n", "import tornado.httpserver\n", "import tornado.gen\n", "import os\n", "from datetime import datetime\n", "import ContentConverter\n", "def FUNC_1(self):...\n", "VAR_6 = ContentConverter.getAllPostsList()\n", "self.render('templates/Home.html', VAR_6=allPosts)\n", "def FUNC_1(self, VAR_0):...\n", "VAR_7 = 'Blog: ' + VAR_0\n", "VAR_8 = ContentConverter.getRenderedBody(VAR_0)\n", "if not VAR_8:\n", "VAR_8 = \"<p>The post under '{}' does not exist.</p>\".format(VAR_0)\n", "self.render('templates/BlogPost.html', title=contentTitle, postBody=\n renderedBody)\n", "def FUNC_0():...\n", "return tornado.web.Application([('/', CLASS_0), ('/blog/(.*)', CLASS_1), (\n '/webResources/(.*)', tornado.web.StaticFileHandler, {'path':\n 'webResources'})], xsrf_cookies=True, cookie_secret='this is my org blog')\n" ]
[ "import tornado.ioloop\n", "import tornado.web\n", "import tornado.websocket\n", "import tornado.httpclient\n", "import tornado.httpserver\n", "import tornado.gen\n", "import os\n", "from datetime import datetime\n", "import ContentConverter\n", "def get(self):...\n", "allPosts = ContentConverter.getAllPostsList()\n", "self.render('templates/Home.html', allPosts=allPosts)\n", "def get(self, request):...\n", "contentTitle = 'Blog: ' + request\n", "renderedBody = ContentConverter.getRenderedBody(request)\n", "if not renderedBody:\n", "renderedBody = \"<p>The post under '{}' does not exist.</p>\".format(request)\n", "self.render('templates/BlogPost.html', title=contentTitle, postBody=\n renderedBody)\n", "def make_app():...\n", "return tornado.web.Application([('/', HomeHandler), ('/blog/(.*)',\n BlogHandler), ('/webResources/(.*)', tornado.web.StaticFileHandler, {\n 'path': 'webResources'})], xsrf_cookies=True, cookie_secret=\n 'this is my org blog')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 5, 0, 5, 5, 0, 5 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "FunctionDef'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "FunctionDef'", "Return'" ]
[ "def FUNC_13(self, *VAR_13, **VAR_14):...\n", "for VAR_9 in VAR_13:\n", "self._set_log_item(VAR_9)\n", "for VAR_10, VAR_9 in VAR_14.items():\n", "self._set_log_item(VAR_9, VAR_10=name)\n" ]
[ "def set_log(self, *logs, **kwlogs):...\n", "for item in logs:\n", "self._set_log_item(item)\n", "for name, item in kwlogs.items():\n", "self._set_log_item(item, name=name)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "For", "Expr'" ]
[ "def FUNC_24(VAR_36):...\n", "return type(VAR_36).__name__ == 'cython_function_or_method'\n" ]
[ "def check_cython(x):...\n", "return type(x).__name__ == 'cython_function_or_method'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = self.agent.type_to_payload(\n 'registerInstancesWithGoogleLoadBalancerDescription', {\n 'loadBalancerNames': [self.__use_lb_name], 'instanceIds': self.\n use_instance_names[:2], 'region': self.bindings['TEST_GCE_REGION'],\n 'credentials': self.bindings['GCE_CREDENTIALS']})\n", "VAR_20 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_20.new_clause_builder('Instances in Target Pool', retryable_for_secs=15\n ).list_resources('target-pools').contains_pred_list([jc.\n PathContainsPredicate('name', self.__use_lb_tp_name), jc.\n PathEqPredicate('region', self.bindings['TEST_GCE_REGION']), jc.\n PathElementsContainPredicate('instances', self.use_instance_names[0]),\n jc.PathElementsContainPredicate('instances', self.use_instance_names[1])]\n ).excludes_pred_list([jc.PathContainsPredicate('name', self.\n __use_lb_tp_name), jc.PathElementsContainPredicate('instances', self.\n use_instance_names[2])])\n", "return st.OperationContract(self.new_post_operation(title=\n 'register_load_balancer_instances', data=payload, VAR_29='ops'),\n contract=builder.build())\n" ]
[ "def register_load_balancer_instances(self):...\n", "\"\"\"docstring\"\"\"\n", "payload = self.agent.type_to_payload(\n 'registerInstancesWithGoogleLoadBalancerDescription', {\n 'loadBalancerNames': [self.__use_lb_name], 'instanceIds': self.\n use_instance_names[:2], 'region': self.bindings['TEST_GCE_REGION'],\n 'credentials': self.bindings['GCE_CREDENTIALS']})\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Instances in Target Pool', retryable_for_secs=15\n ).list_resources('target-pools').contains_pred_list([jc.\n PathContainsPredicate('name', self.__use_lb_tp_name), jc.\n PathEqPredicate('region', self.bindings['TEST_GCE_REGION']), jc.\n PathElementsContainPredicate('instances', self.use_instance_names[0]),\n jc.PathElementsContainPredicate('instances', self.use_instance_names[1])]\n ).excludes_pred_list([jc.PathContainsPredicate('name', self.\n __use_lb_tp_name), jc.PathElementsContainPredicate('instances', self.\n use_instance_names[2])])\n", "return st.OperationContract(self.new_post_operation(title=\n 'register_load_balancer_instances', data=payload, path='ops'), contract\n =builder.build())\n" ]
[ 0, 0, 0, 0, 1, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@memoized_property...\n", "return self._zinc_factory.tool_classpath_from_products(self._products, self\n .ZINC_EXTRACTOR_TOOL_NAME, VAR_25=self._zinc_factory.options_scope)\n" ]
[ "@memoized_property...\n", "return self._zinc_factory.tool_classpath_from_products(self._products, self\n .ZINC_EXTRACTOR_TOOL_NAME, scope=self._zinc_factory.options_scope)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "if not FUNC_0(self.request.host):\n" ]
[ "def prepare(self):...\n", "\"\"\"docstring\"\"\"\n", "if not validate_host(self.request.host):\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition" ]
[ "def FUNC_11(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_21)\n", "return False\n", "return VAR_24[VAR_2] == VAR_13\n" ]
[ "def isfile(self, path):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(path)\n", "return False\n", "return f[A_TYPE] == T_FILE\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_34 = self._accessor.get_by_id(VAR_6)\n", "if not VAR_34 is None:\n", "VAR_37 = get_current_registry()\n", "VAR_40 = None\n", "VAR_39 = VAR_37.getUtility(IDataTraversalProxyFactory)\n", "return VAR_40\n", "VAR_40 = VAR_39.make_proxy(VAR_34, self._accessor, self.relationship_direction)\n" ]
[ "def get_matching(self, source_id):...\n", "\"\"\"docstring\"\"\"\n", "value = self._accessor.get_by_id(source_id)\n", "if not value is None:\n", "reg = get_current_registry()\n", "prx = None\n", "prx_fac = reg.getUtility(IDataTraversalProxyFactory)\n", "return prx\n", "prx = prx_fac.make_proxy(value, self._accessor, self.relationship_direction)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_10(self):...\n", "\"\"\"docstring\"\"\"\n", "settings.SSH_PRIVATE_KEY = ''\n", "VAR_2 = '/api/apps'\n", "VAR_5 = {'id': 'autotest'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "VAR_2 = '/api/apps/{app_id}/run'.format(**locals())\n", "VAR_5 = {'command': 'ls -al'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEquals(VAR_3.status_code, 400)\n", "self.assertEquals(VAR_3.data, 'Support for admin commands is not configured')\n" ]
[ "def test_run_without_auth(self):...\n", "\"\"\"docstring\"\"\"\n", "settings.SSH_PRIVATE_KEY = ''\n", "url = '/api/apps'\n", "body = {'id': 'autotest'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}/run'.format(**locals())\n", "body = {'command': 'ls -al'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEquals(response.status_code, 400)\n", "self.assertEquals(response.data, 'Support for admin commands is not configured'\n )\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_1):...\n", "self.declared_handlers = [('/static/(.*)', tornado.web.StaticFileHandler, {\n 'path': 'static/'}), ('/(favicon.ico)', tornado.web.StaticFileHandler,\n {'path': 'static/img/'}), ('/release/(?P<dataset>[^\\\\/]+)/(?P<file>.*)',\n handlers.AuthorizedStaticNginxFileHanlder, {'path': '/release-files/'}),\n ('/login', handlers.LoginHandler), ('/logout', handlers.LogoutHandler),\n ('/api/countries', VAR_2.CountryList), ('/api/users/me', VAR_2.GetUser),\n ('/api/datasets', VAR_2.ListDatasets), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)', VAR_2.GetDataset), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/log/(?P<event>[^\\\\/]+)', VAR_2.\n LogEvent), ('/api/datasets/(?P<dataset>[^\\\\/]+)/logo', VAR_2.ServeLogo),\n ('/api/datasets/(?P<dataset>[^\\\\/]+)/files', VAR_2.DatasetFiles), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/sample_set', VAR_2.SampleSet), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users', VAR_2.DatasetUsers), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/request',\n VAR_2.RequestAccess), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/approve',\n VAR_2.ApproveUser), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/revoke',\n VAR_2.RevokeUser), ('/api/query', beacon.Query), ('/api/info', beacon.\n Info), ('/query', beacon.Query), ('/info', tornado.web.RedirectHandler,\n {'url': '/api/info'}), ('.*', VAR_2.Home)]\n", "self.oauth_key = VAR_1['google_oauth']['key']\n", "tornado.web.Application.__init__(self, self.declared_handlers, **settings)\n" ]
[ "def __init__(self, settings):...\n", "self.declared_handlers = [('/static/(.*)', tornado.web.StaticFileHandler, {\n 'path': 'static/'}), ('/(favicon.ico)', tornado.web.StaticFileHandler,\n {'path': 'static/img/'}), ('/release/(?P<dataset>[^\\\\/]+)/(?P<file>.*)',\n handlers.AuthorizedStaticNginxFileHanlder, {'path': '/release-files/'}),\n ('/login', handlers.LoginHandler), ('/logout', handlers.LogoutHandler),\n ('/api/countries', application.CountryList), ('/api/users/me',\n application.GetUser), ('/api/datasets', application.ListDatasets), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)', application.GetDataset), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/log/(?P<event>[^\\\\/]+)',\n application.LogEvent), ('/api/datasets/(?P<dataset>[^\\\\/]+)/logo',\n application.ServeLogo), ('/api/datasets/(?P<dataset>[^\\\\/]+)/files',\n application.DatasetFiles), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/sample_set', application.SampleSet),\n ('/api/datasets/(?P<dataset>[^\\\\/]+)/users', application.DatasetUsers),\n ('/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/request',\n application.RequestAccess), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/approve',\n application.ApproveUser), (\n '/api/datasets/(?P<dataset>[^\\\\/]+)/users/(?P<email>[^\\\\/]+)/revoke',\n application.RevokeUser), ('/api/query', beacon.Query), ('/api/info',\n beacon.Info), ('/query', beacon.Query), ('/info', tornado.web.\n RedirectHandler, {'url': '/api/info'}), ('.*', application.Home)]\n", "self.oauth_key = settings['google_oauth']['key']\n", "tornado.web.Application.__init__(self, self.declared_handlers, **settings)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_1():...\n", "VAR_1 = [{'fieldname': 'territory', 'fieldtype': 'Link', 'label': _(\n 'Territory'), 'options': 'Territory', 'width': 100}, {'fieldname':\n 'item_group', 'fieldtype': 'Link', 'label': _('Item Group'), 'options':\n 'Item Group', 'width': 150}, {'fieldname': 'item_name', 'fieldtype':\n 'Link', 'options': 'Item', 'label': 'Item', 'width': 150}, {'fieldname':\n 'item_name', 'fieldtype': 'Data', 'label': _('Item Name'), 'width': 150\n }, {'fieldname': 'customer', 'fieldtype': 'Link', 'label': _('Customer'\n ), 'options': 'Customer', 'width': 100}, {'fieldname':\n 'last_order_date', 'fieldtype': 'Date', 'label': _('Last Order Date'),\n 'width': 100}, {'fieldname': 'qty', 'fieldtype': 'Float', 'label': _(\n 'Quantity'), 'width': 100}, {'fieldname': 'days_since_last_order',\n 'fieldtype': 'Int', 'label': _('Days Since Last Order'), 'width': 100}]\n", "return VAR_1\n" ]
[ "def get_columns():...\n", "columns = [{'fieldname': 'territory', 'fieldtype': 'Link', 'label': _(\n 'Territory'), 'options': 'Territory', 'width': 100}, {'fieldname':\n 'item_group', 'fieldtype': 'Link', 'label': _('Item Group'), 'options':\n 'Item Group', 'width': 150}, {'fieldname': 'item_name', 'fieldtype':\n 'Link', 'options': 'Item', 'label': 'Item', 'width': 150}, {'fieldname':\n 'item_name', 'fieldtype': 'Data', 'label': _('Item Name'), 'width': 150\n }, {'fieldname': 'customer', 'fieldtype': 'Link', 'label': _('Customer'\n ), 'options': 'Customer', 'width': 100}, {'fieldname':\n 'last_order_date', 'fieldtype': 'Date', 'label': _('Last Order Date'),\n 'width': 100}, {'fieldname': 'qty', 'fieldtype': 'Float', 'label': _(\n 'Quantity'), 'width': 100}, {'fieldname': 'days_since_last_order',\n 'fieldtype': 'Int', 'label': _('Days Since Last Order'), 'width': 100}]\n", "return columns\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@FUNC_3.setter...\n", "self._parse('leading_slash', VAR_9)\n" ]
[ "@leading_slash.setter...\n", "self._parse('leading_slash', value)\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_21(VAR_10):...\n", "VAR_9.append(1)\n", "return False\n" ]
[ "def setup_bot(_bot):...\n", "setup_bots.append(1)\n", "return False\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 3\n", "VAR_10 = 'string'.format(repo_dir=REPO_DIR, shard_str='/shard_' + self.\n shard if self.shard else '', procs=process_count)\n", "VAR_7 = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(VAR_7), VAR_10)\n" ]
[ "def test_verbosity_settings_3_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "process_count = 3\n", "expected_verbosity_string = (\n '--with-xunitmp --xunitmp-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --processes={procs} --no-color --process-timeout=1200'\n .format(repo_dir=REPO_DIR, shard_str='/shard_' + self.shard if self.\n shard else '', procs=process_count))\n", "suite = BokChoyTestSuite('', num_processes=process_count)\n", "self.assertEqual(BokChoyTestSuite.verbosity_processes_string(suite),\n expected_verbosity_string)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.error(VAR_1)\n", "self.console.error(VAR_1)\n" ]
[ "def log_error(self, msg):...\n", "\"\"\"docstring\"\"\"\n", "self.logger.error(msg)\n", "self.console.error(msg)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'" ]
[ "import database\n", "from database import cgi\n", "from database import db\n", "def FUNC_0(self):...\n", "VAR_1 = db.GqlQuery('SELECT * FROM Item ORDER BY created_at DESC')\n", "VAR_2 = database.users.is_current_user_admin()\n", "database.render_template(self, 'items/index.html', {'items': VAR_1})\n", "def FUNC_0(self):...\n", "if database.users.get_current_user():\n", "database.render_template(self, 'items/new_item.html', {})\n", "self.redirect('/')\n", "def FUNC_0(self):...\n", "VAR_3 = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "VAR_4 = db.GqlQuery('SELECT * FROM LoginInformation WHERE user_id = :1',\n VAR_3.created_by_id).get()\n", "database.render_template(self, 'items/view_item.html', {'item': VAR_3, 'li':\n VAR_4})\n", "def FUNC_1(self):...\n", "VAR_5 = database.users.get_current_user()\n", "if VAR_5:\n", "VAR_3 = database.Item()\n", "self.redirect('/')\n", "VAR_3.title = cgi.escape(self.request.get('title'))\n", "def FUNC_0(self):...\n", "VAR_3.description = cgi.escape(self.request.get('description'))\n", "VAR_5 = database.users.get_current_user()\n", "VAR_3.price = '%.2f' % float(cgi.escape(self.request.get('price')))\n", "if VAR_5:\n", "VAR_3.created_by_id = VAR_5.user_id()\n", "VAR_3 = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "self.redirect(self.request.referer)\n", "VAR_3.put()\n", "if VAR_3.created_by_id == VAR_5.user_id(\n", "def FUNC_0(self):...\n", "database.logging.info(\n \"\"\"Created a new item.\nTitle: %s\nDescription: %s\nPrice: %s\nCreatedBy: %s\"\"\"\n , VAR_3.title, VAR_3.description, VAR_3.price, VAR_3.created_by_id)\n", "database.logging.info('Deleting item with id %s', VAR_3.key().id())\n", "VAR_5 = database.users.get_current_user()\n", "self.redirect('/items/')\n", "database.db.delete(VAR_3)\n", "if VAR_5:\n", "VAR_3 = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "self.redirect('/')\n", "database.render_template(self, 'items/edit_item.html', {'item': VAR_3})\n", "def FUNC_1(self):...\n", "VAR_5 = database.users.get_current_user()\n", "if VAR_5:\n", "VAR_3 = db.get(db.Key.from_path('Item', int(cgi.escape(self.request.get(\n 'item_id')))))\n", "self.redirect('/')\n", "VAR_3.title = cgi.escape(self.request.get('title'))\n", "def FUNC_0(self):...\n", "VAR_3.description = cgi.escape(self.request.get('description'))\n", "VAR_5 = database.users.get_current_user()\n", "VAR_3.price = cgi.escape(self.request.get('price'))\n", "if VAR_5:\n", "database.logging.info(\n \"\"\"Item #%s changed to:\nTitle: %s\nDescription: %s\nPrice: %s\"\"\", VAR_3.\n key().id(), VAR_3.title, VAR_3.description, VAR_3.price)\n", "VAR_1 = db.GqlQuery(\n 'SELECT * FROM Item WHERE created_by_id = :1 ORDER BY created_at DESC',\n VAR_5.user_id())\n", "self.redirect('/')\n", "VAR_3.put()\n", "database.render_template(self, 'items/my_items.html', {'items': VAR_1})\n", "def FUNC_1(self):...\n", "self.redirect('/items/my_items')\n", "VAR_6 = cgi.escape(self.request.get('query'))\n", "VAR_1 = db.GqlQuery(\n 'SELECT * FROM Item WHERE title = :1 ORDER BY created_at DESC', VAR_6)\n", "database.render_template(self, 'items/search.html', {'items': VAR_1,\n 'query': VAR_6})\n", "VAR_0 = database.webapp2.WSGIApplication([('/items/', CLASS_0), (\n '/items/new_item', CLASS_1), ('/items/save_item', CLASS_3), (\n '/items/view_item', CLASS_2), ('/items/search', CLASS_8), (\n '/items/my_items', CLASS_7), ('/items/delete_item', CLASS_4), (\n '/items/edit_item', CLASS_5), ('/items/update_item', CLASS_6)], debug=True)\n" ]
[ "import database\n", "from database import cgi\n", "from database import db\n", "def get(self):...\n", "items = db.GqlQuery('SELECT * FROM Item ORDER BY created_at DESC')\n", "is_admin = database.users.is_current_user_admin()\n", "database.render_template(self, 'items/index.html', {'items': items})\n", "def get(self):...\n", "if database.users.get_current_user():\n", "database.render_template(self, 'items/new_item.html', {})\n", "self.redirect('/')\n", "def get(self):...\n", "item = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "li = db.GqlQuery('SELECT * FROM LoginInformation WHERE user_id = :1', item.\n created_by_id).get()\n", "database.render_template(self, 'items/view_item.html', {'item': item, 'li': li}\n )\n", "def post(self):...\n", "user = database.users.get_current_user()\n", "if user:\n", "item = database.Item()\n", "self.redirect('/')\n", "item.title = cgi.escape(self.request.get('title'))\n", "def get(self):...\n", "item.description = cgi.escape(self.request.get('description'))\n", "user = database.users.get_current_user()\n", "item.price = '%.2f' % float(cgi.escape(self.request.get('price')))\n", "if user:\n", "item.created_by_id = user.user_id()\n", "item = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "self.redirect(self.request.referer)\n", "item.put()\n", "if item.created_by_id == user.user_id(\n", "def get(self):...\n", "database.logging.info(\n \"\"\"Created a new item.\nTitle: %s\nDescription: %s\nPrice: %s\nCreatedBy: %s\"\"\"\n , item.title, item.description, item.price, item.created_by_id)\n", "database.logging.info('Deleting item with id %s', item.key().id())\n", "user = database.users.get_current_user()\n", "self.redirect('/items/')\n", "database.db.delete(item)\n", "if user:\n", "item = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n", "self.redirect('/')\n", "database.render_template(self, 'items/edit_item.html', {'item': item})\n", "def post(self):...\n", "user = database.users.get_current_user()\n", "if user:\n", "item = db.get(db.Key.from_path('Item', int(cgi.escape(self.request.get(\n 'item_id')))))\n", "self.redirect('/')\n", "item.title = cgi.escape(self.request.get('title'))\n", "def get(self):...\n", "item.description = cgi.escape(self.request.get('description'))\n", "user = database.users.get_current_user()\n", "item.price = cgi.escape(self.request.get('price'))\n", "if user:\n", "database.logging.info(\n \"\"\"Item #%s changed to:\nTitle: %s\nDescription: %s\nPrice: %s\"\"\", item.\n key().id(), item.title, item.description, item.price)\n", "items = db.GqlQuery(\n 'SELECT * FROM Item WHERE created_by_id = :1 ORDER BY created_at DESC',\n user.user_id())\n", "self.redirect('/')\n", "item.put()\n", "database.render_template(self, 'items/my_items.html', {'items': items})\n", "def post(self):...\n", "self.redirect('/items/my_items')\n", "query = cgi.escape(self.request.get('query'))\n", "items = db.GqlQuery(\n 'SELECT * FROM Item WHERE title = :1 ORDER BY created_at DESC', query)\n", "database.render_template(self, 'items/search.html', {'items': items,\n 'query': query})\n", "app = database.webapp2.WSGIApplication([('/items/', MainHandler), (\n '/items/new_item', NewHandler), ('/items/save_item', SaveHandler), (\n '/items/view_item', ViewHandler), ('/items/search', SearchHandler), (\n '/items/my_items', ShopHandler), ('/items/delete_item', DeleteHandler),\n ('/items/edit_item', EditHandler), ('/items/update_item', UpdateHandler\n )], debug=True)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Condition", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.bot.say('https://www.youtube.com/watch?v=miVDKgInzyg')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.bot.say('https://www.youtube.com/watch?v=miVDKgInzyg')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_11(VAR_5):...\n", "if VAR_5 == []:\n", "return 'true'\n", "VAR_11 = '('\n", "for i in range(0, len(VAR_5) - 1):\n", "VAR_11 += ' hej.year = ' + VAR_5[i] + ' or '\n", "VAR_11 += ' hej.year = ' + VAR_5[len(VAR_5) - 1] + ' ) '\n", "return VAR_11\n" ]
[ "def makeYears(list):...\n", "if list == []:\n", "return 'true'\n", "result = '('\n", "for i in range(0, len(list) - 1):\n", "result += ' hej.year = ' + list[i] + ' or '\n", "result += ' hej.year = ' + list[len(list) - 1] + ' ) '\n", "return result\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "For", "AugAssign'", "AugAssign'", "Return'" ]
[ "async def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "while True:\n", "await self.next_activity()\n", "await asyncio.sleep(20)\n" ]
[ "async def activity_update_loop(self):...\n", "\"\"\"docstring\"\"\"\n", "while True:\n", "await self.next_activity()\n", "await asyncio.sleep(20)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Docstring", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_11(self):...\n", "return self._latest_completion_request\n" ]
[ "def GetCurrentCompletionRequest(self):...\n", "return self._latest_completion_request\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_29(self, VAR_77):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.priority = VAR_77\n", "return VAR_101\n" ]
[ "def priority(self, priority):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.priority = priority\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_10(self):...\n", "VAR_19 = []\n", "VAR_18 = threading.Event()\n", "self.mock(VAR_18, 'wait', self.fail)\n", "self.mock(bot_main, 'run_manifest', lambda *VAR_24: VAR_19.append(VAR_24))\n", "self.mock(bot_main, 'update_bot', self.fail)\n", "self.expected_requests([(\n 'https://localhost:1/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'xsrf_token': 'token'}), (\n 'https://localhost:1/swarming/api/v1/bot/poll', {'data': self.bot.\n _attributes, 'headers': {'X-XSRF-Token': 'token'}}, {'cmd': 'run',\n 'manifest': {'foo': 'bar'}})])\n", "self.assertTrue(bot_main.poll_server(self.bot, VAR_18))\n", "VAR_6 = [(self.bot, {'foo': 'bar'}, time.time())]\n", "self.assertEqual(VAR_6, VAR_19)\n" ]
[ "def test_poll_server_run(self):...\n", "manifest = []\n", "bit = threading.Event()\n", "self.mock(bit, 'wait', self.fail)\n", "self.mock(bot_main, 'run_manifest', lambda *args: manifest.append(args))\n", "self.mock(bot_main, 'update_bot', self.fail)\n", "self.expected_requests([(\n 'https://localhost:1/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'xsrf_token': 'token'}), (\n 'https://localhost:1/swarming/api/v1/bot/poll', {'data': self.bot.\n _attributes, 'headers': {'X-XSRF-Token': 'token'}}, {'cmd': 'run',\n 'manifest': {'foo': 'bar'}})])\n", "self.assertTrue(bot_main.poll_server(self.bot, bit))\n", "expected = [(self.bot, {'foo': 'bar'}, time.time())]\n", "self.assertEqual(expected, manifest)\n" ]
[ 0, 0, 0, 0, 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_7():...\n", "return pathlib.Path(VAR_0['cache_file_32bit']).exists() and pathlib.Path(VAR_0\n ['cache_file_64bit']).exists()\n" ]
[ "def cache_files_exist():...\n", "return pathlib.Path(CONFIG['cache_file_32bit']).exists() and pathlib.Path(\n CONFIG['cache_file_64bit']).exists()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __eq__(self, VAR_35):...\n", "return self.__class__ == VAR_35.__class__ and self.size == VAR_35.size\n" ]
[ "def __eq__(self, other):...\n", "return self.__class__ == other.__class__ and self.size == other.size\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import itertools\n", "from django.core.exceptions import ObjectDoesNotExist\n", "from django.db.models import Max\n", "from course.models import StudentGroup\n", "from .cache.content import CachedContent\n", "from .models import BaseExercise, Submission\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_0, VAR_1=None):...\n", "self.exercise = VAR_0\n", "self.max_points = getattr(VAR_0, 'max_points', 0)\n", "self.difficulty = getattr(VAR_0, 'difficulty', '')\n", "self.points_to_pass = getattr(VAR_0, 'points_to_pass', 0)\n", "self.user = VAR_1\n", "self.submissions = []\n", "self.submission_count = 0\n", "self.best_submission = None\n", "self.graded = False\n", "self.unofficial = False\n", "if self.user and self.user.is_authenticated():\n", "self.submissions = list(VAR_0.get_submissions_for_student(VAR_1.userprofile))\n", "def FUNC_0(self):...\n", "for VAR_10 in self.submissions:\n", "return self.submission_count\n", "if not VAR_10.status in (Submission.STATUS.ERROR, Submission.STATUS.REJECTED):\n", "self.submission_count += 1\n", "if VAR_10.status == Submission.STATUS.READY and (self.best_submission is\n", "self.best_submission = VAR_10\n", "if VAR_10.status == Submission.STATUS.UNOFFICIAL and (not self.graded or \n", "self.unofficial = False\n", "self.best_submission = VAR_10\n", "self.graded = True\n", "self.unofficial = True\n" ]
[ "import itertools\n", "from django.core.exceptions import ObjectDoesNotExist\n", "from django.db.models import Max\n", "from course.models import StudentGroup\n", "from .cache.content import CachedContent\n", "from .models import BaseExercise, Submission\n", "\"\"\"\n UserExerciseSummary summarises the submissions of a certain user and\n exercise. It calculates some characterizing figures such as the number of\n submissions and reference to the best submission. See the public methods\n for more.\n \"\"\"\n", "def __init__(self, exercise, user=None):...\n", "self.exercise = exercise\n", "self.max_points = getattr(exercise, 'max_points', 0)\n", "self.difficulty = getattr(exercise, 'difficulty', '')\n", "self.points_to_pass = getattr(exercise, 'points_to_pass', 0)\n", "self.user = user\n", "self.submissions = []\n", "self.submission_count = 0\n", "self.best_submission = None\n", "self.graded = False\n", "self.unofficial = False\n", "if self.user and self.user.is_authenticated():\n", "self.submissions = list(exercise.get_submissions_for_student(user.userprofile))\n", "def get_submission_count(self):...\n", "for s in self.submissions:\n", "return self.submission_count\n", "if not s.status in (Submission.STATUS.ERROR, Submission.STATUS.REJECTED):\n", "self.submission_count += 1\n", "if s.status == Submission.STATUS.READY and (self.best_submission is None or\n", "self.best_submission = s\n", "if s.status == Submission.STATUS.UNOFFICIAL and (not self.graded or self.\n", "self.unofficial = False\n", "self.best_submission = s\n", "self.graded = True\n", "self.unofficial = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "FunctionDef'", "For", "Return'", "Condition", "AugAssign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self):...\n", "return \"\"\"\nNO DATA DUMP FOR TASK STATEMENTS\n\"\"\"\n" ]
[ "def specific_info(self):...\n", "return \"\"\"\nNO DATA DUMP FOR TASK STATEMENTS\n\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __str__(self):...\n", "return self.raw_chem_name\n" ]
[ "def __str__(self):...\n", "return self.raw_chem_name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@api.model...\n", "\"\"\"docstring\"\"\"\n", "VAR_62 = super(CLASS_0, self)._notify_prepare_email_values(VAR_43)\n", "VAR_63 = None\n", "if VAR_43.model and self._context.get('custom_layout', False):\n", "VAR_63 = self.env.ref(self._context['custom_layout'], raise_if_not_found=False)\n", "if not VAR_63:\n", "VAR_63 = self.env.ref('mail.mail_template_data_notification_email_default')\n", "if VAR_63.reply_to:\n", "VAR_62['reply_to'] = VAR_63.reply_to\n", "return VAR_62\n" ]
[ "@api.model...\n", "\"\"\"docstring\"\"\"\n", "mail_values = super(ResPartner, self)._notify_prepare_email_values(message)\n", "base_template = None\n", "if message.model and self._context.get('custom_layout', False):\n", "base_template = self.env.ref(self._context['custom_layout'],\n raise_if_not_found=False)\n", "if not base_template:\n", "base_template = self.env.ref(\n 'mail.mail_template_data_notification_email_default')\n", "if base_template.reply_to:\n", "mail_values['reply_to'] = base_template.reply_to\n", "return mail_values\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_0(VAR_10: str):...\n", "for user in VAR_10.split():\n", "call(VAR_2.format(user))\n" ]
[ "def whitelist(users: str):...\n", "for user in users.split():\n", "call(WHITELIST_COMMAND_TEMPLATE.format(user))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'" ]
[ "from dbhelper import BDHelper\n", "from flask import Flask\n", "from flask import render_template\n", "from flask import request\n", "VAR_0 = Flask(__name__)\n", "VAR_1 = DBHelper()\n", "@VAR_0.route('/')...\n", "VAR_2 = VAR_1.get_all_inputs()\n", "print(e)\n", "return render_template('home.html', VAR_2=data)\n", "VAR_2 = None\n" ]
[ "from dbhelper import BDHelper\n", "from flask import Flask\n", "from flask import render_template\n", "from flask import request\n", "app = Flask(__name__)\n", "DB = DBHelper()\n", "@app.route('/')...\n", "data = DB.get_all_inputs()\n", "print(e)\n", "return render_template('home.html', data=data)\n", "data = None\n" ]
[ 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Return'", "Assign'" ]
[ "def FUNC_6(self):...\n", "return self.request.user == self.get_object().author\n" ]
[ "def test_func(self):...\n", "return self.request.user == self.get_object().author\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ "@eqlx.with_timeout...\n", "return 'no timeout'\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "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" ]
[ "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 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_36, VAR_14, VAR_34):...\n", "self.base_name = VAR_36\n", "self.name = VAR_14\n", "self.type = VAR_34\n", "self.flattened = '{}.{}'.format(self.base_name, self.name\n ) if self.base_name else self.name\n", "self.escaped = FUNC_0(self.flattened)\n" ]
[ "def __init__(self, base_name, name, type):...\n", "self.base_name = base_name\n", "self.name = name\n", "self.type = type\n", "self.flattened = '{}.{}'.format(self.base_name, self.name\n ) if self.base_name else self.name\n", "self.escaped = escape_col(self.flattened)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['clusterName'] = VAR_8\n", "VAR_5['searchDepth'] = '1'\n", "VAR_5['verbose'] = '0'\n", "VAR_18 = self._cliq_run_xml('getClusterInfo', VAR_5)\n", "return VAR_18\n" ]
[ "def _cliq_get_cluster_info(self, cluster_name):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['clusterName'] = cluster_name\n", "cliq_args['searchDepth'] = '1'\n", "cliq_args['verbose'] = '0'\n", "result_xml = self._cliq_run_xml('getClusterInfo', cliq_args)\n", "return result_xml\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_31(VAR_62):...\n", "\"\"\"docstring\"\"\"\n", "VAR_84 = 0\n", "while VAR_62[VAR_84].isdigit():\n", "VAR_84 += 1\n", "if VAR_84 > 0:\n", "return int(VAR_62[:VAR_84])\n", "return 0\n" ]
[ "def _get_value_kw(kw):...\n", "\"\"\"docstring\"\"\"\n", "i = 0\n", "while kw[i].isdigit():\n", "i += 1\n", "if i > 0:\n", "return int(kw[:i])\n", "return 0\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "AugAssign'", "Condition", "Return'", "Return'" ]
[ "@staticmethod...\n", "return VAR_6.total_run_count\n" ]
[ "@staticmethod...\n", "return obj.total_run_count\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_5(self, VAR_8, VAR_1=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1 is None:\n", "VAR_1 = self.order\n", "assert len(VAR_8) > VAR_1, 'Error: Path must be longer than k'\n", "if VAR_1 == 0 and len(VAR_8) == 1:\n", "return ['start', VAR_8[0]]\n", "return [self.separator.join(VAR_8[n:n + VAR_1]) for n in range(len(VAR_8) -\n VAR_1 + 1)]\n" ]
[ "def pathToHigherOrderNodes(self, path, k=None):...\n", "\"\"\"docstring\"\"\"\n", "if k is None:\n", "k = self.order\n", "assert len(path) > k, 'Error: Path must be longer than k'\n", "if k == 0 and len(path) == 1:\n", "return ['start', path[0]]\n", "return [self.separator.join(path[n:n + k]) for n in range(len(path) - k + 1)]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assert'", "Condition", "Return'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import logging\n", "from datetime import timedelta\n", "import voluptuous as vol\n", "from homeassistant.components.sensor import PLATFORM_SCHEMA\n", "from homeassistant.const import TEMP_CELSIUS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, STATE_UNKNOWN\n", "from homeassistant.helpers.entity import Entity\n", "from homeassistant.util import Throttle\n", "import homeassistant.helpers.config_validation as cv\n", "VAR_0 = logging.getLogger(__name__)\n", "VAR_1 = 'modules'\n", "VAR_2 = 'station'\n", "VAR_3 = ['netatmo']\n", "VAR_4 = timedelta(seconds=600)\n", "VAR_5 = {'temperature': ['Temperature', TEMP_CELSIUS, None,\n DEVICE_CLASS_TEMPERATURE], 'co2': ['CO2', 'ppm', 'mdi:cloud', None],\n 'pressure': ['Pressure', 'mbar', 'mdi:gauge', None], 'noise': ['Noise',\n 'dB', 'mdi:volume-high', None], 'humidity': ['Humidity', '%', None,\n DEVICE_CLASS_HUMIDITY], 'rain': ['Rain', 'mm', 'mdi:weather-rainy',\n None], 'sum_rain_1': ['sum_rain_1', 'mm', 'mdi:weather-rainy', None],\n 'sum_rain_24': ['sum_rain_24', 'mm', 'mdi:weather-rainy', None],\n 'battery_vp': ['Battery', '', 'mdi:battery', None], 'battery_lvl': [\n 'Battery_lvl', '', 'mdi:battery', None], 'min_temp': ['Min Temp.',\n TEMP_CELSIUS, 'mdi:thermometer', None], 'max_temp': ['Max Temp.',\n TEMP_CELSIUS, 'mdi:thermometer', None], 'windangle': ['Angle', '',\n 'mdi:compass', None], 'windangle_value': ['Angle Value', 'º',\n 'mdi:compass', None], 'windstrength': ['Strength', 'km/h',\n 'mdi:weather-windy', None], 'gustangle': ['Gust Angle', '',\n 'mdi:compass', None], 'gustangle_value': ['Gust Angle Value', 'º',\n 'mdi:compass', None], 'guststrength': ['Gust Strength', 'km/h',\n 'mdi:weather-windy', None], 'rf_status': ['Radio', '', 'mdi:signal',\n None], 'rf_status_lvl': ['Radio_lvl', '', 'mdi:signal', None],\n 'wifi_status': ['Wifi', '', 'mdi:wifi', None], 'wifi_status_lvl': [\n 'Wifi_lvl', 'dBm', 'mdi:wifi', None]}\n", "VAR_6 = vol.Schema({vol.Required(cv.string): vol.All(cv.ensure_list, [vol.\n In(VAR_5)])})\n", "VAR_7 = VAR_7.extend({vol.Optional(VAR_2): cv.string, vol.Optional(VAR_1):\n VAR_6})\n", "def FUNC_0(VAR_8, VAR_9, VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_12 = VAR_8.components.netatmo\n", "VAR_13 = CLASS_1(VAR_12.NETATMO_AUTH, VAR_9.get(VAR_2, None))\n", "VAR_14 = []\n", "import pyatmo\n", "if VAR_1 in VAR_9:\n", "return None\n", "VAR_10(VAR_14, True)\n", "for VAR_16, monitored_conditions in VAR_9[VAR_1].items():\n", "for VAR_16 in VAR_13.get_module_names():\n", "\"\"\"Implementation of a Netatmo sensor.\"\"\"\n", "if VAR_16 not in VAR_13.get_module_names():\n", "for variable in VAR_13.station_data.monitoredConditions(VAR_16):\n", "def __init__(self, VAR_15, VAR_16, VAR_17):...\n", "VAR_0.error('Module name: \"%s\" not found', VAR_16)\n", "for variable in monitored_conditions:\n", "if variable in VAR_5.keys():\n", "\"\"\"docstring\"\"\"\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_14.append(CLASS_0(VAR_13, VAR_16, variable))\n", "VAR_0.warning('Ignoring unknown var %s for mod %s', variable, VAR_16)\n", "self._name = 'Netatmo {} {}'.format(VAR_16, VAR_5[VAR_17][0])\n", "self.netatmo_data = VAR_15\n", "self.module_name = VAR_16\n", "self.type = VAR_17\n", "self._state = None\n", "self._device_class = VAR_5[self.type][3]\n", "self._icon = VAR_5[self.type][2]\n", "self._unit_of_measurement = VAR_5[self.type][1]\n", "VAR_20 = self.netatmo_data.station_data.moduleByName(module=module_name)['_id']\n", "self.module_id = VAR_20[1]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ "\"\"\"\nSupport for the NetAtmo Weather Service.\n\nFor more details about this platform, please refer to the documentation at\nhttps://home-assistant.io/components/sensor.netatmo/\n\"\"\"\n", "import logging\n", "from datetime import timedelta\n", "import voluptuous as vol\n", "from homeassistant.components.sensor import PLATFORM_SCHEMA\n", "from homeassistant.const import TEMP_CELSIUS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, STATE_UNKNOWN\n", "from homeassistant.helpers.entity import Entity\n", "from homeassistant.util import Throttle\n", "import homeassistant.helpers.config_validation as cv\n", "_LOGGER = logging.getLogger(__name__)\n", "CONF_MODULES = 'modules'\n", "CONF_STATION = 'station'\n", "DEPENDENCIES = ['netatmo']\n", "MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=600)\n", "SENSOR_TYPES = {'temperature': ['Temperature', TEMP_CELSIUS, None,\n DEVICE_CLASS_TEMPERATURE], 'co2': ['CO2', 'ppm', 'mdi:cloud', None],\n 'pressure': ['Pressure', 'mbar', 'mdi:gauge', None], 'noise': ['Noise',\n 'dB', 'mdi:volume-high', None], 'humidity': ['Humidity', '%', None,\n DEVICE_CLASS_HUMIDITY], 'rain': ['Rain', 'mm', 'mdi:weather-rainy',\n None], 'sum_rain_1': ['sum_rain_1', 'mm', 'mdi:weather-rainy', None],\n 'sum_rain_24': ['sum_rain_24', 'mm', 'mdi:weather-rainy', None],\n 'battery_vp': ['Battery', '', 'mdi:battery', None], 'battery_lvl': [\n 'Battery_lvl', '', 'mdi:battery', None], 'min_temp': ['Min Temp.',\n TEMP_CELSIUS, 'mdi:thermometer', None], 'max_temp': ['Max Temp.',\n TEMP_CELSIUS, 'mdi:thermometer', None], 'windangle': ['Angle', '',\n 'mdi:compass', None], 'windangle_value': ['Angle Value', 'º',\n 'mdi:compass', None], 'windstrength': ['Strength', 'km/h',\n 'mdi:weather-windy', None], 'gustangle': ['Gust Angle', '',\n 'mdi:compass', None], 'gustangle_value': ['Gust Angle Value', 'º',\n 'mdi:compass', None], 'guststrength': ['Gust Strength', 'km/h',\n 'mdi:weather-windy', None], 'rf_status': ['Radio', '', 'mdi:signal',\n None], 'rf_status_lvl': ['Radio_lvl', '', 'mdi:signal', None],\n 'wifi_status': ['Wifi', '', 'mdi:wifi', None], 'wifi_status_lvl': [\n 'Wifi_lvl', 'dBm', 'mdi:wifi', None]}\n", "MODULE_SCHEMA = vol.Schema({vol.Required(cv.string): vol.All(cv.ensure_list,\n [vol.In(SENSOR_TYPES)])})\n", "PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Optional(CONF_STATION): cv.\n string, vol.Optional(CONF_MODULES): MODULE_SCHEMA})\n", "def setup_platform(hass, config, add_devices, discovery_info=None):...\n", "\"\"\"docstring\"\"\"\n", "netatmo = hass.components.netatmo\n", "data = NetAtmoData(netatmo.NETATMO_AUTH, config.get(CONF_STATION, None))\n", "dev = []\n", "import pyatmo\n", "if CONF_MODULES in config:\n", "return None\n", "add_devices(dev, True)\n", "for module_name, monitored_conditions in config[CONF_MODULES].items():\n", "for module_name in data.get_module_names():\n", "\"\"\"Implementation of a Netatmo sensor.\"\"\"\n", "if module_name not in data.get_module_names():\n", "for variable in data.station_data.monitoredConditions(module_name):\n", "def __init__(self, netatmo_data, module_name, sensor_type):...\n", "_LOGGER.error('Module name: \"%s\" not found', module_name)\n", "for variable in monitored_conditions:\n", "if variable in SENSOR_TYPES.keys():\n", "\"\"\"docstring\"\"\"\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "dev.append(NetAtmoSensor(data, module_name, variable))\n", "_LOGGER.warning('Ignoring unknown var %s for mod %s', variable, module_name)\n", "self._name = 'Netatmo {} {}'.format(module_name, SENSOR_TYPES[sensor_type][0])\n", "self.netatmo_data = netatmo_data\n", "self.module_name = module_name\n", "self.type = sensor_type\n", "self._state = None\n", "self._device_class = SENSOR_TYPES[self.type][3]\n", "self._icon = SENSOR_TYPES[self.type][2]\n", "self._unit_of_measurement = SENSOR_TYPES[self.type][1]\n", "module_id = self.netatmo_data.station_data.moduleByName(module=module_name)[\n '_id']\n", "self.module_id = module_id[1]\n", "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ 0, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Import'", "Condition", "Return'", "Expr'", "For", "For", "Expr'", "Condition", "For", "FunctionDef'", "Expr'", "For", "Condition", "Docstring", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Docstring", "Return'" ]
[ "@api.public...\n", "FUNC_31(self, 'PUT')\n" ]
[ "@api.public...\n", "record(self, 'PUT')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "@retries(5, delay=0.5, backoff=1.5)...\n", "if VAR_11 == 'POST':\n", "return requests.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=_HEADERS)\n", "if VAR_11 == 'GET':\n", "return requests.get(FUNC_2(VAR_7), headers=_HEADERS)\n" ]
[ "@retries(5, delay=0.5, backoff=1.5)...\n", "if method == 'POST':\n", "return requests.post(_BuildUri(handler), data=ToUtf8Json(data), headers=\n _HEADERS)\n", "if method == 'GET':\n", "return requests.get(_BuildUri(handler), headers=_HEADERS)\n" ]
[ 0, 0, 7, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_13(self):...\n", "self.conditions = []\n", "self.grouped_or_conditions = []\n", "self.build_filter_conditions(self.filters, self.conditions)\n", "self.build_filter_conditions(self.or_filters, self.grouped_or_conditions)\n", "if not self.flags.ignore_permissions:\n", "VAR_58 = self.build_match_conditions()\n", "if VAR_58:\n", "self.conditions.append('(' + VAR_58 + ')')\n" ]
[ "def build_conditions(self):...\n", "self.conditions = []\n", "self.grouped_or_conditions = []\n", "self.build_filter_conditions(self.filters, self.conditions)\n", "self.build_filter_conditions(self.or_filters, self.grouped_or_conditions)\n", "if not self.flags.ignore_permissions:\n", "match_conditions = self.build_match_conditions()\n", "if match_conditions:\n", "self.conditions.append('(' + match_conditions + ')')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_7(self, VAR_42, VAR_41):...\n", "VAR_42 = ''.join(map(str.strip, VAR_42))\n", "VAR_79 = VAR_42.split('+')\n", "VAR_80 = list(map(lambda x: self._parse_coeff(x, VAR_41), VAR_79))\n", "VAR_81 = [0] * (max(VAR_103 for VAR_47, VAR_103 in VAR_80) + 1)\n", "for value, VAR_103 in VAR_80:\n", "if VAR_103 < 0:\n", "return VAR_81\n", "if self.degree_limit is not None and VAR_103 > self.degree_limit:\n", "VAR_81[VAR_103] = value\n" ]
[ "def _parse_poly(self, pstr, var):...\n", "pstr = ''.join(map(str.strip, pstr))\n", "summands = pstr.split('+')\n", "coefficients = list(map(lambda x: self._parse_coeff(x, var), summands))\n", "cs = [0] * (max(degree for _, degree in coefficients) + 1)\n", "for value, degree in coefficients:\n", "if degree < 0:\n", "return cs\n", "if self.degree_limit is not None and degree > self.degree_limit:\n", "cs[degree] = value\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Condition", "Assign'" ]
[ "\"\"\" Navigation and localization\n \nAuthor:\n Annaleah Ernst\n\"\"\"\n", "import tf\n", "import rospy\n", "import numpy as np\n", "from copy import deepcopy\n", "from geometry_msgs.msg import Pose, Point, Quaternion\n", "from math import sin, cos, pi\n", "from time import time\n", "from localization import Localization\n", "from logger import Logger\n", "from navigation import Navigation\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6=False,...\n", "self.map_pos = Point()\n", "self.map_angle = 0\n", "self._path = None\n", "Localization.__init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5)\n", "Navigation.__init__(self, VAR_6=jerky, VAR_7=walking_speed)\n", "self._logger = Logger('NavLoc')\n", "VAR_15 = time()\n", "while time() - VAR_15 < 0.5:\n", "def FUNC_0(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "Navigation._ekfCallback(self, VAR_8)\n", "self.map_pos = self.transformPoint(self.p, 'odom', 'map')\n", "self.map_angle = self.transformAngle(self.angle, 'odom', 'map')\n", "def FUNC_1(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "if Navigation._handleObstacle(self, VAR_9):\n", "self._path = None\n", "return False\n", "return True\n" ]
[ "\"\"\" Navigation and localization\n \nAuthor:\n Annaleah Ernst\n\"\"\"\n", "import tf\n", "import rospy\n", "import numpy as np\n", "from copy import deepcopy\n", "from geometry_msgs.msg import Pose, Point, Quaternion\n", "from math import sin, cos, pi\n", "from time import time\n", "from localization import Localization\n", "from logger import Logger\n", "from navigation import Navigation\n", "\"\"\" Navigate and localize on a map.\n \n Args:\n point_ids (set): Unique identifier for each waypoint in the graph.\n locations (dict): Point_ids mapped to tuples representing locations.\n neighbors (dict): Point_ids mapped to lists containing other point_ids representing \n the current node's neighbors.\n landmark_ids (set): Unique identifier for each landmark in the graph.\n landmark_positions (dict): Map AprilTag landmark ids to their absolute\n position on the floorplan.\n landmark_angles (dict): Map AprilTag landmark ids to their absolute\n position on the floorplan. This specifies the angle of rotation of the landmark in the \n xy plane; ie, how much has its horizontal vector deviated from the x axis.\n jerky (bool, optional): If true, robot will not decelerate, but stop abruptly.\n Defaults to False.\n walking_speed (float, optional): Percentage of maximum speed, magnitude between 0 and 1.\n Values with magnitude greater than 1 will be ignored.\n \n Attributes:\n tags (geometry_msgs.msg.PoseStamped dict): A dict of all the AprilTags currently in view in \n their raw form.\n tags_odom (geometry_msgs.msg.PoseStamped dict): Same as above, but in the odometry frame.\n floorplan (FloorPlan): The map of the current space as a floorplan.\n p (geometry_msgs.msg.Point): The position of the robot in the ekf odometry frame according to\n the robot_pose_ekf package.\n q (geometry_msgs.msg.Quaternion): The orientation of the robot in the ekf odometry frame\n according the the robot_pose_ekf package.\n angle (float): The angle (in radians) that the robot is from 0 in the ekf odometry frame. \n Between -pi and pi\n map_pos (geometry_msgs.msg.Point): The position of the robot in the map frame.\n map_angle (float): The angle (in radians) of the robot in the map frame.\n \"\"\"\n", "def __init__(self, point_ids, locations, neighbors, landmark_ids,...\n", "self.map_pos = Point()\n", "self.map_angle = 0\n", "self._path = None\n", "Localization.__init__(self, point_ids, locations, neighbors, landmark_ids,\n landmark_positions, landmark_angles)\n", "Navigation.__init__(self, jerky=jerky, walking_speed=walking_speed)\n", "self._logger = Logger('NavLoc')\n", "timer = time()\n", "while time() - timer < 0.5:\n", "def _ekfCallback(self, data):...\n", "\"\"\"docstring\"\"\"\n", "Navigation._ekfCallback(self, data)\n", "self.map_pos = self.transformPoint(self.p, 'odom', 'map')\n", "self.map_angle = self.transformAngle(self.angle, 'odom', 'map')\n", "def _handleObstacle(self, turn_delta):...\n", "\"\"\"docstring\"\"\"\n", "if Navigation._handleObstacle(self, turn_delta):\n", "self._path = None\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Condition", "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_6):...\n", "if VAR_6:\n", "VAR_15 = Announce.by_id(VAR_6, self.sql_session).scalar()\n", "VAR_18 = FUNC_0(self.get_argument('start', '0'), -1, 0, 10000000000000000000)\n", "if not VAR_15:\n", "VAR_19 = FUNC_0(self.get_argument('step', '12'), 0, 1, 20)\n", "if VAR_15.is_private and not self.is_group_user('Announcement Manager'):\n", "VAR_20 = self.get_argument('search', '')\n", "VAR_16 = AttachmentList.by_ann_id(VAR_6, self.sql_session).all()\n", "VAR_21 = self.get_argument('group', '')\n", "self.ann_d = VAR_15.to_dict()\n", "VAR_22 = self.get_argument('author', '')\n", "self.ann_d['tags'] = AnnTag.get_ann_tags(VAR_6, self.sql_session)\n", "VAR_23 = FUNC_0(self.get_argument('hours', ''), 0, 1, 23999999976)\n", "self.ann_d['atts'] = [att.to_dict() for att in VAR_16]\n", "if VAR_18 == -1 or VAR_19 == 0:\n", "VAR_17 = {'title': self.ann_d['title'], 'uri': '/announce/%s' % self.ann_d[\n 'id'], 'content': BeautifulSoup(markdown(self.ann_d['content']),\n 'html.parser').text}\n", "VAR_8 = self.sql_session.query(Announce)\n", "self.set_header('Cache-Control', 'max-age=300')\n", "if VAR_20:\n", "self.page_render(self.ann_d, 'announce.html', VAR_17=meta)\n", "VAR_8 = VAR_8.filter(Announce.full_text_search(VAR_20))\n", "VAR_8 = VAR_8.order_by(Announce.created.desc())\n", "if VAR_22:\n", "VAR_8 = VAR_8.filter(Announce.author_name == VAR_22)\n", "if VAR_21:\n", "VAR_8 = VAR_8.filter(Announce.author_group_name == VAR_21)\n", "if VAR_23:\n", "VAR_31 = datetime.utcnow() - timedelta(VAR_23=hours)\n", "if not self.is_group_user('Announcement Manager'):\n", "VAR_8 = VAR_8.filter(Announce.created >= VAR_31)\n", "VAR_8 = VAR_8.filter(Announce.is_private == False)\n", "VAR_24 = VAR_8.count()\n", "VAR_8 = VAR_8.offset(VAR_18).limit(VAR_19)\n", "VAR_25 = VAR_8.all()\n", "VAR_26 = self.sql_session.query(Announce.author_group_name).group_by(Announce\n .author_group_name).all()\n", "VAR_27 = self.sql_session.query(Announce.author_name).group_by(Announce.\n author_name).all()\n", "def FUNC_8(VAR_15):...\n", "VAR_32 = VAR_15.to_dict()\n", "VAR_32['tags'] = AnnTag.get_ann_tags(VAR_15.id, self.sql_session)\n", "return VAR_32\n" ]
[ "def get(self, ann_id):...\n", "if ann_id:\n", "ann = Announce.by_id(ann_id, self.sql_session).scalar()\n", "start = _to_int(self.get_argument('start', '0'), -1, 0, 10000000000000000000)\n", "if not ann:\n", "step = _to_int(self.get_argument('step', '12'), 0, 1, 20)\n", "if ann.is_private and not self.is_group_user('Announcement Manager'):\n", "search = self.get_argument('search', '')\n", "atts = AttachmentList.by_ann_id(ann_id, self.sql_session).all()\n", "group = self.get_argument('group', '')\n", "self.ann_d = ann.to_dict()\n", "author = self.get_argument('author', '')\n", "self.ann_d['tags'] = AnnTag.get_ann_tags(ann_id, self.sql_session)\n", "hours = _to_int(self.get_argument('hours', ''), 0, 1, 23999999976)\n", "self.ann_d['atts'] = [att.to_dict() for att in atts]\n", "if start == -1 or step == 0:\n", "meta = {'title': self.ann_d['title'], 'uri': '/announce/%s' % self.ann_d[\n 'id'], 'content': BeautifulSoup(markdown(self.ann_d['content']),\n 'html.parser').text}\n", "q = self.sql_session.query(Announce)\n", "self.set_header('Cache-Control', 'max-age=300')\n", "if search:\n", "self.page_render(self.ann_d, 'announce.html', meta=meta)\n", "q = q.filter(Announce.full_text_search(search))\n", "q = q.order_by(Announce.created.desc())\n", "if author:\n", "q = q.filter(Announce.author_name == author)\n", "if group:\n", "q = q.filter(Announce.author_group_name == group)\n", "if hours:\n", "start_time = datetime.utcnow() - timedelta(hours=hours)\n", "if not self.is_group_user('Announcement Manager'):\n", "q = q.filter(Announce.created >= start_time)\n", "q = q.filter(Announce.is_private == False)\n", "total = q.count()\n", "q = q.offset(start).limit(step)\n", "anns = q.all()\n", "groups = self.sql_session.query(Announce.author_group_name).group_by(Announce\n .author_group_name).all()\n", "authors = self.sql_session.query(Announce.author_name).group_by(Announce.\n author_name).all()\n", "def _make_ann(ann):...\n", "_d = ann.to_dict()\n", "_d['tags'] = AnnTag.get_ann_tags(ann.id, self.sql_session)\n", "return _d\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_2, VAR_3=False):...\n", "\"\"\"docstring\"\"\"\n", "if FUNC_0(VAR_2):\n", "VAR_0.error('Unable to read from file %s. (%s)' % (VAR_2, ex1.strerror))\n", "VAR_11 = [line.decode('utf-8', 'replace') for line in VAR_24]\n", "if not FUNC_4('pdftotext'):\n", "VAR_24 = open(VAR_2, 'r')\n", "return []\n", "VAR_24.close()\n", "VAR_0.error('pdftotext is not available on the system.')\n", "VAR_23 = 'pdftotext -q -enc UTF-8 %s -' % re.escape(VAR_2)\n", "if not FUNC_2('\\n'.join(VAR_11)):\n", "VAR_24 = os.popen(VAR_23)\n", "VAR_0.warning('string' % VAR_2)\n", "VAR_12 = len(VAR_11)\n", "VAR_13 = 0\n", "for line in VAR_11:\n", "VAR_13 += len(re.findall('\\\\S+', line))\n", "VAR_11 = [line for line in VAR_11 if VAR_1.search(line) is not None]\n", "if not VAR_3:\n", "VAR_0.info('Local file has %d lines and %d words.' % (VAR_12, VAR_13))\n", "return VAR_11\n" ]
[ "def text_lines_from_local_file(document, remote=False):...\n", "\"\"\"docstring\"\"\"\n", "if is_pdf(document):\n", "log.error('Unable to read from file %s. (%s)' % (document, ex1.strerror))\n", "lines = [line.decode('utf-8', 'replace') for line in filestream]\n", "if not executable_exists('pdftotext'):\n", "filestream = open(document, 'r')\n", "return []\n", "filestream.close()\n", "log.error('pdftotext is not available on the system.')\n", "cmd = 'pdftotext -q -enc UTF-8 %s -' % re.escape(document)\n", "if not _is_english_text('\\n'.join(lines)):\n", "filestream = os.popen(cmd)\n", "log.warning(\n \"It seems the file '%s' is unvalid and doesn't contain text. Please communicate this file to the Invenio team.\"\n % document)\n", "line_nb = len(lines)\n", "word_nb = 0\n", "for line in lines:\n", "word_nb += len(re.findall('\\\\S+', line))\n", "lines = [line for line in lines if _ONE_WORD.search(line) is not None]\n", "if not remote:\n", "log.info('Local file has %d lines and %d words.' % (line_nb, word_nb))\n", "return lines\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "For", "AugAssign'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "return 'NOW()'\n" ]
[ "def sqlNowCall(self):...\n", "return 'NOW()'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self, VAR_1, VAR_2=None, VAR_3=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = 'string'.format(default_store=store, repo_dir=REPO_DIR, shard_str=\n '/shard_' + self.shard if self.shard else '', exp_text=name,\n a11y_custom_file=\n 'node_modules/edx-custom-a11y-rules/lib/custom_a11y_rules.js', VAR_3=\n verify_xss)\n", "return VAR_6\n" ]
[ "def _expected_command(self, name, store=None, verify_xss=False):...\n", "\"\"\"docstring\"\"\"\n", "expected_statement = (\n \"DEFAULT_STORE={default_store} SCREENSHOT_DIR='{repo_dir}/test_root/log{shard_str}' BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log{shard_str}/hars' BOKCHOY_A11Y_CUSTOM_RULES_FILE='{repo_dir}/{a11y_custom_file}' SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log{shard_str}' VERIFY_XSS='{verify_xss}' nosetests {repo_dir}/common/test/acceptance/{exp_text} --with-xunit --xunit-file={repo_dir}/reports/bok_choy{shard_str}/xunit.xml --verbosity=2 \"\n .format(default_store=store, repo_dir=REPO_DIR, shard_str='/shard_' +\n self.shard if self.shard else '', exp_text=name, a11y_custom_file=\n 'node_modules/edx-custom-a11y-rules/lib/custom_a11y_rules.js',\n verify_xss=verify_xss))\n", "return expected_statement\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ "def test_fields(self):...\n", "self.assertTrue({'name': 'DocType', 'issingle': 0} in DatabaseQuery(\n 'DocType').execute(fields=['name', 'issingle'], limit_page_length=None))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_9(self, VAR_13):...\n", "if not VAR_13:\n" ]
[ "def p_error(self, p):...\n", "if not p:\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2=[], VAR_3=[], VAR_4={}, VAR_5={},...\n", "self.opcodes = VAR_0\n", "self.functions = VAR_1\n", "self.stack = VAR_2\n", "self.memory = VAR_3\n", "self.storage = VAR_4\n", "self.symbols = VAR_5\n", "self.userIn = VAR_6\n", "self.instrPtr = VAR_7\n", "self.symId = VAR_8\n" ]
[ "def __init__(self, opcodes, functions, stack=[], memory=[], storage={},...\n", "self.opcodes = opcodes\n", "self.functions = functions\n", "self.stack = stack\n", "self.memory = memory\n", "self.storage = storage\n", "self.symbols = symbols\n", "self.userIn = userIn\n", "self.instrPtr = instrPtr\n", "self.symId = symId\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "VAR_27 = self.db.execute('SELECT * FROM mudb.phrases;').fetchall()\n", "VAR_28 = filter(lambda x: x[-2] in [1, -3], VAR_27)\n", "VAR_29 = filter(lambda x: x[-2] == 2, VAR_27)\n", "VAR_30 = filter(lambda x: x[-2] == -2, VAR_27)\n", "VAR_28 = map(lambda x: (x[3], x[-3], x[-2], x[-1]), VAR_28)\n", "VAR_29 = map(lambda x: (x[3], x[-3], 0, x[-1]), VAR_29)\n", "VAR_30 = map(lambda x: (x[3], x[-3], -1, x[-1]), VAR_30)\n", "map(self.update_phrase, VAR_28)\n", "map(self.u_add_phrase, VAR_29)\n", "map(self.u_add_phrase, VAR_30)\n", "self.db.commit()\n" ]
[ "def sync_usrdb(self):...\n", "mudata = self.db.execute('SELECT * FROM mudb.phrases;').fetchall()\n", "data_u = filter(lambda x: x[-2] in [1, -3], mudata)\n", "data_a = filter(lambda x: x[-2] == 2, mudata)\n", "data_n = filter(lambda x: x[-2] == -2, mudata)\n", "data_u = map(lambda x: (x[3], x[-3], x[-2], x[-1]), data_u)\n", "data_a = map(lambda x: (x[3], x[-3], 0, x[-1]), data_a)\n", "data_n = map(lambda x: (x[3], x[-3], -1, x[-1]), data_n)\n", "map(self.update_phrase, data_u)\n", "map(self.u_add_phrase, data_a)\n", "map(self.u_add_phrase, data_n)\n", "self.db.commit()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def __str__(self):...\n", "return str(self.title)\n" ]
[ "def __str__(self):...\n", "return str(self.title)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(self, VAR_14):...\n", "if not VAR_14:\n", "return\n", "self.model.total_items = VAR_14['total']\n", "if self.num_channels_label:\n", "self.num_channels_label.setText('%d items' % VAR_14['total'])\n", "if VAR_14['first'] >= self.model.rowCount():\n", "self.model.add_items(VAR_14['channels'])\n" ]
[ "def on_channels(self, response):...\n", "if not response:\n", "return\n", "self.model.total_items = response['total']\n", "if self.num_channels_label:\n", "self.num_channels_label.setText('%d items' % response['total'])\n", "if response['first'] >= self.model.rowCount():\n", "self.model.add_items(response['channels'])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_74):...\n", "if VAR_74 and (not self.domain_re.match(VAR_74) or VAR_74.endswith(\n", "VAR_101.errors.add(errors.BAD_CNAME)\n", "if VAR_74:\n", "return VAR_100(VAR_74).lower()\n", "VAR_101.errors.add(errors.BAD_CNAME)\n" ]
[ "def run(self, domain):...\n", "if domain and (not self.domain_re.match(domain) or domain.endswith(\n", "c.errors.add(errors.BAD_CNAME)\n", "if domain:\n", "return str(domain).lower()\n", "c.errors.add(errors.BAD_CNAME)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Return'", "Expr'" ]
[ "@staticmethod...\n", "VAR_5 = CLASS_0._get_report(VAR_1)\n", "if not VAR_5:\n", "VAR_9 = {'analysis': VAR_5}\n", "VAR_13 = CLASS_0._get_dnsinfo(VAR_5)\n", "VAR_9.update(VAR_13)\n", "return VAR_9\n" ]
[ "@staticmethod...\n", "report = AnalysisController._get_report(task_id)\n", "if not report:\n", "data = {'analysis': report}\n", "dnsinfo = AnalysisController._get_dnsinfo(report)\n", "data.update(dnsinfo)\n", "return data\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_7 = Container.objects.create(owner=User.objects.get(username='autotest'\n ), app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', VAR_9=1)\n", "self.assertRaises(AttributeError, lambda : setattr(VAR_7, 'state', 'up'))\n" ]
[ "def test_container_state_protected(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "c = Container.objects.create(owner=User.objects.get(username='autotest'),\n app=App.objects.get(id=app_id), release=App.objects.get(id=app_id).\n release_set.latest(), type='web', num=1)\n", "self.assertRaises(AttributeError, lambda : setattr(c, 'state', 'up'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "@app.errorhandler(500)...\n", "return render_template('500.html'), 500\n" ]
[ "@app.errorhandler(500)...\n", "return render_template('500.html'), 500\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_30(VAR_35):...\n", "self.assertEqual(None, VAR_35)\n", "return 0\n" ]
[ "def run_bot(error):...\n", "self.assertEqual(None, error)\n", "return 0\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_0(self, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "self.app = VAR_1\n", "VAR_1.config.setdefault('OIDC_SCOPES', ['openid', 'email'])\n", "VAR_1.config.setdefault('OIDC_GOOGLE_APPS_DOMAIN', None)\n", "VAR_1.config.setdefault('OIDC_ID_TOKEN_COOKIE_NAME', 'oidc_id_token')\n", "VAR_1.config.setdefault('OIDC_ID_TOKEN_COOKIE_TTL', 7 * 86400)\n", "VAR_1.config.setdefault('OIDC_ID_TOKEN_COOKIE_SECURE', True)\n", "VAR_1.config.setdefault('OIDC_VALID_ISSUERS', ['accounts.google.com',\n 'https://accounts.google.com'])\n", "VAR_1.config.setdefault('OIDC_CLOCK_SKEW', 60)\n", "VAR_1.config.setdefault('OIDC_REQUIRE_VERIFIED_EMAIL', True)\n", "VAR_1.route('/oidc_callback')(self.oidc_callback)\n", "VAR_1.before_request(self.before_request)\n", "VAR_1.after_request(self.after_request)\n", "self.flow = flow_from_clientsecrets(VAR_1.config['OIDC_CLIENT_SECRETS'],\n scope=app.config['OIDC_SCOPES'])\n", "assert isinstance(self.flow, OAuth2WebServerFlow)\n", "self.cookie_serializer = TimedJSONWebSignatureSerializer(VAR_1.config[\n 'SECRET_KEY'])\n", "self.credentials_store = VAR_1.config['OIDC_CREDENTIALS_STORE']\n" ]
[ "def init_app(self, app):...\n", "\"\"\"docstring\"\"\"\n", "self.app = app\n", "app.config.setdefault('OIDC_SCOPES', ['openid', 'email'])\n", "app.config.setdefault('OIDC_GOOGLE_APPS_DOMAIN', None)\n", "app.config.setdefault('OIDC_ID_TOKEN_COOKIE_NAME', 'oidc_id_token')\n", "app.config.setdefault('OIDC_ID_TOKEN_COOKIE_TTL', 7 * 86400)\n", "app.config.setdefault('OIDC_ID_TOKEN_COOKIE_SECURE', True)\n", "app.config.setdefault('OIDC_VALID_ISSUERS', ['accounts.google.com',\n 'https://accounts.google.com'])\n", "app.config.setdefault('OIDC_CLOCK_SKEW', 60)\n", "app.config.setdefault('OIDC_REQUIRE_VERIFIED_EMAIL', True)\n", "app.route('/oidc_callback')(self.oidc_callback)\n", "app.before_request(self.before_request)\n", "app.after_request(self.after_request)\n", "self.flow = flow_from_clientsecrets(app.config['OIDC_CLIENT_SECRETS'],\n scope=app.config['OIDC_SCOPES'])\n", "assert isinstance(self.flow, OAuth2WebServerFlow)\n", "self.cookie_serializer = TimedJSONWebSignatureSerializer(app.config[\n 'SECRET_KEY'])\n", "self.credentials_store = app.config['OIDC_CREDENTIALS_STORE']\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assert'", "Assign'", "Assign'" ]
[ "import logging\n", "import os\n", "import urllib\n", "import requests\n", "from django.contrib.auth.decorators import login_required, permission_required\n", "from django.contrib import messages\n", "from django.conf import settings\n", "from django.core.exceptions import PermissionDenied\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseForbidden, JsonResponse, FileResponse, HttpResponseServerError\n", "from django.shortcuts import render, get_object_or_404\n", "from django.views.decorators.http import require_http_methods\n", "from .models import Person, Candidate, Keyword, CommitteeMember\n", "from .widgets import ID_VAL_SEPARATOR\n", "VAR_0 = '[email protected]'\n", "VAR_1 = logging.getLogger('etd')\n", "def FUNC_0(VAR_2):...\n", "if VAR_2.user.is_authenticated():\n", "VAR_33 = VAR_2.GET.get('next', reverse('home'))\n", "VAR_1.error('login() - got anonymous user: %s' % VAR_2.META)\n", "return HttpResponseRedirect(VAR_33)\n", "return HttpResponseServerError(\n 'Internet Server error. Please contact %s for assistance.' % VAR_0)\n" ]
[ "import logging\n", "import os\n", "import urllib\n", "import requests\n", "from django.contrib.auth.decorators import login_required, permission_required\n", "from django.contrib import messages\n", "from django.conf import settings\n", "from django.core.exceptions import PermissionDenied\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseForbidden, JsonResponse, FileResponse, HttpResponseServerError\n", "from django.shortcuts import render, get_object_or_404\n", "from django.views.decorators.http import require_http_methods\n", "from .models import Person, Candidate, Keyword, CommitteeMember\n", "from .widgets import ID_VAL_SEPARATOR\n", "BDR_EMAIL = '[email protected]'\n", "logger = logging.getLogger('etd')\n", "def login(request):...\n", "if request.user.is_authenticated():\n", "next_url = request.GET.get('next', reverse('home'))\n", "logger.error('login() - got anonymous user: %s' % request.META)\n", "return HttpResponseRedirect(next_url)\n", "return HttpResponseServerError(\n 'Internet Server error. Please contact %s for assistance.' % BDR_EMAIL)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Condition", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_18(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = VAR_0[:]\n", "for user in self.company.employees:\n", "VAR_11.append((Allow, user.login, ('view_customer', 'edit_customer')))\n", "return VAR_11\n" ]
[ "def get_customer_acl(self):...\n", "\"\"\"docstring\"\"\"\n", "acl = DEFAULT_PERM[:]\n", "for user in self.company.employees:\n", "acl.append((Allow, user.login, ('view_customer', 'edit_customer')))\n", "return acl\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_28(self, VAR_40, VAR_41, VAR_39, VAR_35=(), VAR_36={}):...\n", "VAR_49 = str(VAR_41.__name__)\n", "self.log.info('Starting %s(s)', VAR_49)\n", "if VAR_40 == 0:\n", "if not hasattr(self, 'th_sock'):\n", "if VAR_40 == 1:\n", "self.init_th_sock()\n", "if not hasattr(self, 'th_back_sock'):\n", "if not hasattr(self, 'pr_sock'):\n", "for i in range(VAR_39):\n", "self.init_th_back_sock()\n", "self.init_pr_sock()\n", "if not hasattr(self, 'pr_back_sock'):\n", "if not self.running.is_set():\n", "self.init_pr_back_sock()\n", "if VAR_40 == 0:\n", "self.log.exception('Exception \"%s\" raised on %s spawn', e, VAR_49)\n", "VAR_47 = workers.WZWorkerThread(self.c.router_addr, VAR_41, VAR_35, VAR_36,\n VAR_25='.'.join((wname, 'th{0}'.format(i))))\n", "if VAR_40 == 1:\n", "self.threads.append(VAR_47)\n", "VAR_47 = workers.WZWorkerProcess(self.c.router_addr, VAR_41, VAR_35, VAR_36,\n VAR_25='.'.join((wname, 'pr{0}'.format(i))))\n", "VAR_47.start(self.p.ctx, self.th_sa)\n", "self.processes.append(VAR_47)\n", "VAR_47.start(self.pr_sa)\n" ]
[ "def spawn_nworkers(self, type_, fun, count, args=(), kvargs={}):...\n", "wname = str(fun.__name__)\n", "self.log.info('Starting %s(s)', wname)\n", "if type_ == 0:\n", "if not hasattr(self, 'th_sock'):\n", "if type_ == 1:\n", "self.init_th_sock()\n", "if not hasattr(self, 'th_back_sock'):\n", "if not hasattr(self, 'pr_sock'):\n", "for i in range(count):\n", "self.init_th_back_sock()\n", "self.init_pr_sock()\n", "if not hasattr(self, 'pr_back_sock'):\n", "if not self.running.is_set():\n", "self.init_pr_back_sock()\n", "if type_ == 0:\n", "self.log.exception('Exception \"%s\" raised on %s spawn', e, wname)\n", "w = workers.WZWorkerThread(self.c.router_addr, fun, args, kvargs, name='.'.\n join((wname, 'th{0}'.format(i))))\n", "if type_ == 1:\n", "self.threads.append(w)\n", "w = workers.WZWorkerProcess(self.c.router_addr, fun, args, kvargs, name='.'\n .join((wname, 'pr{0}'.format(i))))\n", "w.start(self.p.ctx, self.th_sa)\n", "self.processes.append(w)\n", "w.start(self.pr_sa)\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 ]
[ "FunctionDef'", "Assign'", "Expr'", "Condition", "Condition", "Condition", "Expr'", "Condition", "Condition", "For", "Expr'", "Expr'", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_10(self, VAR_12, VAR_15=None):...\n", "" ]
[ "def delete(self, table, where=None):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import logging\n", "import os\n", "import random\n", "import re\n", "import tempfile\n", "from cms.grading.languagemanager import filename_to_language\n", "from cmscommon.crypto import decrypt_number\n", "from cmstestsuite.web import GenericRequest, LoginRequest\n", "VAR_0 = logging.getLogger(__name__)\n", "def FUNC_0(self):...\n", "if not LoginRequest.test_success(self):\n", "return False\n", "if self.redirected_to != self.base_url:\n", "return False\n", "return True\n" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import logging\n", "import os\n", "import random\n", "import re\n", "import tempfile\n", "from cms.grading.languagemanager import filename_to_language\n", "from cmscommon.crypto import decrypt_number\n", "from cmstestsuite.web import GenericRequest, LoginRequest\n", "logger = logging.getLogger(__name__)\n", "def test_success(self):...\n", "if not LoginRequest.test_success(self):\n", "return False\n", "if self.redirected_to != self.base_url:\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_12(self):...\n", "return self._omnicomp\n" ]
[ "def GetOmniCompleter(self):...\n", "return self._omnicomp\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2():...\n", "VAR_11 = datetime.now()\n", "VAR_12 = '%s-%s-%s %s:%s:%s' % (VAR_11.year, VAR_11.month, VAR_11.day,\n VAR_11.hour, VAR_11.minute, VAR_11.second)\n", "return VAR_12\n" ]
[ "def datePass():...\n", "now = datetime.now()\n", "result = '%s-%s-%s %s:%s:%s' % (now.year, now.month, now.day, now.hour, now\n .minute, now.second)\n", "return result\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_6, VAR_7, **VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "assert VAR_0.name != VAR_6.name, 'Refusing to route reply back to the same network, as this would cause a recursive loop'\n", "log.debug('(%s) networks.remote: re-routing reply %r from network %s',\n VAR_0.name, VAR_7, VAR_6.name)\n", "if 'source' in VAR_8:\n", "VAR_0.reply(VAR_7, VAR_1=irc.pseudoclient.uid, **kwargs)\n" ]
[ "def _remote_reply(placeholder_self, text, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "assert irc.name != placeholder_self.name, 'Refusing to route reply back to the same network, as this would cause a recursive loop'\n", "log.debug('(%s) networks.remote: re-routing reply %r from network %s', irc.\n name, text, placeholder_self.name)\n", "if 'source' in kwargs:\n", "irc.reply(text, source=irc.pseudoclient.uid, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_8():...\n", "populate_test_database()\n", "FUNC_1('first playlist')\n", "FUNC_0(1, 'the title of the video', 'the url of the video', 1)\n", "FUNC_0(1, 'the title of the video', 'the url of the video', 2)\n", "VAR_11 = VAR_3.get('/videos/1')\n", "assert VAR_11.json['status'] == 'OK'\n", "assert VAR_11.json['data'] == [dict(id=1, VAR_5='the title of the video',\n VAR_6='the url of the video', VAR_7=1), dict(id=2, VAR_5=\n 'the title of the video', VAR_6='the url of the video', VAR_7=2)]\n" ]
[ "def test_should_return_all_the_videos_from_a_playlist():...\n", "populate_test_database()\n", "create_playlist('first playlist')\n", "create_video(1, 'the title of the video', 'the url of the video', 1)\n", "create_video(1, 'the title of the video', 'the url of the video', 2)\n", "response = test_app.get('/videos/1')\n", "assert response.json['status'] == 'OK'\n", "assert response.json['data'] == [dict(id=1, title='the title of the video',\n thumbnail='the url of the video', position=1), dict(id=2, title=\n 'the title of the video', thumbnail='the url of the video', position=2)]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assert'", "Assert'" ]
[ "VAR_0 = [('E. coli',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/E_Coli_Training.csv'\n ), ('S. dysenteriae',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/S_Dysenterae_Training.csv'\n ), ('S. typhimurium', 'string'), ('P. syringae',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/P_Syringae_Training.csv'\n ), ('X. campestris',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/X_Campestris_Training.csv'\n ), ('C. trachematis', 'string'), ('E. coli + S. dysenteriae', 'string'),\n ('E. coli + S. dysenteriae + S. typhimurium', 'string')]\n", "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if '/' in VAR_1 or '\\\\' in VAR_1:\n", "return False\n", "if len(VAR_1) >= 10:\n", "return False\n", "return True\n" ]
[ "SAMPLE_FILES = [('E. coli',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/E_Coli_Training.csv'\n ), ('S. dysenteriae',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/S_Dysenterae_Training.csv'\n ), ('S. typhimurium',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/S_Typhimurium_Training.csv'\n ), ('P. syringae',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/P_Syringae_Training.csv'\n ), ('X. campestris',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/X_Campestris_Training.csv'\n ), ('C. trachematis',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/C_Trachomatis_Training.csv'\n ), ('E. coli + S. dysenteriae',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/E_Coli_S_Dysenteriae_Training.csv'\n ), ('E. coli + S. dysenteriae + S. typhimurium',\n 'https://raw.githubusercontent.com/cheukyin699/genset-training-csvs/master/E_Coli_S_Dysenteriae_S_Typhimur_Training.csv'\n )]\n", "def sid_is_valid(sid):...\n", "\"\"\"docstring\"\"\"\n", "if '/' in sid or '\\\\' in sid:\n", "return False\n", "if len(sid) >= 10:\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 2, 2, 2, 0, 2 ]
[ "Assign'", "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_10(self):...\n", "if self._IsServerAlive():\n", "return BaseRequest.PostDataToHandler(BuildRequestData(), 'defined_subcommands')\n", "return []\n" ]
[ "def GetDefinedSubcommands(self):...\n", "if self._IsServerAlive():\n", "return BaseRequest.PostDataToHandler(BuildRequestData(), 'defined_subcommands')\n", "return []\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_11(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = False\n", "VAR_11 = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "VAR_11.execute('SELECT type FROM achievement_definitions WHERE id = %s', VAR_1)\n", "VAR_9 = VAR_11.fetchone()\n", "if VAR_9['type'] != 'STANDARD':\n", "VAR_11.execute('string', (VAR_1, VAR_2))\n", "VAR_14 = VAR_11.fetchone()\n", "VAR_15 = 'UNLOCKED'\n", "VAR_10 = not VAR_14 or VAR_14['state'] != 'UNLOCKED'\n", "VAR_11.execute('string', {'player_id': VAR_2, 'achievement_id': VAR_1,\n 'state': VAR_15})\n", "return dict(VAR_10=newly_unlocked)\n" ]
[ "def unlock_achievement(achievement_id, player_id):...\n", "\"\"\"docstring\"\"\"\n", "newly_unlocked = False\n", "cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "cursor.execute('SELECT type FROM achievement_definitions WHERE id = %s',\n achievement_id)\n", "achievement = cursor.fetchone()\n", "if achievement['type'] != 'STANDARD':\n", "cursor.execute(\n \"\"\"SELECT\n state\n FROM player_achievements\n WHERE achievement_id = %s AND player_id = %s\"\"\"\n , (achievement_id, player_id))\n", "player_achievement = cursor.fetchone()\n", "new_state = 'UNLOCKED'\n", "newly_unlocked = not player_achievement or player_achievement['state'\n ] != 'UNLOCKED'\n", "cursor.execute(\n \"\"\"INSERT INTO player_achievements (player_id, achievement_id, state)\n VALUES\n (%(player_id)s, %(achievement_id)s, %(state)s)\n ON DUPLICATE KEY UPDATE\n state = VALUES(state)\"\"\"\n , {'player_id': player_id, 'achievement_id': achievement_id, 'state':\n new_state})\n", "return dict(newly_unlocked=newly_unlocked)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_62():...\n", "VAR_37.execute('rollback')\n" ]
[ "def test():...\n", "cnxn.execute('rollback')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "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'" ]