lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "super(CLASS_0, VAR_0).initArgumentParser(VAR_2, VAR_3=defaults)\n", "VAR_3 = VAR_3 or {}\n", "VAR_2.add_argument('--test_component_detail', default='fe', help=\n 'Refinement for component name to create.')\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "super(GoogleSmokeTestScenario, cls).initArgumentParser(parser, defaults=\n defaults)\n", "defaults = defaults or {}\n", "parser.add_argument('--test_component_detail', default='fe', help=\n 'Refinement for component name to create.')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(self, VAR_1, VAR_2, VAR_3, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_17 = self.pool.get('product.product').browse(VAR_1, VAR_2, VAR_3, VAR_4\n =context)\n", "VAR_18 = (VAR_17.property_stock_account_input and VAR_17.\n property_stock_account_input.id or False)\n", "if not VAR_18:\n", "VAR_18 = (VAR_17.categ_id.property_stock_account_input_categ and VAR_17.\n categ_id.property_stock_account_input_categ.id or False)\n", "VAR_19 = (VAR_17.property_stock_account_output and VAR_17.\n property_stock_account_output.id or False)\n", "if not VAR_19:\n", "VAR_19 = (VAR_17.categ_id.property_stock_account_output_categ and VAR_17.\n categ_id.property_stock_account_output_categ.id or False)\n", "VAR_20 = (VAR_17.categ_id.property_stock_journal and VAR_17.categ_id.\n property_stock_journal.id or False)\n", "VAR_21 = (VAR_17.categ_id.property_stock_variation and VAR_17.categ_id.\n property_stock_variation.id or False)\n", "return {'stock_account_input': VAR_18, 'stock_account_output': VAR_19,\n 'stock_journal': VAR_20, 'property_stock_variation': VAR_21}\n" ]
[ "def get_product_accounts(self, cr, uid, product_id, context=None):...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "product_obj = self.pool.get('product.product').browse(cr, uid, product_id,\n context=context)\n", "stock_input_acc = (product_obj.property_stock_account_input and product_obj\n .property_stock_account_input.id or False)\n", "if not stock_input_acc:\n", "stock_input_acc = (product_obj.categ_id.property_stock_account_input_categ and\n product_obj.categ_id.property_stock_account_input_categ.id or False)\n", "stock_output_acc = (product_obj.property_stock_account_output and\n product_obj.property_stock_account_output.id or False)\n", "if not stock_output_acc:\n", "stock_output_acc = (product_obj.categ_id.\n property_stock_account_output_categ and product_obj.categ_id.\n property_stock_account_output_categ.id or False)\n", "journal_id = (product_obj.categ_id.property_stock_journal and product_obj.\n categ_id.property_stock_journal.id or False)\n", "account_variation = (product_obj.categ_id.property_stock_variation and\n product_obj.categ_id.property_stock_variation.id or False)\n", "return {'stock_account_input': stock_input_acc, 'stock_account_output':\n stock_output_acc, 'stock_journal': journal_id,\n 'property_stock_variation': account_variation}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_19, VAR_20):...\n", "self.first = VAR_19\n", "self.second = VAR_20\n" ]
[ "def __init__(self, first, second):...\n", "self.first = first\n", "self.second = second\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_20(self, VAR_28, **VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "self.abort(VAR_28, json=kwargs, VAR_29={'Content-Type': self.CONTENT_TYPE_FULL}\n )\n" ]
[ "def abort_with_error(self, http_code, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "self.abort(http_code, json=kwargs, headers={'Content-Type': self.\n CONTENT_TYPE_FULL})\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "return {'partition': {'shutdown': FUNC_9, 'ident': FUNC_14}, 'lvm': {\n 'shutdown': FUNC_6, 'ident': FUNC_10}, 'crypt': {'shutdown': FUNC_7,\n 'ident': FUNC_11}, 'raid': {'shutdown': FUNC_8, 'ident': FUNC_12},\n 'bcache': {'shutdown': FUNC_5, 'ident': FUNC_13}, 'disk': {'ident': lambda\n x: False, 'shutdown': FUNC_9}}\n" ]
[ "def _define_handlers_registry():...\n", "\"\"\"docstring\"\"\"\n", "return {'partition': {'shutdown': wipe_superblock, 'ident':\n identify_partition}, 'lvm': {'shutdown': shutdown_lvm, 'ident':\n identify_lvm}, 'crypt': {'shutdown': shutdown_crypt, 'ident':\n identify_crypt}, 'raid': {'shutdown': shutdown_mdadm, 'ident':\n identify_mdadm}, 'bcache': {'shutdown': shutdown_bcache, 'ident':\n identify_bcache}, 'disk': {'ident': lambda x: False, 'shutdown':\n wipe_superblock}}\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_13(self, VAR_9):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "VAR_20 = self.send_cmd('list_comments{} {}'.format(self.insecure_mode, VAR_9))\n", "return\n", "print(VAR_20)\n" ]
[ "def do_list_comments(self, line):...\n", "if not self.logged_in():\n", "print('shrub: unauthenticated; use \"login [username] to log in first')\n", "response = self.send_cmd('list_comments{} {}'.format(self.insecure_mode, line))\n", "return\n", "print(response)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_7(self):...\n", "super().get_resource_objects()\n", "VAR_25 = self._get_kwarg(self.file_kw)\n", "VAR_26 = self._get_kwarg(self.file_name_kw)\n", "self.file = get_object_or_404(SubmittedFile, id=file_id, submission=self.\n submission)\n", "if self.file.filename != VAR_26:\n" ]
[ "def get_resource_objects(self):...\n", "super().get_resource_objects()\n", "file_id = self._get_kwarg(self.file_kw)\n", "file_name = self._get_kwarg(self.file_name_kw)\n", "self.file = get_object_or_404(SubmittedFile, id=file_id, submission=self.\n submission)\n", "if self.file.filename != file_name:\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition" ]
[ "def FUNC_4(self):...\n", "VAR_13 = self.data_group\n", "VAR_14 = self.get_abstract_filename()\n", "return f'/media/{VAR_13.fs_id}/pdf/{VAR_14}'\n" ]
[ "def pdf_url(self):...\n", "dg = self.data_group\n", "fn = self.get_abstract_filename()\n", "return f'/media/{dg.fs_id}/pdf/{fn}'\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "if self.logged_in():\n", "print(\n 'shrub: login: already logged in; restart shrub to login as a different user'\n )\n", "VAR_19 = VAR_9.split()\n", "return\n", "if not len(VAR_19) == 1:\n", "print('login: incorrect arguments; input only your username')\n", "VAR_15 = VAR_19[0]\n", "return\n", "VAR_23 = getpass.getpass()\n", "VAR_20 = FUNC_0('check_login {} {}'.format(VAR_15, VAR_23))\n", "if VAR_20 == 'True':\n", "print('Success: now logged in as {}.'.format(VAR_15))\n", "print('shrub: login: authentication failure')\n", "self.user_creds = [VAR_15, VAR_23]\n" ]
[ "def do_login(self, line):...\n", "\"\"\"docstring\"\"\"\n", "if self.logged_in():\n", "print(\n 'shrub: login: already logged in; restart shrub to login as a different user'\n )\n", "linesplit = line.split()\n", "return\n", "if not len(linesplit) == 1:\n", "print('login: incorrect arguments; input only your username')\n", "username = linesplit[0]\n", "return\n", "password = getpass.getpass()\n", "response = send_unauthenticated_cmd('check_login {} {}'.format(username,\n password))\n", "if response == 'True':\n", "print('Success: now logged in as {}.'.format(username))\n", "print('shrub: login: authentication failure')\n", "self.user_creds = [username, password]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "Return'", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_9(VAR_18, VAR_19):...\n", "VAR_20 = None\n", "if line.startswith(VAR_18):\n", "VAR_20 = line.rstrip()[len(VAR_18):]\n", "return VAR_20 or VAR_19\n" ]
[ "def extract(comment, current_value):...\n", "value = None\n", "if line.startswith(comment):\n", "value = line.rstrip()[len(comment):]\n", "return value or current_value\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_36(self, VAR_51):...\n", "VAR_69, VAR_73 = self.post('/mails/unread', json.dumps({'idents': VAR_51}))\n", "return VAR_69\n" ]
[ "def mark_many_as_unread(self, idents):...\n", "res, req = self.post('/mails/unread', json.dumps({'idents': idents}))\n", "return res\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_2):...\n", "VAR_5 = merge_yaml_files(VAR_2)\n", "VAR_6 = None\n", "VAR_7 = os.path.getmtime(VAR_2)\n", "return VAR_5, CLASS_0(VAR_6=etag, VAR_7=mtime)\n" ]
[ "def read_config_from_file(path):...\n", "yaml_config = merge_yaml_files(path)\n", "etag = None\n", "mtime = os.path.getmtime(path)\n", "return yaml_config, Header(etag=etag, mtime=mtime)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "[VAR_17, VAR_18] = FUNC_2(VAR_0.inf_file)\n", "VAR_19 = 1\n", "while not FUNC_10(VAR_0) and VAR_19 < 5:\n", "if VAR_19 > 1:\n", "if not FUNC_10(VAR_0):\n", "print('Failed Attempt #' + str(VAR_19) + ', trying again.')\n", "VAR_19 += 1\n", "print('Failed Attempt #' + str(VAR_19) + ', giving up.')\n", "VAR_20 = kijiji_api.KijijiApi()\n", "VAR_20.login(VAR_0.username, VAR_0.password)\n", "VAR_20.post_ad_using_data(VAR_17, VAR_18)\n", "sleep(180)\n" ]
[ "def post_ad(args):...\n", "\"\"\"docstring\"\"\"\n", "[data, imageFiles] = get_inf_details(args.inf_file)\n", "attempts = 1\n", "while not check_ad(args) and attempts < 5:\n", "if attempts > 1:\n", "if not check_ad(args):\n", "print('Failed Attempt #' + str(attempts) + ', trying again.')\n", "attempts += 1\n", "print('Failed Attempt #' + str(attempts) + ', giving up.')\n", "api = kijiji_api.KijijiApi()\n", "api.login(args.username, args.password)\n", "api.post_ad_using_data(data, imageFiles)\n", "sleep(180)\n" ]
[ 0, 0, 5, 0, 5, 0, 0, 5, 0, 5, 0, 0, 5, 5 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Expr'", "AugAssign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_12(self, VAR_1, VAR_62=False, VAR_63=False, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if not urllib.parse.urlparse(VAR_1).scheme:\n", "if not os.path.isabs(VAR_1) and self.included_stack:\n", "if VAR_1 in self.included:\n", "VAR_108 = os.path.dirname(self.included_stack[-1])\n", "VAR_1 = os.path.abspath(VAR_1)\n", "logger.info('Multiple include of {} ignored'.format(VAR_1))\n", "self.included.append(VAR_1)\n", "VAR_1 = os.path.join(VAR_108, VAR_1)\n", "return\n", "self.included_stack.append(VAR_1)\n", "VAR_83 = self\n", "VAR_96 = self.first_rule\n", "VAR_97, VAR_98 = parse(VAR_1, VAR_4=self.overwrite_shellcmd)\n", "if VAR_63:\n", "print(VAR_97)\n", "sys.path.insert(0, os.path.dirname(VAR_1))\n", "self.linemaps[VAR_1] = VAR_98\n", "exec(compile(VAR_97, VAR_1, 'exec'), self.globals)\n", "if not VAR_62:\n", "self.first_rule = VAR_96\n", "self.included_stack.pop()\n" ]
[ "def include(self, snakefile, overwrite_first_rule=False, print_compilation=...\n", "\"\"\"docstring\"\"\"\n", "if not urllib.parse.urlparse(snakefile).scheme:\n", "if not os.path.isabs(snakefile) and self.included_stack:\n", "if snakefile in self.included:\n", "current_path = os.path.dirname(self.included_stack[-1])\n", "snakefile = os.path.abspath(snakefile)\n", "logger.info('Multiple include of {} ignored'.format(snakefile))\n", "self.included.append(snakefile)\n", "snakefile = os.path.join(current_path, snakefile)\n", "return\n", "self.included_stack.append(snakefile)\n", "workflow = self\n", "first_rule = self.first_rule\n", "code, linemap = parse(snakefile, overwrite_shellcmd=self.overwrite_shellcmd)\n", "if print_compilation:\n", "print(code)\n", "sys.path.insert(0, os.path.dirname(snakefile))\n", "self.linemaps[snakefile] = linemap\n", "exec(compile(code, snakefile, 'exec'), self.globals)\n", "if not overwrite_first_rule:\n", "self.first_rule = first_rule\n", "self.included_stack.pop()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Return'", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_4):...\n", "VAR_22 = self.profile.user\n", "if VAR_22.is_authenticated():\n", "self.exercise.check_submission(VAR_22, no_update=True)\n", "VAR_23 = []\n", "for t_exercise in self.exercise.exercises:\n", "VAR_29 = t_exercise.parent\n", "VAR_24 = '{}: {} - {}'.format(t_exercise.course_module.course_instance.\n course.name, t_exercise.course_module.course_instance.instance_name,\n t_exercise.category.name)\n", "VAR_30 = VAR_29.url\n", "return VAR_23, VAR_24\n", "VAR_29 = VAR_29.parent\n", "while VAR_29 is not None:\n", "VAR_30 = VAR_29.url + '/' + VAR_30\n", "VAR_31 = t_exercise.name\n", "VAR_29 = VAR_29.parent\n", "for candidate in t_exercise.name.split('|'):\n", "if VAR_4.LANGUAGE_CODE in candidate:\n", "VAR_32 = {'exercise': t_exercise, 'url': reverse('exercise', VAR_6={\n 'course_slug': t_exercise.course_module.course_instance.course.url,\n 'instance_slug': t_exercise.course_module.course_instance.url,\n 'module_slug': t_exercise.course_module.url, 'exercise_path': ex_url}),\n 'title': VAR_31, 'max_points': t_exercise.max_points, 'user_points':\n UserExerciseSummary(t_exercise, VAR_4.user).get_points()}\n", "VAR_31 = candidate[len('{}:'.format(VAR_4.LANGUAGE_CODE)):]\n", "VAR_23.append(VAR_32)\n" ]
[ "def __load_exercisecollection(self, request):...\n", "user = self.profile.user\n", "if user.is_authenticated():\n", "self.exercise.check_submission(user, no_update=True)\n", "target_exercises = []\n", "for t_exercise in self.exercise.exercises:\n", "it = t_exercise.parent\n", "title = '{}: {} - {}'.format(t_exercise.course_module.course_instance.\n course.name, t_exercise.course_module.course_instance.instance_name,\n t_exercise.category.name)\n", "ex_url = it.url\n", "return target_exercises, title\n", "it = it.parent\n", "while it is not None:\n", "ex_url = it.url + '/' + ex_url\n", "ex_name = t_exercise.name\n", "it = it.parent\n", "for candidate in t_exercise.name.split('|'):\n", "if request.LANGUAGE_CODE in candidate:\n", "data = {'exercise': t_exercise, 'url': reverse('exercise', kwargs={\n 'course_slug': t_exercise.course_module.course_instance.course.url,\n 'instance_slug': t_exercise.course_module.course_instance.url,\n 'module_slug': t_exercise.course_module.url, 'exercise_path': ex_url}),\n 'title': ex_name, 'max_points': t_exercise.max_points, 'user_points':\n UserExerciseSummary(t_exercise, request.user).get_points()}\n", "ex_name = candidate[len('{}:'.format(request.LANGUAGE_CODE)):]\n", "target_exercises.append(data)\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_16(VAR_5, VAR_6):...\n", "VAR_38 = 5\n", "VAR_39 = VAR_14 + timedelta(minutes=cache_time) < datetime.now(\n ) if VAR_14 else True\n", "if not VAR_14 or VAR_39 or VAR_5 not in VAR_15:\n", "VAR_14 = datetime.now()\n", "log.info('Returning cached result of %s', VAR_3.__name__)\n", "VAR_50 = VAR_3(VAR_5, VAR_6)\n", "VAR_51 = VAR_14 + timedelta(minutes=cache_time) - datetime.now()\n", "VAR_15[VAR_5] = VAR_50\n", "log.debug('Time to to reevaluate result of %s is %s', VAR_3.__name__, str(\n VAR_51)[:-7])\n", "return VAR_50\n", "return VAR_15[VAR_5]\n" ]
[ "def func_launcher(feature, feature_type):...\n", "cache_time = 5\n", "high_time = when_was_called + timedelta(minutes=cache_time) < datetime.now(\n ) if when_was_called else True\n", "if not when_was_called or high_time or feature not in result:\n", "when_was_called = datetime.now()\n", "log.info('Returning cached result of %s', func.__name__)\n", "num_of_users = func(feature, feature_type)\n", "time_left = when_was_called + timedelta(minutes=cache_time) - datetime.now()\n", "result[feature] = num_of_users\n", "log.debug('Time to to reevaluate result of %s is %s', func.__name__, str(\n time_left)[:-7])\n", "return num_of_users\n", "return result[feature]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def __ne__(self, VAR_1):...\n", "return not self.__eq__(VAR_1)\n" ]
[ "def __ne__(self, other):...\n", "return not self.__eq__(other)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_2 is None:\n", "if 'access_token' in VAR_2:\n", "return FUNC_3(VAR_1, VAR_2)\n", "if 'oauth_token' in VAR_2 and 'oauth_token_secret' in VAR_2:\n", "return FUNC_2(VAR_1, VAR_2)\n", "if 'error' in VAR_2:\n" ]
[ "def response_token_setter(remote, resp):...\n", "\"\"\"docstring\"\"\"\n", "if resp is None:\n", "if 'access_token' in resp:\n", "return oauth2_token_setter(remote, resp)\n", "if 'oauth_token' in resp and 'oauth_token_secret' in resp:\n", "return oauth1_token_setter(remote, resp)\n", "if 'error' in resp:\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'", "Condition", "Return'", "Condition" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._icon\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._icon\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_15(VAR_1, VAR_2, VAR_13, VAR_14, VAR_15):...\n", "\"\"\"docstring\"\"\"\n", "flash('Authorization with remote service failed.')\n", "return redirect('/')\n" ]
[ "def oauth2_handle_error(remote, resp, error_code, error_uri, error_description...\n", "\"\"\"docstring\"\"\"\n", "flash('Authorization with remote service failed.')\n", "return redirect('/')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Return'" ]
[ "def FUNC_22(VAR_49, **VAR_18):...\n", "if self._session_responses:\n", "VAR_64 = self._session_responses[0]\n", "VAR_18['allow_redirects'] = False\n", "VAR_20.record_call(VAR_49, **kwargs)\n", "return VAR_60(VAR_49, **kwargs)\n", "return VAR_64() if hasattr(VAR_64, '__call__') else VAR_64\n" ]
[ "def _session_send(request, **kwargs):...\n", "if self._session_responses:\n", "current_response = self._session_responses[0]\n", "kwargs['allow_redirects'] = False\n", "cluster_api.record_call(request, **kwargs)\n", "return session_send(request, **kwargs)\n", "return current_response() if hasattr(current_response, '__call__'\n ) else current_response\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_3(self):...\n", "for i in range(27):\n", "VAR_22 = DataSource.objects.create(title=f'Test_DS_{i}')\n", "VAR_4 = self.live_server_url + '/datasources/'\n", "self.browser.get(VAR_4)\n", "VAR_5 = len(self.browser.find_elements_by_xpath(\n \"//table[@id='sources']/tbody/tr\"))\n", "self.assertEqual(VAR_5, 25, 'Should be 25 datasources in the table')\n", "self.browser.find_element_by_xpath('//*[@title=\"edit\"]').click()\n", "VAR_6 = self.browser.find_element_by_name('cancel')\n", "self.assertEqual(VAR_6.get_attribute('href'), VAR_4,\n 'User should go back to list view when clicking cancel')\n", "self.browser.find_element_by_name('submit').click()\n", "self.assertIn('/datasource/', self.browser.current_url,\n 'User should always return to detail page after submit')\n", "VAR_7 = self.live_server_url + f'/datasource/{VAR_22.pk}'\n", "self.browser.get(VAR_7)\n", "self.browser.find_element_by_xpath('//*[@title=\"edit\"]').click()\n", "VAR_6 = self.browser.find_element_by_name('cancel')\n", "self.assertEqual(VAR_6.get_attribute('href'), VAR_7,\n 'User should go back to detail view when clicking cancel')\n", "self.browser.find_element_by_name('submit').click()\n", "self.assertIn('/datasource/', self.browser.current_url,\n 'User should always return to detail page after submit')\n", "VAR_8 = len(PUC.objects.filter(kind='FO'))\n", "self.browser.get(self.live_server_url)\n", "import time\n", "time.sleep(3)\n", "VAR_9 = self.browser.find_elements_by_class_name('bubble')\n", "self.assertEqual(VAR_8, len(VAR_9),\n 'There should be a circledrawn for every PUC')\n" ]
[ "def test_hem(self):...\n", "for i in range(27):\n", "ds = DataSource.objects.create(title=f'Test_DS_{i}')\n", "list_url = self.live_server_url + '/datasources/'\n", "self.browser.get(list_url)\n", "row_count = len(self.browser.find_elements_by_xpath(\n \"//table[@id='sources']/tbody/tr\"))\n", "self.assertEqual(row_count, 25, 'Should be 25 datasources in the table')\n", "self.browser.find_element_by_xpath('//*[@title=\"edit\"]').click()\n", "btn = self.browser.find_element_by_name('cancel')\n", "self.assertEqual(btn.get_attribute('href'), list_url,\n 'User should go back to list view when clicking cancel')\n", "self.browser.find_element_by_name('submit').click()\n", "self.assertIn('/datasource/', self.browser.current_url,\n 'User should always return to detail page after submit')\n", "detail_url = self.live_server_url + f'/datasource/{ds.pk}'\n", "self.browser.get(detail_url)\n", "self.browser.find_element_by_xpath('//*[@title=\"edit\"]').click()\n", "btn = self.browser.find_element_by_name('cancel')\n", "self.assertEqual(btn.get_attribute('href'), detail_url,\n 'User should go back to detail view when clicking cancel')\n", "self.browser.find_element_by_name('submit').click()\n", "self.assertIn('/datasource/', self.browser.current_url,\n 'User should always return to detail page after submit')\n", "num_pucs = len(PUC.objects.filter(kind='FO'))\n", "self.browser.get(self.live_server_url)\n", "import time\n", "time.sleep(3)\n", "bubbles = self.browser.find_elements_by_class_name('bubble')\n", "self.assertEqual(num_pucs, len(bubbles),\n 'There should be a circledrawn for every PUC')\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 ]
[ "FunctionDef'", "For", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Import'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_31(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_21\n" ]
[ "def realpath(self, path):...\n", "\"\"\"docstring\"\"\"\n", "return path\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_17(self):...\n", "\"\"\"docstring\"\"\"\n", "self.parser.parse_args(['--delete-player'])\n" ]
[ "def test_arg_delete_player(self):...\n", "\"\"\"docstring\"\"\"\n", "self.parser.parse_args(['--delete-player'])\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "\"\"\"Set of functions for tasks to freeze the data within a GSoCProgram.\n\"\"\"\n", "__authors__ = ['\"Daniel Hans\" <[email protected]>',\n '\"Lennard de Rijk\" <[email protected]>']\n", "import pickle\n", "from google.appengine.ext import db\n", "from soc.tasks import responses\n", "from soc.tasks.helper import error_handler\n", "from soc.modules.gsoc.logic.models.mentor import logic as mentor_logic\n", "from soc.modules.gsoc.logic.models.org_admin import logic as org_admin_logic\n", "from soc.modules.gsoc.logic.models.organization import logic as org_logic\n", "from soc.modules.gsoc.logic.models.program import logic as program_logic\n", "from soc.modules.gsoc.logic.models.student import logic as student_logic\n", "VAR_0 = [('^tasks/gsoc/freezer/manage_students_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageStudentsStatus')]\n", "VAR_1 = [('^tasks/gsoc/freezer/manage_mentors_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageMentorsStatus'), (\n '^tasks/gsoc/freezer/manage_org_admins_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageOrgAdminsStatus')]\n", "VAR_2 = [('^tasks/gsoc/freezer/manage_orgs_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageOrgsStatus')]\n", "VAR_3 = VAR_0 + VAR_1 + VAR_2\n", "VAR_4 = 50\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "return VAR_3\n" ]
[ "\"\"\"Set of functions for tasks to freeze the data within a GSoCProgram.\n\"\"\"\n", "__authors__ = ['\"Daniel Hans\" <[email protected]>',\n '\"Lennard de Rijk\" <[email protected]>']\n", "import pickle\n", "from google.appengine.ext import db\n", "from soc.tasks import responses\n", "from soc.tasks.helper import error_handler\n", "from soc.modules.gsoc.logic.models.mentor import logic as mentor_logic\n", "from soc.modules.gsoc.logic.models.org_admin import logic as org_admin_logic\n", "from soc.modules.gsoc.logic.models.organization import logic as org_logic\n", "from soc.modules.gsoc.logic.models.program import logic as program_logic\n", "from soc.modules.gsoc.logic.models.student import logic as student_logic\n", "ROLE_PER_SCOPE_MODELS_URL_PATTERNS = [(\n '^tasks/gsoc/freezer/manage_students_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageStudentsStatus')]\n", "ROLE_PER_PROGRAM_MODELS_URL_PATTERNS = [(\n '^tasks/gsoc/freezer/manage_mentors_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageMentorsStatus'), (\n '^tasks/gsoc/freezer/manage_org_admins_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageOrgAdminsStatus')]\n", "ORG_MODEL_URL_PATTERNS = [('^tasks/gsoc/freezer/manage_orgs_status$',\n 'soc.modules.gsoc.tasks.program_freezer.manageOrgsStatus')]\n", "ROLE_MODELS_URL_PATTERNS = (ROLE_PER_SCOPE_MODELS_URL_PATTERNS +\n ROLE_PER_PROGRAM_MODELS_URL_PATTERNS + ORG_MODEL_URL_PATTERNS)\n", "BATCH_SIZE = 50\n", "def getDjangoURLPatterns():...\n", "\"\"\"docstring\"\"\"\n", "return ROLE_MODELS_URL_PATTERNS\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Assign'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "Return'" ]
[ "@VAR_0.route('/', methods=['GET'])...\n", "return redirect(url_for('auth.login'))\n" ]
[ "@app.route('/', methods=['GET'])...\n", "return redirect(url_for('auth.login'))\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_25(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_57 = self.getfile(VAR_21, VAR_23=False)\n", "if VAR_57 == False:\n", "if not VAR_57[VAR_6] & FUNC_30.S_IFLNK:\n", "return VAR_57[VAR_9]\n" ]
[ "def readlink(self, path):...\n", "\"\"\"docstring\"\"\"\n", "p = self.getfile(path, follow_symlinks=False)\n", "if p == False:\n", "if not p[A_MODE] & stat.S_IFLNK:\n", "return p[A_TARGET]\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Condition", "Return'" ]
[ "def FUNC_1(self, VAR_5, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = 'https://www.kijiji.ca/t-login.html'\n", "VAR_14 = self.session.get(VAR_13)\n", "VAR_15 = {'emailOrNickname': VAR_5, 'password': VAR_6, 'rememberMe': 'true',\n '_rememberMe': 'on', 'ca.kijiji.xsrf.token': FUNC_0(VAR_14.text,\n 'ca.kijiji.xsrf.token'), 'targetUrl': 'string'}\n", "VAR_14 = self.session.post(VAR_13, VAR_11=payload)\n", "if not self.is_logged_in():\n" ]
[ "def login(self, username, password):...\n", "\"\"\"docstring\"\"\"\n", "login_url = 'https://www.kijiji.ca/t-login.html'\n", "resp = self.session.get(login_url)\n", "payload = {'emailOrNickname': username, 'password': password, 'rememberMe':\n 'true', '_rememberMe': 'on', 'ca.kijiji.xsrf.token': get_token(resp.\n text, 'ca.kijiji.xsrf.token'), 'targetUrl':\n 'L3QtbG9naW4uaHRtbD90YXJnZXRVcmw9TDNRdGJHOW5hVzR1YUhSdGJEOTBZWEpuWlhSVmNtdzlUREpuZEZwWFVuUmlNalV3WWpJMGRGbFlTbXhaVXpoNFRucEJkMDFxUVhsWWJVMTZZbFZLU1dGVmJHdGtiVTVzVlcxa1VWSkZPV0ZVUmtWNlUyMWpPVkJSTFMxZVRITTBVMk5wVW5wbVRHRlFRVUZwTDNKSGNtVk9kejA5XnpvMnFzNmc2NWZlOWF1T1BKMmRybEE9PQ--'\n }\n", "resp = self.session.post(login_url, data=payload)\n", "if not self.is_logged_in():\n" ]
[ 0, 0, 0, 0, 5, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Condition" ]
[ "def FUNC_20(self, VAR_26, *VAR_1, **VAR_2):...\n", "self.sig_addr = VAR_26\n", "multiprocessing.Process.start(self, *VAR_1, **kvargs)\n" ]
[ "def start(self, sig_addr, *args, **kvargs):...\n", "self.sig_addr = sig_addr\n", "multiprocessing.Process.start(self, *args, **kvargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.filename\n" ]
[ "def getDBFilename(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.filename\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@property...\n", "VAR_28 = list(self.output)\n", "if self.benchmark:\n", "VAR_28.append(self.benchmark)\n", "return VAR_28\n" ]
[ "@property...\n", "products = list(self.output)\n", "if self.benchmark:\n", "products.append(self.benchmark)\n", "return products\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_3):...\n", "return '{:,}'.format(result.objects.filter(campaign=record.id).count())\n" ]
[ "def render_results(self, record):...\n", "return '{:,}'.format(result.objects.filter(campaign=record.id).count())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(VAR_3):...\n", "return Task('nfs/{}'.format(VAR_0), VAR_1, VAR_2, partial(\n serialize_dashboard_exception, include_http_status=True))(VAR_3)\n" ]
[ "def composed_decorator(func):...\n", "return Task('nfs/{}'.format(name), metadata, wait_for, partial(\n serialize_dashboard_exception, include_http_status=True))(func)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_5):...\n", "self.parsedConfig = yaml.load_all(VAR_5)\n", "self.__class__.docConfig.append(self)\n" ]
[ "def __init__(self, txt):...\n", "self.parsedConfig = yaml.load_all(txt)\n", "self.__class__.docConfig.append(self)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_1(self, **VAR_3):...\n", "VAR_5 = super().get_context_data(**kwargs)\n", "VAR_5['search_form'] = SearchForm()\n", "VAR_6 = self.kwargs['pk']\n", "VAR_7 = VT()\n", "VAR_5['vt_hash'] = VAR_7.getFileReport(VAR_6)\n", "VAR_5['vt_behavior'] = VAR_7.getFileBehavior(VAR_6)\n", "VAR_8 = ThreatMiner()\n", "VAR_5['tm_meta'] = VAR_8.getMetaFromSample(VAR_6)\n", "VAR_5['tm_http'] = VAR_8.getHttpFromSample(VAR_6)\n", "VAR_5['tm_host'] = VAR_8.getHostsFromSample(VAR_6)\n", "VAR_5['tm_av'] = VAR_8.getAVFromSample(VAR_6)\n", "VAR_5['tm_report'] = VAR_8.getReportFromSample(VAR_6)\n", "VAR_5['events'] = Event.objects.filter(Q(info__icontains=filehash)).order_by(\n '-publish_timestamp')\n", "VAR_9 = VAR_5['events'].count()\n", "if VAR_9 > 0:\n", "VAR_5['events_count'] = VAR_9\n", "VAR_5['attributes'] = Attribute.objects.filter(Q(value__icontains=filehash)\n ).order_by('-timestamp')\n", "VAR_9 = VAR_5['attributes'].count()\n", "if VAR_9 > 0:\n", "VAR_5['attributes_count'] = VAR_9\n", "VAR_5['tws'] = tweet.objects.filter(Q(text__icontains=filehash)).order_by(\n '-datetime')\n", "VAR_9 = VAR_5['tws'].count()\n", "if VAR_9 > 0:\n", "VAR_5['tws_count'] = VAR_9\n", "VAR_5['exs'] = Exploit.objects.filter(Q(text__icontains=filehash)).order_by(\n '-datetime')\n", "VAR_9 = VAR_5['exs'].count()\n", "if VAR_9 > 0:\n", "VAR_5['exs_count'] = VAR_9\n", "return VAR_5\n" ]
[ "def get_context_data(self, **kwargs):...\n", "context = super().get_context_data(**kwargs)\n", "context['search_form'] = SearchForm()\n", "filehash = self.kwargs['pk']\n", "vt = VT()\n", "context['vt_hash'] = vt.getFileReport(filehash)\n", "context['vt_behavior'] = vt.getFileBehavior(filehash)\n", "tm = ThreatMiner()\n", "context['tm_meta'] = tm.getMetaFromSample(filehash)\n", "context['tm_http'] = tm.getHttpFromSample(filehash)\n", "context['tm_host'] = tm.getHostsFromSample(filehash)\n", "context['tm_av'] = tm.getAVFromSample(filehash)\n", "context['tm_report'] = tm.getReportFromSample(filehash)\n", "context['events'] = Event.objects.filter(Q(info__icontains=filehash)).order_by(\n '-publish_timestamp')\n", "count = context['events'].count()\n", "if count > 0:\n", "context['events_count'] = count\n", "context['attributes'] = Attribute.objects.filter(Q(value__icontains=filehash)\n ).order_by('-timestamp')\n", "count = context['attributes'].count()\n", "if count > 0:\n", "context['attributes_count'] = count\n", "context['tws'] = tweet.objects.filter(Q(text__icontains=filehash)).order_by(\n '-datetime')\n", "count = context['tws'].count()\n", "if count > 0:\n", "context['tws_count'] = count\n", "context['exs'] = Exploit.objects.filter(Q(text__icontains=filehash)).order_by(\n '-datetime')\n", "count = context['exs'].count()\n", "if count > 0:\n", "context['exs_count'] = count\n", "return context\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_35(VAR_29):...\n", "VAR_40 = VAR_29.group('name')\n", "VAR_16 = VAR_11[VAR_40]\n", "if VAR_15:\n", "if VAR_13 and VAR_16 == VAR_14:\n", "return '{{{}}}'.format(VAR_40)\n", "if VAR_12:\n", "return str(VAR_16)\n", "return VAR_14\n" ]
[ "def format_match(match):...\n", "name = match.group('name')\n", "value = wildcards[name]\n", "if keep_dynamic:\n", "if fail_dynamic and value == dynamic_fill:\n", "return '{{{}}}'.format(name)\n", "if fill_missing:\n", "return str(value)\n", "return dynamic_fill\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_12(self):...\n", "self.run_test_case(self.scenario.upsert_google_server_group_tags())\n" ]
[ "def Xtest_a_upsert_server_group_tags(self):...\n", "self.run_test_case(self.scenario.upsert_google_server_group_tags())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@VAR_0.route('/search_taxon_name/<table>/<expr>', methods=['GET'])...\n", "VAR_8 = getConnexion()\n", "VAR_9 = 'string' + VAR_2 + 'string'\n", "VAR_10 = ['%' + VAR_3 + '%']\n", "VAR_8.cur.execute(VAR_9, VAR_10)\n", "VAR_11 = VAR_8.cur.fetchone()[0]\n", "VAR_8.closeAll()\n", "return Response(flask.json.dumps(VAR_11), mimetype='application/json')\n" ]
[ "@addObs.route('/search_taxon_name/<table>/<expr>', methods=['GET'])...\n", "db = getConnexion()\n", "sql = \"\"\" SELECT array_to_json(array_agg(row_to_json(r))) FROM(\n SELECT cd_ref, search_name, nom_valide from taxonomie.taxons_\"\"\" + table + \"\"\"\n WHERE search_name ILIKE %s \n ORDER BY search_name ASC \n LIMIT 20) r\"\"\"\n", "params = ['%' + expr + '%']\n", "db.cur.execute(sql, params)\n", "res = db.cur.fetchone()[0]\n", "db.closeAll()\n", "return Response(flask.json.dumps(res), mimetype='application/json')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_22(self, VAR_38):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_38:\n", "return\n", "VAR_57 = VAR_38.lower()\n", "if 'select' in VAR_57 and ' from ' in VAR_57:\n", "frappe.throw(_('Cannot use sub-query in order by'))\n", "for field in VAR_38.split(','):\n", "if '.' in field and field.strip().startswith('`tab'):\n", "VAR_71 = field.strip().split('.')[0]\n", "if VAR_71 not in self.tables:\n", "if VAR_71.startswith('`'):\n", "VAR_71 = VAR_71[4:-1]\n", "frappe.throw(_('Please select atleast 1 column from {0} to sort/group').\n format(VAR_71))\n" ]
[ "def validate_order_by_and_group_by(self, parameters):...\n", "\"\"\"docstring\"\"\"\n", "if not parameters:\n", "return\n", "_lower = parameters.lower()\n", "if 'select' in _lower and ' from ' in _lower:\n", "frappe.throw(_('Cannot use sub-query in order by'))\n", "for field in parameters.split(','):\n", "if '.' in field and field.strip().startswith('`tab'):\n", "tbl = field.strip().split('.')[0]\n", "if tbl not in self.tables:\n", "if tbl.startswith('`'):\n", "tbl = tbl[4:-1]\n", "frappe.throw(_('Please select atleast 1 column from {0} to sort/group').\n format(tbl))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Expr'", "For", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_14(self):...\n", "def __init__(self):...\n", "self._time = 0.0\n", "def FUNC_28(self):...\n", "VAR_21 = self._time\n", "self._time += 0.0001\n", "return VAR_21\n" ]
[ "def test_timer(self):...\n", "def __init__(self):...\n", "self._time = 0.0\n", "def time(self):...\n", "ret = self._time\n", "self._time += 0.0001\n", "return ret\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "FunctionDef'", "Assign'", "AugAssign'", "Return'" ]
[ "def FUNC_7(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "if not self._rules:\n", "if not VAR_10 in self._rules:\n", "return self._rules[VAR_10]\n" ]
[ "def get_rule(self, name):...\n", "\"\"\"docstring\"\"\"\n", "if not self._rules:\n", "if not name in self._rules:\n", "return self._rules[name]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'" ]
[ "def FUNC_0(VAR_0, VAR_1, VAR_2=None, VAR_3=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = posixpath.normpath(unquote(VAR_1))\n", "VAR_1 = VAR_1.lstrip('/')\n", "VAR_10 = ''\n", "for VAR_18 in VAR_1.split('/'):\n", "if not VAR_18:\n", "if VAR_10 and VAR_1 != VAR_10:\n", "VAR_17, VAR_18 = os.path.splitdrive(VAR_18)\n", "return HttpResponseRedirect(VAR_10)\n", "VAR_6 = os.path.join(VAR_2, VAR_10)\n", "VAR_19, VAR_18 = os.path.split(VAR_18)\n", "if os.path.isdir(VAR_6):\n", "if VAR_18 in (os.curdir, os.pardir):\n", "if VAR_3:\n", "if not os.path.exists(VAR_6):\n", "VAR_10 = os.path.join(VAR_10, VAR_18).replace('\\\\', '/')\n", "return FUNC_1(VAR_10, VAR_6)\n", "VAR_11 = os.stat(VAR_6)\n", "if not FUNC_2(VAR_0.META.get('HTTP_IF_MODIFIED_SINCE'), VAR_11.st_mtime,\n", "return HttpResponseNotModified()\n", "VAR_12, VAR_13 = mimetypes.guess_type(VAR_6)\n", "VAR_12 = VAR_12 or 'application/octet-stream'\n", "VAR_14 = FileResponse(open(VAR_6, 'rb'), VAR_12=content_type)\n", "VAR_14['Last-Modified'] = http_date(VAR_11.st_mtime)\n", "if stat.S_ISREG(VAR_11.st_mode):\n", "VAR_14['Content-Length'] = VAR_11.st_size\n", "if VAR_13:\n", "VAR_14['Content-Encoding'] = VAR_13\n", "return VAR_14\n" ]
[ "def serve(request, path, document_root=None, show_indexes=False):...\n", "\"\"\"docstring\"\"\"\n", "path = posixpath.normpath(unquote(path))\n", "path = path.lstrip('/')\n", "newpath = ''\n", "for part in path.split('/'):\n", "if not part:\n", "if newpath and path != newpath:\n", "drive, part = os.path.splitdrive(part)\n", "return HttpResponseRedirect(newpath)\n", "fullpath = os.path.join(document_root, newpath)\n", "head, part = os.path.split(part)\n", "if os.path.isdir(fullpath):\n", "if part in (os.curdir, os.pardir):\n", "if show_indexes:\n", "if not os.path.exists(fullpath):\n", "newpath = os.path.join(newpath, part).replace('\\\\', '/')\n", "return directory_index(newpath, fullpath)\n", "statobj = os.stat(fullpath)\n", "if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),\n", "return HttpResponseNotModified()\n", "content_type, encoding = mimetypes.guess_type(fullpath)\n", "content_type = content_type or 'application/octet-stream'\n", "response = FileResponse(open(fullpath, 'rb'), content_type=content_type)\n", "response['Last-Modified'] = http_date(statobj.st_mtime)\n", "if stat.S_ISREG(statobj.st_mode):\n", "response['Content-Length'] = statobj.st_size\n", "if encoding:\n", "response['Content-Encoding'] = encoding\n", "return response\n" ]
[ 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 6, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Condition", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_5(self, VAR_10, VAR_11):...\n", "VAR_21 = KeepAlive(sess_id=session.sess_id).update_or_expire_session()\n", "VAR_9 = {'msg': 'pong'}\n", "if not VAR_21:\n", "VAR_9.update(VAR_1)\n", "return VAR_9\n" ]
[ "def _handle_ping_pong(self, data, session):...\n", "still_alive = KeepAlive(sess_id=session.sess_id).update_or_expire_session()\n", "msg = {'msg': 'pong'}\n", "if not still_alive:\n", "msg.update(LOGIN_REQUIRED_MESSAGE)\n", "return msg\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_13(self, VAR_7):...\n", "return int(VAR_7[:len(str(self.mapWidth))].rstrip('-')), int(VAR_7[len(str(\n self.mapHeight)):].rstrip('-'))\n" ]
[ "def IDToCoord(self, ID):...\n", "return int(ID[:len(str(self.mapWidth))].rstrip('-')), int(ID[len(str(self.\n mapHeight)):].rstrip('-'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@abc.abstractmethod...\n", "\"\"\"docstring\"\"\"\n" ]
[ "@abc.abstractmethod...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "Condition", "Docstring" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_16 = self.session.get('https://www.kijiji.ca/m-my-ads.html/').text\n", "return 'Sign Out' in VAR_16\n" ]
[ "def is_logged_in(self):...\n", "\"\"\"docstring\"\"\"\n", "index_page_text = self.session.get('https://www.kijiji.ca/m-my-ads.html/').text\n", "return 'Sign Out' in index_page_text\n" ]
[ 0, 0, 5, 5 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def __init__(self):...\n", "super(CLASS_0, self).__init__()\n" ]
[ "def __init__(self):...\n", "super(BigIpOSUtil, self).__init__()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "import cgi\n", "import mysql.connector\n", "from html import beghtml, endhtml\n", "VAR_0 = cgi.FieldStorage()\n", "VAR_1 = VAR_0.getvalue('enzyme_name')\n", "VAR_2 = VAR_0.getvalue('product_name')\n", "VAR_3 = VAR_0.getvalue('enzyme_name2')\n", "VAR_4 = VAR_0.getvalue('mechanism_name')\n", "VAR_5 = VAR_0.getvalue('process_name')\n", "VAR_6 = VAR_0.getvalue('concentration')\n", "VAR_7 = VAR_0.getvalue('compound_name')\n", "VAR_8 = VAR_0.getvalue('process_name2')\n", "VAR_9 = VAR_0.getvalue('goal')\n", "VAR_10 = VAR_0.getvalue('inter')\n", "VAR_11 = VAR_0.getvalue('conc')\n", "VAR_12 = VAR_0.getvalue('process_name3')\n", "VAR_13 = VAR_0.getvalue('enzyme_name3')\n", "VAR_14 = VAR_0.getvalue('enzyme_name4')\n", "VAR_15 = VAR_0.getvalue('organelle')\n", "VAR_16 = VAR_0.getvalue('sub')\n", "VAR_17 = VAR_0.getvalue('organelle2')\n", "VAR_18 = VAR_0.getvalue('sub2')\n", "VAR_19 = VAR_0.getvalue('conc2')\n", "VAR_20 = VAR_0.getvalue('comp')\n", "VAR_21 = VAR_0.getvalue('loc')\n", "VAR_22 = VAR_0.getvalue('sub3')\n", "VAR_23 = VAR_0.getvalue('sub4')\n", "VAR_24 = mysql.connector.connect(user='eapfelba', database='eapfelba2',\n host='localhost', password='chumash1000')\n", "VAR_25 = VAR_24.cursor(buffered=True)\n", "VAR_26 = ''\n", "VAR_27 = ''\n", "if VAR_1 and VAR_2:\n", "VAR_26 = \"update converts set product_name = '%s' where enzyme_name = '%s'\" % (\n VAR_2, VAR_1)\n", "if VAR_3 and VAR_4:\n", "VAR_27 = (\n \"select * from converts where product_name = '%s' and enzyme_name = '%s'\" %\n (VAR_2, VAR_1))\n", "VAR_26 = (\n \"update enzyme set ligand_mechanism = '%s' where enzyme_name = '%s'\" %\n (VAR_4, VAR_3))\n", "if VAR_5 and VAR_6 and VAR_7:\n", "VAR_27 = \"select * from enzyme where enzyme_name = '%s'\" % VAR_3\n", "VAR_26 = (\n \"update operates_under set concentration = '%s', compound = '%s' where process_name = '%s'\"\n % (VAR_6, VAR_7, VAR_5))\n", "if VAR_8 and VAR_9:\n", "VAR_27 = \"select * from operates_under where process_name = '%s'\" % VAR_5\n", "VAR_26 = \"update process set goal_product = '%s' where process_name = '%s'\" % (\n VAR_9, VAR_8)\n", "if VAR_10 and VAR_11:\n", "VAR_27 = \"select * from process where process_name = '%s'\" % VAR_8\n", "VAR_26 = (\n \"update intermediate set concenration = '%s' where intermediate_name = '%s'\"\n % (VAR_11, VAR_10))\n", "if VAR_12 and VAR_13:\n", "VAR_27 = \"select * from intermediate where intermediate_name = '%s'\" % VAR_10\n", "VAR_26 = \"update uses set enzyme_name = '%s' where process_name = '%s'\" % (\n VAR_13, VAR_12)\n", "if VAR_14 and VAR_15 and VAR_16 and VAR_23:\n", "VAR_27 = (\n \"select * from uses where process_name = '%s' and enzyme_name = '%s'\" %\n (VAR_12, VAR_13))\n", "VAR_26 = 'string' % (VAR_15, VAR_16, VAR_14, VAR_23)\n", "if VAR_17 and VAR_18:\n", "VAR_27 = \"select * from located_in where enzyme_name = '%s'\" % VAR_14\n", "VAR_26 = (\n \"update location set substructure = '%s' where organelle = '%s' and substructure = '%s'\"\n % (VAR_18, VAR_17, VAR_22))\n", "if VAR_19 and VAR_20 and VAR_21:\n", "VAR_27 = (\n \"select * from location where organelle = '%s' and substructure = '%s'\" %\n (VAR_17, VAR_18))\n", "VAR_26 = (\n \"update conds set prime_location = '%s' where concentration = '%s' and compound = '%s'\"\n % (VAR_21, VAR_19, VAR_20))\n", "VAR_28 = False\n", "VAR_27 = (\n \"select * from conds where concentration = '%s' and compound = '%s' and prime_location = '%s'\"\n % (VAR_19, VAR_20, VAR_21))\n", "if not VAR_26:\n", "beghtml()\n", "if VAR_26:\n", "print(\"<h3>You didn't fill anything out! :/</h3>\")\n", "if VAR_28 == False:\n", "VAR_25.execute(VAR_26)\n", "beghtml()\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "VAR_25.execute(VAR_27)\n", "VAR_25.close()\n", "VAR_24.commit()\n", "print('Something went wrong: {}'.format(err) + '<br><br>')\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "VAR_29 = VAR_25.fetchall()\n", "VAR_24.close()\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "endhtml()\n", "beghtml()\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "VAR_28 = True\n", "if not VAR_29:\n", "endhtml()\n", "print('<h3><b>Something went wrong </b></h3>')\n", "print('<h3>Updated!</h3>')\n", "VAR_28 = True\n", "print('<b>Check your spelling!</b><br><br>')\n", "print('The database now reads <br><br>')\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "for result in VAR_29[0]:\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "print('<b> | %s' % result)\n", "print(' | </b>')\n", "endhtml()\n", "print('<br><br>')\n", "print('string')\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Try Something Else!</a></b><br><br>'\n )\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n" ]
[ "import cgi\n", "import mysql.connector\n", "from html import beghtml, endhtml\n", "form = cgi.FieldStorage()\n", "enzyme_name = form.getvalue('enzyme_name')\n", "product_name = form.getvalue('product_name')\n", "enzyme_name2 = form.getvalue('enzyme_name2')\n", "mechanism_name = form.getvalue('mechanism_name')\n", "process_name = form.getvalue('process_name')\n", "concentration = form.getvalue('concentration')\n", "compound_name = form.getvalue('compound_name')\n", "process_name2 = form.getvalue('process_name2')\n", "goal = form.getvalue('goal')\n", "inter = form.getvalue('inter')\n", "conc = form.getvalue('conc')\n", "process_name3 = form.getvalue('process_name3')\n", "enzyme_name3 = form.getvalue('enzyme_name3')\n", "enzyme_name4 = form.getvalue('enzyme_name4')\n", "organelle = form.getvalue('organelle')\n", "sub = form.getvalue('sub')\n", "organelle2 = form.getvalue('organelle2')\n", "sub2 = form.getvalue('sub2')\n", "conc2 = form.getvalue('conc2')\n", "comp = form.getvalue('comp')\n", "loc = form.getvalue('loc')\n", "sub3 = form.getvalue('sub3')\n", "sub4 = form.getvalue('sub4')\n", "cnx = mysql.connector.connect(user='eapfelba', database='eapfelba2', host=\n 'localhost', password='chumash1000')\n", "cursor = cnx.cursor(buffered=True)\n", "query = ''\n", "query2 = ''\n", "if enzyme_name and product_name:\n", "query = \"update converts set product_name = '%s' where enzyme_name = '%s'\" % (\n product_name, enzyme_name)\n", "if enzyme_name2 and mechanism_name:\n", "query2 = (\n \"select * from converts where product_name = '%s' and enzyme_name = '%s'\" %\n (product_name, enzyme_name))\n", "query = (\n \"update enzyme set ligand_mechanism = '%s' where enzyme_name = '%s'\" %\n (mechanism_name, enzyme_name2))\n", "if process_name and concentration and compound_name:\n", "query2 = \"select * from enzyme where enzyme_name = '%s'\" % enzyme_name2\n", "query = (\n \"update operates_under set concentration = '%s', compound = '%s' where process_name = '%s'\"\n % (concentration, compound_name, process_name))\n", "if process_name2 and goal:\n", "query2 = (\"select * from operates_under where process_name = '%s'\" %\n process_name)\n", "query = \"update process set goal_product = '%s' where process_name = '%s'\" % (\n goal, process_name2)\n", "if inter and conc:\n", "query2 = \"select * from process where process_name = '%s'\" % process_name2\n", "query = (\n \"update intermediate set concenration = '%s' where intermediate_name = '%s'\"\n % (conc, inter))\n", "if process_name3 and enzyme_name3:\n", "query2 = \"select * from intermediate where intermediate_name = '%s'\" % inter\n", "query = \"update uses set enzyme_name = '%s' where process_name = '%s'\" % (\n enzyme_name3, process_name3)\n", "if enzyme_name4 and organelle and sub and sub4:\n", "query2 = (\n \"select * from uses where process_name = '%s' and enzyme_name = '%s'\" %\n (process_name3, enzyme_name3))\n", "query = (\n \"update located_in set organelle = '%s', substructure = '%s' where enzyme_name = '%s' and substructure = '%s'\"\n % (organelle, sub, enzyme_name4, sub4))\n", "if organelle2 and sub2:\n", "query2 = \"select * from located_in where enzyme_name = '%s'\" % enzyme_name4\n", "query = (\n \"update location set substructure = '%s' where organelle = '%s' and substructure = '%s'\"\n % (sub2, organelle2, sub3))\n", "if conc2 and comp and loc:\n", "query2 = (\n \"select * from location where organelle = '%s' and substructure = '%s'\" %\n (organelle2, sub2))\n", "query = (\n \"update conds set prime_location = '%s' where concentration = '%s' and compound = '%s'\"\n % (loc, conc2, comp))\n", "hasError = False\n", "query2 = (\n \"select * from conds where concentration = '%s' and compound = '%s' and prime_location = '%s'\"\n % (conc2, comp, loc))\n", "if not query:\n", "beghtml()\n", "if query:\n", "print(\"<h3>You didn't fill anything out! :/</h3>\")\n", "if hasError == False:\n", "cursor.execute(query)\n", "beghtml()\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "cursor.execute(query2)\n", "cursor.close()\n", "cnx.commit()\n", "print('Something went wrong: {}'.format(err) + '<br><br>')\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "data = cursor.fetchall()\n", "cnx.close()\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "endhtml()\n", "beghtml()\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "hasError = True\n", "if not data:\n", "endhtml()\n", "print('<h3><b>Something went wrong </b></h3>')\n", "print('<h3>Updated!</h3>')\n", "hasError = True\n", "print('<b>Check your spelling!</b><br><br>')\n", "print('The database now reads <br><br>')\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\n", "for result in data[0]:\n", "print(\n '<br><b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Home</a></b>'\n )\n", "print('<b> | %s' % result)\n", "print(' | </b>')\n", "endhtml()\n", "print('<br><br>')\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/cgi-bin/showdb.py\">Current Database</a></b><br><br>'\n )\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/biobase.html\">Try Something Else!</a></b><br><br>'\n )\n", "print(\n '<b><a href = \"http://ada.sterncs.net/~eapfelbaum/update.html\">Back</a></b>'\n )\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, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 4, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_42():...\n", "print('PAGE {}'.format(VAR_100))\n", "VAR_117 = 'string'.format(VAR_100)\n", "VAR_41 = get(VAR_117)\n", "VAR_6 = VAR_41.text\n", "VAR_46 = BeautifulSoup(VAR_6, 'html.parser')\n", "VAR_118 = 'singles' if VAR_32 else 'doubles'\n", "VAR_104 = VAR_46.find_all('a')\n", "for link in VAR_104:\n", "if link.has_attr('href') and 'tournament' in link['href']:\n", "VAR_112 = link['href'].split('/')\n", "VAR_120 = VAR_112[VAR_112.index('tournament') + 1]\n", "if VAR_120 in VAR_43:\n", "VAR_127 = VAR_101.tournament_show_events(VAR_120)\n", "def FUNC_43(VAR_127, VAR_96):...\n", "for VAR_121 in VAR_127['events']:\n", "if all([(match in VAR_121) for match in VAR_96]):\n", "return None\n", "return VAR_121\n" ]
[ "def iterate():...\n", "print('PAGE {}'.format(page))\n", "results_url = (\n 'https://smash.gg/tournaments?per_page=30&filter=%7B%22upcoming%22%3Afalse%2C%22videogameIds%22%3A4%2C%22past%22%3Atrue%7D&page={}'\n .format(page))\n", "r = get(results_url)\n", "data = r.text\n", "soup = BeautifulSoup(data, 'html.parser')\n", "grep = 'singles' if singles else 'doubles'\n", "links = soup.find_all('a')\n", "for link in links:\n", "if link.has_attr('href') and 'tournament' in link['href']:\n", "url_parts = link['href'].split('/')\n", "t = url_parts[url_parts.index('tournament') + 1]\n", "if t in brackets:\n", "events = smash.tournament_show_events(t)\n", "def get_event(events, matches):...\n", "for e in events['events']:\n", "if all([(match in e) for match in matches]):\n", "return None\n", "return e\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "FunctionDef'", "For", "For", "Return'", "Return'" ]
[ "def FUNC_1(VAR_0, VAR_1):...\n", "VAR_6 = '{0}/{1}'.format(VAR_0.fs_id, VAR_1)\n", "return VAR_6\n" ]
[ "def csv_upload_path(instance, filename):...\n", "name = '{0}/{1}'.format(instance.fs_id, filename)\n", "return name\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_6(self, VAR_12):...\n", "VAR_14 = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(VAR_12))\n", "VAR_15 = self.cur.execute(VAR_14)\n", "self.conn.commit()\n", "return VAR_15\n" ]
[ "def delete_event(self, event_id):...\n", "sql = (\n \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\"\n .format(event_id))\n", "affected_count = self.cur.execute(sql)\n", "self.conn.commit()\n", "return affected_count\n" ]
[ 0, 4, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, *VAR_4, **VAR_5):...\n", "self.sbjfun = VAR_2\n", "self.msgfun = VAR_3\n", "self.forums = VAR_0\n", "self.targets = type(VAR_1) == str and [('', VAR_1)] or type(VAR_1\n ) == tuple and list(VAR_1) or VAR_1\n", "super().__init__(*VAR_4, **kvargs)\n" ]
[ "def __init__(self, forums, targets, sbjfun, msgfun, *args, **kvargs):...\n", "self.sbjfun = sbjfun\n", "self.msgfun = msgfun\n", "self.forums = forums\n", "self.targets = type(targets) == str and [('', targets)] or type(targets\n ) == tuple and list(targets) or targets\n", "super().__init__(*args, **kvargs)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_29(self):...\n", "self.compilation_ko('require [\"toto\", \"tata\";')\n" ]
[ "def test_unclosed_string_list(self):...\n", "self.compilation_ko('require [\"toto\", \"tata\";')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_6(self, VAR_38):...\n", "VAR_38 = CLASS_17.run(self, VAR_38)\n", "if VAR_38 and self.only_whitespace.match(VAR_38):\n", "VAR_101.errors.add(errors.NO_TITLE)\n", "return VAR_38\n" ]
[ "def run(self, title):...\n", "title = VLength.run(self, title)\n", "if title and self.only_whitespace.match(title):\n", "c.errors.add(errors.NO_TITLE)\n", "return title\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "self.assertTrue({'name': 'DocField'} in DatabaseQuery('DocType').execute(\n filters={'name': 'DocField'}))\n" ]
[ "def test_filters_4(self):...\n", "self.assertTrue({'name': 'DocField'} in DatabaseQuery('DocType').execute(\n filters={'name': 'DocField'}))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@then(parsers.parse(...\n", "VAR_8 = 'string'\n", "VAR_9 = VAR_0.check_output(VAR_8.format(VAR_1, VAR_2))\n", "assert len(VAR_9.strip()) > 0, 'No {0} found in namespace {1}'.format(VAR_1,\n VAR_2)\n" ]
[ "@then(parsers.parse(...\n", "cmd = (\n 'kubectl --kubeconfig=/etc/kubernetes/admin.conf get {0} --namespace {1} -o custom-columns=:metadata.name'\n )\n", "cmd_res = host.check_output(cmd.format(resource, namespace))\n", "assert len(cmd_res.strip()) > 0, 'No {0} found in namespace {1}'.format(\n resource, namespace)\n" ]
[ 0, 2, 2, 2 ]
[ "Condition", "Assign'", "Assign'", "Assert'" ]
[ "@mock.patch('requests.post', FUNC_0)...\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_4 = '/api/apps/{app_id}/builds'.format(**locals())\n", "VAR_7 = {'image': 'autotest/example'}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_13 = Build.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(VAR_13), '{}-{}'.format(VAR_5.data['app'], VAR_5.data[\n 'uuid'][:7]))\n" ]
[ "@mock.patch('requests.post', mock_import_repository_task)...\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", "url = '/api/apps/{app_id}/builds'.format(**locals())\n", "body = {'image': 'autotest/example'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "build = Build.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(build), '{}-{}'.format(response.data['app'], response.\n data['uuid'][:7]))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import os.path\n", "from django.test import TestCase\n", "from django.conf import settings\n", "from api.models import App\n", "\"\"\"Tests creation of applications\"\"\"\n", "VAR_1 = ['tests.json']\n", "def FUNC_0(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "settings.SSH_PRIVATE_KEY = '<some-ssh-private-key>'\n", "def FUNC_1(self):...\n", "settings.SSH_PRIVATE_KEY = ''\n", "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = '/api/apps'\n", "VAR_3 = self.client.post(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_4 = VAR_3.data['id']\n", "self.assertIn('id', VAR_3.data)\n", "self.assertIn('url', VAR_3.data)\n", "self.assertEqual(VAR_3.data['url'], '{app_id}.deisapp.local'.format(**locals())\n )\n", "VAR_3 = self.client.get('/api/apps')\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertEqual(len(VAR_3.data['results']), 1)\n", "VAR_2 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 200)\n", "VAR_5 = {'id': 'new'}\n", "VAR_3 = self.client.patch(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 405)\n", "VAR_3 = self.client.delete(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 204)\n", "def FUNC_3(self):...\n", "VAR_5 = {'id': 'myid'}\n", "VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 201)\n", "VAR_5 = {'id': VAR_3.data['id']}\n", "VAR_3 = self.client.post('/api/apps', json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertContains(VAR_3, 'App with this Id already exists.', status_code=400)\n", "return VAR_3\n" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "import os.path\n", "from django.test import TestCase\n", "from django.conf import settings\n", "from api.models import App\n", "\"\"\"Tests creation of applications\"\"\"\n", "fixtures = ['tests.json']\n", "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "settings.SSH_PRIVATE_KEY = '<some-ssh-private-key>'\n", "def tearDown(self):...\n", "settings.SSH_PRIVATE_KEY = ''\n", "def test_app(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "self.assertIn('id', response.data)\n", "self.assertIn('url', response.data)\n", "self.assertEqual(response.data['url'], '{app_id}.deisapp.local'.format(**\n locals()))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "body = {'id': 'new'}\n", "response = self.client.patch(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 405)\n", "response = self.client.delete(url)\n", "self.assertEqual(response.status_code, 204)\n", "def test_app_override_id(self):...\n", "body = {'id': 'myid'}\n", "response = self.client.post('/api/apps', json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "body = {'id': response.data['id']}\n", "response = self.client.post('/api/apps', json.dumps(body), content_type=\n 'application/json')\n", "self.assertContains(response, 'App with this Id already exists.',\n status_code=400)\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 5, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_11(self, VAR_4, VAR_11, VAR_13=False):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 is None and self.null:\n", "return None\n", "while isinstance(VAR_4, str):\n", "return json_encode(VAR_4, cls=self.encoder, sort_keys=True)\n", "VAR_4 = json_decode(VAR_4)\n" ]
[ "def get_db_prep_value(self, value, connection, prepared=False):...\n", "\"\"\"docstring\"\"\"\n", "if value is None and self.null:\n", "return None\n", "while isinstance(value, str):\n", "return json_encode(value, cls=self.encoder, sort_keys=True)\n", "value = json_decode(value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Assign'" ]
[ "@click.command(help='Get state')...\n", "VAR_39 = newrelic.get_state(VAR_0.obj['ACCOUNT'])\n", "print('# Generated on {}'.format(datetime.utcnow().isoformat()))\n", "print(yaml.dump(VAR_39, allow_unicode=True, default_flow_style=False,\n Dumper=yamlordereddictloader.SafeDumper))\n" ]
[ "@click.command(help='Get state')...\n", "state = newrelic.get_state(ctx.obj['ACCOUNT'])\n", "print('# Generated on {}'.format(datetime.utcnow().isoformat()))\n", "print(yaml.dump(state, allow_unicode=True, default_flow_style=False, Dumper\n =yamlordereddictloader.SafeDumper))\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Expr'", "Expr'" ]
[ "import sys\n", "if 'lib' not in sys.path:\n", "sys.path.append('lib')\n", "import os, signal, logging, threading, re, traceback, time\n", "import random\n", "import zmq\n", "from queue import Queue\n", "import sup\n", "import wzworkers as workers\n", "from dataloader import DataLoader\n", "from uniwipe import UniWipe\n", "from wipeskel import *\n", "import wzrpc\n", "from beon import regexp\n", "import pickle\n", "from logging import config\n", "from logconfig import logging_config\n", "VAR_34.dictConfig(logging_config)\n", "VAR_0 = logging.getLogger()\n", "VAR_1 = zmq.Context()\n", "VAR_2 = 'ipc://signals'\n", "VAR_3 = VAR_1.socket(zmq.PUB)\n", "VAR_3.bind(VAR_2)\n", "VAR_4 = set()\n", "VAR_5 = dict()\n", "VAR_6 = set()\n", "VAR_7 = dict()\n", "def FUNC_0():...\n", "VAR_30 = []\n", "VAR_30.append('[image-original-none-http://simg4.gelbooru.com/' +\n '/images/db/1d/db1dfb62a40f5ced2043bb8966da9a98.png]')\n", "VAR_30.append('Каждый хочет дружить с ядерной бомбой.')\n", "VAR_30.append(str(random.randint(0, 9999999999)))\n", "return '\\n'.join(VAR_30)\n" ]
[ "import sys\n", "if 'lib' not in sys.path:\n", "sys.path.append('lib')\n", "import os, signal, logging, threading, re, traceback, time\n", "import random\n", "import zmq\n", "from queue import Queue\n", "import sup\n", "import wzworkers as workers\n", "from dataloader import DataLoader\n", "from uniwipe import UniWipe\n", "from wipeskel import *\n", "import wzrpc\n", "from beon import regexp\n", "import pickle\n", "from logging import config\n", "from logconfig import logging_config\n", "config.dictConfig(logging_config)\n", "logger = logging.getLogger()\n", "ctx = zmq.Context()\n", "sig_addr = 'ipc://signals'\n", "sig_sock = ctx.socket(zmq.PUB)\n", "sig_sock.bind(sig_addr)\n", "domains = set()\n", "targets = dict()\n", "protected = set()\n", "forums = dict()\n", "def message():...\n", "msg = []\n", "msg.append('[image-original-none-http://simg4.gelbooru.com/' +\n '/images/db/1d/db1dfb62a40f5ced2043bb8966da9a98.png]')\n", "msg.append('Каждый хочет дружить с ядерной бомбой.')\n", "msg.append(str(random.randint(0, 9999999999)))\n", "return '\\n'.join(msg)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Condition", "Expr'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_10(self, VAR_13, VAR_14):...\n", "self.filechooser_creation_dialog = Gtk.FileChooserDialog('Create new Database',\n self, Gtk.FileChooserAction.SAVE, (Gtk.STOCK_CANCEL, Gtk.ResponseType.\n CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK))\n", "self.filechooser_creation_dialog.set_current_name('Database.kdbx')\n", "self.filechooser_creation_dialog.set_modal(True)\n", "VAR_36 = Gtk.FileFilter()\n", "VAR_36.set_name('Keepass 2 Database')\n", "VAR_36.add_mime_type('application/x-keepass2')\n", "self.filechooser_creation_dialog.add_filter(VAR_36)\n", "VAR_37 = self.filechooser_creation_dialog.run()\n", "if VAR_37 == Gtk.ResponseType.OK:\n", "self.does_file_exist()\n", "if VAR_37 == Gtk.ResponseType.CANCEL:\n", "self.filechooser_creation_dialog.close()\n" ]
[ "def create_filechooser(self, widget, none):...\n", "self.filechooser_creation_dialog = Gtk.FileChooserDialog('Create new Database',\n self, Gtk.FileChooserAction.SAVE, (Gtk.STOCK_CANCEL, Gtk.ResponseType.\n CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK))\n", "self.filechooser_creation_dialog.set_current_name('Database.kdbx')\n", "self.filechooser_creation_dialog.set_modal(True)\n", "filter_text = Gtk.FileFilter()\n", "filter_text.set_name('Keepass 2 Database')\n", "filter_text.add_mime_type('application/x-keepass2')\n", "self.filechooser_creation_dialog.add_filter(filter_text)\n", "response = self.filechooser_creation_dialog.run()\n", "if response == Gtk.ResponseType.OK:\n", "self.does_file_exist()\n", "if response == Gtk.ResponseType.CANCEL:\n", "self.filechooser_creation_dialog.close()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_17(self):...\n", "VAR_7 = Pa11yCrawler('')\n", "VAR_7.generate_html_reports()\n", "self._mock_sh.assert_has_calls([call(\n 'pa11ycrawler json-to-html --pa11ycrawler-reports-dir={}'.format(VAR_7.\n pa11y_report_dir))])\n" ]
[ "def test_generate_html_reports(self):...\n", "suite = Pa11yCrawler('')\n", "suite.generate_html_reports()\n", "self._mock_sh.assert_has_calls([call(\n 'pa11ycrawler json-to-html --pa11ycrawler-reports-dir={}'.format(suite.\n pa11y_report_dir))])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_37(self):...\n", "for VAR_46 in VAR_11.witch_targets:\n", "if VAR_46['domain'] == 'beon.ru' and VAR_46['forum'] == 'anonymous':\n", "FUNC_10(VAR_46['id'], VAR_46['user'])\n" ]
[ "def targets_from_witch(self):...\n", "for t in d.witch_targets:\n", "if t['domain'] == 'beon.ru' and t['forum'] == 'anonymous':\n", "add_target_exc(t['id'], t['user'])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "For", "Expr'" ]
[ "def __init__(self, VAR_1, VAR_5, VAR_4=None):...\n", "GenericRequest.__init__(self, VAR_1, VAR_4)\n", "self.url = '%stasks/%s/description' % (self.base_url, VAR_5)\n", "self.task_id = VAR_5\n" ]
[ "def __init__(self, browser, task_id, base_url=None):...\n", "GenericRequest.__init__(self, browser, base_url)\n", "self.url = '%stasks/%s/description' % (self.base_url, task_id)\n", "self.task_id = task_id\n" ]
[ 0, 0, 5, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_6(self, VAR_41):...\n", "if VAR_41:\n", "return self.error()\n", "return Thing._by_fullname(VAR_41, False, data=True)\n" ]
[ "def run(self, fullname):...\n", "if fullname:\n", "return self.error()\n", "return Thing._by_fullname(fullname, False, data=True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_8(self, VAR_8, VAR_10, VAR_9):...\n", "VAR_0.info('Start creation new repeating event')\n", "VAR_20 = VAR_8.copy(default={'website_published': True})\n", "VAR_20.date_end = VAR_9\n", "VAR_20.date_begin = VAR_10\n", "VAR_8.fit_repetition_enabled = False\n", "VAR_8.fit_repetition = ''\n" ]
[ "def _create_new_event(self, old_repeating_event, new_start_date, new_end_date):...\n", "_logger.info('Start creation new repeating event')\n", "new_repeating_event = old_repeating_event.copy(default={'website_published':\n True})\n", "new_repeating_event.date_end = new_end_date\n", "new_repeating_event.date_begin = new_start_date\n", "old_repeating_event.fit_repetition_enabled = False\n", "old_repeating_event.fit_repetition = ''\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def __enter__(self):...\n", "return self\n" ]
[ "def __enter__(self):...\n", "return self\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self):...\n", "self.assertEquals(0, self.course_module.get_late_submission_point_worth())\n", "self.assertEquals(80, self.course_module_with_late_submissions_allowed.\n get_late_submission_point_worth())\n" ]
[ "def test_course_module_late_submission_point_worth(self):...\n", "self.assertEquals(0, self.course_module.get_late_submission_point_worth())\n", "self.assertEquals(80, self.course_module_with_late_submissions_allowed.\n get_late_submission_point_worth())\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_0(VAR_1, VAR_2, **VAR_3):...\n", "VAR_5 = VAR_1.get_url_kwargs()\n", "VAR_5.update({'model': VAR_2})\n", "VAR_5.update(VAR_3)\n", "return VAR_5\n" ]
[ "def _normal_kwargs(instance, model_name, **extra_kwargs):...\n", "kwargs = instance.get_url_kwargs()\n", "kwargs.update({'model': model_name})\n", "kwargs.update(extra_kwargs)\n", "return kwargs\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_8(self, VAR_10):...\n", "self.model.reset()\n", "self.load_channels(1, 50)\n" ]
[ "def _on_filter_input_change(self, _):...\n", "self.model.reset()\n", "self.load_channels(1, 50)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_19(self, VAR_27, VAR_28=200, VAR_29=None):...\n", "\"\"\"docstring\"\"\"\n", "self.response.set_status(VAR_28)\n", "self.response.headers.update(VAR_29 or {})\n", "self.response.headers['Content-Type'] = self.CONTENT_TYPE_FULL\n", "self.response.write(json.dumps(VAR_27))\n" ]
[ "def send_response(self, response, http_code=200, headers=None):...\n", "\"\"\"docstring\"\"\"\n", "self.response.set_status(http_code)\n", "self.response.headers.update(headers or {})\n", "self.response.headers['Content-Type'] = self.CONTENT_TYPE_FULL\n", "self.response.write(json.dumps(response))\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_27):...\n", "if VAR_27:\n", "VAR_27 = int(VAR_27, 36)\n", "return Comment._byID(VAR_27, True)\n" ]
[ "def run(self, cid):...\n", "if cid:\n", "cid = int(cid, 36)\n", "return Comment._byID(cid, True)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "from flask import Flask, request, render_template, redirect, url_for\n", "import mysql.connector\n", "VAR_0 = mysql.connector.connect(host='localhost', user='root', password=\n 'navi98%', database='DB_work')\n", "VAR_1 = VAR_0.cursor()\n", "VAR_2 = Flask(__name__)\n", "@VAR_2.route('/')...\n", "VAR_4 = 'SELECT img_path, img_name\\t\\t\\tFROM imageTable'\n", "VAR_1.execute(VAR_4)\n", "return render_template('index.html', images=cursor)\n" ]
[ "from flask import Flask, request, render_template, redirect, url_for\n", "import mysql.connector\n", "db = mysql.connector.connect(host='localhost', user='root', password=\n 'navi98%', database='DB_work')\n", "cursor = db.cursor()\n", "app = Flask(__name__)\n", "@app.route('/')...\n", "query = 'SELECT img_path, img_name\\t\\t\\tFROM imageTable'\n", "cursor.execute(query)\n", "return render_template('index.html', images=cursor)\n" ]
[ 0, 0, 4, 0, 0, 0, 4, 4, 4 ]
[ "ImportFrom'", "Import'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "VAR_1 = self.client.get('/qa/extractedtext/5', follow=True)\n", "self.assertIn(b'/datadocument/5', VAR_1.content)\n" ]
[ "def test_dd_link(self):...\n", "response = self.client.get('/qa/extractedtext/5', follow=True)\n", "self.assertIn(b'/datadocument/5', response.content)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@rest_utils.ajax(data_required=True)...\n", "VAR_9 = VAR_1.DATA['instance_id']\n", "VAR_6 = VAR_1.DATA['name']\n", "VAR_10 = api.nova.snapshot_create(VAR_1, VAR_9=instance_id, VAR_6=name)\n", "return VAR_10\n" ]
[ "@rest_utils.ajax(data_required=True)...\n", "instance_id = request.DATA['instance_id']\n", "name = request.DATA['name']\n", "result = api.nova.snapshot_create(request, instance_id=instance_id, name=name)\n", "return result\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@api.multi...\n", "self._secure_save_data()\n", "super(CLASS_0, self).forget_me()\n", "self.write({'church_id': False, 'church_unlinked': False, 'street3': False,\n 'firstname': False, 'deathdate': False, 'geo_point': False,\n 'partner_latitude': False, 'partner_longitude': False})\n", "self.advocate_details_id.unlink()\n", "self.survey_inputs.unlink()\n", "self.env['mail.tracking.email'].search([('partner_id', '=', self.id)]).unlink()\n", "self.env['auditlog.log'].search([('model_id.model', '=', 'res.partner'), (\n 'res_id', '=', self.id)]).unlink()\n", "self.env['partner.communication.job'].search([('partner_id', '=', self.id)]\n ).unlink()\n", "self.message_ids.unlink()\n", "return True\n" ]
[ "@api.multi...\n", "self._secure_save_data()\n", "super(ResPartner, self).forget_me()\n", "self.write({'church_id': False, 'church_unlinked': False, 'street3': False,\n 'firstname': False, 'deathdate': False, 'geo_point': False,\n 'partner_latitude': False, 'partner_longitude': False})\n", "self.advocate_details_id.unlink()\n", "self.survey_inputs.unlink()\n", "self.env['mail.tracking.email'].search([('partner_id', '=', self.id)]).unlink()\n", "self.env['auditlog.log'].search([('model_id.model', '=', 'res.partner'), (\n 'res_id', '=', self.id)]).unlink()\n", "self.env['partner.communication.job'].search([('partner_id', '=', self.id)]\n ).unlink()\n", "self.message_ids.unlink()\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "GenericRequest._prepare(self)\n", "VAR_17 = os.path.join(self.submissions_path, self.task[1])\n", "VAR_18 = os.listdir(VAR_17)\n", "VAR_19 = random.choice(VAR_18)\n", "self.source_path = os.path.join(VAR_17, VAR_19)\n", "self.files = []\n", "if os.path.isdir(self.source_path):\n", "VAR_22 = os.listdir(self.source_path)\n", "VAR_8 = os.path.splitext(VAR_19)[0]\n", "self.files = [('%s.%%l' % os.path.splitext(sf)[0], os.path.join(self.\n source_path, sf)) for sf in VAR_22]\n", "self.files = [('%s.%%l' % VAR_8, self.source_path)]\n" ]
[ "def _prepare(self):...\n", "\"\"\"docstring\"\"\"\n", "GenericRequest._prepare(self)\n", "task_path = os.path.join(self.submissions_path, self.task[1])\n", "sources = os.listdir(task_path)\n", "source = random.choice(sources)\n", "self.source_path = os.path.join(task_path, source)\n", "self.files = []\n", "if os.path.isdir(self.source_path):\n", "submission_formats = os.listdir(self.source_path)\n", "submission_format = os.path.splitext(source)[0]\n", "self.files = [('%s.%%l' % os.path.splitext(sf)[0], os.path.join(self.\n source_path, sf)) for sf in submission_formats]\n", "self.files = [('%s.%%l' % submission_format, self.source_path)]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_9(self, VAR_10):...\n", "VAR_32 = Gtk.FileChooserDialog('Choose Keyfile', self.window, Gtk.\n FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk\n .STOCK_OPEN, Gtk.ResponseType.OK))\n", "VAR_26 = self.builder.get_object('composite_unlock_select_button')\n", "VAR_29 = Gtk.FileFilter()\n", "VAR_29.set_name('Keyfile')\n", "VAR_29.add_mime_type('application/octet-stream')\n", "VAR_29.add_mime_type('application/x-keepass2')\n", "VAR_29.add_mime_type('text/plain')\n", "VAR_29.add_mime_type('application/x-iwork-keynote-sffkey')\n", "VAR_32.add_filter(VAR_29)\n", "VAR_30 = VAR_32.run()\n", "if VAR_30 == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' + VAR_32.get_filename())\n", "if VAR_30 == Gtk.ResponseType.CANCEL:\n", "VAR_32.close()\n", "self.logging_manager.log_debug('File selection cancelled')\n", "VAR_38 = VAR_32.get_filename()\n", "VAR_32.close()\n", "VAR_26.set_label(ntpath.basename(VAR_38))\n", "self.composite_keyfile_path = VAR_38\n" ]
[ "def on_composite_unlock_select_button_clicked(self, widget):...\n", "filechooser_opening_dialog = Gtk.FileChooserDialog('Choose Keyfile', self.\n window, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType\n .CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))\n", "composite_unlock_select_button = self.builder.get_object(\n 'composite_unlock_select_button')\n", "filter_text = Gtk.FileFilter()\n", "filter_text.set_name('Keyfile')\n", "filter_text.add_mime_type('application/octet-stream')\n", "filter_text.add_mime_type('application/x-keepass2')\n", "filter_text.add_mime_type('text/plain')\n", "filter_text.add_mime_type('application/x-iwork-keynote-sffkey')\n", "filechooser_opening_dialog.add_filter(filter_text)\n", "response = filechooser_opening_dialog.run()\n", "if response == Gtk.ResponseType.OK:\n", "self.logging_manager.log_debug('File selected: ' +\n filechooser_opening_dialog.get_filename())\n", "if response == Gtk.ResponseType.CANCEL:\n", "filechooser_opening_dialog.close()\n", "self.logging_manager.log_debug('File selection cancelled')\n", "file_path = filechooser_opening_dialog.get_filename()\n", "filechooser_opening_dialog.close()\n", "composite_unlock_select_button.set_label(ntpath.basename(file_path))\n", "self.composite_keyfile_path = file_path\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "def FUNC_36(VAR_11):...\n", "for VAR_51, VAR_58 in VAR_11.items():\n", "if isinstance(VAR_58, str) or not isinstance(VAR_58, Iterable):\n", "VAR_58 = [VAR_58]\n", "yield [(VAR_51, VAR_16) for VAR_16 in VAR_58]\n" ]
[ "def flatten(wildcards):...\n", "for wildcard, values in wildcards.items():\n", "if isinstance(values, str) or not isinstance(values, Iterable):\n", "values = [values]\n", "yield [(wildcard, value) for value in values]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_5(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "return bool(self.getIDbyPath(VAR_8))\n" ]
[ "def fileExists(self, pth):...\n", "\"\"\"docstring\"\"\"\n", "return bool(self.getIDbyPath(pth))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_10(*VAR_11):...\n", "VAR_12 = ' '.join(str(elem) for elem in VAR_11)\n", "return VAR_12\n" ]
[ "def fastboot_call(*args):...\n", "arg_str = ' '.join(str(elem) for elem in args)\n", "return arg_str\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "if self._state is None:\n", "self._state = np.zeros(2 ** self.wires, dtype=complex)\n", "for operation in self._queue:\n", "self._state[0] = 1\n", "if operation.name == 'QubitStateVector':\n", "VAR_1 = CLASS_0._get_operator_matrix(self._observe)\n", "self._out = np.full(self.wires, np.nan)\n", "VAR_22 = np.asarray(operation.params[0])\n", "VAR_23 = CLASS_0._get_operator_matrix(operation)\n", "if self.shots == 0:\n", "if VAR_22.ndim == 1 and VAR_22.shape[0] == 2 ** self.wires:\n", "if len(operation.wires) == 1:\n", "VAR_44 = self.ev(VAR_1, [self._observe.wires])\n", "if 0:\n", "self._state = VAR_22\n", "VAR_23 = self.expand_one(VAR_23, operation.wires)\n", "if len(operation.wires) == 2:\n", "self._out = VAR_44\n", "VAR_44 = self.ev(VAR_1, self._observe.wires)\n", "VAR_9, VAR_21 = FUNC_0(VAR_1)\n", "self._state = VAR_23 @ self._state\n", "VAR_23 = self.expand_two(VAR_23, operation.wires)\n", "VAR_45 = self.ev(VAR_1 ** 2, self._observe.wires) - VAR_44 ** 2\n", "VAR_46 = self.ev(VAR_21[0], self._observe.wires)\n", "VAR_44 = np.random.normal(VAR_44, np.sqrt(VAR_45 / self.shots))\n", "VAR_47 = np.random.binomial(self.shots, VAR_46)\n", "VAR_44 = (VAR_47 * VAR_9[0] + (self.shots - VAR_47) * VAR_9[1]) / self.shots\n" ]
[ "def execute(self):...\n", "\"\"\"docstring\"\"\"\n", "if self._state is None:\n", "self._state = np.zeros(2 ** self.wires, dtype=complex)\n", "for operation in self._queue:\n", "self._state[0] = 1\n", "if operation.name == 'QubitStateVector':\n", "A = DefaultQubit._get_operator_matrix(self._observe)\n", "self._out = np.full(self.wires, np.nan)\n", "state = np.asarray(operation.params[0])\n", "U = DefaultQubit._get_operator_matrix(operation)\n", "if self.shots == 0:\n", "if state.ndim == 1 and state.shape[0] == 2 ** self.wires:\n", "if len(operation.wires) == 1:\n", "ev = self.ev(A, [self._observe.wires])\n", "if 0:\n", "self._state = state\n", "U = self.expand_one(U, operation.wires)\n", "if len(operation.wires) == 2:\n", "self._out = ev\n", "ev = self.ev(A, self._observe.wires)\n", "a, P = spectral_decomposition_qubit(A)\n", "self._state = U @ self._state\n", "U = self.expand_two(U, operation.wires)\n", "var = self.ev(A ** 2, self._observe.wires) - ev ** 2\n", "p0 = self.ev(P[0], self._observe.wires)\n", "ev = np.random.normal(ev, np.sqrt(var / self.shots))\n", "n0 = np.random.binomial(self.shots, p0)\n", "ev = (n0 * a[0] + (self.shots - n0) * a[1]) / self.shots\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "async def FUNC_1(self, VAR_0):...\n", "for callback in self.on_member_remove_callbacks:\n", "await callback(VAR_0)\n" ]
[ "async def on_member_remove(self, member):...\n", "for callback in self.on_member_remove_callbacks:\n", "await callback(member)\n" ]
[ 0, 0, 0 ]
[ "AsyncFunctionDef'", "For", "Expr'" ]
[ "def FUNC_5(self):...\n", "VAR_0 = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "VAR_0.tags = json.dumps(['v1.0.0', 'v1.0.1'])\n", "VAR_0.put()\n", "VAR_7 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "VAR_7.put()\n", "VAR_8 = Version(parent=library.key, id='v1.0.1', sha='lol')\n", "VAR_8.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.1/README.md',\n chr(248))\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 0)\n", "self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.1'), params={\n 'latestVersion': 'True'})\n", "VAR_8 = VAR_8.key.get()\n", "self.assertEqual(VAR_8.error, 'Could not store README.md as a utf-8 string')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n" ]
[ "def test_ingest_version_falls_back(self):...\n", "library = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "library.tags = json.dumps(['v1.0.0', 'v1.0.1'])\n", "library.put()\n", "version1 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "version1.put()\n", "version2 = Version(parent=library.key, id='v1.0.1', sha='lol')\n", "version2.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.1/README.md',\n chr(248))\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 0)\n", "self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.1'), params={\n 'latestVersion': 'True'})\n", "version2 = version2.key.get()\n", "self.assertEqual(version2.error, 'Could not store README.md as a utf-8 string')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 1)\n", "self.assertEqual(tasks[0].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def __repr__(self):...\n", "return '<Options for %s>' % self.resource_name\n" ]
[ "def __repr__(self):...\n", "return '<Options for %s>' % self.resource_name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(VAR_27, VAR_28):...\n", "VAR_15.pack_forget()\n", "VAR_10.forget()\n", "VAR_36 = Frame(self, bg='#f8f8f8')\n", "VAR_36.rowconfigure(0, weight=1)\n", "VAR_36.columnconfigure(0, weight=1)\n", "VAR_36.rowconfigure(1, weight=3)\n", "VAR_36.columnconfigure(1, weight=3)\n", "VAR_36.pack()\n", "VAR_37 = []\n", "VAR_38 = []\n", "VAR_39 = 'meal_planner.db'\n", "VAR_48 = conn.cursor()\n", "VAR_49 = VAR_48.execute('SELECT * FROM recipe')\n", "for result in [VAR_49]:\n", "for VAR_32 in result.fetchall():\n", "for VAR_44 in range(len(VAR_37)):\n", "VAR_51 = VAR_32[0]\n", "Button(VAR_36, text=recipeNames[i], highlightbackground='#f8f8f8', command=\n lambda x=recipeNames[i], y=ingredientList[i]: add_recipe(x, y,\n add_meal_frame, rowLocation, columnLocation)).grid(VAR_32=i, VAR_33=0)\n", "VAR_30 = VAR_32[4]\n", "VAR_37.append(VAR_51)\n", "VAR_38.append(VAR_30)\n" ]
[ "def add_meal(rowLocation, columnLocation):...\n", "menu.pack_forget()\n", "viewRecipeFrame.forget()\n", "add_meal_frame = Frame(self, bg='#f8f8f8')\n", "add_meal_frame.rowconfigure(0, weight=1)\n", "add_meal_frame.columnconfigure(0, weight=1)\n", "add_meal_frame.rowconfigure(1, weight=3)\n", "add_meal_frame.columnconfigure(1, weight=3)\n", "add_meal_frame.pack()\n", "recipeNames = []\n", "ingredientList = []\n", "database_file = 'meal_planner.db'\n", "cursor = conn.cursor()\n", "selection = cursor.execute('SELECT * FROM recipe')\n", "for result in [selection]:\n", "for row in result.fetchall():\n", "for i in range(len(recipeNames)):\n", "name = row[0]\n", "Button(add_meal_frame, text=recipeNames[i], highlightbackground='#f8f8f8',\n command=lambda x=recipeNames[i], y=ingredientList[i]: add_recipe(x, y,\n add_meal_frame, rowLocation, columnLocation)).grid(row=i, column=0)\n", "ingredients = row[4]\n", "recipeNames.append(name)\n", "ingredientList.append(ingredients)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "For", "For", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.clear_log_area_action.triggered.connect(self.clear_log_area)\n", "self.open_idle_action.triggered.connect(self.open_idle)\n", "self.restart_action.triggered.connect(self.restart)\n", "self.set_wavelength_action.triggered.connect(self.set_wavelength_dialog)\n", "self.set_bifi_approx_wavelength_action.triggered.connect(self.\n set_bifi_approx_wavelength_dialog)\n", "self.set_bifi_motor_pos_action.triggered.connect(self.set_bifi_motor_pos_dialog\n )\n", "self.set_thin_eta_motor_pos_action.triggered.connect(self.\n set_thin_eta_motor_pos_dialog)\n", "self.bifi_scan_action.triggered.connect(self.start_bifi_scan)\n", "self.thin_eta_scan_action.triggered.connect(self.start_thin_etalon_scan)\n", "self.lock_all_action.triggered.connect(self.toggle_lock_all)\n", "self.lock_slow_piezo_action.triggered.connect(self.toggle_slow_piezo_lock)\n", "self.lock_thin_etalon_action.triggered.connect(self.toggle_thin_etalon_lock)\n", "self.lock_piezo_etalon_action.triggered.connect(self.toggle_piezo_etalon_lock)\n", "self.lock_fast_piezo_action.triggered.connect(self.toggle_fast_piezo_lock)\n" ]
[ "def setup_action_listeners(self):...\n", "self.clear_log_area_action.triggered.connect(self.clear_log_area)\n", "self.open_idle_action.triggered.connect(self.open_idle)\n", "self.restart_action.triggered.connect(self.restart)\n", "self.set_wavelength_action.triggered.connect(self.set_wavelength_dialog)\n", "self.set_bifi_approx_wavelength_action.triggered.connect(self.\n set_bifi_approx_wavelength_dialog)\n", "self.set_bifi_motor_pos_action.triggered.connect(self.set_bifi_motor_pos_dialog\n )\n", "self.set_thin_eta_motor_pos_action.triggered.connect(self.\n set_thin_eta_motor_pos_dialog)\n", "self.bifi_scan_action.triggered.connect(self.start_bifi_scan)\n", "self.thin_eta_scan_action.triggered.connect(self.start_thin_etalon_scan)\n", "self.lock_all_action.triggered.connect(self.toggle_lock_all)\n", "self.lock_slow_piezo_action.triggered.connect(self.toggle_slow_piezo_lock)\n", "self.lock_thin_etalon_action.triggered.connect(self.toggle_thin_etalon_lock)\n", "self.lock_piezo_etalon_action.triggered.connect(self.toggle_piezo_etalon_lock)\n", "self.lock_fast_piezo_action.triggered.connect(self.toggle_fast_piezo_lock)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "async def FUNC_3():...\n", "VAR_12.channel.send('Command list:\\n' + '\\n' +\n '`help` - Shows this help text\\n' +\n '`whitelist` - Add user(s) to the whitelist')\n" ]
[ "async def help():...\n", "message.channel.send('Command list:\\n' + '\\n' +\n '`help` - Shows this help text\\n' +\n '`whitelist` - Add user(s) to the whitelist')\n" ]
[ 0, 0 ]
[ "AsyncFunctionDef'", "Expr'" ]
[ "def FUNC_17(self):...\n", "return '`tab{0}`.name in ({1})'.format(self.doctype, ', '.join([\"'%s'\"] *\n len(self.shared))) % tuple([frappe.db.escape(s, percent=False) for s in\n self.shared])\n" ]
[ "def get_share_condition(self):...\n", "return '`tab{0}`.name in ({1})'.format(self.doctype, ', '.join([\"'%s'\"] *\n len(self.shared))) % tuple([frappe.db.escape(s, percent=False) for s in\n self.shared])\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "\"\"\"string\"\"\"\n", "from __future__ import print_function\n", "import os\n", "from six import iteritems\n", "import config as bconfig\n", "from invenio.legacy.bibclassify import ontology_reader as reader\n", "import text_extractor as extractor\n", "import text_normalizer as normalizer\n", "import keyword_analyzer as keyworder\n", "import acronym_analyzer as acronymer\n", "from invenio.utils.url import make_user_agent_string\n", "from invenio.utils.text import encode_for_xml\n", "VAR_0 = bconfig.get_logger('bibclassify.engine')\n", "def FUNC_0(VAR_1, VAR_2, VAR_3='text', VAR_4=bconfig....\n", "\"\"\"docstring\"\"\"\n", "def FUNC_30():...\n", "if VAR_3 == 'text':\n", "print('Input file: %s' % VAR_75)\n", "VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronyms)\n", "if VAR_12:\n", "return VAR_52\n", "if isinstance(VAR_52, dict):\n", "for VAR_84 in VAR_52:\n", "for entry in VAR_1:\n", "print(VAR_52[VAR_84])\n", "VAR_0.info('Trying to read input file %s.' % entry)\n", "def FUNC_1(VAR_14, VAR_2, VAR_3='text', VAR_4=bconfig....\n", "VAR_15 = None\n", "\"\"\"docstring\"\"\"\n", "VAR_75 = ''\n", "VAR_0.info('Analyzing keywords for local file %s.' % VAR_14)\n", "if os.path.isdir(entry):\n", "VAR_15 = extractor.text_lines_from_local_file(VAR_14)\n", "for VAR_40 in os.listdir(entry):\n", "if os.path.isfile(entry):\n", "return FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5=\n spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronyms)\n", "if VAR_40.startswith('.'):\n", "VAR_15 = extractor.text_lines_from_local_file(entry)\n", "VAR_15 = extractor.text_lines_from_url(entry, user_agent=\n make_user_agent_string('BibClassify'))\n", "VAR_40 = os.path.join(entry, VAR_40)\n", "if VAR_15:\n", "if VAR_15:\n", "if os.path.isfile(VAR_40):\n", "VAR_75 = os.path.basename(entry)\n", "VAR_75 = entry.split('/')[-1]\n", "VAR_15 = extractor.text_lines_from_local_file(VAR_40)\n", "FUNC_30()\n", "FUNC_30()\n", "if VAR_15:\n", "VAR_75 = VAR_40\n", "FUNC_30()\n" ]
[ "\"\"\"\nBibClassify engine.\n\nThis module is the main module of BibClassify. its two main methods are\noutput_keywords_for_sources and get_keywords_from_text. The first one output\nkeywords for a list of sources (local files or URLs, PDF or text) while the\nsecond one outputs the keywords for text lines (which are obtained using the\nmodule bibclassify_text_normalizer).\n\nThis module also takes care of the different outputs (text, MARCXML or HTML).\nBut unfortunately there is a confusion between running in a standalone mode\nand producing output suitable for printing, and running in a web-based\nmode where the webtemplate is used. For the moment the pieces of the representation\ncode are left in this module.\n\"\"\"\n", "from __future__ import print_function\n", "import os\n", "from six import iteritems\n", "import config as bconfig\n", "from invenio.legacy.bibclassify import ontology_reader as reader\n", "import text_extractor as extractor\n", "import text_normalizer as normalizer\n", "import keyword_analyzer as keyworder\n", "import acronym_analyzer as acronymer\n", "from invenio.utils.url import make_user_agent_string\n", "from invenio.utils.text import encode_for_xml\n", "log = bconfig.get_logger('bibclassify.engine')\n", "def output_keywords_for_sources(input_sources, taxonomy_name, output_mode=...\n", "\"\"\"docstring\"\"\"\n", "def process_lines():...\n", "if output_mode == 'text':\n", "print('Input file: %s' % source)\n", "output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with_author_keywords, rebuild_cache=rebuild_cache, only_core_tags=\n only_core_tags, extract_acronyms=extract_acronyms)\n", "if api:\n", "return output\n", "if isinstance(output, dict):\n", "for i in output:\n", "for entry in input_sources:\n", "print(output[i])\n", "log.info('Trying to read input file %s.' % entry)\n", "def get_keywords_from_local_file(local_file, taxonomy_name, output_mode=...\n", "text_lines = None\n", "\"\"\"docstring\"\"\"\n", "source = ''\n", "log.info('Analyzing keywords for local file %s.' % local_file)\n", "if os.path.isdir(entry):\n", "text_lines = extractor.text_lines_from_local_file(local_file)\n", "for filename in os.listdir(entry):\n", "if os.path.isfile(entry):\n", "return get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with_author_keywords, rebuild_cache=rebuild_cache, only_core_tags=\n only_core_tags, extract_acronyms=extract_acronyms)\n", "if filename.startswith('.'):\n", "text_lines = extractor.text_lines_from_local_file(entry)\n", "text_lines = extractor.text_lines_from_url(entry, user_agent=\n make_user_agent_string('BibClassify'))\n", "filename = os.path.join(entry, filename)\n", "if text_lines:\n", "if text_lines:\n", "if os.path.isfile(filename):\n", "source = os.path.basename(entry)\n", "source = entry.split('/')[-1]\n", "text_lines = extractor.text_lines_from_local_file(filename)\n", "process_lines()\n", "process_lines()\n", "if text_lines:\n", "source = filename\n", "process_lines()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "Condition", "Docstring", "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Condition", "For", "For", "Expr'", "Expr'", "Condition", "Assign'", "Docstring", "Assign'", "Expr'", "Condition", "Assign'", "For", "Condition", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_1 = 'cmd'\n", "self.assertEqual(escape_path_argument('C:\\\\Windows\\\\has-a-weird-shell.txt',\n VAR_1), '\"C:\\\\Windows\\\\has-a-weird-shell.txt\"')\n", "self.assertEqual(escape_path_argument('C:\\\\Windows\\\\lolrofl\\\\dirs\\\\', VAR_1\n ), '\"C:\\\\Windows\\\\lolrofl\\\\dirs\\\\\"')\n", "self.assertEqual(escape_path_argument('X:\\\\Users\\\\Maito Gai\\\\fi le.exe',\n VAR_1), '\"X:\\\\Users\\\\Maito Gai\\\\fi le.exe\"')\n", "self.assertEqual(escape_path_argument('X:\\\\Users\\\\Mai to Gai\\\\director y\\\\',\n VAR_1), '\"X:\\\\Users\\\\Mai to Gai\\\\director y\\\\\"')\n", "self.assertEqual(escape_path_argument(\n 'X:\\\\Users\\\\Maito Gai\\\\\"seven-gates\".y', VAR_1),\n '\"X:\\\\Users\\\\Maito Gai\\\\^\"seven-gates^\".y\"')\n", "self.assertEqual(escape_path_argument('System32\\\\my-custom relative tool\\\\',\n VAR_1), '\"System32\\\\my-custom relative tool\\\\\"')\n", "self.assertEqual(escape_path_argument('System32\\\\illegal\" name \"\".curd',\n VAR_1), '\"System32\\\\illegal^\" name ^\"^\".curd\"')\n" ]
[ "def test_escape_path_argument_cmd(self):...\n", "_type = 'cmd'\n", "self.assertEqual(escape_path_argument('C:\\\\Windows\\\\has-a-weird-shell.txt',\n _type), '\"C:\\\\Windows\\\\has-a-weird-shell.txt\"')\n", "self.assertEqual(escape_path_argument('C:\\\\Windows\\\\lolrofl\\\\dirs\\\\', _type\n ), '\"C:\\\\Windows\\\\lolrofl\\\\dirs\\\\\"')\n", "self.assertEqual(escape_path_argument('X:\\\\Users\\\\Maito Gai\\\\fi le.exe',\n _type), '\"X:\\\\Users\\\\Maito Gai\\\\fi le.exe\"')\n", "self.assertEqual(escape_path_argument('X:\\\\Users\\\\Mai to Gai\\\\director y\\\\',\n _type), '\"X:\\\\Users\\\\Mai to Gai\\\\director y\\\\\"')\n", "self.assertEqual(escape_path_argument(\n 'X:\\\\Users\\\\Maito Gai\\\\\"seven-gates\".y', _type),\n '\"X:\\\\Users\\\\Maito Gai\\\\^\"seven-gates^\".y\"')\n", "self.assertEqual(escape_path_argument('System32\\\\my-custom relative tool\\\\',\n _type), '\"System32\\\\my-custom relative tool\\\\\"')\n", "self.assertEqual(escape_path_argument('System32\\\\illegal\" name \"\".curd',\n _type), '\"System32\\\\illegal^\" name ^\"^\".curd\"')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_33(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = 'TRUNCATE TABLE players;'\n", "tools.query(VAR_11)\n", "self.assertEqual(tournament.list_players(), 1)\n" ]
[ "def test_display_zero_matches(self):...\n", "\"\"\"docstring\"\"\"\n", "q = 'TRUNCATE TABLE players;'\n", "tools.query(q)\n", "self.assertEqual(tournament.list_players(), 1)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self):...\n", "self.content = VAR_2\n" ]
[ "def __init__(self):...\n", "self.content = content\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_11(self, VAR_7=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_18 = set()\n", "if self.benchmark and (VAR_7 is None or self.benchmark in VAR_7):\n", "if not self.benchmark.exists:\n", "for VAR_28, VAR_27 in zip(self.output, self.rule.output):\n", "VAR_18.add(self.benchmark)\n", "if VAR_7 is None or VAR_28 in VAR_7:\n", "return VAR_18\n", "if VAR_28 in self.dynamic_output:\n", "if not self.expand_dynamic(VAR_27, VAR_13=self.wildcards, VAR_14=_IOFile.\n", "if not VAR_28.exists:\n", "VAR_18.add('{} (dynamic)'.format(VAR_27))\n", "VAR_18.add(VAR_28)\n" ]
[ "def missing_output(self, requested=None):...\n", "\"\"\"docstring\"\"\"\n", "files = set()\n", "if self.benchmark and (requested is None or self.benchmark in requested):\n", "if not self.benchmark.exists:\n", "for f, f_ in zip(self.output, self.rule.output):\n", "files.add(self.benchmark)\n", "if requested is None or f in requested:\n", "return files\n", "if f in self.dynamic_output:\n", "if not self.expand_dynamic(f_, restriction=self.wildcards, omit_value=\n", "if not f.exists:\n", "files.add('{} (dynamic)'.format(f_))\n", "files.add(f)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Condition", "For", "Expr'", "Condition", "Return'", "Condition", "Condition", "Condition", "Expr'", "Expr'" ]
[ "@integration_synonym_api...\n", "FUNC_2(VAR_2)\n", "FUNC_3(VAR_2, 'RHEN GNAT', VAR_7='1')\n", "FUNC_5(VAR_4, VAR_5, VAR_11='REN NAT', VAR_10=[{'name': '----REN NAT'}, {\n 'name': 'RHEN GNAT'}, {'name': '----REN'}])\n" ]
[ "@integration_synonym_api...\n", "clean_database(solr)\n", "seed_database_with(solr, 'RHEN GNAT', id='1')\n", "verify_results(client, jwt, query='REN NAT', expected=[{'name':\n '----REN NAT'}, {'name': 'RHEN GNAT'}, {'name': '----REN'}])\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "@auth.require(acl.is_bot)...\n", "VAR_4 = self.parse_body()\n", "VAR_14 = VAR_4.get('id')\n", "VAR_17 = VAR_4.get('task_id', '')\n", "VAR_8 = VAR_4.get('message', 'unknown')\n", "bot_management.bot_event(VAR_31='task_error', VAR_14=bot_id, external_ip=\n self.request.remote_addr, VAR_24=None, VAR_25=None, VAR_9=None, VAR_16=\n None, VAR_17=task_id, VAR_32=None, VAR_8=message)\n", "VAR_50 = (\n \"\"\"Bot: https://%s/restricted/bot/%s\nTask failed: https://%s/user/task/%s\n%s\"\"\"\n % (app_identity.get_default_version_hostname(), VAR_14, app_identity.\n get_default_version_hostname(), VAR_17, VAR_8))\n", "ereporter2.log_request(self.request, VAR_5='bot', VAR_8=line)\n", "VAR_38 = FUNC_3(self.EXPECTED_KEYS, VAR_4, self.request, 'bot', 'keys')\n", "if VAR_38:\n", "self.abort_with_error(400, error=msg)\n", "VAR_38 = task_scheduler.bot_kill_task(task_pack.unpack_run_result_key(\n VAR_17), VAR_14)\n", "if VAR_38:\n", "logging.error(VAR_38)\n", "self.send_response({})\n", "self.abort_with_error(400, error=msg)\n" ]
[ "@auth.require(acl.is_bot)...\n", "request = self.parse_body()\n", "bot_id = request.get('id')\n", "task_id = request.get('task_id', '')\n", "message = request.get('message', 'unknown')\n", "bot_management.bot_event(event_type='task_error', bot_id=bot_id,\n external_ip=self.request.remote_addr, dimensions=None, state=None,\n version=None, quarantined=None, task_id=task_id, task_name=None,\n message=message)\n", "line = (\n \"\"\"Bot: https://%s/restricted/bot/%s\nTask failed: https://%s/user/task/%s\n%s\"\"\"\n % (app_identity.get_default_version_hostname(), bot_id, app_identity.\n get_default_version_hostname(), task_id, message))\n", "ereporter2.log_request(self.request, source='bot', message=line)\n", "msg = log_unexpected_keys(self.EXPECTED_KEYS, request, self.request, 'bot',\n 'keys')\n", "if msg:\n", "self.abort_with_error(400, error=msg)\n", "msg = task_scheduler.bot_kill_task(task_pack.unpack_run_result_key(task_id),\n bot_id)\n", "if msg:\n", "logging.error(msg)\n", "self.send_response({})\n", "self.abort_with_error(400, error=msg)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "@pytest.fixture...\n", "config.load_kube_config(config_file=kubeconfig)\n", "VAR_4 = client.CoreV1Api()\n", "VAR_5 = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'files',\n 'busybox.yaml')\n", "VAR_6 = yaml.safe_load(pod_fd)\n", "VAR_4.create_namespaced_pod(body=pod_manifest_content, namespace='default')\n", "def FUNC_3():...\n", "VAR_7 = VAR_4.read_namespaced_pod(name='busybox', namespace='default')\n", "assert VAR_7.status.phase == 'Running', \"Wrong status for 'busybox' Pod - found {status}\".format(\n status=pod_info.status.phase)\n", "utils.retry(FUNC_3, times=10)\n", "yield 'busybox'\n", "VAR_4.delete_namespaced_pod(name='busybox', namespace='default', body=\n client.V1DeleteOptions())\n" ]
[ "@pytest.fixture...\n", "config.load_kube_config(config_file=kubeconfig)\n", "k8s_client = client.CoreV1Api()\n", "pod_manifest = os.path.join(os.path.realpath(os.path.dirname(__file__)),\n 'files', 'busybox.yaml')\n", "pod_manifest_content = yaml.safe_load(pod_fd)\n", "k8s_client.create_namespaced_pod(body=pod_manifest_content, namespace='default'\n )\n", "def _check_status():...\n", "pod_info = k8s_client.read_namespaced_pod(name='busybox', namespace='default')\n", "assert pod_info.status.phase == 'Running', \"Wrong status for 'busybox' Pod - found {status}\".format(\n status=pod_info.status.phase)\n", "utils.retry(_check_status, times=10)\n", "yield 'busybox'\n", "k8s_client.delete_namespaced_pod(name='busybox', namespace='default', body=\n client.V1DeleteOptions())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assert'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_22(self, VAR_23, VAR_24):...\n", "if VAR_23.get_active():\n", "self.databases_to_save.append(VAR_24)\n", "self.databases_to_save.remove(VAR_24)\n" ]
[ "def on_save_check_button_toggled(self, check_button, db):...\n", "if check_button.get_active():\n", "self.databases_to_save.append(db)\n", "self.databases_to_save.remove(db)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_0):...\n", "return render_form(VAR_0, False, url_for('auth_login'), 'Login', '', True, '')\n" ]
[ "def render_loginForm(form):...\n", "return render_form(form, False, url_for('auth_login'), 'Login', '', True, '')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]