lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"@auth.public...\n",
"VAR_28 = self.parse_body()\n",
"VAR_29 = VAR_28.get('v')\n",
"if not VAR_29:\n",
"self.abort(400, 'Missing version')\n",
"VAR_30 = VAR_28.get('r')\n",
"if not VAR_30:\n",
"self.abort(400, 'Missing report')\n",
"VAR_31 = dict((k, VAR_30[k]) for k in on_error.VALID_ERROR_KEYS if ... | [
"@auth.public...\n",
"body = self.parse_body()\n",
"version = body.get('v')\n",
"if not version:\n",
"self.abort(400, 'Missing version')\n",
"report = body.get('r')\n",
"if not report:\n",
"self.abort(400, 'Missing report')\n",
"kwargs = dict((k, report[k]) for k in on_error.VALID_ERROR_KEYS if repo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_12(self, VAR_18):...\n",
"VAR_36 = {'cmd': 'update', 'version': VAR_18}\n",
"self.send_response(VAR_36)\n"
] | [
"def _cmd_update(self, expected_version):...\n",
"out = {'cmd': 'update', 'version': expected_version}\n",
"self.send_response(out)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"self.run_test_case(self.scenario.clone_server_group(), max_retries=5)\n"
] | [
"def test_d_clone_server_group(self):...\n",
"self.run_test_case(self.scenario.clone_server_group(), max_retries=5)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"VAR_32 = CLASS_3.find_check\n",
"VAR_0 = self.loader.load_all()\n",
"VAR_37 = VAR_32('Test0', VAR_0)\n",
"VAR_38 = VAR_32('Test1_default', VAR_0)\n",
"VAR_38.depends_on('Test0', rfm.DEPEND_EXACT, {'e0': ['eX']})\n",
"dependency.build_deps(ex... | [
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"find_check = TestDependencies.find_check\n",
"checks = self.loader.load_all()\n",
"test0 = find_check('Test0', checks)\n",
"test1 = find_check('Test1_default', checks)\n",
"test1.depends_on('Test0', rfm.DEPEND_EXACT, {'e0': ['eX']})\n",
"dep... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0):...\n",
"return {'Jan': '1', 'Feb': '2', 'Mar': '3', 'Apr': '4', 'May': '5', 'Jun':\n '6', 'Jul': '7', 'Aug': '8', 'Sep': '9', 'Oct': '10', 'Nov': '11',\n 'Dec': '12'}[VAR_0]\n"
] | [
"def monthConvertor(month):...\n",
"return {'Jan': '1', 'Feb': '2', 'Mar': '3', 'Apr': '4', 'May': '5', 'Jun':\n '6', 'Jul': '7', 'Aug': '8', 'Sep': '9', 'Oct': '10', 'Nov': '11',\n 'Dec': '12'}[month]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._target_roots\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._target_roots\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"from app import app, db, models\n",
"from app.models import Article, User, Post, Project\n",
"from flask import Flask, render_template, redirect, flash, request\n",
"from flask_login import current_user, login_user, logout_user\n",
"from app.forms import LoginForm, ArticleCreateForm, PostCreateForm\n",
"... | [
"from app import app, db, models\n",
"from app.models import Article, User, Post, Project\n",
"from flask import Flask, render_template, redirect, flash, request\n",
"from flask_login import current_user, login_user, logout_user\n",
"from app.forms import LoginForm, ArticleCreateForm, PostCreateForm\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
4,
4,
4,
4,
4
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.log = VAR_79, VAR_80\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.log = logs, kwlogs\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(VAR_10):...\n",
"VAR_0 = []\n",
"VAR_28 = 0\n",
"VAR_11 = set()\n",
"for VAR_29 in VAR_5.finditer(VAR_10):\n",
"VAR_0.append(re.escape(VAR_10[VAR_28:VAR_29.start()]))\n",
"VAR_0.append(re.escape(VAR_10[VAR_28:]))\n",
"VAR_51 = VAR_29.group('name')\n",
"VAR_0.append('$')\n",
"if VAR_51 ... | [
"def regex(filepattern):...\n",
"f = []\n",
"last = 0\n",
"wildcards = set()\n",
"for match in _wildcard_regex.finditer(filepattern):\n",
"f.append(re.escape(filepattern[last:match.start()]))\n",
"f.append(re.escape(filepattern[last:]))\n",
"wildcard = match.group('name')\n",
"f.append('$')\n",
"i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(self):...\n",
"VAR_5 = [{'targetSize': 2, 'capacity': {'min': 2, 'max': 2, 'desired': 2},\n 'replicaPoolName': self.__server_group_name, 'numReplicas': 2, 'region':\n self.TEST_REGION, 'zone': self.TEST_ZONE, 'asgName': self.\n __server_group_name, 'type': 'resizeServerGroup', 'regions': [sel... | [
"def resize_server_group(self):...\n",
"job = [{'targetSize': 2, 'capacity': {'min': 2, 'max': 2, 'desired': 2},\n 'replicaPoolName': self.__server_group_name, 'numReplicas': 2, 'region':\n self.TEST_REGION, 'zone': self.TEST_ZONE, 'asgName': self.\n __server_group_name, 'type': 'resizeServerGroup', 'reg... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_23(VAR_31, VAR_32, VAR_3, VAR_33, VAR_34=apply_wildcards, VAR_35=None...\n",
"for VAR_10, VAR_9 in VAR_32.allitems():\n",
"VAR_48 = len(VAR_31)\n",
"VAR_49 = True\n",
"if callable(VAR_9):\n",
"if not_iterable(VAR_9):\n",
"VAR_9 = VAR_9(VAR_33)\n",
"if not_iterable(VAR_9):\n",
"VAR_9 = [VAR... | [
"def _apply_wildcards(newitems, olditems, wildcards, wildcards_obj,...\n",
"for name, item in olditems.allitems():\n",
"start = len(newitems)\n",
"is_iterable = True\n",
"if callable(item):\n",
"if not_iterable(item):\n",
"item = item(wildcards_obj)\n",
"if not_iterable(item):\n",
"item = [item]\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assig... |
[
"def FUNC_6(self):...\n",
"VAR_4 = 'autotest-errors'\n",
"VAR_2 = '/api/apps'\n",
"VAR_5 = {'id': 'camelCase'}\n",
"VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n",
"self.assertContains(VAR_3, 'App IDs can only contain [a-z0-9-]',\n status_code=400)\n",
"V... | [
"def test_app_errors(self):...\n",
"app_id = 'autotest-errors'\n",
"url = '/api/apps'\n",
"body = {'id': 'camelCase'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertContains(response, 'App IDs can only contain [a-z0-9-]',\n status_code=400... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"For",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_30(self, VAR_2, VAR_3, VAR_4, VAR_7=None):...\n",
"if 'active_id' in VAR_7:\n",
"VAR_56 = self.browse(VAR_2, VAR_3, VAR_4)[0].remaining_hours\n",
"return {'type': 'ir.actions.act_window_close'}\n",
"self.pool.get('project.task').write(VAR_2, VAR_3, VAR_7['active_id'], {\n 'remaining_hours': VAR... | [
"def compute_hours(self, cr, uid, ids, context=None):...\n",
"if 'active_id' in context:\n",
"remaining_hrs = self.browse(cr, uid, ids)[0].remaining_hours\n",
"return {'type': 'ir.actions.act_window_close'}\n",
"self.pool.get('project.task').write(cr, uid, context['active_id'], {\n 'remaining_hours': rem... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.REMOVE, *VAR_13, VAR_12=(\n 'delete_project',), **kwargs)\n"
] | [
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.REMOVE, *args, perms=(\n 'delete_project',), **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed\n"
] | [
"def is_accessible(self):...\n",
"return current_user.is_authenticated and current_user.role.role_code in self.roles_allowed\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = '/api/apps'\n",
"VAR_5 = {'id': 'autotest'}\n",
"VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_3.status_code, 201)\n",
"VAR_4 = VAR_3.data['id']\n",
"VAR_6 = os.path.join... | [
"def test_app_release_notes_in_logs(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"body = {'id': 'autotest'}\n",
"response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(VAR_28):...\n",
"VAR_38 = optparse.OptionParser(description=sys.modules[__name__].__doc__)\n",
"VAR_38.add_option('--in-file', help='Name of the request file')\n",
"VAR_38.add_option('--out-file', help=\n 'Name of the JSON file to write a task summary to')\n",
"VAR_38.add_option('--swarming-s... | [
"def main(args):...\n",
"parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)\n",
"parser.add_option('--in-file', help='Name of the request file')\n",
"parser.add_option('--out-file', help=\n 'Name of the JSON file to write a task summary to')\n",
"parser.add_option('--swarming-serve... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
5,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = {}\n",
"VAR_17 = {}\n",
"VAR_18 = {}\n",
"VAR_19 = {}\n",
"if self.args.a:\n",
"for VAR_41, VAR_43 in [x.split(':', 1) for x in self.args.a]:\n",
"if self.args.v:\n",
"VAR_7[VAR_41] = VAR_43\n",
"for VAR_4, VAR_5, VAR_42 in [x.split('... | [
"def reload(self):...\n",
"\"\"\"docstring\"\"\"\n",
"user = {}\n",
"mread = {}\n",
"mwrite = {}\n",
"mount = {}\n",
"if self.args.a:\n",
"for u, p in [x.split(':', 1) for x in self.args.a]:\n",
"if self.args.v:\n",
"user[u] = p\n",
"for src, dst, perms in [x.split(':', 2) for x in self.args.v]:... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Condition",
"Assign'",
"For",
"Condition",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assi... |
[
"@property...\n",
"return str(self)\n"
] | [
"@property...\n",
"return str(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"self.run_test_case(self.scenario.list_available_images())\n"
] | [
"def test_available_images(self):...\n",
"self.run_test_case(self.scenario.list_available_images())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
"def _init_common(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"model.bootstrap_ip_whitelist('bots', ['192.168.1.100/32'])\n",
"@api.public...\n",
"self.response.write(api.get_current_identity().to_bytes())\n",
"VAR_7 = self.make_test_app('/request', CLASS_7)\n",
"def FUNC_26(VAR_8):...\n",
"api.reset_local_sta... | [
"def test_ip_whitelist_bot(self):...\n",
"\"\"\"docstring\"\"\"\n",
"model.bootstrap_ip_whitelist('bots', ['192.168.1.100/32'])\n",
"@api.public...\n",
"self.response.write(api.get_current_identity().to_bytes())\n",
"app = self.make_test_app('/request', Handler)\n",
"def call(ip):...\n",
"api.reset_lo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"@classmethod...\n",
"super(CLASS_0, VAR_3).register_options(VAR_4)\n",
"VAR_4('--native-source-extensions', type=list, default=cls.\n default_native_source_extensions, fingerprint=True, advanced=True, help\n =\n 'The extensions recognized for native source files in `python_dist()` sources.'\n )\n"
... | [
"@classmethod...\n",
"super(PythonNativeCode, cls).register_options(register)\n",
"register('--native-source-extensions', type=list, default=cls.\n default_native_source_extensions, fingerprint=True, advanced=True, help\n =\n 'The extensions recognized for native source files in `python_dist()` sources... | [
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_26):...\n",
"if VAR_26:\n",
"VAR_106 = int(VAR_26, 36)\n",
"abort(404, 'page not found')\n",
"return Message._byID(VAR_106, True)\n"
] | [
"def run(self, message_id):...\n",
"if message_id:\n",
"aid = int(message_id, 36)\n",
"abort(404, 'page not found')\n",
"return Message._byID(aid, True)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_5(self):...\n",
"return self.display_name\n"
] | [
"def get_display_name(self):...\n",
"return self.display_name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, *VAR_10, **VAR_17):...\n",
"super(CLASS_0, self).__init__(*VAR_10, **kwargs)\n",
"self._processor_info_dir = os.path.join(self.workdir, 'apt-processor-info')\n",
"CLASS_1.validate_arguments(self.context.log, self.get_options().\n whitelisted_args, self._args)\n",
"if self.execution_st... | [
"def __init__(self, *args, **kwargs):...\n",
"super(BaseZincCompile, self).__init__(*args, **kwargs)\n",
"self._processor_info_dir = os.path.join(self.workdir, 'apt-processor-info')\n",
"ZincCompile.validate_arguments(self.context.log, self.get_options().\n whitelisted_args, self._args)\n",
"if self.exec... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition"
] |
[
"def FUNC_12(self, VAR_1, VAR_2):...\n",
"return str(VAR_1) + '-' * (len(str(self.mapWidth)) - len(str(VAR_1))) + str(\n VAR_2) + '-' * (len(str(self.mapHeight)) - len(str(VAR_2)))\n"
] | [
"def coordToID(self, x, y):...\n",
"return str(x) + '-' * (len(str(self.mapWidth)) - len(str(x))) + str(y\n ) + '-' * (len(str(self.mapHeight)) - len(str(y)))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_7(VAR_24, VAR_25, VAR_26):...\n",
"logging.warning('SIGTERM finally due to %s', VAR_26)\n",
"VAR_24.terminate()\n",
"VAR_24.wait(VAR_25)\n",
"logging.warning('SIGKILL finally due to %s', VAR_26)\n",
"VAR_17 = VAR_24.wait()\n",
"VAR_24.kill()\n",
"logging.info('Waiting for proces exit in fina... | [
"def kill_and_wait(proc, grace_period, reason):...\n",
"logging.warning('SIGTERM finally due to %s', reason)\n",
"proc.terminate()\n",
"proc.wait(grace_period)\n",
"logging.warning('SIGKILL finally due to %s', reason)\n",
"exit_code = proc.wait()\n",
"proc.kill()\n",
"logging.info('Waiting for proces ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"import veil_component\n",
"from .website_launcher import start_website\n",
"from .website_launcher import start_test_website\n",
"from .website_launcher import register_website_context_manager\n",
"from .website_installer import get_website_url_prefix\n",
"from .website_installer import website_resource\... | [
"import veil_component\n",
"from .website_launcher import start_website\n",
"from .website_launcher import start_test_website\n",
"from .website_launcher import register_website_context_manager\n",
"from .website_installer import get_website_url_prefix\n",
"from .website_installer import website_resource\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",... |
[
"\"\"\" Views for a student's account information. \"\"\"\n",
"import json\n",
"import logging\n",
"import urlparse\n",
"from datetime import datetime\n",
"from django.conf import settings\n",
"from django.contrib import messages\n",
"from django.contrib.auth import get_user_model\n",
"from django.c... | [
"\"\"\" Views for a student's account information. \"\"\"\n",
"import json\n",
"import logging\n",
"import urlparse\n",
"from datetime import datetime\n",
"from django.conf import settings\n",
"from django.contrib import messages\n",
"from django.contrib.auth import get_user_model\n",
"from django.c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
... |
[
"def FUNC_26(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 8, 'MEDIUM': 0, 'HIGH': 1}, 'CONFIDENCE': {\n 'HIGH': 9}}\n",
"self.check_example('os-popen.py', VAR_2)\n"
] | [
"def test_os_popen(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 8, 'MEDIUM': 0, 'HIGH': 1}, 'CONFIDENCE': {\n 'HIGH': 9}}\n",
"self.check_example('os-popen.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return bool(self.wildcard_names)\n"
] | [
"def has_wildcards(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return bool(self.wildcard_names)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_1 = 'http://my.url.com'\n",
"VAR_2 = 'True'\n",
"url_helper.urllib2.urlopen(VAR_1, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(VAR_2))\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen(VAR_1, method='POST'), VAR_2)\n",
"sel... | [
"def testUrlOpenPOSTSuccess(self):...\n",
"url = 'http://my.url.com'\n",
"response = 'True'\n",
"url_helper.urllib2.urlopen(url, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(response))\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen(url, method='POST'), r... | [
0,
0,
0,
5,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(VAR_5):...\n",
"VAR_10 = []\n",
"for col in VAR_5:\n",
"VAR_10.append(col[0])\n",
"return VAR_10\n"
] | [
"def extract_schema(description):...\n",
"names = []\n",
"for col in description:\n",
"names.append(col[0])\n",
"return names\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"VAR_7 = BokChoyTestSuite('', serversonly=True)\n",
"self.assertEqual(VAR_7.cmd, '')\n"
] | [
"def test_serversonly(self):...\n",
"suite = BokChoyTestSuite('', serversonly=True)\n",
"self.assertEqual(suite.cmd, '')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(VAR_4):...\n",
"if not VAR_4:\n",
"return True\n",
"if g.account == VAR_4:\n",
"return True\n",
"return False\n"
] | [
"def service_in_account(account):...\n",
"if not account:\n",
"return True\n",
"if g.account == account:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_22(self, VAR_17, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"from __future__ import absolute_import\n",
"from __future__ import division\n",
"from __future__ import print_function\n",
"import json\n",
"import time\n",
"import threading\n",
"import traceback\n",
"import ray\n",
"VAR_0 = 0\n",
"VAR_1 = 1\n",
"VAR_2 = 2\n",
"\"\"\"A log span context manag... | [
"from __future__ import absolute_import\n",
"from __future__ import division\n",
"from __future__ import print_function\n",
"import json\n",
"import time\n",
"import threading\n",
"import traceback\n",
"import ray\n",
"LOG_POINT = 0\n",
"LOG_SPAN_START = 1\n",
"LOG_SPAN_END = 2\n",
"\"\"\"A lo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"FunctionDef'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_6 = ('\"normal_string\"', '\"string with spaces\"',\n '\"string with quotes\\\\\"a\"', '\"string with s-quotes\\'b\"', '\"bsn \\n A\"',\n '\"unrecognized \\\\q escape\"')\n",
"for string, result in zip(self.test_strings, VAR_6):\n",
"self.assertEqual(prepare_string_argume... | [
"def test_prepare_string_argument_sh(self):...\n",
"expected_results = ('\"normal_string\"', '\"string with spaces\"',\n '\"string with quotes\\\\\"a\"', '\"string with s-quotes\\'b\"', '\"bsn \\n A\"',\n '\"unrecognized \\\\q escape\"')\n",
"for string, result in zip(self.test_strings, expected_results):... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_7(VAR_27):...\n",
"VAR_14 = str(VAR_27.author)\n",
"VAR_36 = datetime.utcfromtimestamp(VAR_27.created_utc)\n",
"FUNC_2(VAR_14=str(message.author), VAR_18='message', VAR_25=message_time.\n strftime('%Y-%m-%d %H:%M:%S'), VAR_15='balance', VAR_26=str(message.\n body)[:255])\n",
"VAR_13.execute(... | [
"def handle_balance(message):...\n",
"username = str(message.author)\n",
"message_time = datetime.utcfromtimestamp(message.created_utc)\n",
"add_history_record(username=str(message.author), comment_or_message=\n 'message', reddit_time=message_time.strftime('%Y-%m-%d %H:%M:%S'),\n action='balance', comme... | [
0,
0,
0,
4,
0,
0,
0,
4,
4,
4,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_3(VAR_3):...\n",
"VAR_6 = 'SELECT * FROM articles WHERE index=' + str(VAR_3)\n",
"VAR_5.execute(VAR_6)\n",
"VAR_20 = VAR_5.fetchone()\n",
"return VAR_20\n"
] | [
"def get_article(index):...\n",
"query = 'SELECT * FROM articles WHERE index=' + str(index)\n",
"cur.execute(query)\n",
"article = cur.fetchone()\n",
"return article\n"
] | [
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_29(VAR_28):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_40(*VAR_19, **VAR_20):...\n",
"VAR_62 = Thread(target=function, VAR_19=args, VAR_46=ka)\n",
"VAR_62.daemon = True\n",
"VAR_62.start()\n",
"return FUNC_40\n"
] | [
"def postpone(function):...\n",
"\"\"\"docstring\"\"\"\n",
"def decorator(*args, **ka):...\n",
"t = Thread(target=function, args=args, kwargs=ka)\n",
"t.daemon = True\n",
"t.start()\n",
"return decorator\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"VAR_7 = BokChoyTestSuite('')\n",
"VAR_1 = 'tests'\n",
"self.assertEqual(VAR_7.cmd, self._expected_command(VAR_1=name))\n"
] | [
"def test_default(self):...\n",
"suite = BokChoyTestSuite('')\n",
"name = 'tests'\n",
"self.assertEqual(suite.cmd, self._expected_command(name=name))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self):...\n",
"self.db_name = VAR_0\n",
"self.connection = sqlite3.connect(self.db_name)\n"
] | [
"def __init__(self):...\n",
"self.db_name = db_name\n",
"self.connection = sqlite3.connect(self.db_name)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_25(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = app.config['SAML_DEBUG']\n",
"if VAR_19 is None:\n",
"VAR_19 = app.debug\n",
"VAR_20 = app.config['SAML_CONFIDANT_URL_ROOT']\n",
"if not VAR_20:\n",
"VAR_20 = VAR_20.rstrip('/')\n",
"VAR_21 = 'urn:oasis:names:tc:SAML:1.1:nameid-format:e... | [
"def _render_saml_settings_dict(self):...\n",
"\"\"\"docstring\"\"\"\n",
"debug = app.config['SAML_DEBUG']\n",
"if debug is None:\n",
"debug = app.debug\n",
"root_url = app.config['SAML_CONFIDANT_URL_ROOT']\n",
"if not root_url:\n",
"root_url = root_url.rstrip('/')\n",
"name_id_fmt = 'urn:oasis:name... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
... |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return {VAR_8: self.get_safe_value(self.meta, VAR_8) for VAR_8 in self.meta\n .iptc_keys}\n"
] | [
"def get_all_meta(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return {key: self.get_safe_value(self.meta, key) for key in self.meta.iptc_keys\n }\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_1(VAR_3):...\n",
"return VAR_1 + '/' + VAR_3 + '.yaml'\n"
] | [
"def get_goal_file_path(goal_name):...\n",
"return GOALS_CONFIG_FOLDER_PATH + '/' + goal_name + '.yaml'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_35(VAR_16, VAR_22, VAR_23, VAR_29):...\n",
"VAR_53 = 'string'.format(VAR_22, VAR_23, VAR_29)\n",
"VAR_54 = VAR_16.exec(VAR_53)\n",
"VAR_18 = [VAR_41[0] for VAR_41 in VAR_54]\n",
"return VAR_18, VAR_23\n"
] | [
"def get_n_tournaments_before_date(db, scene, date, limit):...\n",
"sql = (\n \"select url, date from matches where scene='{}' and date<='{}' group by url, date order by date desc limit {};\"\n .format(scene, date, limit))\n",
"res = db.exec(sql)\n",
"urls = [r[0] for r in res]\n",
"return urls, date\... | [
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_0):...\n",
"warn('Tables not yet implemented')\n",
"super(CLASS_8, self).__init__('Table: ' + VAR_0)\n"
] | [
"def __init__(self, txt):...\n",
"warn('Tables not yet implemented')\n",
"super(TableEnv, self).__init__('Table: ' + txt)\n"
] | [
0,
2,
2
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self, VAR_11, VAR_12):...\n",
"self.common._cli_run('createhost -iscsi -add %s %s' % (VAR_11, VAR_12), None)\n"
] | [
"def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):...\n",
"self.common._cli_run('createhost -iscsi -add %s %s' % (hostname, iscsi_iqn),\n None)\n"
] | [
0,
2
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_3):...\n",
"VAR_5 = 'delete from comments where commentid=%d' % VAR_3\n",
"VAR_6 = sql.deleteDB(self.conn, VAR_5)\n",
"return VAR_6\n"
] | [
"def deleteComment(self, commentid):...\n",
"sqlText = 'delete from comments where commentid=%d' % commentid\n",
"result = sql.deleteDB(self.conn, sqlText)\n",
"return result\n"
] | [
0,
4,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_27(VAR_24, VAR_25, VAR_26=True, VAR_27=False):...\n",
"VAR_63, VAR_64, VAR_65 = VAR_24.split('-')\n",
"VAR_69, VAR_70, VAR_71 = VAR_25.split('-')\n",
"VAR_72 = '{}-{}'.format(VAR_63, VAR_64)\n",
"VAR_25 = '{}-{}'.format(VAR_69, VAR_70)\n",
"VAR_73 = []\n",
"if VAR_26:\n",
"VAR_73.append('{}-... | [
"def iter_months(first, last, include_first=True, include_last=False):...\n",
"y, m, d = first.split('-')\n",
"last_y, last_m, last_d = last.split('-')\n",
"cur = '{}-{}'.format(y, m)\n",
"last = '{}-{}'.format(last_y, last_m)\n",
"months = []\n",
"if include_first:\n",
"months.append('{}-01'.format(c... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_1, VAR_2):...\n",
"for col_name in VAR_2:\n",
"setattr(self, col_name, VAR_1[VAR_2.index(col_name)])\n",
"self.cwe = self.associate_cwes()\n"
] | [
"def __init__(self, cve_entry, column_names):...\n",
"for col_name in column_names:\n",
"setattr(self, col_name, cve_entry[column_names.index(col_name)])\n",
"self.cwe = self.associate_cwes()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"Assign'"
] |
[
"def FUNC_13(self, VAR_10, VAR_11, VAR_12, VAR_13):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_24 = self.common._cli_run('createhost -persona %s -domain %s %s %s' % (\n VAR_13, VAR_12, VAR_10, ' '.join(VAR_11)), None)\n",
"if VAR_24 and len(VAR_24) > 1:\n",
"return self.common.parse_create_host_error(VAR_10,... | [
"def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):...\n",
"\"\"\"docstring\"\"\"\n",
"out = self.common._cli_run('createhost -persona %s -domain %s %s %s' % (\n persona_id, domain, hostname, ' '.join(wwn)), None)\n",
"if out and len(out) > 1:\n",
"return self.common.parse_create_h... | [
0,
0,
2,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, VAR_23):...\n",
"VAR_23 = FUNC_1(VAR_23)\n",
"if not VAR_23:\n",
"return self.error()\n",
"VAR_15 = Subreddit._by_name(VAR_23)\n",
"return VAR_23\n",
"return self.error(errors.SUBREDDIT_EXISTS)\n"
] | [
"def run(self, name):...\n",
"name = chksrname(name)\n",
"if not name:\n",
"return self.error()\n",
"a = Subreddit._by_name(name)\n",
"return name\n",
"return self.error(errors.SUBREDDIT_EXISTS)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Return'"
] |
[
"from os import walk as os_walk\n",
"from os.path import basename, join, relpath\n",
"def __init__(self, VAR_0, VAR_1, VAR_2=None):...\n",
"self.base_directory_path = VAR_1\n",
"self.directory_filter, self.file_filter = VAR_0.filters\n",
"if VAR_2 is None:\n",
"VAR_2 = os_walk\n",
"self.walk_fn = VAR_... | [
"from os import walk as os_walk\n",
"from os.path import basename, join, relpath\n",
"def __init__(self, loader, base_directory_path, walk_fn=None):...\n",
"self.base_directory_path = base_directory_path\n",
"self.directory_filter, self.file_filter = loader.filters\n",
"if walk_fn is None:\n",
"walk_fn ... | [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"FunctionDef'",
"For",
"Assign'",
"Assign'",
"Condition",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_14(self, VAR_9, VAR_10=None):...\n",
"if isinstance(VAR_9, str) or callable(VAR_9):\n",
"self.log.append(IOFile(VAR_9, VAR_16=self) if isinstance(VAR_9, str) else VAR_9\n )\n",
"VAR_48 = len(self.log)\n",
"if VAR_10:\n",
"for VAR_51 in VAR_9:\n",
"self.log.add_name(VAR_10)\n",
"self._set_... | [
"def _set_log_item(self, item, name=None):...\n",
"if isinstance(item, str) or callable(item):\n",
"self.log.append(IOFile(item, rule=self) if isinstance(item, str) else item)\n",
"start = len(self.log)\n",
"if name:\n",
"for i in item:\n",
"self.log.add_name(name)\n",
"self._set_log_item(i)\n",
"if... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"For",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_3(self, VAR_2, *VAR_5, **VAR_6):...\n",
"VAR_2 = db.get_dataset(VAR_2)\n",
"VAR_9 = self.get_argument('email', default='', strip=False)\n",
"VAR_20 = self.get_argument('affiliation', strip=False)\n",
"VAR_21 = self.get_argument('country', strip=False)\n",
"VAR_22 = self.get_argument('newsletter'... | [
"def post(self, dataset, *args, **kwargs):...\n",
"dataset = db.get_dataset(dataset)\n",
"email = self.get_argument('email', default='', strip=False)\n",
"affiliation = self.get_argument('affiliation', strip=False)\n",
"country = self.get_argument('country', strip=False)\n",
"newsletter = self.get_argumen... | [
0,
0,
5,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_3):...\n",
"self._logger.info('Received data: %s' % VAR_3)\n",
"self.json_buffer.append(json.loads(VAR_3))\n",
"self.messages_to_wait_for -= 1\n",
"if self.messages_to_wait_for == 0:\n",
"self.response.loseConnection()\n"
] | [
"def dataReceived(self, data):...\n",
"self._logger.info('Received data: %s' % data)\n",
"self.json_buffer.append(json.loads(data))\n",
"self.messages_to_wait_for -= 1\n",
"if self.messages_to_wait_for == 0:\n",
"self.response.loseConnection()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"AugAssign'",
"For",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.tables = ['`tab' + self.doctype + '`']\n",
"if self.fields:\n",
"for VAR_34 in self.fields:\n",
"if not ('tab' in VAR_34 and '.' in VAR_34\n",
"VAR_32 = VAR_34.split('.')[0]\n",
"if VAR_32.lower().startswith('group_concat('):\n",
"VAR_32 = V... | [
"def extract_tables(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.tables = ['`tab' + self.doctype + '`']\n",
"if self.fields:\n",
"for f in self.fields:\n",
"if not ('tab' in f and '.' in f) or 'locate(' in f or 'count(' in f:\n",
"table_name = f.split('.')[0]\n",
"if table_name.lower().startswith('g... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"For",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_58 = []\n",
"yield self.mail_store.add_mailbox(VAR_31)\n",
"for VAR_63 in range(VAR_30):\n",
"VAR_82 = MailBuilder().with_status(VAR_32).with_tags(VAR_33).with_to(VAR_34\n ).with_cc(VAR_35).with_bcc(VAR_36)\n",
"defer.returnValue(VAR_58)\n",
"VAR_82.with_body(str(r... | [
"@defer.inlineCallbacks...\n",
"mails = []\n",
"yield self.mail_store.add_mailbox(mailbox)\n",
"for _ in range(num):\n",
"builder = MailBuilder().with_status(flags).with_tags(tags).with_to(to).with_cc(\n cc).with_bcc(bcc)\n",
"defer.returnValue(mails)\n",
"builder.with_body(str(random.random()))\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"For",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"For",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"from os.path import exists, join, dirname, splitext, basename\n",
"from configparser import SafeConfigParser\n",
"VAR_10 = 'setup.cfg'\n",
"VAR_11 = 'connection-string'\n",
"VAR_12 = join(dirname(dirname(abspath(__file__))), 'tmp', VAR_10)\n",
"if... | [
"def load_setup_connection_string(section):...\n",
"\"\"\"docstring\"\"\"\n",
"from os.path import exists, join, dirname, splitext, basename\n",
"from configparser import SafeConfigParser\n",
"FILENAME = 'setup.cfg'\n",
"KEY = 'connection-string'\n",
"path = join(dirname(dirname(abspath(__file__))), 'tm... | [
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
1,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self, *VAR_17):...\n",
"return self.context.include(*VAR_17, VAR_18=self.contexts)\n"
] | [
"def include(self, *names):...\n",
"return self.context.include(*names, contexts=self.contexts)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(VAR_4):...\n",
"if VAR_4.method == 'POST':\n",
"VAR_9 = VAR_4.POST['email']\n",
"return HttpResponse(json.dumps(VAR_15), content_type='application/json')\n",
"VAR_17 = VAR_4.POST['password']\n",
"VAR_14 = VAR_1.confs\n",
"VAR_15 = {'email': VAR_9, 'date': datetime.datetime.utcnow(), 'hash':\... | [
"def confirmation(request):...\n",
"if request.method == 'POST':\n",
"email = request.POST['email']\n",
"return HttpResponse(json.dumps(new_conf), content_type='application/json')\n",
"password = request.POST['password']\n",
"confs = db.confs\n",
"new_conf = {'email': email, 'date': datetime.datetime.ut... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_7 = Container.objects.create(owner=User.objects.get(username='autotest'\n ), app=App.objects.get(id=app_i... | [
"def test_container_state_good(self):...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"c = Container.objects.create(owner=User.objects.get(username='autotest'),\n app=App.... | [
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_7, VAR_54=None, VAR_55=None, *VAR_15, **VAR_16):...\n",
"self.min = VAR_54\n",
"self.max = VAR_55\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n"
] | [
"def __init__(self, param, min=None, max=None, *a, **kw):...\n",
"self.min = min\n",
"self.max = max\n",
"Validator.__init__(self, param, *a, **kw)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5():...\n",
"VAR_3 = {'foo': 'bar'}\n",
"VAR_1 = yaml.dump(VAR_3)\n",
"VAR_4 = tempfile.NamedTemporaryFile(mode='w')\n",
"VAR_4.write(VAR_1)\n",
"VAR_4.flush()\n",
"VAR_2 = load_source(yaml_file)\n",
"assert VAR_2 == VAR_3\n"
] | [
"def test_yaml_file_object():...\n",
"native = {'foo': 'bar'}\n",
"source = yaml.dump(native)\n",
"tmp_file = tempfile.NamedTemporaryFile(mode='w')\n",
"tmp_file.write(source)\n",
"tmp_file.flush()\n",
"result = load_source(yaml_file)\n",
"assert result == native\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assert'"
] |
[
"def FUNC_10(self, VAR_21, VAR_27, VAR_28, VAR_29, VAR_30, VAR_31=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.newcount > 10000:\n",
"if VAR_31 is None:\n",
"VAR_31 = time.time()\n",
"if not len(VAR_21.strip('/')):\n",
"VAR_58 = self.get_path(os.path.dirname(VAR_21.strip('/')))\n",
"return False\... | [
"def mkdir(self, path, uid, gid, size, mode, ctime=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.newcount > 10000:\n",
"if ctime is None:\n",
"ctime = time.time()\n",
"if not len(path.strip('/')):\n",
"dir = self.get_path(os.path.dirname(path.strip('/')))\n",
"return False\n",
"dir.append([os.pa... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"AugAssign'"
] |
[
"def FUNC_0(VAR_1, VAR_2, VAR_3, VAR_4=60, VAR_5='spynner'):...\n",
"@route('POST', '/-test/stop', VAR_1=website)...\n",
"FUNC_7()\n",
"@route('POST', '/-test/fail', VAR_1=website)...\n",
"VAR_16 = get_http_argument('message')\n",
"VAR_0.error(VAR_16)\n",
"get_executing_test().error = VAR_16\n",
"@rou... | [
"def start_website_and_browser(website, path, page_interactions, timeout=60,...\n",
"@route('POST', '/-test/stop', website=website)...\n",
"stop_browser()\n",
"@route('POST', '/-test/fail', website=website)...\n",
"message = get_http_argument('message')\n",
"LOGGER.error(message)\n",
"get_executing_test... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"if not self.config:\n",
"self.logger.error(' Config not loaded yet!')\n",
"if not self.session:\n",
"exit(CLASS_0.STOPPED.value)\n",
"self.logger.error(' Init aborted. No session was found!')\n",
"VAR_55 = FUNC_1(self.config, self.session, self.logger)\n",
"exit(CLASS_0.STO... | [
"def run_check(self):...\n",
"if not self.config:\n",
"self.logger.error(' Config not loaded yet!')\n",
"if not self.session:\n",
"exit(CheckState.STOPPED.value)\n",
"self.logger.error(' Init aborted. No session was found!')\n",
"check_state = check_component(self.config, self.session, self.logger)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"def FUNC_29(VAR_34):...\n",
"self.assertEqual(logging.WARNING, VAR_34)\n",
"self.mock(logging_utils, 'set_console_level', FUNC_29)\n",
"def FUNC_30(VAR_35):...\n",
"self.assertEqual(None, VAR_35)\n",
"return 0\n"
] | [
"def test_main(self):...\n",
"def check(x):...\n",
"self.assertEqual(logging.WARNING, x)\n",
"self.mock(logging_utils, 'set_console_level', check)\n",
"def run_bot(error):...\n",
"self.assertEqual(None, error)\n",
"return 0\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"__revision__ = '$Rev$'\n",
"__date__ = '$Date$'\n",
"__author__ = '$Author$'\n",
"from django.db import connection, models, transaction\n",
"def FUNC_0(self, **VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = ['UPDATE', connection.ops.quote_name(self._meta.db_table), 'SET']\... | [
"\"\"\"\nUpdate only selected fields of a model.\n\nThe problem with model.save() is that it also overwrites all other\nfields with possibly stale data.\n\"\"\"\n",
"__revision__ = '$Rev$'\n",
"__date__ = '$Date$'\n",
"__author__ = '$Author$'\n",
"from django.db import connection, models, transaction\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
4,
4,
4,
0,
4,
4,
4,
0,
4,
4
] | [
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assi... |
[
"def FUNC_4(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"conda.ensure_pip_packages(VAR_2, ['jupyterhub==0.9.4',\n 'jupyterhub-dummyauthenticator==0.3.1',\n 'jupyterhub-systemdspawner==0.11',\n 'jupyterhub-firstuseauthenticator==0.12',\n 'jupyterhub-nativeauthenticator==0.0.4',\n 'jupyterhub-ldapaut... | [
"def ensure_jupyterhub_package(prefix):...\n",
"\"\"\"docstring\"\"\"\n",
"conda.ensure_pip_packages(prefix, ['jupyterhub==0.9.4',\n 'jupyterhub-dummyauthenticator==0.3.1',\n 'jupyterhub-systemdspawner==0.11',\n 'jupyterhub-firstuseauthenticator==0.12',\n 'jupyterhub-nativeauthenticator==0.0.4',\n ... | [
0,
0,
6,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, *VAR_4, **VAR_5):...\n",
"VAR_11 = self.REQUEST\n",
"self._zmi_page_request()\n",
"if not VAR_11.get('lang'):\n",
"VAR_11.set('lang', self.getLanguage(VAR_11))\n",
"if not VAR_11.get('manage_lang') in self.getLocale().get_manage_langs():\n",
"VAR_11.set('manage_lang', self.get_manage_l... | [
"def f_standard_html_request(self, *args, **kwargs):...\n",
"request = self.REQUEST\n",
"self._zmi_page_request()\n",
"if not request.get('lang'):\n",
"request.set('lang', self.getLanguage(request))\n",
"if not request.get('manage_lang') in self.getLocale().get_manage_langs():\n",
"request.set('manage_l... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"\"\"\"\nDjango settings for the Deis project.\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import os.path\n",
"import sys\n",
"import tempfile\n",
"VAR_0 = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))\n",
"VAR_1 = False\n",
"VAR_2 = VAR_1\n",
"VAR_3 = ()\n",
"VAR_4... | [
"\"\"\"\nDjango settings for the Deis project.\n\"\"\"\n",
"from __future__ import unicode_literals\n",
"import os.path\n",
"import sys\n",
"import tempfile\n",
"PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))\n",
"DEBUG = False\n",
"TEMPLATE_DEBUG = DEBUG\n",
"ADMINS ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_52(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = next(x for x in self.b_mgr.b_ts.tests['ExceptHandler'] if x.\n __name__ == 'try_except_pass')\n",
"VAR_9._config = {'check_typed_exception': True}\n",
"VAR_2 = {'SEVERITY': {'LOW': 3}, 'CONFIDENCE': {'HIGH': 3}}\n",
"self.check_example('try... | [
"def test_try_except_pass(self):...\n",
"\"\"\"docstring\"\"\"\n",
"test = next(x for x in self.b_mgr.b_ts.tests['ExceptHandler'] if x.__name__ ==\n 'try_except_pass')\n",
"test._config = {'check_typed_exception': True}\n",
"expect = {'SEVERITY': {'LOW': 3}, 'CONFIDENCE': {'HIGH': 3}}\n",
"self.check_e... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self, *VAR_4, **VAR_5):...\n",
"for daemon in filter(lambda x: IZMSDaemon.IZMSDaemon in list(zope.interface\n",
"daemon.startDaemon()\n",
"VAR_11 = self.REQUEST\n",
"VAR_11.set('ZMS_THIS', self.getSelf())\n",
"VAR_11.set('ZMS_DOCELMNT', self.breadcrumbs_obj_path()[0])\n",
"VAR_11.set('ZMS_RO... | [
"def _zmi_page_request(self, *args, **kwargs):...\n",
"for daemon in filter(lambda x: IZMSDaemon.IZMSDaemon in list(zope.interface\n",
"daemon.startDaemon()\n",
"request = self.REQUEST\n",
"request.set('ZMS_THIS', self.getSelf())\n",
"request.set('ZMS_DOCELMNT', self.breadcrumbs_obj_path()[0])\n",
"requ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_4):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.environ.get('OVER_HEROKU', False) is not False:\n",
"VAR_43 = VAR_4.headers.get('X-Hub-Signature')\n",
"return True\n",
"if VAR_43 is None:\n",
"abort(403)\n",
"VAR_44, VAR_45 = VAR_43.split('=')\n",
"if VAR_44 != 'sha1':\n",
"abort(501)... | [
"def match_webhook_secret(request):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.environ.get('OVER_HEROKU', False) is not False:\n",
"header_signature = request.headers.get('X-Hub-Signature')\n",
"return True\n",
"if header_signature is None:\n",
"abort(403)\n",
"sha_name, signature = header_signature.spl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'"
] |
[
"@VAR_1.route('/authorize/<provider>')...\n",
"VAR_15 = OAuthSignIn.get_provider(VAR_7)\n",
"return VAR_15.authorize()\n"
] | [
"@app.route('/authorize/<provider>')...\n",
"oauth = OAuthSignIn.get_provider(provider)\n",
"return oauth.authorize()\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"@property...\n",
"if not self._metadata:\n",
"self._metadata = sqlalchemy.MetaData(bind=self._engine)\n",
"return self._metadata\n"
] | [
"@property...\n",
"if not self._metadata:\n",
"self._metadata = sqlalchemy.MetaData(bind=self._engine)\n",
"return self._metadata\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/screenshot/<folder>/<page>')...\n",
"if current_user.email == 'brocksmith225@gmail.com':\n",
"return render_template(VAR_8 + '/' + VAR_7 + '.html')\n",
"return redirect(VAR_4)\n"
] | [
"@app.route('/screenshot/<folder>/<page>')...\n",
"if current_user.email == 'brocksmith225@gmail.com':\n",
"return render_template(folder + '/' + page + '.html')\n",
"return redirect(url_prefix)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_10):...\n",
"if VAR_9 is None:\n",
"VAR_9 = Browser()\n",
"return VAR_9\n",
"VAR_54 = VAR_3[VAR_10]['username']\n",
"VAR_55 = VAR_3[VAR_10]['password']\n",
"VAR_53 = CWSLoginRequest(VAR_9, VAR_54, VAR_55, base_url=CWS_BASE_URL)\n",
"VAR_9.login(VAR_53)\n"
] | [
"def get_cws_browser(user_id):...\n",
"if cws_browser is None:\n",
"cws_browser = Browser()\n",
"return cws_browser\n",
"username = created_users[user_id]['username']\n",
"password = created_users[user_id]['password']\n",
"lr = CWSLoginRequest(cws_browser, username, password, base_url=CWS_BASE_URL)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"self._check_report_owner()\n",
"VAR_26 = self.request.POST['key']\n",
"return False\n",
"if VAR_26:\n",
"VAR_0.info(self.invalid_access_no_key_message)\n",
"self.storage.report.decrypt_record(VAR_26)\n",
"VAR_0.warn(self.invalid_access_key_message)\n",
"return False\n",
"return ... | [
"@property...\n",
"self._check_report_owner()\n",
"passphrase = self.request.POST['key']\n",
"return False\n",
"if passphrase:\n",
"logger.info(self.invalid_access_no_key_message)\n",
"self.storage.report.decrypt_record(passphrase)\n",
"logger.warn(self.invalid_access_key_message)\n",
"return False\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"@VAR_13.whitelist()...\n",
"if isinstance(VAR_4, string_types):\n",
"VAR_4 = json.loads(VAR_4)\n",
"VAR_9 = VAR_13.get_meta(VAR_1)\n",
"if VAR_0:\n",
"FUNC_0(VAR_0)\n",
"if not VAR_0:\n",
"VAR_0 = 'name'\n",
"VAR_14 = VAR_13.get_hooks().standard_queries or {}\n",
"if VAR_3 and VAR_3.split()[0].lo... | [
"@frappe.whitelist()...\n",
"if isinstance(filters, string_types):\n",
"filters = json.loads(filters)\n",
"meta = frappe.get_meta(doctype)\n",
"if searchfield:\n",
"sanitize_searchfield(searchfield)\n",
"if not searchfield:\n",
"searchfield = 'name'\n",
"standard_queries = frappe.get_hooks().standar... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condit... |
[
"def FUNC_15(VAR_20, VAR_22, VAR_23, VAR_24, VAR_25):...\n",
"VAR_17 = [('input', VAR_23), ('output', VAR_24)]\n",
"VAR_16 = {}\n",
"VAR_16['codename'] = '%03d' % VAR_22\n",
"if VAR_25:\n",
"VAR_16['public'] = '1'\n",
"VAR_47 = FUNC_14(VAR_20)\n",
"FUNC_8('dataset/%d/testcases/add' % VAR_47, VAR_17=fi... | [
"def add_testcase(task_id, num, input_file, output_file, public):...\n",
"files = [('input', input_file), ('output', output_file)]\n",
"args = {}\n",
"args['codename'] = '%03d' % num\n",
"if public:\n",
"args['public'] = '1'\n",
"dataset_id = get_task_active_dataset_id(task_id)\n",
"admin_req('dataset... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_7, VAR_67=(), *VAR_15, **VAR_16):...\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n",
"self.options = VAR_67\n"
] | [
"def __init__(self, param, options=(), *a, **kw):...\n",
"Validator.__init__(self, param, *a, **kw)\n",
"self.options = options\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.eng is not None and self.backend == 'Simulator' or self.backend == 'IBMBackend':\n",
"self.eng.flush()\n",
"self.eng.backend.collapse_wavefunction(self.reg, [(0) for i in range(len(\n self.reg))])\n"
] | [
"def _deallocate3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.eng is not None and self.backend == 'Simulator' or self.backend == 'IBMBackend':\n",
"self.eng.flush()\n",
"self.eng.backend.collapse_wavefunction(self.reg, [(0) for i in range(len(\n self.reg))])\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self):...\n",
"VAR_35 = {}\n",
"VAR_36 = self.configuration.safe_get('volume_backend_name')\n",
"VAR_35['volume_backend_name'] = VAR_36 or self.__class__.__name__\n",
"VAR_35['driver_version'] = '1.0'\n",
"VAR_35['reserved_percentage'] = 0\n",
"VAR_35['storage_protocol'] = 'iSCSI'\n",
"VA... | [
"def _update_backend_status(self):...\n",
"data = {}\n",
"backend_name = self.configuration.safe_get('volume_backend_name')\n",
"data['volume_backend_name'] = backend_name or self.__class__.__name__\n",
"data['driver_version'] = '1.0'\n",
"data['reserved_percentage'] = 0\n",
"data['storage_protocol'] = ... | [
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'",
"Assign'"
] |
[
"def FUNC_0(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.model.document import Document\n",
"if not VAR_1 in VAR_0:\n",
"VAR_31, VAR_32 = VAR_54.db.get_value('DocType', VAR_1, ('module', 'custom'),\n cache=True) or ['Core', False]\n",
"return VAR_0[VAR_1]\n",
"if VAR_32:\n",
"VAR_51 = Doc... | [
"def get_controller(doctype):...\n",
"\"\"\"docstring\"\"\"\n",
"from frappe.model.document import Document\n",
"if not doctype in _classes:\n",
"module_name, custom = frappe.db.get_value('DocType', doctype, ('module',\n 'custom'), cache=True) or ['Core', False]\n",
"return _classes[doctype]\n",
"if ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_30(self, VAR_21, VAR_23=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_21 == '/':\n",
"VAR_57 = {VAR_2: VAR_12, VAR_3: 0, VAR_4: 0, VAR_5: 4096, VAR_6: 16877,\n VAR_7: time.time()}\n",
"VAR_57 = self.getfile(VAR_21, VAR_23=follow_symlinks)\n",
"if VAR_57 == False:\n",
"return CLASS_3(VAR_... | [
"def stat(self, path, follow_symlinks=True):...\n",
"\"\"\"docstring\"\"\"\n",
"if path == '/':\n",
"p = {A_TYPE: T_DIR, A_UID: 0, A_GID: 0, A_SIZE: 4096, A_MODE: 16877,\n A_CTIME: time.time()}\n",
"p = self.getfile(path, follow_symlinks=follow_symlinks)\n",
"if p == False:\n",
"return _statobj(p[A_M... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_0(*VAR_0, **VAR_1):...\n",
"return\n"
] | [
"def _validate_conn_up(*args, **kwargs):...\n",
"return\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return None\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return None\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_5():...\n",
"VAR_16 = [random.choice(VAR_2) for _ in xrange(16)]\n",
"return ''.join(VAR_16)\n"
] | [
"def generate_salt():...\n",
"chars = [random.choice(ALPHABET) for _ in xrange(16)]\n",
"return ''.join(chars)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"VAR_5 = database.users.get_current_user()\n",
"if VAR_5:\n",
"VAR_3 = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n",
"self.redirect('/')\n",
"database.render_template(self, 'items/edit_item.html', {'item': VAR_3})\n"
] | [
"def get(self):...\n",
"user = database.users.get_current_user()\n",
"if user:\n",
"item = db.get(db.Key.from_path('Item', int(self.request.get('item_id'))))\n",
"self.redirect('/')\n",
"database.render_template(self, 'items/edit_item.html', {'item': item})\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"\"\"\"string\"\"\"\n",
"import os\n",
"import unittest\n",
"from mock import patch, call\n",
"from test.test_support import EnvironmentVarGuard\n",
"from paver.easy import BuildFailure\n",
"from pavelib.utils.test.suites import BokChoyTestSuite, Pa11yCrawler\n",
"VAR_0 = os.getcwd()\n",
"\"\"\"\n ... | [
"\"\"\"\nTests for the bok-choy paver commands themselves.\nRun just this test with: paver test_lib -t pavelib/paver_tests/test_paver_bok_choy_cmds.py\n\"\"\"\n",
"import os\n",
"import unittest\n",
"from mock import patch, call\n",
"from test.test_support import EnvironmentVarGuard\n",
"from paver.easy i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@app.route('/issues/', methods=['GET'])...\n",
"VAR_2 = text('SELECT issue.id, issue.name FROM issue ORDER BY issue.name')\n",
"VAR_3 = db.engine.execute(VAR_2)\n",
"return render_template('/issues/list.html', current_user=current_user,\n VAR_3=issues)\n"
] | [
"@app.route('/issues/', methods=['GET'])...\n",
"query = text('SELECT issue.id, issue.name FROM issue ORDER BY issue.name')\n",
"issues = db.engine.execute(query)\n",
"return render_template('/issues/list.html', current_user=current_user,\n issues=issues)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"import json\n",
"from django.utils import safestring\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from django.utils.translation import ungettext_lazy\n",
"from horizon import tables\n",
"from openstack_dashboard import api\n",
"VAR_1 = 'create'\n",
"VAR_2 = _('Create Mapping')\n"... | [
"import json\n",
"from django.utils import safestring\n",
"from django.utils.translation import ugettext_lazy as _\n",
"from django.utils.translation import ungettext_lazy\n",
"from horizon import tables\n",
"from openstack_dashboard import api\n",
"name = 'create'\n",
"verbose_name = _('Create Mappin... | [
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, *VAR_5, **VAR_6):...\n",
"VAR_1 = self.current_user\n",
"VAR_2 = db.get_dataset(VAR_2)\n",
"VAR_18 = {}\n",
"for sample_set in VAR_2.sample_sets:\n",
"VAR_32 = sample_set.collection\n",
"VAR_12 = {'collections': VAR_18, 'study': db.build_dict_from_row(VAR_2.study)}\n",
"if not... | [
"def get(self, dataset, *args, **kwargs):...\n",
"user = self.current_user\n",
"dataset = db.get_dataset(dataset)\n",
"collections = {}\n",
"for sample_set in dataset.sample_sets:\n",
"collection = sample_set.collection\n",
"ret = {'collections': collections, 'study': db.build_dict_from_row(dataset.\n ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(VAR_1, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = FUNC_0()\n",
"VAR_4 = VAR_3.cursor()\n",
"VAR_4.execute('string' % (VAR_1, VAR_2))\n",
"VAR_4.execute('string' % (VAR_1,))\n",
"VAR_4.execute('string' % (VAR_2,))\n",
"VAR_3.commit()\n",
"VAR_3.close()\n"
] | [
"def reportMatch(winner, loser):...\n",
"\"\"\"docstring\"\"\"\n",
"conn = connect()\n",
"c = conn.cursor()\n",
"c.execute(\n \"\"\"INSERT INTO matches (winner, loser) \n VALUES ('%i', '%i')\"\"\"\n % (winner, loser))\n",
"c.execute(\n \"\"\"UPDATE p... | [
0,
0,
0,
0,
4,
4,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.