lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_34(VAR_39):...\n",
"self.fail()\n"
] | [
"def release(self2):...\n",
"self.fail()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_7):...\n",
"VAR_8 = self.content\n",
"while VAR_8:\n",
"yield VAR_8[:VAR_7]\n",
"VAR_8 = VAR_8[VAR_7:]\n"
] | [
"def iter_content(self, chunk_size):...\n",
"c = self.content\n",
"while c:\n",
"yield c[:chunk_size]\n",
"c = c[chunk_size:]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_18(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7, VAR_12 = self.make_xsrf_handling_app(VAR_4='tok')\n",
"VAR_17 = VAR_7.get('/request').body\n",
"VAR_7.post('/request', {'tok': VAR_17})\n",
"self.assertEqual([('POST', True)], VAR_12)\n"
] | [
"def test_xsrf_token_uses_xsrf_token_request_param(self):...\n",
"\"\"\"docstring\"\"\"\n",
"app, calls = self.make_xsrf_handling_app(xsrf_token_request_param='tok')\n",
"token = app.get('/request').body\n",
"app.post('/request', {'tok': token})\n",
"self.assertEqual([('POST', True)], calls)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, *VAR_4, **VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"for VAR_9 in VAR_4:\n",
"self._set_inoutput_item(VAR_9)\n",
"for VAR_10, VAR_9 in VAR_6.items():\n",
"self._set_inoutput_item(VAR_9, VAR_10=name)\n"
] | [
"def set_input(self, *input, **kwinput):...\n",
"\"\"\"docstring\"\"\"\n",
"for item in input:\n",
"self._set_inoutput_item(item)\n",
"for name, item in kwinput.items():\n",
"self._set_inoutput_item(item, name=name)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Expr'",
"For",
"Expr'"
] |
[
"@VAR_0.route('/')...\n",
"if VAR_2 is None:\n",
"return render_template('browse.html', VAR_7=get_subjects())\n",
"VAR_19 = FUNC_2(VAR_2)\n",
"return render_template('articles.html', VAR_19=articles, VAR_2=subject)\n"
] | [
"@application.route('/')...\n",
"if subject is None:\n",
"return render_template('browse.html', subjects=get_subjects())\n",
"articles = get_articles_by_subject(subject)\n",
"return render_template('articles.html', articles=articles, subject=subject)\n"
] | [
0,
0,
4,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def __call__(self, VAR_2, VAR_3, VAR_4=None):...\n",
"VAR_56 = self.rollex_all.match(VAR_3)\n",
"if not VAR_56:\n",
"self.reply(VAR_2, 'usage: XdY rolls a dY X times')\n",
"VAR_57 = []\n",
"return\n",
"VAR_58 = VAR_56.group(1)\n",
"for VAR_82 in self.rollex.finditer(VAR_58):\n",
"if len(VAR_57) > 4... | [
"def __call__(self, msg, arguments, errorSink=None):...\n",
"matched = self.rollex_all.match(arguments)\n",
"if not matched:\n",
"self.reply(msg, 'usage: XdY rolls a dY X times')\n",
"results = []\n",
"return\n",
"die = matched.group(1)\n",
"for match in self.rollex.finditer(die):\n",
"if len(result... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Re... |
[
"def __init__(self, VAR_1, VAR_2=None):...\n",
"if isinstance(VAR_1, CLASS_3):\n",
"for attr in ('_r_item_', '_r_is_multi_item_', '_r_raise_'):\n",
"self._r_item_ = VAR_1\n",
"setattr(self, attr, getattr(VAR_1, attr))\n",
"self._r_path_ = CLASS_1(VAR_1._r_item_, VAR_1._r_path_)\n",
"self._r_path_ = CLAS... | [
"def __init__(self, item, _raise=None):...\n",
"if isinstance(item, Roamer):\n",
"for attr in ('_r_item_', '_r_is_multi_item_', '_r_raise_'):\n",
"self._r_item_ = item\n",
"setattr(self, attr, getattr(item, attr))\n",
"self._r_path_ = _Path(item._r_item_, item._r_path_)\n",
"self._r_path_ = _Path(self._... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"For",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_2(VAR_4, VAR_10, VAR_11, VAR_12=None, VAR_9=None):...\n",
"VAR_16 = collect_config.collect_config(VAR_4, VAR_9)\n",
"VAR_23 = VAR_10.split('.')\n",
"for VAR_10 in VAR_23:\n",
"value_types.ensure_type(str(VAR_16), VAR_11)\n",
"VAR_16 = VAR_16[VAR_10]\n",
"if VAR_12 is not None:\n",
"print(str... | [
"def print_key(config_path, key, type_name, default=None, fallback_metadata=None...\n",
"config = collect_config.collect_config(config_path, fallback_metadata)\n",
"keys = key.split('.')\n",
"for key in keys:\n",
"value_types.ensure_type(str(config), type_name)\n",
"config = config[key]\n",
"if default ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'"
] |
[
"def __eq__(self, VAR_24):...\n",
"if isinstance(VAR_24, type(self)):\n",
"return self.cname == VAR_24.cname and self.pname == VAR_24.pname and self.ename == VAR_24.ename\n",
"if isinstance(VAR_24, executors.TestCase):\n",
"return self.cname == VAR_24.check.name and self.pname == VAR_24.partition.fullname a... | [
"def __eq__(self, other):...\n",
"if isinstance(other, type(self)):\n",
"return self.cname == other.cname and self.pname == other.pname and self.ename == other.ename\n",
"if isinstance(other, executors.TestCase):\n",
"return self.cname == other.check.name and self.pname == other.partition.fullname and self.... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(VAR_0):...\n",
"VAR_2 = []\n",
"VAR_3 = FUNC_4(VAR_0)\n",
"VAR_4 = FUNC_3(VAR_0)\n",
"for item in VAR_3:\n",
"if VAR_4.get(item.name):\n",
"return VAR_2\n",
"VAR_9 = VAR_4[item.name]\n",
"VAR_10 = {'item_group': item.item_group, 'item': item.name, 'item_name':\n item.item_name}\n",
... | [
"def get_data(filters):...\n",
"data = []\n",
"items = get_items(filters)\n",
"sales_invoice_data = get_sales_details(filters)\n",
"for item in items:\n",
"if sales_invoice_data.get(item.name):\n",
"return data\n",
"item_obj = sales_invoice_data[item.name]\n",
"row = {'item_group': item.item_group, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"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 __init__(self, *VAR_3, **VAR_4):...\n",
"super(CLASS_1, self).__init__(*VAR_3, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"super(SanISCSIDriver, self).__init__(*args, **kwargs)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.mode != ray.WORKER_MODE:\n",
"if VAR_2.startswith(b'FunctionsToRun'):\n",
"if VAR_2.startswith(b'RemoteFunction'):\n",
"self.fetch_and_execute_function_to_run(VAR_2)\n",
"return\n",
"self.worker.function_actor_manager.fetch_and_regis... | [
"def _process_key(self, key):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.mode != ray.WORKER_MODE:\n",
"if key.startswith(b'FunctionsToRun'):\n",
"if key.startswith(b'RemoteFunction'):\n",
"self.fetch_and_execute_function_to_run(key)\n",
"return\n",
"self.worker.function_actor_manager.fetch_and_registe... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_11(self):...\n",
"VAR_20 = []\n",
"VAR_18 = threading.Event()\n",
"self.mock(VAR_18, 'wait', self.fail)\n",
"self.mock(bot_main, 'run_manifest', self.fail)\n",
"self.mock(bot_main, 'update_bot', lambda *VAR_24: VAR_20.append(VAR_24))\n",
"self.expected_requests([(\n 'https://localhost:1/aut... | [
"def test_poll_server_update(self):...\n",
"update = []\n",
"bit = threading.Event()\n",
"self.mock(bit, 'wait', self.fail)\n",
"self.mock(bot_main, 'run_manifest', self.fail)\n",
"self.mock(bot_main, 'update_bot', lambda *args: update.append(args))\n",
"self.expected_requests([(\n 'https://localhost... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"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_14(self):...\n",
"VAR_6 = StudentGroup(course_instance=self.current_course_instance)\n",
"VAR_6.save()\n",
"VAR_6.members.add(self.user.userprofile, self.grader.userprofile)\n",
"self.assertEqual(StudentGroup.get_exact(self.current_course_instance, [self\n .user.userprofile, self.grader.userpro... | [
"def test_groups(self):...\n",
"group = StudentGroup(course_instance=self.current_course_instance)\n",
"group.save()\n",
"group.members.add(self.user.userprofile, self.grader.userprofile)\n",
"self.assertEqual(StudentGroup.get_exact(self.current_course_instance, [self\n .user.userprofile, self.grader.use... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_37(self, VAR_40):...\n",
"\"\"\"docstring\"\"\"\n",
"self.set_name(VAR_40, len(self) - 1)\n"
] | [
"def add_name(self, name):...\n",
"\"\"\"docstring\"\"\"\n",
"self.set_name(name, len(self) - 1)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def FUNC_5(self, VAR_10):...\n",
"VAR_21 = self.table_view.selectedIndexes()\n",
"if not VAR_21:\n",
"return\n",
"self.torrents_container.details_container.show()\n",
"VAR_22 = VAR_21[0].model().data_items[VAR_21[0].row()]\n",
"self.torrents_container.details_tab_widget.update_with_torrent(VAR_21[0],\n... | [
"def _on_selection_changed(self, _):...\n",
"selected_indices = self.table_view.selectedIndexes()\n",
"if not selected_indices:\n",
"return\n",
"self.torrents_container.details_container.show()\n",
"torrent_info = selected_indices[0].model().data_items[selected_indices[0].row()\n ]\n",
"self.torrents... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_16, VAR_17, VAR_18):...\n",
"self.log.debug('Binding %s,%s route', VAR_16, VAR_17)\n",
"def FUNC_23(VAR_33, VAR_13, VAR_20, VAR_21, VAR_12):...\n",
"if VAR_21 == wzrpc.status.success:\n",
"self.wz.set_req_handler(VAR_16, VAR_17, VAR_18)\n",
"if VAR_21 == wzrpc.status.e_req_denied:\n"... | [
"def bind_route(self, i, m, f):...\n",
"self.log.debug('Binding %s,%s route', i, m)\n",
"def accept(that, reqid, seqnum, status, data):...\n",
"if status == wzrpc.status.success:\n",
"self.wz.set_req_handler(i, m, f)\n",
"if status == wzrpc.status.e_req_denied:\n",
"self.log.debug('Succesfully binded ro... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_8(self, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_18.isdigit():\n",
"return CLASS_0.INVALID_ID\n",
"VAR_19 = self.__con.cursor()\n",
"return CLASS_0.SUCCESS if VAR_19.execute(\n 'DELETE FROM tasks WHERE taskid=%d' % int(VAR_18)\n ) else CLASS_0.DOES_NOT_EXIST\n"
] | [
"def delete_task(self, taskid):...\n",
"\"\"\"docstring\"\"\"\n",
"if not taskid.isdigit():\n",
"return Database.INVALID_ID\n",
"cur = self.__con.cursor()\n",
"return Database.SUCCESS if cur.execute('DELETE FROM tasks WHERE taskid=%d' %\n int(taskid)) else Database.DOES_NOT_EXIST\n"
] | [
0,
0,
0,
0,
0,
2
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_2: HttpRequest, VAR_3: str):...\n",
"VAR_5: str = VAR_3\n",
"if VAR_2.GET.get('redirect'):\n",
"VAR_5 = VAR_2.GET['redirect']\n",
"VAR_5 = '/admin'\n",
"if 'rid' not in VAR_2.GET:\n",
"return HttpResponseRedirect(\n '/admin?error=Missing%20reservation%20id%20in%20request')\n",
"u: P... | [
"def add_article_action(request: HttpRequest, default_foreward_url: str):...\n",
"forward_url: str = default_foreward_url\n",
"if request.GET.get('redirect'):\n",
"forward_url = request.GET['redirect']\n",
"forward_url = '/admin'\n",
"if 'rid' not in request.GET:\n",
"return HttpResponseRedirect(\n '... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
0
] | [
"FunctionDef'",
"AnnAssign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"AnnAssign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"AnnAssign'",
"Condition",
"AnnAssign'",
"Return'",
"AnnAssign'",
"AnnAssign'",
"For",
"Assign'",
... |
[
"def FUNC_5(VAR_34, VAR_32, VAR_33):...\n",
"print('save weeks')\n",
"VAR_39 = 'meal_planner.db'\n",
"VAR_50 = 'recipes_' + str(VAR_13)\n",
"conn.execute('CREATE TABLE IF NOT EXISTS ' + VAR_50 +\n ' (recipe text, row int, column int)')\n",
"conn.execute('INSERT INTO ' + VAR_50 + ' VALUES (?, ?, ?);', (... | [
"def save_weeks_recipes(recipeName, row, column):...\n",
"print('save weeks')\n",
"database_file = 'meal_planner.db'\n",
"tableName = 'recipes_' + str(weekNumber)\n",
"conn.execute('CREATE TABLE IF NOT EXISTS ' + tableName +\n ' (recipe text, row int, column int)')\n",
"conn.execute('INSERT INTO ' + ta... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.netatmo_data.update()\n",
"VAR_13 = self.netatmo_data.data.get(self.module_name)\n",
"if VAR_13 is None:\n",
"VAR_0.warning('No data found for %s', self.module_name)\n",
"if self.type == 'temperature':\n",
"self._state = STATE_UNKNOWN\n",
"s... | [
"def update(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.netatmo_data.update()\n",
"data = self.netatmo_data.data.get(self.module_name)\n",
"if data is None:\n",
"_LOGGER.warning('No data found for %s', self.module_name)\n",
"if self.type == 'temperature':\n",
"self._state = STATE_UNKNOWN\n",
"sel... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition"... |
[
"def __init__(self, VAR_24=None):...\n",
"self.logger = logging.getLogger(__name__)\n",
"self.logger.setLevel(logging.DEBUG)\n",
"self.configfile = VAR_24\n",
"self.nodes = {}\n",
"self.server = []\n",
"self.host_list = []\n",
"if VAR_24:\n",
"self.load_config(VAR_24)\n",
"self.config = None\n",
... | [
"def __init__(self, configfile=None):...\n",
"self.logger = logging.getLogger(__name__)\n",
"self.logger.setLevel(logging.DEBUG)\n",
"self.configfile = configfile\n",
"self.nodes = {}\n",
"self.server = []\n",
"self.host_list = []\n",
"if configfile:\n",
"self.load_config(configfile)\n",
"self.con... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_16(**VAR_19):...\n",
"VAR_35 = FUNC_8('users/add', VAR_16=kwargs)\n",
"VAR_46 = re.search('/user/([0-9]+)$', VAR_35.url)\n",
"if VAR_46:\n",
"VAR_10 = int(VAR_46.group(1))\n",
"VAR_19['user_id'] = VAR_10\n",
"VAR_3[VAR_10] = VAR_19\n",
"VAR_35 = FUNC_8('contest/' + VAR_19['contest_id'] + '/u... | [
"def add_user(**kwargs):...\n",
"r = admin_req('users/add', args=kwargs)\n",
"g = re.search('/user/([0-9]+)$', r.url)\n",
"if g:\n",
"user_id = int(g.group(1))\n",
"kwargs['user_id'] = user_id\n",
"created_users[user_id] = kwargs\n",
"r = admin_req('contest/' + kwargs['contest_id'] + '/users/add', arg... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'"
] |
[
"import sys, os, time, shodan\n",
"from pathlib import Path\n",
"from scapy.all import *\n",
"from contextlib import contextmanager, redirect_stdout\n",
"VAR_0 = time.time()\n",
"@contextmanager...\n",
"yield\n",
"VAR_3 = '\\x1b[0m'\n",
"VAR_1 = Path('./api.txt')\n",
"VAR_2 = CLASS_0.HEADER + 'str... | [
"import sys, os, time, shodan\n",
"from pathlib import Path\n",
"from scapy.all import *\n",
"from contextlib import contextmanager, redirect_stdout\n",
"starttime = time.time()\n",
"@contextmanager...\n",
"yield\n",
"HEADER = '\\x1b[0m'\n",
"keys = Path('./api.txt')\n",
"logo = color.HEADER + \"\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0... | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
... |
[
"def FUNC_9(VAR_9, VAR_10, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = jwt.encode(VAR_9, VAR_10, algorithm='RS256')\n",
"VAR_17 = HybridRSA.encrypt(VAR_7, VAR_11)\n",
"return b64encode(VAR_17).decode('utf-8')\n"
] | [
"def packJWT(data, sign_key, encrypt_key):...\n",
"\"\"\"docstring\"\"\"\n",
"token = jwt.encode(data, sign_key, algorithm='RS256')\n",
"enc_token = HybridRSA.encrypt(token, encrypt_key)\n",
"return b64encode(enc_token).decode('utf-8')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"import logging\n",
"import os\n",
"import sys\n",
"import threading\n",
"VAR_0 = os.path.dirname(os.path.abspath(__file__))\n",
"VAR_1 = os.path.dirname(VAR_0)\n",
"sys.path.insert(0, VAR_1)\n",
"sys.path.insert(0, os.path.join(VAR_1, 'third_party'))\n",
"from depot_tools import auto_stub\n",
"fr... | [
"import logging\n",
"import os\n",
"import sys\n",
"import threading\n",
"TEST_DIR = os.path.dirname(os.path.abspath(__file__))\n",
"ROOT_DIR = os.path.dirname(TEST_DIR)\n",
"sys.path.insert(0, ROOT_DIR)\n",
"sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party'))\n",
"from depot_tools import auto... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"FunctionDef'",
"Assign'",
"Ret... |
[
"def FUNC_25(VAR_14, VAR_27, VAR_28):...\n",
"VAR_26.append((VAR_14, VAR_27.splitlines()[0], VAR_28))\n"
] | [
"def post_error_task(botobj, msg, task_id):...\n",
"posted.append((botobj, msg.splitlines()[0], task_id))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"from base import Field\n",
"VAR_0 = 'DATE'\n",
"def __init__(self, *VAR_1, **VAR_2):...\n",
"super(CLASS_0, self).__init__(*VAR_1, **kwargs)\n",
"def FUNC_0(self, VAR_3):...\n",
"VAR_5 = '%s timestamp' % str(VAR_3)\n",
"return VAR_5\n"
] | [
"from base import Field\n",
"TYPE = 'DATE'\n",
"def __init__(self, *args, **kwargs):...\n",
"super(TimestampField, self).__init__(*args, **kwargs)\n",
"def create_field(self, name):...\n",
"field_string = '%s timestamp' % str(name)\n",
"return field_string\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"super(CLASS_5, self).__init__(VAR_2)\n",
"self.message = 'Component %s crashed on localhost' % VAR_2\n"
] | [
"def __init__(self, comp_name):...\n",
"\"\"\"docstring\"\"\"\n",
"super(LocalCrashEvent, self).__init__(comp_name)\n",
"self.message = 'Component %s crashed on localhost' % comp_name\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'"
] |
[
"@FUNC_7...\n",
"\"\"\"docstring\"\"\"\n",
"if not current_user.is_authenticated():\n",
"return current_app.login_manager.unauthorized()\n",
"VAR_20 = RemoteAccount.get(user_id=current_user.get_id(), client_id=remote.\n consumer_key)\n",
"if VAR_20:\n",
"VAR_20.delete()\n",
"return redirect(url_for... | [
"@oauth_error_handler...\n",
"\"\"\"docstring\"\"\"\n",
"if not current_user.is_authenticated():\n",
"return current_app.login_manager.unauthorized()\n",
"account = RemoteAccount.get(user_id=current_user.get_id(), client_id=remote\n .consumer_key)\n",
"if account:\n",
"account.delete()\n",
"return ... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"import logging, concurrent.futures\n",
"from utils import *\n",
"from urllib.parse import urljoin, urlparse\n",
"from threading import Lock\n",
"def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5=None, VAR_6=...\n",
"self.logger = logging.getLogger('fuxploider')\n",
"self.postData = VAR_4\n",
... | [
"import logging, concurrent.futures\n",
"from utils import *\n",
"from urllib.parse import urljoin, urlparse\n",
"from threading import Lock\n",
"def __init__(self, notRegex, trueRegex, session, size, postData,...\n",
"self.logger = logging.getLogger('fuxploider')\n",
"self.postData = postData\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"As... |
[
"def FUNC_0(VAR_0):...\n",
"return json.load(f)\n"
] | [
"def readJsonFile(file_name):...\n",
"return json.load(f)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_7, VAR_8=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_7(VAR_17, *VAR_18, **VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = VAR_17.POST\n",
"VAR_21 = VAR_20.get('new_status')\n",
"if not VAR_21:\n",
"if not VAR_8 or not callable(VAR_8):\n",
"if not 'fields' in VAR_20:\n",
... | [
"def manageModelStatus(entity_logic, status_retriever=None):...\n",
"\"\"\"docstring\"\"\"\n",
"def manageModelsStatus(request, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"post_dict = request.POST\n",
"new_status = post_dict.get('new_status')\n",
"if not new_status:\n",
"if not status_retriev... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_30(VAR_35):...\n",
"self.assertEqual(None, VAR_35)\n",
"return 0\n"
] | [
"def run_bot(error):...\n",
"self.assertEqual(None, error)\n",
"return 0\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"VAR_21 = pyodbc.drivers()\n",
"self.assertTrue(isinstance(VAR_21, list))\n"
] | [
"def test_drivers(self):...\n",
"p = pyodbc.drivers()\n",
"self.assertTrue(isinstance(p, list))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'DELETE FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"VAR_2.commit()\n"
] | [
"def clear_all(self):...\n",
"connection = self.connect()\n",
"query = 'DELETE FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"connection.commit()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"if self.receivers(self.finished) == 0:\n",
"self.finished.connect(lambda reply: self.on_finished())\n",
"self.connect_timer.stop()\n",
"VAR_28 = self.reply.readAll()\n",
"self.current_event_string += VAR_28\n",
"if len(self.current_event_string) > 0 and self.current_event_stri... | [
"def on_read_data(self):...\n",
"if self.receivers(self.finished) == 0:\n",
"self.finished.connect(lambda reply: self.on_finished())\n",
"self.connect_timer.stop()\n",
"data = self.reply.readAll()\n",
"self.current_event_string += data\n",
"if len(self.current_event_string) > 0 and self.current_event_st... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"AugAssign'",
"Condition",
"For",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Condition",
... |
[
"def FUNC_12(self, VAR_14):...\n",
""
] | [
"def is_numeric(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@integration_synonym_api...\n",
"FUNC_2(VAR_2)\n",
"FUNC_3(VAR_2, 'GLADSTONE CAPITAL corp', VAR_7='1')\n",
"FUNC_5(VAR_4, VAR_5, VAR_11='GOLDSMITHS', VAR_10=[{'name': '----GOLDSMITHS'}])\n"
] | [
"@integration_synonym_api...\n",
"clean_database(solr)\n",
"seed_database_with(solr, 'GLADSTONE CAPITAL corp', id='1')\n",
"verify_results(client, jwt, query='GOLDSMITHS', expected=[{'name':\n '----GOLDSMITHS'}])\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_16 = self.getDistanceMatrix()\n",
"VAR_18 = _co.defaultdict(lambda : _co.defaultdict(lambda : _np.inf))\n",
"for vk in VAR_16:\n",
"for wk in VAR_16[vk]:\n",
"return VAR_18\n",
"VAR_51 = self.HigherOrderNodeToPath(vk)[0]\n",
"VAR_52 = self.H... | [
"def getDistanceMatrixFirstOrder(self):...\n",
"\"\"\"docstring\"\"\"\n",
"dist = self.getDistanceMatrix()\n",
"dist_first = _co.defaultdict(lambda : _co.defaultdict(lambda : _np.inf))\n",
"for vk in dist:\n",
"for wk in dist[vk]:\n",
"return dist_first\n",
"v1 = self.HigherOrderNodeToPath(vk)[0]\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Assign'"
] |
[
"@VAR_0.route('/dashboard')...\n",
"VAR_28 = VAR_1.connection.cursor()\n",
"VAR_29 = VAR_28.execute(\n 'SELECT cid, crawl_date, pdf_crawled, pdf_processed, domain, url FROM Crawls'\n )\n",
"VAR_47 = VAR_28.fetchall()\n",
"if VAR_29 > 0:\n",
"return render_template('dashboard.html', VAR_47=crawls)\n"... | [
"@app.route('/dashboard')...\n",
"cur = mysql.connection.cursor()\n",
"result = cur.execute(\n 'SELECT cid, crawl_date, pdf_crawled, pdf_processed, domain, url FROM Crawls'\n )\n",
"crawls = cur.fetchall()\n",
"if result > 0:\n",
"return render_template('dashboard.html', crawls=crawls)\n",
"msg = ... | [
0,
0,
4,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._conn:\n",
"self._conn.close()\n",
"self._conn = None\n"
] | [
"def close(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self._conn:\n",
"self._conn.close()\n",
"self._conn = None\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'"
] |
[
"@staticmethod...\n",
"from rasterio.features import rasterize\n",
"VAR_52 = VAR_20.geometry\n",
"VAR_53 = rasterize(((g, VAR_28) for g in VAR_52), VAR_29=out_shape,\n transform=out_transform, fill=background_value)\n",
"return VAR_53\n"
] | [
"@staticmethod...\n",
"from rasterio.features import rasterize\n",
"geom = df.geometry\n",
"out = rasterize(((g, value) for g in geom), out_shape=out_shape, transform=\n out_transform, fill=background_value)\n",
"return out\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return VAR_6\n",
"for perm in VAR_2:\n",
"if not VAR_0.user.has_perm(perm, VAR_6):\n"
] | [
"def get_and_check_project(request, project_pk, perms=('view_project',)):...\n",
"\"\"\"docstring\"\"\"\n",
"project = models.Project.objects.get(pk=project_pk, deleting=False)\n",
"return project\n",
"for perm in perms:\n",
"if not request.user.has_perm(perm, project):\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"For",
"Condition"
] |
[
"def FUNC_1(self, VAR_4, VAR_5, **VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_5:\n",
"VAR_8 = False\n",
"for k, v in VAR_6.iteritems():\n",
"assert k in self._properties, k\n",
"if VAR_8:\n",
"if getattr(self, k) != v:\n",
"VAR_9 = VAR_4.email().split('@')[0]\n",
"return VAR_8\n",
"set... | [
"def Update(self, user, is_admin, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if not is_admin:\n",
"dirty = False\n",
"for k, v in kwargs.iteritems():\n",
"assert k in self._properties, k\n",
"if dirty:\n",
"if getattr(self, k) != v:\n",
"user_name = user.email().split('@')[0]\n",
"return dirty\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"For",
"Assert'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_1, VAR_6):...\n",
""
] | [
"def directory_index(path, fullpath):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_4(self):...\n",
"VAR_15 = super(CLASS_0, self).get_template_namespace()\n",
"VAR_15['css_urls'] = self.assets['css_all'].urls()\n",
"VAR_15['js_urls'] = self.assets['js_all'].urls()\n",
"VAR_15['system_name'] = options.system_name\n",
"VAR_15['SERVER_DEBUG'] = options.server_debug\n",
"VAR_15[... | [
"def get_template_namespace(self):...\n",
"_ = super(BaseHandler, self).get_template_namespace()\n",
"_['css_urls'] = self.assets['css_all'].urls()\n",
"_['js_urls'] = self.assets['js_all'].urls()\n",
"_['system_name'] = options.system_name\n",
"_['SERVER_DEBUG'] = options.server_debug\n",
"_['ip'] = se... | [
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'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"super(CLASS_0, self).validate()\n",
"if not self.blog_intro:\n",
"self.blog_intro = self.content[:140]\n",
"if self.blog_intro:\n",
"self.blog_intro = strip_html_tags(self.blog_intro)\n",
"self.blog_intro = self.blog_intro[:140]\n",
"if self.published and not self.published_... | [
"def validate(self):...\n",
"super(BlogPost, self).validate()\n",
"if not self.blog_intro:\n",
"self.blog_intro = self.content[:140]\n",
"if self.blog_intro:\n",
"self.blog_intro = strip_html_tags(self.blog_intro)\n",
"self.blog_intro = self.blog_intro[:140]\n",
"if self.published and not self.publish... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"@patch('invenio.ext.session.interface.SessionInterface.save_session')...\n",
"from invenio.modules.oauthclient.client import oauth\n",
"VAR_9 = MagicMock()\n",
"VAR_9.get_id = MagicMock(return_value=1)\n",
"VAR_9.is_authenticated = MagicMock(return_value=True)\n",
"VAR_10 = c.get(url_for('oauthclient.log... | [
"@patch('invenio.ext.session.interface.SessionInterface.save_session')...\n",
"from invenio.modules.oauthclient.client import oauth\n",
"user = MagicMock()\n",
"user.get_id = MagicMock(return_value=1)\n",
"user.is_authenticated = MagicMock(return_value=True)\n",
"res = c.get(url_for('oauthclient.login', r... | [
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Expr'",
"Assign'",
"Assert'"
] |
[
"@property...\n",
"return (file for VAR_13 in self.rules for file in chain(VAR_13.input,\n VAR_13.output) if not callable(file) and not file.contains_wildcard())\n"
] | [
"@property...\n",
"return (file for rule in self.rules for file in chain(rule.input, rule.\n output) if not callable(file) and not file.contains_wildcard())\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_42(self):...\n",
"VAR_54 = 0\n",
"for VAR_40, VAR_41 in sorted(self._names.items(), VAR_44=lambda item: item[\n",
"VAR_57, VAR_42 = VAR_41\n",
"for item in self[VAR_54:]:\n",
"if VAR_42 is None:\n",
"yield None, item\n",
"VAR_42 = VAR_57 + 1\n",
"if VAR_57 > VAR_54:\n",
"for item in self... | [
"def allitems(self):...\n",
"next = 0\n",
"for name, index in sorted(self._names.items(), key=lambda item: item[1][0]):\n",
"start, end = index\n",
"for item in self[next:]:\n",
"if end is None:\n",
"yield None, item\n",
"end = start + 1\n",
"if start > next:\n",
"for item in self[next:start]:\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Condition",
"For",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_4(self, VAR_11='', VAR_12=None, VAR_13=None, VAR_6=None):...\n",
"VAR_5 = self.session.query(self.obj)\n",
"VAR_5 = self._get_base_query(VAR_5=query, VAR_6=filters)\n",
"VAR_25 = VAR_5.all()\n",
"VAR_26 = GroupByCol(VAR_11, 'Group by')\n",
"return VAR_26.apply(VAR_25)\n"
] | [
"def query_simple_group(self, group_by='', aggregate_func=None,...\n",
"query = self.session.query(self.obj)\n",
"query = self._get_base_query(query=query, filters=filters)\n",
"query_result = query.all()\n",
"group = GroupByCol(group_by, 'Group by')\n",
"return group.apply(query_result)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import typing\n",
"import wordnik.swagger as swagger\n",
"import wordnik.WordApi as wordapi\n",
"import wordnik.models.Definition as definition\n",
"import neko\n",
"VAR_0 = 'http://api.wordnik.com/v4'\n",
"VAR_1 = 'all'\n",
"def __init__(self):...\n",
"self.__token = neko... | [
"\"\"\"\nUtilises the free wordnik API.\n\nRequires an API key.\n\nSign up:\n http://www.wordnik.com/signup\n\nGet a key:\n http://developer.wordnik.com/\n\nThey seem to say they will send an email, however, I never got one. I checked\nin my settings and found the API key there.\n\nThe key should be stored in... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Docstring",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_8(self, VAR_5, VAR_7):...\n",
"VAR_14 = 'insert into friends values(%d,%d);' % (VAR_7, VAR_5)\n",
"VAR_11 = sql.insertDB(self.conn, VAR_14)\n",
"return VAR_11\n"
] | [
"def followFriends(self, userid, friendid):...\n",
"sqlText = 'insert into friends values(%d,%d);' % (friendid, userid)\n",
"result = sql.insertDB(self.conn, sqlText)\n",
"return result\n"
] | [
0,
4,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.callback({'success': True, 'completions': comps, 'uid': self.uid,\n 'vid': self.vid})\n",
"logging.error(error)\n",
"logging.debug(traceback.format_exc())\n",
"self.callback({'success': False, 'error': str(error), 'uid': self.uid,\n 'vid': s... | [
"def run(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.callback({'success': True, 'completions': comps, 'uid': self.uid,\n 'vid': self.vid})\n",
"logging.error(error)\n",
"logging.debug(traceback.format_exc())\n",
"self.callback({'success': False, 'error': str(error), 'uid': self.uid,\n 'vid': self... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(VAR_20, VAR_21):...\n",
"return VAR_21[len(VAR_20):] if VAR_21.startswith(VAR_20) else VAR_21\n"
] | [
"def strip_prefix(prefix, s):...\n",
"return s[len(prefix):] if s.startswith(prefix) else s\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"if len(self.data) == 0:\n",
"return None\n",
"return self.data.pop(len(self.data) - 1)\n"
] | [
"def pop(self):...\n",
"if len(self.data) == 0:\n",
"return None\n",
"return self.data.pop(len(self.data) - 1)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/disconnect/<remote_app>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1 not in disconnect_handlers:\n",
"return abort(404)\n",
"return disconnect_handlers[VAR_1]()\n"
] | [
"@blueprint.route('/disconnect/<remote_app>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if remote_app not in disconnect_handlers:\n",
"return abort(404)\n",
"return disconnect_handlers[remote_app]()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_0(VAR_2, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = dict(external_id=resp.get('orcid'), external_method='orcid')\n",
"return VAR_5\n"
] | [
"def account_info(remote, resp):...\n",
"\"\"\"docstring\"\"\"\n",
"account_info = dict(external_id=resp.get('orcid'), external_method='orcid')\n",
"return account_info\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_4):...\n",
"VAR_11 = makeNGrams(VAR_4)\n",
"print(VAR_11)\n",
"VAR_12 = Ranking()\n",
"VAR_6 = set()\n",
"for ngram in VAR_11:\n",
"VAR_15 = FUNC_3(' '.join(ngram))\n",
"VAR_13 = FUNC_4(VAR_6)\n",
"VAR_12.addNgram(VAR_15)\n",
"for additionalStat in VAR_13:\n",
"for record in VAR_... | [
"def getRanking(query):...\n",
"ngrams = makeNGrams(query)\n",
"print(ngrams)\n",
"ranking = Ranking()\n",
"ids = set()\n",
"for ngram in ngrams:\n",
"records = sendIndexReq(' '.join(ngram))\n",
"additionalStatList = sendIndexDocumentReq(ids)\n",
"ranking.addNgram(records)\n",
"for additionalStat ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Expr'",
"For",
"For",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_2):...\n",
"if current_app:\n",
"current_app.logger.error(VAR_2)\n"
] | [
"def __init__(self, message):...\n",
"if current_app:\n",
"current_app.logger.error(message)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'"
] |
[
"def FUNC_30(self, VAR_5):...\n",
"def FUNC_32(VAR_19):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n VAR_19)\n"
] | [
"def _AddExtraConfDataIfNeeded(self, extra_data):...\n",
"def BuildExtraConfData(extra_conf_vim_data):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n extra_conf_vim_data)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'SELECT description FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"return cursor.fetchall()\n"
] | [
"def get_all_inputs(self):...\n",
"connection = self.connect()\n",
"query = 'SELECT description FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"return cursor.fetchall()\n"
] | [
0,
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"\"\"\"HTTP Handlers.\"\"\"\n",
"import datetime\n",
"import itertools\n",
"import json\n",
"import time\n",
"import webapp2\n",
"from google.appengine.api import app_identity\n",
"from google.appengine.datastore import datastore_query\n",
"from google.appengine.ext import ndb\n",
"from components... | [
"\"\"\"HTTP Handlers.\"\"\"\n",
"import datetime\n",
"import itertools\n",
"import json\n",
"import time\n",
"import webapp2\n",
"from google.appengine.api import app_identity\n",
"from google.appengine.datastore import datastore_query\n",
"from google.appengine.ext import ndb\n",
"from components... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Condition",
"Docstring... |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._base_dir\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._base_dir\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"return self.get_serializer_class().setup_eager_loading(Action.objects.\n filter(published=True))\n"
] | [
"def get_queryset(self):...\n",
"return self.get_serializer_class().setup_eager_loading(Action.objects.\n filter(published=True))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self, VAR_12):...\n",
"VAR_5 = {}\n",
"VAR_5['serverName'] = VAR_12['host']\n",
"VAR_16 = self._cliq_run_xml('getServerInfo', VAR_5, False)\n",
"VAR_33 = VAR_16.find('response')\n",
"VAR_34 = VAR_33.attrib.get('result')\n",
"if VAR_34 != '0':\n",
"VAR_5 = {}\n",
"VAR_5['serverName'] = V... | [
"def _create_server(self, connector):...\n",
"cliq_args = {}\n",
"cliq_args['serverName'] = connector['host']\n",
"out = self._cliq_run_xml('getServerInfo', cliq_args, False)\n",
"response = out.find('response')\n",
"result = response.attrib.get('result')\n",
"if result != '0':\n",
"cliq_args = {}\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_16(VAR_24):...\n",
"VAR_42 = logging.getLogger('ray')\n",
"if VAR_21:\n",
"VAR_53 = logging.StreamHandler(stream=new_stream)\n",
"VAR_53.setFormatter(VAR_21.formatter)\n",
"VAR_21.close()\n",
"VAR_21 = VAR_53\n",
"VAR_42.addHandler(VAR_21)\n"
] | [
"def try_update_handler(new_stream):...\n",
"logger = logging.getLogger('ray')\n",
"if _default_handler:\n",
"new_handler = logging.StreamHandler(stream=new_stream)\n",
"new_handler.setFormatter(_default_handler.formatter)\n",
"_default_handler.close()\n",
"_default_handler = new_handler\n",
"logger.a... | [
0,
0,
6,
6,
6,
6,
6,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(self, VAR_2, VAR_3='app.html', **VAR_4):...\n",
"if self.is_api:\n",
"self.write(VAR_2)\n",
"self.render(VAR_3, VAR_2=page_json, **kw)\n"
] | [
"def page_render(self, page_json, template='app.html', **kw):...\n",
"if self.is_api:\n",
"self.write(page_json)\n",
"self.render(template, page_json=page_json, **kw)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"return self.request.user == self.get_object().author\n"
] | [
"def test_func(self):...\n",
"return self.request.user == self.get_object().author\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(self, VAR_11='', VAR_6=None):...\n",
"VAR_5 = self.session.query(self.obj)\n",
"VAR_5 = self._get_base_query(VAR_5=query, VAR_6=filters)\n",
"VAR_25 = VAR_5.all()\n",
"VAR_27 = GroupByDateYear(VAR_11, 'Group by Year')\n",
"return VAR_27.apply(VAR_25)\n"
] | [
"def query_year_group(self, group_by='', filters=None):...\n",
"query = self.session.query(self.obj)\n",
"query = self._get_base_query(query=query, filters=filters)\n",
"query_result = query.all()\n",
"group_year = GroupByDateYear(group_by, 'Group by Year')\n",
"return group_year.apply(query_result)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_18, VAR_35=100, **VAR_16):...\n",
"CLASS_17.__init__(self, VAR_18, VAR_35=length, VAR_37=errors.\n LOCATION_TOO_LONG, VAR_36=None, **kw)\n"
] | [
"def __init__(self, item, length=100, **kw):...\n",
"VLength.__init__(self, item, length=length, length_error=errors.\n LOCATION_TOO_LONG, empty_error=None, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_7(self, VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.connection:\n",
"self.cursor.execute(\n 'insert into item (name, shoppinglistid) values (\"%s\", \"%s\")' % (VAR_6[\n 0], VAR_6[1]))\n",
"self.connection.commit()\n"
] | [
"def add_item(self, item):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.connection:\n",
"self.cursor.execute(\n 'insert into item (name, shoppinglistid) values (\"%s\", \"%s\")' % (item[0\n ], item[1]))\n",
"self.connection.commit()\n"
] | [
0,
0,
0,
4,
4
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_27(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.exists and FUNC_0(self.file):\n"
] | [
"def check_broken_symlink(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if not self.exists and lstat(self.file):\n"
] | [
0,
0,
7
] | [
"FunctionDef'",
"Docstring",
"Condition"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._name\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._name\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@login_required()...\n",
"VAR_5 = {}\n",
"VAR_6, VAR_7 = FUNC_5(**kwargs)\n",
"VAR_5['concept'] = VAR_6\n",
"VAR_4 = VAR_6.transaction\n",
"VAR_5['transaction'] = VAR_4\n",
"return render(VAR_0, 'transactions/concept_detail.html', VAR_5)\n"
] | [
"@login_required()...\n",
"extra_context = {}\n",
"concept, concept_form = get_concept_and_form_from_kwargs(**kwargs)\n",
"extra_context['concept'] = concept\n",
"transaction = concept.transaction\n",
"extra_context['transaction'] = transaction\n",
"return render(request, 'transactions/concept_detail.ht... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_3():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_7 = {}\n",
"for arg in request.args:\n",
"VAR_8 = re.findall('_oc_(.*)', arg)\n",
"return VAR_7\n",
"if VAR_8:\n",
"VAR_7[VAR_8[0]] = request.args.get(arg), request.args.get('_od_' + VAR_8[0])\n"
] | [
"def get_order_args():...\n",
"\"\"\"docstring\"\"\"\n",
"orders = {}\n",
"for arg in request.args:\n",
"re_match = re.findall('_oc_(.*)', arg)\n",
"return orders\n",
"if re_match:\n",
"orders[re_match[0]] = request.args.get(arg), request.args.get('_od_' +\n re_match[0])\n"
] | [
0,
0,
0,
0,
0,
0,
0,
4
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'"
] |
[
"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_20(self):...\n",
"VAR_16 = self.mox.CreateMock(paramiko.SSHClient)\n",
"VAR_12 = self.mox.CreateMock(paramiko.Channel)\n",
"VAR_17 = self.mox.CreateMock(paramiko.Transport)\n",
"self.mox.StubOutWithMock(self.driver, '_get_output')\n",
"self.mox.StubOutWithMock(VAR_16, 'get_transport')\n",
"sel... | [
"def test_ssh_execute_error(self):...\n",
"ssh = self.mox.CreateMock(paramiko.SSHClient)\n",
"chan = self.mox.CreateMock(paramiko.Channel)\n",
"transport = self.mox.CreateMock(paramiko.Transport)\n",
"self.mox.StubOutWithMock(self.driver, '_get_output')\n",
"self.mox.StubOutWithMock(ssh, 'get_transport')\... | [
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'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"import json\n",
"import os\n",
"import pathlib\n",
"import re\n",
"import shlex\n",
"import subprocess\n",
"import sys\n",
"from collections import OrderedDict\n",
"from operator import itemgetter\n",
"import click\n",
"VAR_0 = {'syscall_header_file': '/usr/include/bits/syscall.h',\n 'cache_... | [
"import json\n",
"import os\n",
"import pathlib\n",
"import re\n",
"import shlex\n",
"import subprocess\n",
"import sys\n",
"from collections import OrderedDict\n",
"from operator import itemgetter\n",
"import click\n",
"CONFIG = {'syscall_header_file': '/usr/include/bits/syscall.h',\n 'cache... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'",
"FunctionDef'",
"Return'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
... |
[
"def FUNC_44(self):...\n",
"return self._names\n"
] | [
"def keys(self):...\n",
"return self._names\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(self, *VAR_7, **VAR_8):...\n",
"VAR_14 = self.cleaned_data['user_ip']\n",
"VAR_2 = self.cleaned_data['comment']\n",
"VAR_15 = super(CLASS_0, self).save(*VAR_7, **kwargs)\n",
"VAR_16 = getattr(self, 'editor', None)\n",
"VAR_17 = getattr(self, 'group', None)\n",
"if self.is_new:\n",
"VAR_15.... | [
"def save(self, *args, **kwargs):...\n",
"editor_ip = self.cleaned_data['user_ip']\n",
"comment = self.cleaned_data['comment']\n",
"article = super(ArticleForm, self).save(*args, **kwargs)\n",
"editor = getattr(self, 'editor', None)\n",
"group = getattr(self, 'group', None)\n",
"if self.is_new:\n",
"a... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_6(self, VAR_38):...\n",
"if not VAR_38:\n",
"VAR_101.errors.add(errors.NO_TITLE)\n",
"if len(VAR_38) > 100:\n",
"VAR_101.errors.add(errors.TITLE_TOO_LONG)\n",
"return VAR_38\n"
] | [
"def run(self, title):...\n",
"if not title:\n",
"c.errors.add(errors.NO_TITLE)\n",
"if len(title) > 100:\n",
"c.errors.add(errors.TITLE_TOO_LONG)\n",
"return title\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"CLASS_4.ScenarioMaker().given_a_public_domain('http://pachatary.com'\n ).given_a_dynamic_link('http://dynamic.link/link={}&other=param'\n ).when_call_root_redirect().then_response_should_be_a_redirect_to(\n 'http://dynamic.link/link=http://pachatary.com/&other=param')\n"
] | [
"def test_when_there_is_a_dynamic_link_wraps_public_domain_url(self):...\n",
"RedirectRootTestCase.ScenarioMaker().given_a_public_domain(\n 'http://pachatary.com').given_a_dynamic_link(\n 'http://dynamic.link/link={}&other=param').when_call_root_redirect(\n ).then_response_should_be_a_redirect_to(\n '... | [
0,
6
] | [
"FunctionDef'",
"Expr'"
] |
[
"import uuid\n",
"def FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3):...\n",
"VAR_8 = VAR_3.connect()\n",
"VAR_9 = VAR_8.cursor()\n",
"VAR_10 = \"SELECT userId FROM Users WHERE userEmail = '{0}'\".format(VAR_2)\n",
"VAR_9.execute(VAR_10)\n",
"VAR_11 = VAR_9.fetchone()\n",
"if VAR_11 is None:\n",
"return False, ... | [
"import uuid\n",
"def createCalendar(calendarName, day, username, sqlHandle):...\n",
"conn = sqlHandle.connect()\n",
"cursor = conn.cursor()\n",
"userCheckQuery = \"SELECT userId FROM Users WHERE userEmail = '{0}'\".format(\n username)\n",
"cursor.execute(userCheckQuery)\n",
"userResult = cursor.fetc... | [
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0
] | [
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_11(self, VAR_9, VAR_10=None):...\n",
"if isinstance(VAR_9, str) or callable(VAR_9):\n",
"self.params.append(VAR_9)\n",
"VAR_48 = len(self.params)\n",
"if VAR_10:\n",
"for VAR_51 in VAR_9:\n",
"self.params.add_name(VAR_10)\n",
"self._set_params_item(VAR_51)\n",
"if VAR_10:\n",
"self.param... | [
"def _set_params_item(self, item, name=None):...\n",
"if isinstance(item, str) or callable(item):\n",
"self.params.append(item)\n",
"start = len(self.params)\n",
"if name:\n",
"for i in item:\n",
"self.params.add_name(name)\n",
"self._set_params_item(i)\n",
"if name:\n",
"self.params.set_name(name... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"For",
"Expr'",
"Expr'",
"Condition",
"Expr'"
] |
[
"@decorators.require_cronjob...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = 'https://%s.appspot.com' % app_identity.get_application_id()\n",
"VAR_21 = VAR_20 + '/restricted/ereporter2/request/'\n",
"VAR_22 = VAR_20 + '/restricted/ereporter2/report'\n",
"VAR_23 = self.request.get('recipients', acl.get_ereport... | [
"@decorators.require_cronjob...\n",
"\"\"\"docstring\"\"\"\n",
"host_url = 'https://%s.appspot.com' % app_identity.get_application_id()\n",
"request_id_url = host_url + '/restricted/ereporter2/request/'\n",
"report_url = host_url + '/restricted/ereporter2/report'\n",
"recipients = self.request.get('recipi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_4):...\n",
"VAR_4 = u\"'{0}'\".format(VAR_4)\n",
"return VAR_4\n"
] | [
"def insert_format(self, value):...\n",
"value = u\"'{0}'\".format(value)\n",
"return value\n"
] | [
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_30(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 2, 'MEDIUM': 6}, 'CONFIDENCE': {'HIGH': 8}}\n",
"self.check_example('pickle_deserialize.py', VAR_2)\n"
] | [
"def test_pickle(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 2, 'MEDIUM': 6}, 'CONFIDENCE': {'HIGH': 8}}\n",
"self.check_example('pickle_deserialize.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"VAR_3 = self.config['runtime.gallery']\n",
"VAR_4 = Pager(VAR_3, self.current_page)\n",
"return {'pager': VAR_4}\n"
] | [
"def get(self):...\n",
"index = self.config['runtime.gallery']\n",
"pager = Pager(index, self.current_page)\n",
"return {'pager': pager}\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self, VAR_11, VAR_12=None):...\n",
"self.tree = Node(VAR_11)\n",
"self.add_children(self.tree)\n"
] | [
"def build_node_tree(self, oldest_node, parent=None):...\n",
"self.tree = Node(oldest_node)\n",
"self.add_children(self.tree)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"return eduid_init_app('testing', VAR_2)\n"
] | [
"def load_app(self, config):...\n",
"\"\"\"docstring\"\"\"\n",
"return eduid_init_app('testing', config)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"import psycopg2\n",
"VAR_0 = 'news'\n",
"def FUNC_0(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = 'string' % VAR_1\n",
"VAR_3 = psycopg2.connect(database=DBNAME)\n",
"VAR_4 = VAR_3.cursor()\n",
"VAR_4.execute(VAR_2)\n",
"VAR_5 = VAR_4.fetchall()\n",
"VAR_3.close()\n",
"return VAR_5\n"
] | [
"import psycopg2\n",
"DBNAME = 'news'\n",
"def get_top_articles(list_count):...\n",
"\"\"\"docstring\"\"\"\n",
"query = (\n 'select a.title, count(alv.article) as views from articles a, article_log_view alv where a.slug = alv.article group by a.title order by count(alv.article) desc limit %d;'\n %... | [
0,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0
] | [
"Import'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@staticmethod...\n",
"if not VAR_1 or not VAR_6:\n",
"if not VAR_5:\n",
"VAR_5 = CLASS_0.get_report(VAR_1)['analysis']\n",
"VAR_16 = VAR_5['behavior']['generic']\n",
"VAR_17 = [z for z in VAR_16 if z['pid'] == VAR_6]\n",
"if not VAR_17:\n",
"VAR_17 = VAR_17[0]\n",
"VAR_9 = {}\n",
"for VAR_30, VAR... | [
"@staticmethod...\n",
"if not task_id or not pid:\n",
"if not report:\n",
"report = AnalysisController.get_report(task_id)['analysis']\n",
"behavior_generic = report['behavior']['generic']\n",
"process = [z for z in behavior_generic if z['pid'] == pid]\n",
"if not process:\n",
"process = process[0]\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Condition",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_46(self, VAR_14):...\n",
"return self.list_properties[VAR_14].columns[0]\n"
] | [
"def get_property_first_col(self, col_name):...\n",
"return self.list_properties[col_name].columns[0]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = ['volume', 'select', VAR_16['name'], 'show']\n",
"self._eql_execute(*VAR_11)\n",
"if err.stdout.find('does not exist.\\n') > -1:\n",
"VAR_0.debug(_('Volume %s does not exist, it may have already been deleted'),\n VAR_16['name'])\n"... | [
"def _check_volume(self, volume):...\n",
"\"\"\"docstring\"\"\"\n",
"command = ['volume', 'select', volume['name'], 'show']\n",
"self._eql_execute(*command)\n",
"if err.stdout.find('does not exist.\\n') > -1:\n",
"LOG.debug(_('Volume %s does not exist, it may have already been deleted'),\n volume['name... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"VAR_1 = ['DTXSID9022528', 'DTXSID1020273', 'DTXSID6026296', 'DTXSID2021781']\n",
"VAR_2 = stats_by_dtxsids(VAR_1)\n",
"VAR_3 = VAR_2.get(sid='DTXSID9022528')\n",
"self.assertEqual(0, VAR_3['pucs_n'])\n",
"self.client.login(username='Karyn', password='specialP@55word')\n",
"VAR... | [
"def test_dtxsid_pucs_n(self):...\n",
"dtxs = ['DTXSID9022528', 'DTXSID1020273', 'DTXSID6026296', 'DTXSID2021781']\n",
"stats = stats_by_dtxsids(dtxs)\n",
"ethylparaben_stats = stats.get(sid='DTXSID9022528')\n",
"self.assertEqual(0, ethylparaben_stats['pucs_n'])\n",
"self.client.login(username='Karyn', pa... | [
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'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"VAR_0 = 'pos.open.statement'\n",
"VAR_1 = 'Open Statements'\n",
"def FUNC_0(self, VAR_2, VAR_3, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = []\n",
"VAR_7 = self.pool.get('ir.model.data')\n",
"VAR_8 = self.p... | [
"from osv import osv\n",
"from tools.translate import _\n",
"import time\n",
"_name = 'pos.open.statement'\n",
"_description = 'Open Statements'\n",
"def open_statement(self, cr, uid, ids, context):...\n",
"\"\"\"docstring\"\"\"\n",
"list_statement = []\n",
"mod_obj = self.pool.get('ir.model.data')\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Import'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.