lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_9(self):...\n",
"VAR_13 = self.cnxn.getinfo(pyodbc.SQL_ACCESSIBLE_TABLES)\n",
"self.assertTrue(isinstance(VAR_13, bool))\n"
] | [
"def test_getinfo_bool(self):...\n",
"value = self.cnxn.getinfo(pyodbc.SQL_ACCESSIBLE_TABLES)\n",
"self.assertTrue(isinstance(value, bool))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"VAR_40 = self.create_test('t0')\n",
"VAR_41 = self.create_test('t1')\n",
"VAR_41.depends_on('t0', rfm.DEPEND_EXACT, {'e0': ['e0']})\n",
"VAR_40.depends_on('t1', rfm.DEPEND_EXACT, {'e1': ['e1']})\n",
"VAR_34 = dependency.build_deps(executors.ge... | [
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"t0 = self.create_test('t0')\n",
"t1 = self.create_test('t1')\n",
"t1.depends_on('t0', rfm.DEPEND_EXACT, {'e0': ['e0']})\n",
"t0.depends_on('t1', rfm.DEPEND_EXACT, {'e1': ['e1']})\n",
"deps = dependency.build_deps(executors.generate_testcases([... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assert'"
] |
[
"def FUNC_1():...\n",
"return FUNC_0('secrets.json')\n"
] | [
"def read_secrets():...\n",
"return readJsonFile('secrets.json')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.norun = True\n",
"return VAR_101\n"
] | [
"def norun(self):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.norun = True\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"VAR_0 = [{'group': 'test', 'description': 'Test exception handling', 'get':\n 'foobar', 'set': 'set-foobar', 'os_v_min': '10.09', 'os_v_max': None},\n {'group': 'animation', 'description':\n 'Disable animations when opening and closing windows.', 'get':\n 'defaults read NSGlobalDomain NSAutomaticWindow... | [
"tweaks = [{'group': 'test', 'description': 'Test exception handling', 'get':\n 'foobar', 'set': 'set-foobar', 'os_v_min': '10.09', 'os_v_max': None},\n {'group': 'animation', 'description':\n 'Disable animations when opening and closing windows.', 'get':\n 'defaults read NSGlobalDomain NSAutomaticWindo... | [
2
] | [
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"VAR_15 = 'string'\n",
"return VAR_15\n"
] | [
"def _select(self):...\n",
"select_str = \"\"\"\n SELECT qcp.id as id,\n qcp.name as name,\n qcp.notes as notes,\n qcp.problem_group_id as problem_group_id,\n qcp.color as color,\n qcp.priority as priority,\... | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.finalize_sos_cmd()\n",
"self.log_debug('Final sos command set to %s' % self.sos_cmd)\n",
"VAR_25 = self.execute_sos_command()\n",
"self.cleanup()\n",
"if VAR_25:\n",
"self.finalize_sos_path(VAR_25)\n",
"self.log_error('Unable to determine p... | [
"def sosreport(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.finalize_sos_cmd()\n",
"self.log_debug('Final sos command set to %s' % self.sos_cmd)\n",
"path = self.execute_sos_command()\n",
"self.cleanup()\n",
"if path:\n",
"self.finalize_sos_path(path)\n",
"self.log_error('Unable to determine path ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Assign'"
] |
[
"def FUNC_18(self, VAR_14=False, VAR_15=False, VAR_13=False):...\n",
"VAR_11 = self.get_valid_dict(VAR_13=convert_dates_to_str)\n",
"VAR_11['doctype'] = self.doctype\n",
"for VAR_25 in self.meta.get_table_fields():\n",
"VAR_55 = self.get(VAR_25.fieldname) or []\n",
"if VAR_14:\n",
"VAR_11[VAR_25.fieldna... | [
"def as_dict(self, no_nulls=False, no_default_fields=False,...\n",
"doc = self.get_valid_dict(convert_dates_to_str=convert_dates_to_str)\n",
"doc['doctype'] = self.doctype\n",
"for df in self.meta.get_table_fields():\n",
"children = self.get(df.fieldname) or []\n",
"if no_nulls:\n",
"doc[df.fieldname] =... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Assign'",
"For",
"Condition",
"Condition",
"For",
"For",
"Condition",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_9(self, *VAR_15, **VAR_75):...\n",
""
] | [
"def newfn(self, *a, **env):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(VAR_0):...\n",
"VAR_6 = ['preferred', 'other', 'exceptions']\n",
"VAR_7 = VAR_0.head.commit.tree['LICENSES']\n",
"VAR_8 = CLASS_2()\n",
"for d in VAR_6:\n",
"for VAR_5 in VAR_7[d].traverse():\n",
"return VAR_8\n",
"if not os.path.isfile(VAR_5.path):\n",
"VAR_23 = None\n",
"for l in ope... | [
"def read_spdxdata(repo):...\n",
"license_dirs = ['preferred', 'other', 'exceptions']\n",
"lictree = repo.head.commit.tree['LICENSES']\n",
"spdx = SPDXdata()\n",
"for d in license_dirs:\n",
"for el in lictree[d].traverse():\n",
"return spdx\n",
"if not os.path.isfile(el.path):\n",
"exception = None\... | [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"For",
"Return'",
"Condition",
"Assign'",
"For",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"For",
"Condition",
"Condition",
"Condition",
"Expr'",
"Condition",
"... |
[
"def FUNC_15(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(VAR_5=False),\n max_retries=5)\n"
] | [
"def test_y_delete_load_balancer_pub(self):...\n",
"self.run_test_case(self.scenario.delete_load_balancer(use_vpc=False),\n max_retries=5)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_27(VAR_8):...\n",
"return '{}#{}'.format(VAR_7, VAR_8)\n"
] | [
"def u(string):...\n",
"return '{}#{}'.format(uuid_str, string)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(VAR_1):...\n",
"import json\n",
"from core.libs.playhouse.shortcuts import model_to_dict\n",
"return json.loads(json.dumps(model_to_dict(VAR_1, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n"
] | [
"def json_dump(obj):...\n",
"import json\n",
"from core.libs.playhouse.shortcuts import model_to_dict\n",
"return json.loads(json.dumps(model_to_dict(obj, recurse=False), default=\n default, separators=(', ', ': '), indent=1))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"self.delete_results()\n",
"self.cursor.execute('DELETE FROM log_event WHERE campaign_id=?', [self.\n campaign['id']])\n",
"self.cursor.execute('DELETE FROM log_campaign WHERE id=?', [self.campaign[\n 'id']])\n"
] | [
"def delete_campaign(self):...\n",
"self.delete_results()\n",
"self.cursor.execute('DELETE FROM log_event WHERE campaign_id=?', [self.\n campaign['id']])\n",
"self.cursor.execute('DELETE FROM log_campaign WHERE id=?', [self.campaign[\n 'id']])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@csrf_exempt...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_7.method == 'POST':\n",
"VAR_21 = VAR_7.POST.get('_action')\n",
"print(VAR_21)\n",
"if VAR_21 == 'registerService':\n",
"VAR_22 = VAR_7.POST.get('name')\n",
"if VAR_21 == 'getSchema':\n",
"VAR_23 = VAR_7.POST.get('address')\n",
"VAR_27 = FUNC... | [
"@csrf_exempt...\n",
"\"\"\"docstring\"\"\"\n",
"if request.method == 'POST':\n",
"action = request.POST.get('_action')\n",
"print(action)\n",
"if action == 'registerService':\n",
"request_name = request.POST.get('name')\n",
"if action == 'getSchema':\n",
"request_address = request.POST.get('address... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition"... |
[
"def FUNC_5(self):...\n",
""
] | [
"def test_run_interactive_shell_command_kwargs_delegation(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_32(*VAR_26):...\n",
""
] | [
"def mocked_check(*_args):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(self, VAR_4, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = 'string'.format(VAR_5=' '.join(start_urls), VAR_4=report_dir)\n",
"return VAR_6\n"
] | [
"def _expected_command(self, report_dir, start_urls):...\n",
"\"\"\"docstring\"\"\"\n",
"expected_statement = (\n 'pa11ycrawler run {start_urls} --pa11ycrawler-allowed-domains=localhost --pa11ycrawler-reports-dir={report_dir} --pa11ycrawler-deny-url-matcher=logout --pa11y-reporter=\"1.0-json\" --depth-limit=... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"@abstractmethod...\n",
""
] | [
"@abstractmethod...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def __init__(self, VAR_16):...\n",
"self.flags = dict()\n"
] | [
"def __init__(self, value):...\n",
"self.flags = dict()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __iter__(self):...\n",
"return self\n"
] | [
"def __iter__(self):...\n",
"return self\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self, VAR_13):...\n",
"if not isinstance(VAR_13, JvmTarget):\n",
"return False\n",
"return VAR_13.has_sources('.java')\n"
] | [
"def select(self, target):...\n",
"if not isinstance(target, JvmTarget):\n",
"return False\n",
"return target.has_sources('.java')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_7):...\n",
"SubmitAPIHandler.post(self, VAR_7)\n"
] | [
"def post(self, uuid):...\n",
"SubmitAPIHandler.post(self, uuid)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_1(VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9...\n",
"VAR_7 = VAR_7.split(' ')\n",
"if len(VAR_7) >= 2:\n",
"VAR_0 = VAR_7[0].lower()\n",
"await VAR_1.send_message(VAR_2,\n '{}, **USAGE:** {}remindme <time> <message...>'.format(VAR_3, VAR_9))\n",
"VAR_14 = ''\n",
"pr... | [
"async def ex_me(dclient, channel, mention, con, con_ex, author_id, a,...\n",
"a = a.split(' ')\n",
"if len(a) >= 2:\n",
"time = a[0].lower()\n",
"await dclient.send_message(channel,\n '{}, **USAGE:** {}remindme <time> <message...>'.format(mention, cmd_char))\n",
"msg = ''\n",
"print('')\n",
"for i... | [
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"For",
"AugAssign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"import unittest\n",
"import re\n",
"from mockito import mock, when, any as ANY\n",
"from pixelated.application import UserAgentMode\n",
"from test.unit.resources import DummySite\n",
"from twisted.web.test.requesthelper import DummyRequest\n",
"from pixelated.resources.root_resource import RootResource... | [
"import unittest\n",
"import re\n",
"from mockito import mock, when, any as ANY\n",
"from pixelated.application import UserAgentMode\n",
"from test.unit.resources import DummySite\n",
"from twisted.web.test.requesthelper import DummyRequest\n",
"from pixelated.resources.root_resource import RootResource... | [
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"A... |
[
"def FUNC_3(self):...\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen('url', wait_duration=-1), None)\n",
"self._mox.VerifyAll()\n"
] | [
"def testUrlOpenInvalidWaitDuration(self):...\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen('url', wait_duration=-1), None)\n",
"self._mox.VerifyAll()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"frappe.set_user('test1@example.com')\n",
"self.assertRaises(frappe.PermissionError, get_filters_cond, 'DocType', dict\n (istable=1), [])\n",
"self.assertTrue(get_filters_cond('DocType', dict(istable=1), [],\n ignore_permissions=True))\n",
"frappe.set_user('Administrator')\n... | [
"def test_ignore_permissions_for_get_filters_cond(self):...\n",
"frappe.set_user('test1@example.com')\n",
"self.assertRaises(frappe.PermissionError, get_filters_cond, 'DocType', dict\n (istable=1), [])\n",
"self.assertTrue(get_filters_cond('DocType', dict(istable=1), [],\n ignore_permissions=True))\n",
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = self.stdout_interceptor.read_all()\n",
"VAR_4 = ''\n",
"return render_texts.preformatted_text(VAR_4)\n"
] | [
"def read_stdout(self):...\n",
"\"\"\"docstring\"\"\"\n",
"contents = self.stdout_interceptor.read_all()\n",
"contents = ''\n",
"return render_texts.preformatted_text(contents)\n"
] | [
0,
0,
6,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_7):...\n",
"\"\"\"docstring\"\"\"\n",
"@functools.wraps(VAR_7)...\n",
"assert isinstance(self, webapp2.RequestHandler)\n",
"if model.is_replica():\n",
"VAR_40 = model.get_replication_state().primary_url\n",
"return VAR_7(self, *VAR_9, **kwargs)\n",
"self.abort(405, detail='Not allowed ... | [
"def forbid_ui_on_replica(method):...\n",
"\"\"\"docstring\"\"\"\n",
"@functools.wraps(method)...\n",
"assert isinstance(self, webapp2.RequestHandler)\n",
"if model.is_replica():\n",
"primary_url = model.get_replication_state().primary_url\n",
"return method(self, *args, **kwargs)\n",
"self.abort(405,... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assert'",
"Condition",
"Assign'",
"Return'",
"Expr'"
] |
[
"def __exit__(self, *VAR_4):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def __exit__(self, *ext):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_4(self):...\n",
"if self._user_notified_about_crash or self._IsServerAlive():\n",
"return\n",
"self._user_notified_about_crash = True\n",
"if self._server_stderr:\n",
"VAR_27 = ''.join(server_stderr_file.readlines()[:-VAR_1])\n",
"vimsupport.PostVimMessage(VAR_3)\n",
"vimsupport.PostMultiLin... | [
"def _NotifyUserIfServerCrashed(self):...\n",
"if self._user_notified_about_crash or self._IsServerAlive():\n",
"return\n",
"self._user_notified_about_crash = True\n",
"if self._server_stderr:\n",
"error_output = ''.join(server_stderr_file.readlines()[:-\n NUM_YCMD_STDERR_LINES_ON_CRASH])\n",
"vimsup... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = pq.backends.Simulator(**self.filter_kwargs_for_backend(self.kwargs))\n",
"self.eng = pq.MainEngine(VAR_18)\n",
"super().reset()\n"
] | [
"def reset(self):...\n",
"\"\"\"docstring\"\"\"\n",
"backend = pq.backends.Simulator(**self.filter_kwargs_for_backend(self.kwargs))\n",
"self.eng = pq.MainEngine(backend)\n",
"super().reset()\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"self.run_test_case(self.scenario.upsert_load_balancer())\n"
] | [
"def test_a_upsert_load_balancer(self):...\n",
"self.run_test_case(self.scenario.upsert_load_balancer())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_8(self):...\n",
"self.authn('/login')\n"
] | [
"def test_login_authn(self):...\n",
"self.authn('/login')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(self, VAR_3, VAR_4=False):...\n",
"return VAR_3.cursor()\n"
] | [
"def newCursorForConnection(self, conn, dictMode=False):...\n",
"return conn.cursor()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"async def FUNC_0(self, VAR_0):...\n",
"for callback in self.on_member_join_callbacks:\n",
"await callback(VAR_0)\n"
] | [
"async def on_member_join(self, member):...\n",
"for callback in self.on_member_join_callbacks:\n",
"await callback(member)\n"
] | [
0,
0,
0
] | [
"AsyncFunctionDef'",
"For",
"Expr'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"while self.char and self.char.isspace():\n",
"self.read()\n",
"if self.char == None:\n",
"return CLASS_2(CLASS_1.EOF, None, self.position)\n",
"if self.char == '>':\n",
"VAR_49 = self.position\n",
"if self.char == '<':\n",
"if self.read() == '>... | [
"def token(self):...\n",
"\"\"\"docstring\"\"\"\n",
"while self.char and self.char.isspace():\n",
"self.read()\n",
"if self.char == None:\n",
"return Token(TokenType.EOF, None, self.position)\n",
"if self.char == '>':\n",
"start = self.position\n",
"if self.char == '<':\n",
"if self.read() == '>':... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Return'",
"E... |
[
"def FUNC_12(self):...\n",
"return self.vars.copy()\n"
] | [
"def get_vars(self):...\n",
"return self.vars.copy()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if VAR_1 not in oauth.remote_apps:\n",
"VAR_4 = oauth.remote_app(VAR_1, **conf['params']... | [
"@blueprint.before_app_first_request...\n",
"\"\"\"docstring\"\"\"\n",
"user_logged_out.connect(oauth_logout_handler)\n",
"oauth.init_app(current_app)\n",
"for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n",
"if remote_app not in oauth.remote_apps:\n",
"remote = oauth.remote_app(remote_a... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Docstring",
"Expr'",
"Expr'",
"For",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.con.commit()\n",
"logging.error(T('SQL Commit Failed, see log'))\n",
"logging.info('Traceback: ', exc_info=True)\n"
] | [
"def save(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.con.commit()\n",
"logging.error(T('SQL Commit Failed, see log'))\n",
"logging.info('Traceback: ', exc_info=True)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_11, VAR_7):...\n",
""
] | [
"def expectation(self, observable, wires):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def __getattr__(self, VAR_2: str) ->Any:...\n",
"...\n"
] | [
"def __getattr__(self, name: str) ->Any:...\n",
"...\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_1():...\n",
"VAR_6 = './data/input/'\n",
"VAR_7 = VAR_6 + 'download/'\n",
"VAR_8 = './data/temp/'\n",
"VAR_9 = './data/vcf/'\n",
"VAR_10 = './data/zarr/'\n",
"VAR_11 = './data/zarr_benchmark/'\n",
"VAR_12 = FUNC_0()\n",
"VAR_13 = VAR_12['command']\n",
"if VAR_13 == 'config':\n",
"VAR_1... | [
"def _main():...\n",
"input_directory = './data/input/'\n",
"download_directory = input_directory + 'download/'\n",
"temp_directory = './data/temp/'\n",
"vcf_directory = './data/vcf/'\n",
"zarr_directory_setup = './data/zarr/'\n",
"zarr_directory_benchmark = './data/zarr_benchmark/'\n",
"cli_arguments... | [
0,
7,
7,
7,
7,
7,
7,
0,
0,
0,
0,
0,
0,
0,
0,
0,
7,
0,
0,
7,
0,
0,
0,
0,
0,
0,
0,
0,
7,
7,
7,
0,
7
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign... |
[
"def FUNC_13():...\n",
"populate_test_database()\n",
"FUNC_1('first playlist')\n",
"VAR_11 = VAR_3.post('/videos/1/title/thumbnail')\n",
"assert VAR_11.json['status'] == 'OK'\n",
"VAR_12 = VAR_3.post('/videos/1/title2/thumbnail2')\n",
"assert VAR_12.json['status'] == 'OK'\n",
"VAR_13 = VAR_3.post('/vi... | [
"def test_should_reorder_video_position_given_a_deleted_video():...\n",
"populate_test_database()\n",
"create_playlist('first playlist')\n",
"response = test_app.post('/videos/1/title/thumbnail')\n",
"assert response.json['status'] == 'OK'\n",
"response2 = test_app.post('/videos/1/title2/thumbnail2')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assert'",
"Assert'"
] |
[
"def FUNC_1(self, VAR_1):...\n",
"return self.properties\n"
] | [
"def _fake_get_iscsi_properties(self, volume):...\n",
"return self.properties\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_14(self):...\n",
"self._test_strtype('text', None, 100)\n"
] | [
"def test_text_null(self):...\n",
"self._test_strtype('text', None, 100)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_20(self, VAR_2, VAR_3, VAR_4, *VAR_5):...\n",
"self.write_data({'type': VAR_3, 'event': VAR_5[0]})\n"
] | [
"def on_resource_event(self, subject, changetype, objectID, *args):...\n",
"self.write_data({'type': changetype, 'event': args[0]})\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_1(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = 'string'.format(VAR_1)\n",
"VAR_6 = FUNC_3(VAR_0, VAR_4)\n",
"if VAR_6 is not None:\n",
"VAR_8 = open('top_authors_report.txt', 'w')\n",
"return False\n",
"for row in VAR_6:\n",
"VAR_8.write('{} - {} views \\n'.format(row[0], row[... | [
"def get_top_authors(cur, order):...\n",
"\"\"\"docstring\"\"\"\n",
"query = (\n \"\"\"SELECT authors.name, COUNT(*) as views\n FROM authors, articles, log\n WHERE authors.id = articles.author AND\n log.path LIKE '%'||articles.slug AND\n log.method = 'GET'\n ... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"For",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_5(self, VAR_13=''):...\n",
"self.write(VAR_13 + '\\n')\n",
"return self.read_until()\n"
] | [
"def command(self, command=''):...\n",
"self.write(command + '\\n')\n",
"return self.read_until()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_17(VAR_8):...\n",
""
] | [
"def open_port_firewalld(cfg):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_15(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 4, 'MEDIUM': 5, 'HIGH': 0}, 'CONFIDENCE': {\n 'HIGH': 9}}\n",
"self.check_example('imports-aliases.py', VAR_2)\n"
] | [
"def test_imports_aliases(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 4, 'MEDIUM': 5, 'HIGH': 0}, 'CONFIDENCE': {\n 'HIGH': 9}}\n",
"self.check_example('imports-aliases.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_16(self):...\n",
"return False\n"
] | [
"def do_existing_paths(self):...\n",
"return False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(VAR_5):...\n",
"self.session.notifier.notify(NTFY_UPGRADER, NTFY_STARTED, None, None)\n",
"self.session.notifier.notify(NTFY_UPGRADER_TICK, NTFY_STARTED, None, None)\n",
"self.session.notifier.notify(NTFY_UPGRADER, NTFY_FINISHED, None, None)\n",
"self.session.notifier.notify(NTFY_WATCH_FOLDER_CO... | [
"def send_notifications(_):...\n",
"self.session.notifier.notify(NTFY_UPGRADER, NTFY_STARTED, None, None)\n",
"self.session.notifier.notify(NTFY_UPGRADER_TICK, NTFY_STARTED, None, None)\n",
"self.session.notifier.notify(NTFY_UPGRADER, NTFY_FINISHED, None, None)\n",
"self.session.notifier.notify(NTFY_WATCH_F... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_19(self):...\n",
"self._diag_interface.OnCursorMoved()\n"
] | [
"def OnCursorMoved(self):...\n",
"self._diag_interface.OnCursorMoved()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_71 = {'encoding': [VAR_44]}\n",
"if VAR_45:\n",
"VAR_71['filename'] = [VAR_45]\n",
"if VAR_46:\n",
"VAR_71['content_type'] = [VAR_46]\n",
"VAR_72, VAR_73 = self.get('/attachment/%s' % VAR_43, VAR_71, VAR_21=False)\n",
"VAR_69 = yield VAR_72\n",
"defer.returnValue(... | [
"@defer.inlineCallbacks...\n",
"params = {'encoding': [encoding]}\n",
"if filename:\n",
"params['filename'] = [filename]\n",
"if content_type:\n",
"params['content_type'] = [content_type]\n",
"deferred_result, req = self.get('/attachment/%s' % ident, params, as_json=False\n )\n",
"res = yield defer... | [
5,
0,
0,
0,
0,
0,
5,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(VAR_6):...\n",
"return os.path.isfile(VAR_6) and os.stat(VAR_6).st_size > 0\n"
] | [
"def file_exists(file_path):...\n",
"return os.path.isfile(file_path) and os.stat(file_path).st_size > 0\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import os\n",
"import os.path as path\n",
"import sys\n",
"import sqlite3\n",
"import uuid\n",
"import time\n",
"import re\n",
"import hunspell_suggest\n",
"VAR_0 = '0.61'\n",
"VAR_1 = re.compile('c([ea])(\\\\d):(.*)')\n",
"VAR_2 = re.compile('p(-{0,1}\\\\d)(-{0,1}\\\\d)')\n",
"def __init__(s... | [
"import os\n",
"import os.path as path\n",
"import sys\n",
"import sqlite3\n",
"import uuid\n",
"import time\n",
"import re\n",
"import hunspell_suggest\n",
"user_database_version = '0.61'\n",
"patt_r = re.compile('c([ea])(\\\\d):(.*)')\n",
"patt_p = re.compile('p(-{0,1}\\\\d)(-{0,1}\\\\d)')\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"For",
"FunctionDef'",
"Condition",
"Condition",
"As... |
[
"from django.core.exceptions import ObjectDoesNotExist\n",
"from rest_framework import exceptions\n",
"from app import models\n",
"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",... | [
"from django.core.exceptions import ObjectDoesNotExist\n",
"from rest_framework import exceptions\n",
"from app import models\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)... | [
1,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Assign'",
"Return'",
"For",
"Condition"
] |
[
"def FUNC_6(self, VAR_14, VAR_15=None, VAR_16=200):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = {'app_name': VAR_1, 'csp_nonce': self.csp_nonce, 'identity': api.\n get_current_identity(), 'logout_url': json.dumps(self.create_logout_url\n ('/')), 'xsrf_token': self.generate_xsrf_token()}\n",
"VAR_28.upda... | [
"def reply(self, path, env=None, status=200):...\n",
"\"\"\"docstring\"\"\"\n",
"full_env = {'app_name': _ui_app_name, 'csp_nonce': self.csp_nonce,\n 'identity': api.get_current_identity(), 'logout_url': json.dumps(self.\n create_logout_url('/')), 'xsrf_token': self.generate_xsrf_token()}\n",
"full_env.... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"VAR_10 = super().clean()\n",
"if 'path' in VAR_10:\n",
"FUNC_0(self.instance.project, VAR_10['path'], self.instance.pk)\n",
"return VAR_10\n"
] | [
"def clean(self):...\n",
"cleaned_data = super().clean()\n",
"if 'path' in cleaned_data:\n",
"validate_unique_project_path(self.instance.project, cleaned_data['path'],\n self.instance.pk)\n",
"return cleaned_data\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_0(self, VAR_11=None, VAR_12=None):...\n",
"\"\"\"docstring\"\"\"\n",
"assert self.use_stdin and VAR_12 is not None or not self.use_stdin and VAR_11 is not None\n",
"VAR_21 = self.generate_config_file()\n",
"self.command = self._create_command(VAR_11=filename, VAR_21=config_file)\n",
"VAR_22 = ''... | [
"def lint(self, filename=None, file=None):...\n",
"\"\"\"docstring\"\"\"\n",
"assert self.use_stdin and file is not None or not self.use_stdin and filename is not None\n",
"config_file = self.generate_config_file()\n",
"self.command = self._create_command(filename=filename, config_file=config_file)\n",
"s... | [
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assert'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self, VAR_6):...\n",
"print('Start Crawl')\n",
"print(VAR_6.url)\n",
"VAR_7 = KeyExtractor()\n",
"while VAR_7.hasMoreProfileLinks():\n",
"VAR_10 = VAR_7.getMoreProfileLinks()\n",
"for link in VAR_10:\n",
"VAR_13 = link\n",
"VAR_14 = link + '/couch'\n",
"VAR_15 = link + '/photos'\n",
... | [
"def start_crawl(self, response):...\n",
"print('Start Crawl')\n",
"print(response.url)\n",
"key_extractor = KeyExtractor()\n",
"while key_extractor.hasMoreProfileLinks():\n",
"links = key_extractor.getMoreProfileLinks()\n",
"for link in links:\n",
"about_link = link\n",
"couch_link = link + '/couch... | [
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_19(self, VAR_2):...\n",
"self._target_roots = list(VAR_2)\n"
] | [
"def _replace_targets(self, target_roots):...\n",
"self._target_roots = list(target_roots)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __init__(self, VAR_0):...\n",
"VAR_0 = VAR_0.strip().splitlines()\n",
"VAR_13 = VAR_0[1][0]\n",
"VAR_23 = CLASS_5.usedMarkers.index(VAR_13)\n",
"VAR_23 = len(CLASS_5.usedMarkers)\n",
"if VAR_23 > 2:\n",
"CLASS_5.usedMarkers.append(VAR_13)\n",
"warn(\"Something's wrong with heading marker\", VAR_1... | [
"def __init__(self, txt):...\n",
"txt = txt.strip().splitlines()\n",
"marker = txt[1][0]\n",
"i = Heading.usedMarkers.index(marker)\n",
"i = len(Heading.usedMarkers)\n",
"if i > 2:\n",
"Heading.usedMarkers.append(marker)\n",
"warn(\"Something's wrong with heading marker\", marker, 'having index', i)\n... | [
0,
2,
0,
0,
0,
0,
0,
2,
2,
0,
2
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_3):...\n",
"def FUNC_6(VAR_6):...\n",
"assert VAR_6 == VAR_3\n",
"return VAR_0\n"
] | [
"def create_mock_os_walk(mock_path):...\n",
"def _os_walk(path):...\n",
"assert path == mock_path\n",
"return MOCK_PATHS\n"
] | [
0,
0,
0,
1
] | [
"FunctionDef'",
"FunctionDef'",
"Assert'",
"Return'"
] |
[
"def __init__(self, VAR_2=None, VAR_3=None, VAR_4=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = VAR_2\n",
"self.address = VAR_2\n",
"if VAR_3:\n",
"self.set_variable('ansible_port', int(VAR_3))\n",
"if VAR_4:\n",
"self._uuid = get_unique_id()\n",
"se... | [
"def __init__(self, name=None, port=None, gen_uuid=True):...\n",
"self.vars = {}\n",
"self.groups = []\n",
"self._uuid = None\n",
"self.name = name\n",
"self.address = name\n",
"if port:\n",
"self.set_variable('ansible_port', int(port))\n",
"if gen_uuid:\n",
"self._uuid = get_unique_id()\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_13(self, VAR_8):...\n",
"logging.info('Rebooting bot: %s', VAR_8)\n",
"VAR_36 = {'cmd': 'restart', 'message': VAR_8}\n",
"self.send_response(VAR_36)\n"
] | [
"def _cmd_restart(self, message):...\n",
"logging.info('Rebooting bot: %s', message)\n",
"out = {'cmd': 'restart', 'message': message}\n",
"self.send_response(out)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._out = self.execute_queued()\n"
] | [
"def execute(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._out = self.execute_queued()\n"
] | [
0,
0,
7
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_9(self):...\n",
"for resource in set(resource for VAR_13 in self.rules for resource in\n",
"if resource not in '_cores _nodes'.split():\n",
"logger.info(resource)\n"
] | [
"def list_resources(self):...\n",
"for resource in set(resource for rule in self.rules for resource in rule.\n",
"if resource not in '_cores _nodes'.split():\n",
"logger.info(resource)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"VAR_1 = {'name': self.volume_name, 'size': 1}\n",
"self.driver._eql_execute('volume', 'select', VAR_1['name'], 'show')\n",
"self.mox.ReplayAll()\n",
"self.driver.ensure_export({}, VAR_1)\n"
] | [
"def test_ensure_export(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"volume = {'name': self.volume_name, 'size': 1}\n",
"self.driver._eql_execute('volume', 'select', volume['name'], 'show')\n",
"self.mox.ReplayAll()\n",
"self.driver.ensure_export({}, volume)... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_1.route('/run/form/init', methods=['POST'])...\n",
"VAR_37 = FUNC_15()\n",
"VAR_10 = json.loads(request.data)['commands']\n",
"FUNC_16(VAR_37, VAR_10)\n",
"return json.dumps({'commands': VAR_10, 'html': render_template(\n 'run_form.html', VAR_9=run_form)})\n"
] | [
"@app.route('/run/form/init', methods=['POST'])...\n",
"run_form = get_run_form()\n",
"commands = json.loads(request.data)['commands']\n",
"set_form_defaults(run_form, commands)\n",
"return json.dumps({'commands': commands, 'html': render_template(\n 'run_form.html', form=run_form)})\n"
] | [
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"self.bytes_buffer.seek(0)\n",
"VAR_4 = self.bytes_buffer.read()\n",
"self.bytes_buffer.truncate(0)\n",
"self.bytes_buffer.seek(0)\n",
"if VAR_4 is None:\n",
"return ''\n",
"return VAR_4.decode(self.source_encoding)\n"
] | [
"def flush_all(self) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"self.bytes_buffer.seek(0)\n",
"contents = self.bytes_buffer.read()\n",
"self.bytes_buffer.truncate(0)\n",
"self.bytes_buffer.seek(0)\n",
"if contents is None:\n",
"return ''\n",
"return contents.decode(self.source_encoding)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
6
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(VAR_0):...\n",
"VAR_0.update({field: str(value) for field, value in VAR_0.items() if value is\n None})\n",
"VAR_2 = ', '.join([str(field) for field in VAR_0.keys()])\n",
"VAR_5 = list(VAR_0.values())\n",
"return VAR_2, VAR_5\n"
] | [
"def preprocess_record(record):...\n",
"record.update({field: str(value) for field, value in record.items() if \n value is None})\n",
"field_names = ', '.join([str(field) for field in record.keys()])\n",
"data = list(record.values())\n",
"return field_names, data\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_15(self, VAR_22):...\n",
"VAR_38 = urlparse.urlparse(self._url_prefix)\n",
"VAR_22 = ('/%s/%s' % (VAR_38.path, VAR_22)).replace('//', '/').strip('/')\n",
"if VAR_38.netloc:\n",
"VAR_22 = '%s/%s' % (VAR_38.netloc, VAR_22)\n",
"if VAR_38.scheme:\n",
"VAR_22 = '%s://%s' % (VAR_38.scheme, VAR_22)\... | [
"def _build_url(self, uri):...\n",
"prefix = urlparse.urlparse(self._url_prefix)\n",
"uri = ('/%s/%s' % (prefix.path, uri)).replace('//', '/').strip('/')\n",
"if prefix.netloc:\n",
"uri = '%s/%s' % (prefix.netloc, uri)\n",
"if prefix.scheme:\n",
"uri = '%s://%s' % (prefix.scheme, uri)\n",
"return uri\... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@handler.unsupported_on_local_server...\n",
"\"\"\"docstring\"\"\"\n",
"self.render('login.html', {'apiKey': local_config.ProjectConfig().get(\n 'firebase.api_key'), 'authDomain': auth.auth_domain(), 'dest': self.\n request.get('dest')})\n"
] | [
"@handler.unsupported_on_local_server...\n",
"\"\"\"docstring\"\"\"\n",
"self.render('login.html', {'apiKey': local_config.ProjectConfig().get(\n 'firebase.api_key'), 'authDomain': auth.auth_domain(), 'dest': self.\n request.get('dest')})\n"
] | [
0,
0,
3
] | [
"Condition",
"Docstring",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"return {'XSS': self.payload}\n"
] | [
"def signature(self):...\n",
"return {'XSS': self.payload}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import argparse\n",
"import importlib\n",
"import os\n",
"import sys\n",
"from parlai.core.agents import get_agent_module, get_task_module\n",
"from parlai.tasks.tasks import ids_to_tasks\n",
"def FUNC_0(VAR_0):...\n",
"VAR_3 = VAR_0.lower()\n",
"if VAR_3 in ('yes', 'true'... | [
"\"\"\"Provides an argument parser and a set of default command line options for\nusing the ParlAI package.\n\"\"\"\n",
"import argparse\n",
"import importlib\n",
"import os\n",
"import sys\n",
"from parlai.core.agents import get_agent_module, get_task_module\n",
"from parlai.tasks.tasks import ids_to_t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"VAR_15 = '%s@%s:%s%s ' % ('user', 'oms', self._cwd(), '#')\n",
"return [VAR_15, '... ']\n"
] | [
"@property...\n",
"ps1 = '%s@%s:%s%s ' % ('user', 'oms', self._cwd(), '#')\n",
"return [ps1, '... ']\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import config\n",
"from photogpsbot import bot, log, db\n",
"from photogpsbot.db_connector import DatabaseError, DatabaseConnectionError\n",
"from telebot.types import Message\n",
"\"\"\"string\"\"\"\n",
"def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4='en-US'):...\n",
"s... | [
"\"\"\"\nModule to manage users of bot: store and update information, interact with\nthe database, keep tack of and switch language of interface for user\n\"\"\"\n",
"import config\n",
"from photogpsbot import bot, log, db\n",
"from photogpsbot.db_connector import DatabaseError, DatabaseConnectionError\n",
... | [
0,
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
] | [
"Expr'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Docstring",
"Assign'",
... |
[
"def FUNC_5(self):...\n",
"VAR_24 = 'katotest-httplb-' + self.test_id\n",
"self.__use_http_lb_name = VAR_24\n",
"self.__use_http_lb_hc_name = VAR_24 + '-health-check'\n",
"self.__use_http_lb_bs_name = VAR_24 + '-backend-service'\n",
"self.__use_http_lb_fr_name = VAR_24\n",
"self.__use_http_lb_map_name =... | [
"def create_http_load_balancer(self):...\n",
"logical_http_lb_name = 'katotest-httplb-' + self.test_id\n",
"self.__use_http_lb_name = logical_http_lb_name\n",
"self.__use_http_lb_hc_name = logical_http_lb_name + '-health-check'\n",
"self.__use_http_lb_bs_name = logical_http_lb_name + '-backend-service'\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"from __future__ import absolute_import\n",
"from twisted.internet import reactor\n",
"from twisted.internet.defer import inlineCallbacks, maybeDeferred\n",
"from twisted.web.server import Site\n",
"from twisted.web.util import Redirect\n",
"from Tribler.Core.Utilities.network_utils import get_random_port... | [
"from __future__ import absolute_import\n",
"from twisted.internet import reactor\n",
"from twisted.internet.defer import inlineCallbacks, maybeDeferred\n",
"from twisted.web.server import Site\n",
"from twisted.web.util import Redirect\n",
"from Tribler.Core.Utilities.network_utils import get_random_port... | [
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"FunctionDef'",
"Docstring",
"Assi... |
[
"def __init__(self, VAR_9, VAR_10=None, VAR_11=None, **VAR_12):...\n",
"for attr in self.config_attrs:\n",
"if VAR_12:\n",
"VAR_34 = VAR_12.pop(attr)\n",
"VAR_34 = decode_if_byte_string(VAR_34)\n",
"self.media_types = MediaTypes(extra_types=self.mimetypes)\n",
"setattr(self, attr, VAR_34)\n",
"self.ap... | [
"def __init__(self, application, root=None, prefix=None, **kwargs):...\n",
"for attr in self.config_attrs:\n",
"if kwargs:\n",
"value = kwargs.pop(attr)\n",
"value = decode_if_byte_string(value)\n",
"self.media_types = MediaTypes(extra_types=self.mimetypes)\n",
"setattr(self, attr, value)\n",
"self.ap... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"@api.onchange('lastname', 'firstname', 'zip', 'email')...\n",
"if (self.lastname and self.firstname and self.zip or self.email\n",
"VAR_64 = self.search([('id', '!=', self._origin.id), '|', '&', ('email',\n '=', self.email), ('email', '!=', False), '&', '&', ('firstname',\n 'ilike', self.firstname), ('la... | [
"@api.onchange('lastname', 'firstname', 'zip', 'email')...\n",
"if (self.lastname and self.firstname and self.zip or self.email\n",
"partner_duplicates = self.search([('id', '!=', self._origin.id), '|', '&',\n ('email', '=', self.email), ('email', '!=', False), '&', '&', (\n 'firstname', 'ilike', self.fir... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_17(VAR_25):...\n",
"def FUNC_21(VAR_55):...\n",
"@wraps(VAR_55)...\n",
"VAR_70['timer'] = CLASS_2(VAR_25)\n",
"return VAR_55(*VAR_69, **kwargs)\n"
] | [
"def time_request(name):...\n",
"def decorator(func):...\n",
"@wraps(func)...\n",
"kwargs['timer'] = Timer(name)\n",
"return func(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Condition",
"Assign'",
"Return'"
] |
[
"def __ne__(self, VAR_1):...\n",
"return not self.__eq__(VAR_1)\n"
] | [
"def __ne__(self, other):...\n",
"return not self.__eq__(other)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self, VAR_21, VAR_27, VAR_28):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_57 = self.getfile(VAR_21)\n",
"if VAR_57 == False:\n",
"if VAR_27 != -1:\n",
"VAR_57[VAR_3] = VAR_27\n",
"if VAR_28 != -1:\n",
"VAR_57[VAR_4] = VAR_28\n"
] | [
"def chown(self, path, uid, gid):...\n",
"\"\"\"docstring\"\"\"\n",
"p = self.getfile(path)\n",
"if p == False:\n",
"if uid != -1:\n",
"p[A_UID] = uid\n",
"if gid != -1:\n",
"p[A_GID] = gid\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_45(VAR_25, VAR_39):...\n",
"if self.parentfield:\n",
"return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(VAR_25.label), VAR_39)\n",
"return '{}: {}'.format(_(VAR_25.label), VAR_39)\n"
] | [
"def get_msg(df, docname):...\n",
"if self.parentfield:\n",
"return '{} #{}: {}: {}'.format(_('Row'), self.idx, _(df.label), docname)\n",
"return '{}: {}'.format(_(df.label), docname)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_49(self):...\n",
"for VAR_14 in self.list_columns.keys():\n",
"if self.is_pk(VAR_14):\n",
"return VAR_14\n"
] | [
"def get_pk_name(self):...\n",
"for col_name in self.list_columns.keys():\n",
"if self.is_pk(col_name):\n",
"return col_name\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Return'"
] |
[
"@api.route('/songs/<int:id>')...\n",
"VAR_2 = Song.query.filter_by(VAR_1=id).first()\n",
"if not VAR_2:\n",
"return route_not_found(VAR_2)\n",
"return make_response(jsonify(VAR_2.to_json()), 200)\n"
] | [
"@api.route('/songs/<int:id>')...\n",
"song = Song.query.filter_by(id=id).first()\n",
"if not song:\n",
"return route_not_found(song)\n",
"return make_response(jsonify(song.to_json()), 200)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_1=None):...\n",
"self.options = VAR_1\n"
] | [
"def __init__(self, options=None):...\n",
"self.options = options\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_10(VAR_27, VAR_28, VAR_18):...\n",
"VAR_40 = ''\n",
"VAR_41 = ''\n",
"VAR_42 = ''\n",
"VAR_43 = ''\n",
"VAR_19 = ''\n",
"VAR_20 = ''\n",
"VAR_36 = datetime.utcfromtimestamp(VAR_27.created_utc)\n",
"VAR_14 = str(VAR_27.author)\n",
"VAR_44 = FUNC_2(VAR_14=username, VAR_15='send', VAR_18=co... | [
"def handle_send_nano(message, parsed_text, comment_or_message):...\n",
"user_or_address = ''\n",
"private_key = ''\n",
"adrress = ''\n",
"recipient = ''\n",
"recipient_username = ''\n",
"recipient_address = ''\n",
"message_time = datetime.utcfromtimestamp(message.created_utc)\n",
"username = str(me... | [
0,
4,
4,
4,
4,
4,
4,
0,
4,
4,
4,
4,
4,
4,
4,
4,
4,
0,
4,
0,
4,
0,
4,
0,
0,
4,
0,
0,
0,
4,
0,
4,
0,
0,
0,
4,
4,
0,
0,
0,
4,
4,
4,
4,
0,
0,
0,
4,
4,
0,
4,
4,
4,
4,
0,
4,
4,
4,
4,
0,
4,
4,
4,
0... | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assig... |
[
"def FUNC_40(VAR_63=None):...\n",
"VAR_81 = VAR_20.getWrittenData()\n",
"if VAR_81:\n",
"return FUNC_39(VAR_81)\n"
] | [
"def get_request_written_data(_=None):...\n",
"written_data = request.getWrittenData()\n",
"if written_data:\n",
"return get_str(written_data)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'"
] |
[
"@catch_bare_integrity_error...\n",
"VAR_6 = get_json_request_body(self)\n",
"if VAR_6.get('survey_id', None) != VAR_0:\n",
"VAR_7 = validation_message('submission', 'survey_id', 'invalid')\n",
"self.write(api.submission.submit(VAR_6))\n",
"VAR_7 = validation_message('submission', str(e), 'missing_field')... | [
"@catch_bare_integrity_error...\n",
"data = get_json_request_body(self)\n",
"if data.get('survey_id', None) != survey_id:\n",
"reason = validation_message('submission', 'survey_id', 'invalid')\n",
"self.write(api.submission.submit(data))\n",
"reason = validation_message('submission', str(e), 'missing_fiel... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_8(self, VAR_10):...\n",
"if isinstance(VAR_10, ndb.Model):\n",
"VAR_28 = VAR_10.to_dict()\n",
"if isinstance(VAR_10, datetime.datetime):\n",
"VAR_28['id'] = VAR_10.key.id()\n",
"return int((VAR_10 - self._EPOCH).total_seconds())\n",
"if hasattr(VAR_10, 'to_dict'):\n",
"return VAR_28\n",
"r... | [
"def default(self, obj):...\n",
"if isinstance(obj, ndb.Model):\n",
"dict_obj = obj.to_dict()\n",
"if isinstance(obj, datetime.datetime):\n",
"dict_obj['id'] = obj.key.id()\n",
"return int((obj - self._EPOCH).total_seconds())\n",
"if hasattr(obj, 'to_dict'):\n",
"return dict_obj\n",
"return obj.to_d... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'",
"Return'",
"Condition",
"Return'"
] |
[
"@wraps(VAR_6)...\n",
"if 'logged_in' in VAR_10:\n",
"return VAR_6(*VAR_8, **kwargs)\n",
"flash('Unauthorized, Please login', 'danger')\n",
"return redirect(url_for('login'))\n"
] | [
"@wraps(f)...\n",
"if 'logged_in' in session:\n",
"return f(*args, **kwargs)\n",
"flash('Unauthorized, Please login', 'danger')\n",
"return redirect(url_for('login'))\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"def FUNC_22(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"if type(VAR_16) == str:\n",
"VAR_16 = self.locate(VAR_16)\n",
"VAR_54 = list()\n",
"if not VAR_16:\n",
"for VAR_18 in VAR_16.sub_items:\n",
"return []\n",
"VAR_66 = dict()\n",
"return VAR_54\n",
"VAR_66['file-name'] = VAR_18.file_nam... | [
"def listdir(self, path):...\n",
"\"\"\"docstring\"\"\"\n",
"if type(path) == str:\n",
"path = self.locate(path)\n",
"dirs = list()\n",
"if not path:\n",
"for item in path.sub_items:\n",
"return []\n",
"attrib = dict()\n",
"return dirs\n",
"attrib['file-name'] = item.file_name\n",
"attrib['fil... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Return'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"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'"
] |
[
"@classmethod...\n",
"return super(CLASS_0, VAR_0).subsystem_dependencies() + (ClocBinary,)\n"
] | [
"@classmethod...\n",
"return super(CountLinesOfCode, cls).subsystem_dependencies() + (ClocBinary,)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_30():...\n",
"if VAR_3 == 'text':\n",
"print('Input file: %s' % VAR_75)\n",
"VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=with_author_keywords,\n VAR_9=rebuild_cache, VAR_10=only_core_tags, VAR_11=extract_acronym... | [
"def process_lines():...\n",
"if output_mode == 'text':\n",
"print('Input file: %s' % source)\n",
"output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_limit=output_limit, spires=spires, match_mode=\n match_mode, no_cache=no_cache, with_author_keywords=\n with... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Condition",
"For",
"Expr'"
] |
[
"def FUNC_15(self, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def _make_accessor(self, value_type):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.