lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"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_6(VAR_0, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = FUNC_5(VAR_0, VAR_5.number())\n",
"VAR_13, VAR_19 = FUNC_4(VAR_0, VAR_5)\n",
"return VAR_20.seed_games(omitting_players=sitters, players_doubling_up=\n two_gamers)\n"
] | [
"def _seed_games(tournament, the_round):...\n",
"\"\"\"docstring\"\"\"\n",
"seeder = _create_game_seeder(tournament, the_round.number())\n",
"sitters, two_gamers = _sitters_and_two_gamers(tournament, the_round)\n",
"return seeder.seed_games(omitting_players=sitters, players_doubling_up=\n two_gamers)\n"
... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_1):...\n",
"VAR_2 = self.connects()\n",
"VAR_4 = \"INSERT INTO crimes (description) VALUES ('{}');\".format(VAR_1)\n",
"VAR_2.close()\n",
"cursor.execute(VAR_4)\n",
"VAR_2.commit()\n"
] | [
"def add_input(self, data):...\n",
"connection = self.connects()\n",
"query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n",
"connection.close()\n",
"cursor.execute(query)\n",
"connection.commit()\n"
] | [
0,
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"import copy\n",
"from oslo_log import log\n",
"from oslo_serialization import jsonutils\n",
"import requests\n",
"from vmware_nsxlib.tests.unit.v3 import mocks\n",
"from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase\n",
"from vmware_nsxlib.v3 import client\n",
"from vmware_nsxlib.v3 import excep... | [
"import copy\n",
"from oslo_log import log\n",
"from oslo_serialization import jsonutils\n",
"import requests\n",
"from vmware_nsxlib.tests.unit.v3 import mocks\n",
"from vmware_nsxlib.tests.unit.v3 import nsxlib_testcase\n",
"from vmware_nsxlib.v3 import client\n",
"from vmware_nsxlib.v3 import excep... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(self, VAR_1=None, VAR_2=None):...\n",
""
] | [
"def parse(self, headers=None, body=None):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"\"\"\"string\"\"\"\n",
"import sys\n",
"import citest.aws_testing as aws\n",
"import citest.json_contract as jc\n",
"import citest.service_testing as st\n",
"import spinnaker_testing as sk\n",
"import spinnaker_testing.gate as gate\n",
"\"\"\"string\"\"\"\n",
"@classmethod...\n",
"\"\"\"docstring... | [
"\"\"\"\nSmoke test to see if Spinnaker can interoperate with Amazon Web Services.\n\nSee testable_service/integration_test.py and spinnaker_testing/spinnaker.py\nfor more details.\n\nThe smoke test will use ssh to peek at the spinnaker configuration\nto determine the managed project it should verify, and to determ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Expr'",
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_13 = threading.Thread(target=self._periodically_flush_profile_events,\n name='ray_push_profiling_information')\n",
"VAR_13.daemon = True\n",
"VAR_13.start()\n"
] | [
"def start_flush_thread(self):...\n",
"t = threading.Thread(target=self._periodically_flush_profile_events, name=\n 'ray_push_profiling_information')\n",
"t.daemon = True\n",
"t.start()\n"
] | [
0,
6,
6,
6
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(VAR_10):...\n",
"VAR_0 = []\n",
"VAR_28 = 0\n",
"VAR_11 = set()\n",
"for VAR_29 in VAR_5.finditer(VAR_10):\n",
"VAR_0.append(re.escape(VAR_10[VAR_28:VAR_29.start()]))\n",
"VAR_0.append(re.escape(VAR_10[VAR_28:]))\n",
"VAR_51 = VAR_29.group('name')\n",
"VAR_0.append('$')\n",
"if VAR_51 ... | [
"def regex(filepattern):...\n",
"f = []\n",
"last = 0\n",
"wildcards = set()\n",
"for match in _wildcard_regex.finditer(filepattern):\n",
"f.append(re.escape(filepattern[last:match.start()]))\n",
"f.append(re.escape(filepattern[last:]))\n",
"wildcard = match.group('name')\n",
"f.append('$')\n",
"i... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_21(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.parent is not None:\n",
"return self.parent.__acl__\n",
"if self.company_header_backref is not None:\n",
"return self.company_header_backref.__acl__\n",
"if self.company_logo_backref is not None:\n",
"return self.company_logo_backref.__acl... | [
"def get_file_acl(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.parent is not None:\n",
"return self.parent.__acl__\n",
"if self.company_header_backref is not None:\n",
"return self.company_header_backref.__acl__\n",
"if self.company_logo_backref is not None:\n",
"return self.company_logo_backref.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(VAR_6)\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_volume(volume)\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"import sqlalchemy\n",
"from sqlalchemy import text\n",
"from sqlalchemy.orm import sessionmaker, scoped_session\n",
"VAR_0 = sqlalchemy.create_engine(\n 'mysql+pymysql://root:bajtastore@127.0.0.1/mydb')\n",
"VAR_1 = scoped_session(sessionmaker(bind=engine))\n",
"VAR_2 = VAR_1()\n",
"def FUNC_0(VAR_3... | [
"import sqlalchemy\n",
"from sqlalchemy import text\n",
"from sqlalchemy.orm import sessionmaker, scoped_session\n",
"engine = sqlalchemy.create_engine(\n 'mysql+pymysql://root:bajtastore@127.0.0.1/mydb')\n",
"Session = scoped_session(sessionmaker(bind=engine))\n",
"s = Session()\n",
"def select_row_... | [
2,
2,
2,
2,
2,
2,
0,
0,
2,
2,
2
] | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_29(self, VAR_19):...\n",
"self._time += VAR_19\n"
] | [
"def sleep(self, duration):...\n",
"self._time += duration\n"
] | [
0,
0
] | [
"FunctionDef'",
"AugAssign'"
] |
[
"def __init__(self, VAR_0=None):...\n",
"self.depth = 0\n",
"self.name = VAR_0\n",
"self.hosts = []\n",
"self._hosts = None\n",
"self.vars = {}\n",
"self.child_groups = []\n",
"self.parent_groups = []\n",
"self._hosts_cache = None\n",
"self.priority = 1\n"
] | [
"def __init__(self, name=None):...\n",
"self.depth = 0\n",
"self.name = name\n",
"self.hosts = []\n",
"self._hosts = None\n",
"self.vars = {}\n",
"self.child_groups = []\n",
"self.parent_groups = []\n",
"self._hosts_cache = None\n",
"self.priority = 1\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
""
] | [
"@utils.synchronized('3par', external=True)...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_31(VAR_62):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_84 = 0\n",
"while VAR_62[VAR_84].isdigit():\n",
"VAR_84 += 1\n",
"if VAR_84 > 0:\n",
"return int(VAR_62[:VAR_84])\n",
"return 0\n"
] | [
"def _get_value_kw(kw):...\n",
"\"\"\"docstring\"\"\"\n",
"i = 0\n",
"while kw[i].isdigit():\n",
"i += 1\n",
"if i > 0:\n",
"return int(kw[:i])\n",
"return 0\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"AugAssign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_7():...\n",
"VAR_10 = get_executing_test()\n",
"if 'spynner' == VAR_10.browser_type:\n",
"FUNC_8()\n",
"if VAR_10.browser_type in ['chrome', 'remote']:\n",
"FUNC_9()\n"
] | [
"def stop_browser():...\n",
"test = get_executing_test()\n",
"if 'spynner' == test.browser_type:\n",
"stop_spynner_browser()\n",
"if test.browser_type in ['chrome', 'remote']:\n",
"stop_webdriver()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self.set_default_size(800, 500)\n",
"self.create_headerbar()\n",
"self.first_start_screen()\n",
"self.connect('delete-event', self.on_application_quit)\n",
"self.custom_css()\n"
] | [
"def assemble_window(self):...\n",
"self.set_default_size(800, 500)\n",
"self.create_headerbar()\n",
"self.first_start_screen()\n",
"self.connect('delete-event', self.on_application_quit)\n",
"self.custom_css()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_4):...\n",
"VAR_4.add_subscriber(FUNC_0, NewResponse)\n"
] | [
"def includeme(config):...\n",
"config.add_subscriber(on_GET_request_setup_csrf_cookie, NewResponse)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self.get_zip_url() != 'no_path_found':\n",
"return self.get_zip_url\n",
"return False\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self.get_zip_url() != 'no_path_found':\n",
"return self.get_zip_url\n",
"return False\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"assert self._plasma_store_socket_name is None\n",
"self._plasma_store_socket_name = (self._ray_params.plasma_store_socket_name or\n get_object_store_socket_name())\n",
"self.prepare_socket_file(self._plasma_store_socket_name)\n",
"VAR_14, VAR_15 = n... | [
"def start_plasma_store(self):...\n",
"\"\"\"docstring\"\"\"\n",
"assert self._plasma_store_socket_name is None\n",
"self._plasma_store_socket_name = (self._ray_params.plasma_store_socket_name or\n get_object_store_socket_name())\n",
"self.prepare_socket_file(self._plasma_store_socket_name)\n",
"stdout... | [
0,
0,
0,
0,
0,
0,
6,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assert'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assert'",
"Assign'"
] |
[
"def FUNC_17(VAR_16):...\n",
"VAR_0.info('Login Error for %s' % VAR_5.args['username'][0])\n",
"VAR_0.info('%s' % VAR_16)\n",
"VAR_5.setResponseCode(UNAUTHORIZED)\n",
"return self._render_template(VAR_5, 'Invalid credentials')\n"
] | [
"def render_error(error):...\n",
"log.info('Login Error for %s' % request.args['username'][0])\n",
"log.info('%s' % error)\n",
"request.setResponseCode(UNAUTHORIZED)\n",
"return self._render_template(request, 'Invalid credentials')\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_18(VAR_25):...\n",
"VAR_22[VAR_25] = VAR_20\n",
"VAR_23[VAR_25] = VAR_20\n",
"VAR_20 += 1\n",
"VAR_21.append(VAR_25)\n",
"VAR_24[VAR_25] = True\n",
"for VAR_34 in self.successors[VAR_25]:\n",
"if VAR_22[VAR_34] == None:\n",
"VAR_46 = set()\n",
"FUNC_18(VAR_34)\n",
"if VAR_24[VAR_34]:\n... | [
"def strong_connect(v):...\n",
"indices[v] = index\n",
"lowlink[v] = index\n",
"index += 1\n",
"S.append(v)\n",
"onstack[v] = True\n",
"for w in self.successors[v]:\n",
"if indices[w] == None:\n",
"component = set()\n",
"strong_connect(w)\n",
"if onstack[w]:\n",
"if lowlink[v] == indices[v]:\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"AugAssign'",
"Expr'",
"Assign'",
"For",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Condition"
] |
[
"def FUNC_15(self):...\n",
"VAR_4 = 'hubba-bubba'\n",
"VAR_13 = self.app.config['TOKEN_LOGIN_SHARED_KEY']\n",
"VAR_14 = '{:x}'.format(int(time.time()))\n",
"VAR_15 = os.urandom(16).encode('hex')\n",
"VAR_16 = sha256('{0}|{1}|{2}|{3}'.format(VAR_13, VAR_4, VAR_15, VAR_14)\n ).hexdigest()\n",
"VAR_17 =... | [
"def test_token_login_old_user(self):...\n",
"eppn = 'hubba-bubba'\n",
"shared_key = self.app.config['TOKEN_LOGIN_SHARED_KEY']\n",
"timestamp = '{:x}'.format(int(time.time()))\n",
"nonce = os.urandom(16).encode('hex')\n",
"token = sha256('{0}|{1}|{2}|{3}'.format(shared_key, eppn, nonce, timestamp)\n ).... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_19(self, VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_58 = self.getfile(VAR_21)\n",
"if VAR_58 != False:\n",
"self.mkdir(VAR_21, 0, 0, 4096, 16877)\n"
] | [
"def mkdir2(self, path):...\n",
"\"\"\"docstring\"\"\"\n",
"dir = self.getfile(path)\n",
"if dir != False:\n",
"self.mkdir(path, 0, 0, 4096, 16877)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_11(VAR_18):...\n",
"if not VAR_4:\n",
"print('Restarting worker due to change in %s' % VAR_18.src_path)\n",
"log.info('modified %s' % VAR_18.src_path)\n",
"FUNC_13()\n",
"log.exception('Error while restarting worker')\n",
"FUNC_12()\n"
] | [
"def on_modified(event):...\n",
"if not is_background:\n",
"print('Restarting worker due to change in %s' % event.src_path)\n",
"log.info('modified %s' % event.src_path)\n",
"kill_children()\n",
"log.exception('Error while restarting worker')\n",
"run_children()\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_7(VAR_9=None):...\n",
"if VAR_9 is None:\n",
"VAR_9 = sys.exc_info()[0]\n",
"if DEBUG:\n",
"VAR_0.error(VAR_9)\n",
"return VAR_9\n",
"return 'Unexpected error'\n"
] | [
"def error_handle(error=None):...\n",
"if error is None:\n",
"error = sys.exc_info()[0]\n",
"if DEBUG:\n",
"logger.error(error)\n",
"return error\n",
"return 'Unexpected error'\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_0(self, VAR_20):...\n",
"\"\"\"docstring\"\"\"\n",
"for VAR_21, directories, filenames in os.walk(VAR_20):\n",
"for VAR_32 in filenames:\n",
"VAR_72 = os.path.join(VAR_21, VAR_32)\n",
"VAR_73 = '/' + os.path.relpath(VAR_72, VAR_20)\n",
"VAR_24 = self.getfile(VAR_73, VAR_23=False)\n",
"if VAR... | [
"def init_honeyfs(self, honeyfs_path):...\n",
"\"\"\"docstring\"\"\"\n",
"for path, directories, filenames in os.walk(honeyfs_path):\n",
"for filename in filenames:\n",
"realfile_path = os.path.join(path, filename)\n",
"virtual_path = '/' + os.path.relpath(realfile_path, honeyfs_path)\n",
"f = self.getf... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"For",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_2(VAR_2, VAR_7, VAR_0):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def sqli_union_lab_3(null, index, url):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_1(self):...\n",
"VAR_6 = cgi.escape(self.request.get('query'))\n",
"VAR_1 = db.GqlQuery(\n 'SELECT * FROM Item WHERE title = :1 ORDER BY created_at DESC', VAR_6)\n",
"database.render_template(self, 'items/search.html', {'items': VAR_1,\n 'query': VAR_6})\n"
] | [
"def post(self):...\n",
"query = cgi.escape(self.request.get('query'))\n",
"items = db.GqlQuery(\n 'SELECT * FROM Item WHERE title = :1 ORDER BY created_at DESC', query)\n",
"database.render_template(self, 'items/search.html', {'items': items,\n 'query': query})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@auth.route('/login/auth')...\n",
"if g.user.is_authenticated:\n",
"return redirect(url_for('gallery.show_posts'))\n",
"VAR_0 = url_for('auth.oauthorize_callback', VAR_5=request.args.get('next'))\n",
"return twitter.authorize(callback=callback_url or request.referrer or None)\n"
] | [
"@auth.route('/login/auth')...\n",
"if g.user.is_authenticated:\n",
"return redirect(url_for('gallery.show_posts'))\n",
"callback_url = url_for('auth.oauthorize_callback', next=request.args.get(\n 'next'))\n",
"return twitter.authorize(callback=callback_url or request.referrer or None)\n"
] | [
0,
0,
6,
0,
6
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"self.user.is_active = False\n",
"self.user.save()\n",
"VAR_1 = VAR_0.copy()\n",
"VAR_1['SHIB_eppn'] = self.user.username.encode('utf-8')\n",
"VAR_2 = self._get(VAR_1)\n",
"self.assertEqual(VAR_2.status_code, 403)\n",
"self.assertEqual(User.objects.count(), 1)\n"
] | [
"def test_inactive(self):...\n",
"self.user.is_active = False\n",
"self.user.save()\n",
"meta = DEF_SHIBD_META.copy()\n",
"meta['SHIB_eppn'] = self.user.username.encode('utf-8')\n",
"response = self._get(meta)\n",
"self.assertEqual(response.status_code, 403)\n",
"self.assertEqual(User.objects.count(),... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._redis_address\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._redis_address\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_10(self, VAR_6):...\n",
"settings.APP_DEEPLINK_DOMAIN = VAR_6\n",
"return self\n"
] | [
"def given_a_deep_link_domain(self, deep_link_domain):...\n",
"settings.APP_DEEPLINK_DOMAIN = deep_link_domain\n",
"return self\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_23(self, VAR_16, VAR_22):...\n",
"\"\"\"docstring\"\"\"\n",
"self._eql_execute('volume', 'select', VAR_16['name'], 'size', '%sG' % VAR_22)\n",
"VAR_0.error(_(\n 'Failed to extend_volume %(name)s from %(current_size)sGB to %(new_size)sGB'\n ), {'name': VAR_16['name'], 'current_size': VAR_16['si... | [
"def extend_volume(self, volume, new_size):...\n",
"\"\"\"docstring\"\"\"\n",
"self._eql_execute('volume', 'select', volume['name'], 'size', '%sG' % new_size)\n",
"LOG.error(_(\n 'Failed to extend_volume %(name)s from %(current_size)sGB to %(new_size)sGB'\n ), {'name': volume['name'], 'current_size': vo... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"def FUNC_31(self, *VAR_79, **VAR_80):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.log = VAR_79, VAR_80\n",
"return VAR_101\n"
] | [
"def log(self, *logs, **kwlogs):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.log = logs, kwlogs\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"self.run_test_case(self.scenario.create_server_group(), timeout_ok=True)\n"
] | [
"def test_c_create_server_group(self):...\n",
"self.run_test_case(self.scenario.create_server_group(), timeout_ok=True)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(VAR_10, VAR_3):...\n",
"VAR_31 = []\n",
"if VAR_1[VAR_10].last_action_message_ids:\n",
"for message_id in VAR_1[VAR_10].last_action_message_ids:\n",
"return VAR_31\n",
"VAR_31.append(VAR_3.delete_message(VAR_10, message_id))\n",
"VAR_1[VAR_10].last_action_message_ids.remove(message_id)\n"
] | [
"def remove_messages(telegram_id, bot):...\n",
"result = []\n",
"if explorers[telegram_id].last_action_message_ids:\n",
"for message_id in explorers[telegram_id].last_action_message_ids:\n",
"return result\n",
"result.append(bot.delete_message(telegram_id, message_id))\n",
"explorers[telegram_id].last_a... | [
0,
0,
4,
4,
0,
0,
4
] | [
"FunctionDef'",
"Assign'",
"Condition",
"For",
"Return'",
"Expr'",
"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'"
] |
[
"def FUNC_9(self, VAR_13):...\n",
"if not VAR_13:\n"
] | [
"def p_error(self, p):...\n",
"if not p:\n"
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_13(VAR_20, VAR_21):...\n",
"VAR_16 = {}\n",
"VAR_17 = [('manager', VAR_21)]\n",
"VAR_47 = FUNC_14(VAR_20)\n",
"FUNC_8('dataset/%d/managers/add' % VAR_47, VAR_17=files, VAR_16=args)\n"
] | [
"def add_manager(task_id, manager):...\n",
"args = {}\n",
"files = [('manager', manager)]\n",
"dataset_id = get_task_active_dataset_id(task_id)\n",
"admin_req('dataset/%d/managers/add' % dataset_id, files=files, args=args)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.lasttok == 'EXC':\n",
"print(VAR_3)\n",
"VAR_3.value = VAR_3.value.strip()\n",
"VAR_21 = VAR_3.value.upper()\n",
"if VAR_21 in self.reserved:\n",
"VAR_3.type = VAR_21\n",
"if self.lasttok == 'WITH':\n",
"self.lasttok = VAR_3.type... | [
"def t_ID(self, tok):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.lasttok == 'EXC':\n",
"print(tok)\n",
"tok.value = tok.value.strip()\n",
"val = tok.value.upper()\n",
"if val in self.reserved:\n",
"tok.type = val\n",
"if self.lasttok == 'WITH':\n",
"self.lasttok = tok.type\n",
"tok.type = 'EXC'\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_7(self, VAR_17=None):...\n",
"if not VAR_17:\n",
"VAR_17 = self._error\n",
"if VAR_17:\n",
"VAR_101.errors.add(VAR_17)\n"
] | [
"def error(self, e=None):...\n",
"if not e:\n",
"e = self._error\n",
"if e:\n",
"c.errors.add(e)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_11(self, VAR_25=None, **VAR_18):...\n",
"return CLASS_2.MockNSXClusteredAPI(VAR_25=session_response, **kwargs)\n"
] | [
"def mock_nsx_clustered_api(self, session_response=None, **kwargs):...\n",
"return NsxClientTestCase.MockNSXClusteredAPI(session_response=\n session_response, **kwargs)\n"
] | [
0,
5
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_27 = request.script_root + request.path\n",
"return flask.redirect(self.login_redirect_url(VAR_12=self_page))\n"
] | [
"def log_in(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self_page = request.script_root + request.path\n",
"return flask.redirect(self.login_redirect_url(return_to=self_page))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_0, VAR_4):...\n",
"VAR_42 = True\n",
"if isinstance(VAR_4, list):\n",
"for VAR_72 in VAR_4:\n",
"return VAR_42\n",
"if VAR_0 not in VAR_72:\n",
"VAR_42 = False\n",
"if 'Between' in VAR_72:\n",
"VAR_72[3] = FUNC_3(VAR_72[3])\n"
] | [
"def is_parent_only_filter(doctype, filters):...\n",
"only_parent_doctype = True\n",
"if isinstance(filters, list):\n",
"for flt in filters:\n",
"return only_parent_doctype\n",
"if doctype not in flt:\n",
"only_parent_doctype = False\n",
"if 'Between' in flt:\n",
"flt[3] = get_between_date_filter(fl... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"For",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_18(self):...\n",
"self.run_test_case(self.scenario.deregister_load_balancer_instances())\n"
] | [
"def test_w_deregister_load_balancer_instances(self):...\n",
"self.run_test_case(self.scenario.deregister_load_balancer_instances())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
"def __repr__(self):...\n",
"return self.rule.name\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_32(self):...\n",
"VAR_33 = VAR_5.search(self.file)\n",
"if VAR_33:\n",
"return self.file[:VAR_33.start()]\n",
"return self.file\n"
] | [
"def constant_prefix(self):...\n",
"first_wildcard = _wildcard_regex.search(self.file)\n",
"if first_wildcard:\n",
"return self.file[:first_wildcard.start()]\n",
"return self.file\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"\"\"\"\nDatabase helper class.\n\"\"\"\n",
"import pymysql\n",
"import dbconfig\n",
"def FUNC_0(self, VAR_0='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
"\"\"\"\nDatabase helper class.\n\"\"\"\n",
"import pymysql\n",
"import dbconfig\n",
"def connect(self, database='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_28(VAR_24):...\n",
"VAR_33.append(VAR_24)\n",
"return 23\n"
] | [
"def exec_python(args):...\n",
"calls.append(args)\n",
"return 23\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_48(self, VAR_22, VAR_6=None):...\n",
"if VAR_6:\n",
"VAR_5 = VAR_5 = self.session.query(self.obj)\n",
"return self.session.query(self.obj).get(VAR_22)\n",
"VAR_35 = VAR_6.copy()\n",
"VAR_35.add_filter(self.get_pk_name(), self.FilterEqual, VAR_22)\n",
"VAR_5 = self._get_base_query(VAR_5=query, ... | [
"def get(self, id, filters=None):...\n",
"if filters:\n",
"query = query = self.session.query(self.obj)\n",
"return self.session.query(self.obj).get(id)\n",
"_filters = filters.copy()\n",
"_filters.add_filter(self.get_pk_name(), self.FilterEqual, id)\n",
"query = self._get_base_query(query=query, filter... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = logging.getLogger(__name__)\n",
"VAR_33 = self.gce_observer\n",
"VAR_34 = self.bindings.get('GCE_SERVICE_ACCOUNT', None)\n",
"VAR_35 = ['--account', VAR_34] if VAR_34 else []\n",
"VAR_32.debug('Looking up available images.')\n",
"VAR_36 =... | [
"def list_available_images(self):...\n",
"\"\"\"docstring\"\"\"\n",
"logger = logging.getLogger(__name__)\n",
"gcloud_agent = self.gce_observer\n",
"service_account = self.bindings.get('GCE_SERVICE_ACCOUNT', None)\n",
"extra_args = ['--account', service_account] if service_account else []\n",
"logger.de... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"@api.public...\n",
""
] | [
"@api.public...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_0(self):...\n",
"VAR_7 = super().get_context_data()\n",
"VAR_7['life_conditions'] = LifeCondition.objects.with_benefits()\n",
"return VAR_7\n"
] | [
"def get_context_data(self):...\n",
"data = super().get_context_data()\n",
"data['life_conditions'] = LifeCondition.objects.with_benefits()\n",
"return data\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self, VAR_17, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def remove_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def __init__(self, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"self.comp_name = VAR_2\n"
] | [
"def __init__(self, comp_name):...\n",
"\"\"\"docstring\"\"\"\n",
"self.comp_name = comp_name\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_34(self, VAR_14):...\n",
"return self.list_properties[VAR_14].mapper.class_\n"
] | [
"def get_related_model(self, col_name):...\n",
"return self.list_properties[col_name].mapper.class_\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"import psycopg2\n",
"import bleach\n",
"def FUNC_0():...\n",
"\"\"\"docstring\"\"\"\n",
"return psycopg2.connect('dbname=tournament')\n"
] | [
"import psycopg2\n",
"import bleach\n",
"def connect():...\n",
"\"\"\"docstring\"\"\"\n",
"return psycopg2.connect('dbname=tournament')\n"
] | [
0,
4,
0,
0,
0
] | [
"Import'",
"Import'",
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"db.session.delete(self)\n",
"db.session.commit()\n"
] | [
"def delete(self):...\n",
"\"\"\"docstring\"\"\"\n",
"db.session.delete(self)\n",
"db.session.commit()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_22 = CLASS_1.get_user_by_username(VAR_4)\n",
"VAR_38 = OSMService.get_osm_details_for_user(VAR_22.id)\n",
"return VAR_38\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"user = UserService.get_user_by_username(username)\n",
"osm_dto = OSMService.get_osm_details_for_user(user.id)\n",
"return osm_dto\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self, VAR_18, VAR_19):...\n",
"if self.shouldLog:\n",
"if self.logger.verbosity > 0:\n",
"VAR_28 = self.session.get(VAR_18)\n",
"self.logger.debug('Requesting %s ...', VAR_18)\n",
"if self.shouldLog:\n",
"if VAR_28.status_code >= 400:\n",
"VAR_29 = re.search(VAR_19, VAR_28.text)\n",
"sel... | [
"def detectCodeExec(self, url, regex):...\n",
"if self.shouldLog:\n",
"if self.logger.verbosity > 0:\n",
"r = self.session.get(url)\n",
"self.logger.debug('Requesting %s ...', url)\n",
"if self.shouldLog:\n",
"if r.status_code >= 400:\n",
"res = re.search(regex, r.text)\n",
"self.logger.warning('Cod... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"AugAssign'",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"self._mox.UnsetStubs()\n"
] | [
"def tearDown(self):...\n",
"self._mox.UnsetStubs()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_13(self, VAR_11, VAR_12, VAR_13, VAR_14):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_31 = 'createhost -iscsi -persona %s -domain %s %s %s' % (VAR_14, VAR_13,\n VAR_11, VAR_12)\n",
"VAR_32 = self.common._cli_run(VAR_31, None)\n",
"if VAR_32 and len(VAR_32) > 1:\n",
"return self.common.parse_create... | [
"def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):...\n",
"\"\"\"docstring\"\"\"\n",
"cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % (persona_id,\n domain, hostname, iscsi_iqn)\n",
"out = self.common._cli_run(cmd, None)\n",
"if out and len(out) > 1:\n",
"return self.... | [
0,
0,
2,
2,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_13(self, VAR_13):...\n",
"if VAR_13:\n",
"self._update_backend_status()\n",
"return self.device_stats\n"
] | [
"def get_volume_stats(self, refresh):...\n",
"if refresh:\n",
"self._update_backend_status()\n",
"return self.device_stats\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"def FUNC_13(VAR_16, VAR_7=None, VAR_8=None):...\n",
"if VAR_7:\n",
"return CLASS_2.objects.get_or_create(VAR_16=parent, VAR_7=child_branch)\n",
"if VAR_8:\n",
"return CLASS_2.objects.get_or_create(VAR_16=parent, VAR_8=child_leaf)\n",
"return AttributeError('child branch OR child leaf params must be set')... | [
"def get_or_create_group_element_year(parent, child_branch=None, child_leaf=None...\n",
"if child_branch:\n",
"return GroupElementYear.objects.get_or_create(parent=parent, child_branch=\n child_branch)\n",
"if child_leaf:\n",
"return GroupElementYear.objects.get_or_create(parent=parent, child_leaf=\n ... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = self.bindings['TEST_AWS_REGION']\n",
"VAR_9 = self.agent.type_to_payload('deleteAmazonLoadBalancerDescription', {\n 'credentials': self.bindings['AWS_CREDENTIALS'], 'regions': [VAR_5],\n 'loadBalancerName': self.__use_lb_name})\n",
"VAR_10 ... | [
"def delete_load_balancer(self):...\n",
"\"\"\"docstring\"\"\"\n",
"region = self.bindings['TEST_AWS_REGION']\n",
"payload = self.agent.type_to_payload('deleteAmazonLoadBalancerDescription',\n {'credentials': self.bindings['AWS_CREDENTIALS'], 'regions': [region],\n 'loadBalancerName': self.__use_lb_name... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_29(VAR_34):...\n",
"self.assertEqual(logging.WARNING, VAR_34)\n"
] | [
"def check(x):...\n",
"self.assertEqual(logging.WARNING, x)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_33):...\n",
"VAR_33 = CLASS_17.run(self, VAR_33)\n",
"if VAR_33 == None:\n",
"return ''\n",
"return VAR_33\n"
] | [
"def run(self, val):...\n",
"val = VLength.run(self, val)\n",
"if val == None:\n",
"return ''\n",
"return val\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_20(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_34 = []\n",
"for value in self.iscsi_ips.values():\n",
"VAR_34.append(value['nsp'])\n",
"return VAR_34\n"
] | [
"def _get_iscsi_nsps(self):...\n",
"\"\"\"docstring\"\"\"\n",
"nsps = []\n",
"for value in self.iscsi_ips.values():\n",
"nsps.append(value['nsp'])\n",
"return nsps\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Return'"
] |
[
"@staticmethod...\n",
"return FUNC_1(CLASS_0._TalkToHandlerAsync('', VAR_7, 'GET', VAR_10))\n"
] | [
"@staticmethod...\n",
"return JsonFromFuture(BaseRequest._TalkToHandlerAsync('', handler, 'GET',\n timeout))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self):...\n",
""
] | [
"def emptyline(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"from django.urls import resolve\n",
"from django.test import TestCase\n",
"from django.http import HttpRequest\n",
"from lxml import html\n",
"from dashboard import views\n",
"from dashboard.models import *\n",
"from dashboard.forms import create_detail_formset\n",
"from dashboard.tests.loader import... | [
"from django.urls import resolve\n",
"from django.test import TestCase\n",
"from django.http import HttpRequest\n",
"from lxml import html\n",
"from dashboard import views\n",
"from dashboard.models import *\n",
"from dashboard.forms import create_detail_formset\n",
"from dashboard.tests.loader import... | [
0,
0,
6,
6,
0,
6,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Assign'",
"FunctionDef'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",... |
[
"def __del__(self):...\n",
"if CLASS_0.con is not None:\n",
"CLASS_0.con.close()\n",
"VAR_0.info('################## Database connection closed.')\n"
] | [
"def __del__(self):...\n",
"if DBConnection.con is not None:\n",
"DBConnection.con.close()\n",
"logger.info('################## Database connection closed.')\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_2, VAR_3, VAR_4, VAR_7={}):...\n",
"self.write(VAR_2, VAR_3, VAR_4, {'state': 'done'}, VAR_7=context)\n",
"return True\n"
] | [
"def set_done(self, cr, uid, ids, context={}):...\n",
"self.write(cr, uid, ids, {'state': 'done'}, context=context)\n",
"return True\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_7(VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_10 is None:\n",
"return 0\n",
"VAR_8 = VAR_10.get('userInfo', None)\n",
"if VAR_8 is None:\n",
"return 1\n",
"VAR_7 = VAR_8.get('fbid', None)\n",
"if VAR_7 is None:\n",
"return 2\n",
"if type(VAR_7) == 'int':\n",
"return 3\n",
"r... | [
"def verify_proper_post_request(req_data):...\n",
"\"\"\"docstring\"\"\"\n",
"if req_data is None:\n",
"return 0\n",
"user_info = req_data.get('userInfo', None)\n",
"if user_info is None:\n",
"return 1\n",
"fbid = user_info.get('fbid', None)\n",
"if fbid is None:\n",
"return 2\n",
"if type(fbid)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_7, VAR_54=None, VAR_55=None, VAR_14=errors....\n",
"self.min = VAR_54\n",
"self.max = VAR_55\n",
"self.error = VAR_14\n",
"CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n"
] | [
"def __init__(self, param, min=None, max=None, error=errors.BAD_NUMBER, *a, **kw...\n",
"self.min = min\n",
"self.max = max\n",
"self.error = error\n",
"Validator.__init__(self, param, *a, **kw)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_0: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = shlex.split(VAR_0)\n",
"VAR_7 = subprocess.check_output(VAR_6).decode('utf-8').split('\\n')\n",
"for VAR_10, line in enumerate(VAR_7):\n",
"if '*' in line:\n",
"return '\\n'.join(VAR_7)\n",
"VAR_7[VAR_10] = f'\\x1b[93m{line}\\x1... | [
"def shell(command: str) ->str:...\n",
"\"\"\"docstring\"\"\"\n",
"cmd = shlex.split(command)\n",
"output_lines = subprocess.check_output(cmd).decode('utf-8').split('\\n')\n",
"for index, line in enumerate(output_lines):\n",
"if '*' in line:\n",
"return '\\n'.join(output_lines)\n",
"output_lines[index... | [
0,
0,
2,
2,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'"
] |
[
"def FUNC_6(self, VAR_3):...\n",
"return self.value_from_object(VAR_3)\n"
] | [
"def value_to_string(self, obj):...\n",
"return self.value_from_object(obj)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_10(self):...\n",
"VAR_36 = db.log_event('Warning', 'Debugger', 'Reset BDI', success=False)\n",
"self.telnet.write(bytes('boot\\r\\n', encoding='utf-8'))\n",
"self.telnet.close()\n",
"if self.db.result:\n",
"self.db.result['debugger_output'] += 'boot\\n'\n",
"self.db.campaign['debugger_output']... | [
"def reset_bdi(self):...\n",
"event = db.log_event('Warning', 'Debugger', 'Reset BDI', success=False)\n",
"self.telnet.write(bytes('boot\\r\\n', encoding='utf-8'))\n",
"self.telnet.close()\n",
"if self.db.result:\n",
"self.db.result['debugger_output'] += 'boot\\n'\n",
"self.db.campaign['debugger_output'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"AugAssign'",
"AugAssign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@app.route('/')...\n",
"VAR_6 = Politician.all()\n",
"VAR_6.order('-search_count')\n",
"VAR_7 = []\n",
"VAR_8 = 0\n",
"for VAR_2 in VAR_6:\n",
"VAR_7.append(VAR_2)\n",
"return render_template('home.html', VAR_7=politicians)\n",
"VAR_8 = VAR_8 + 1\n",
"if VAR_8 == 8:\n"
] | [
"@app.route('/')...\n",
"q = Politician.all()\n",
"q.order('-search_count')\n",
"politicians = []\n",
"count = 0\n",
"for politician in q:\n",
"politicians.append(politician)\n",
"return render_template('home.html', politicians=politicians)\n",
"count = count + 1\n",
"if count == 8:\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Return'",
"Assign'",
"Condition"
] |
[
"import json\n",
"import logging\n",
"import os\n",
"import shutil\n",
"import sys\n",
"import tempfile\n",
"import threading\n",
"import time\n",
"import unittest\n",
"import zipfile\n",
"import test_env_bot_code\n",
"test_env_bot_code.setup_test_env()\n",
"import net_utils\n",
"import bo... | [
"import json\n",
"import logging\n",
"import os\n",
"import shutil\n",
"import sys\n",
"import tempfile\n",
"import threading\n",
"import time\n",
"import unittest\n",
"import zipfile\n",
"import test_env_bot_code\n",
"test_env_bot_code.setup_test_env()\n",
"import net_utils\n",
"import bo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
5,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Expr'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Imp... |
[
"def FUNC_1(VAR_2, VAR_3, VAR_4=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29, VAR_30 = [], {}\n",
"if not VAR_2:\n",
"return VAR_29\n",
"if VAR_3:\n",
"for VAR_64 in VAR_3:\n",
"for VAR_6 in VAR_2:\n",
"VAR_63 = VAR_3[VAR_64]\n",
"VAR_50 = True\n",
"return VAR_29\n",
"if not isinstance(VAR... | [
"def _filter(data, filters, limit=None):...\n",
"\"\"\"docstring\"\"\"\n",
"out, _filters = [], {}\n",
"if not data:\n",
"return out\n",
"if filters:\n",
"for f in filters:\n",
"for d in data:\n",
"fval = filters[f]\n",
"add = True\n",
"return out\n",
"if not isinstance(fval, (tuple, list)):\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
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Condition",
"For",
"For",
"Assign'",
"Assign'",
"Return'",
"Condition",
"For",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Conditi... |
[
"def FUNC_36(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor = self.cnxn.cursor()\n",
"self.cursor.execute('create table t1(a int, b char(3))')\n",
"self.cnxn.commit()\n",
"self.cursor.execute(\"insert into t1 values(1, 'abc')\")\n",
"VAR_24 = self.cursor.execute('select * from t1').fetchone()\n",... | [
"def test_row_description(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.cursor = self.cnxn.cursor()\n",
"self.cursor.execute('create table t1(a int, b char(3))')\n",
"self.cnxn.commit()\n",
"self.cursor.execute(\"insert into t1 values(1, 'abc')\")\n",
"row = self.cursor.execute('select * from t1').fetc... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"@VAR_0.route('/level-2/<page>')...\n",
"return render_template('level-2/' + VAR_7 + '.html')\n"
] | [
"@app.route('/level-2/<page>')...\n",
"return render_template('level-2/' + page + '.html')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_12(self):...\n",
"self.run_test_case(self.scenario.resize_server_group())\n"
] | [
"def test_c_resize_server_group(self):...\n",
"self.run_test_case(self.scenario.resize_server_group())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@staticmethod...\n",
"return VAR_82\n"
] | [
"@staticmethod...\n",
"return f\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@classmethod...\n",
"if not VAR_17:\n",
"return []\n",
"VAR_40 = VAR_14.search_keyword('\"' + VAR_17 + '\"*', VAR_16=limit)[:]\n",
"VAR_33 = [g.title.lower() for g in VAR_40]\n",
"VAR_34 = set()\n",
"for line in VAR_33:\n",
"if len(VAR_34) >= VAR_18:\n",
"return list(VAR_34)\n",
"VAR_41 = line.fi... | [
"@classmethod...\n",
"if not keyword:\n",
"return []\n",
"result = cls.search_keyword('\"' + keyword + '\"*', lim=limit)[:]\n",
"titles = [g.title.lower() for g in result]\n",
"all_terms = set()\n",
"for line in titles:\n",
"if len(all_terms) >= max_terms:\n",
"return list(all_terms)\n",
"i1 = lin... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_9(*VAR_11):...\n",
"VAR_12 = ' '.join(str(elem) for elem in VAR_11)\n",
"return VAR_12\n"
] | [
"def adb_call(*args):...\n",
"arg_str = ' '.join(str(elem) for elem in args)\n",
"return arg_str\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_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'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_snapshot(VAR_8)\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"self.common.client_login()\n",
"self.common.delete_snapshot(snapshot)\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"self.add_tracker(self.tracker_info)\n"
] | [
"def before_update(self):...\n",
"self.add_tracker(self.tracker_info)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_9(self):...\n",
"VAR_5 = [{'loadBalancerName': self.__lb_name, 'networkLoadBalancerName':\n self.__lb_name, 'region': 'us-central1', 'type': 'deleteLoadBalancer',\n 'regions': ['us-central1'], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'cloudProvider': 'gce', 'user': 'integration-tests... | [
"def delete_load_balancer(self):...\n",
"job = [{'loadBalancerName': self.__lb_name, 'networkLoadBalancerName': self\n .__lb_name, 'region': 'us-central1', 'type': 'deleteLoadBalancer',\n 'regions': ['us-central1'], 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'cloudProvider': 'gce', 'user': 'inte... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"import json\n",
"import jsonschema\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_2 = json.loads(VAR_0)\n",
"print(err)\n",
"jsonschema.validate(VAR_2, VAR_1)\n",
"return {'status': -1, 'message': \"Найдены ошибки в JSON'е\"}\n",
"return VAR_2\n"
] | [
"import json\n",
"import jsonschema\n",
"def json_validate(data_source, schema):...\n",
"data = json.loads(data_source)\n",
"print(err)\n",
"jsonschema.validate(data, schema)\n",
"return {'status': -1, 'message': \"Найдены ошибки в JSON'е\"}\n",
"return data\n"
] | [
0,
0,
0,
0,
0,
0,
4,
0
] | [
"Import'",
"Import'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"VAR_18 = self.common.create_volume_from_snapshot(VAR_6, VAR_8)\n",
"self.common.client_logout()\n",
"return {'metadata': VAR_18}\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"metadata = self.common.create_volume_from_snapshot(volume, snapshot)\n",
"self.common.client_logout()\n",
"return {'metadata': metadata}\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_46(self):...\n",
"self.assertEqual(self.cnxn.autocommit, False)\n",
"VAR_30 = pyodbc.connect(self.connection_string, autocommit=True)\n",
"self.assertEqual(VAR_30.autocommit, True)\n",
"VAR_30.autocommit = False\n",
"self.assertEqual(VAR_30.autocommit, False)\n"
] | [
"def test_autocommit(self):...\n",
"self.assertEqual(self.cnxn.autocommit, False)\n",
"othercnxn = pyodbc.connect(self.connection_string, autocommit=True)\n",
"self.assertEqual(othercnxn.autocommit, True)\n",
"othercnxn.autocommit = False\n",
"self.assertEqual(othercnxn.autocommit, False)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1():...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = 'testing inband sql injection on parameter '\n",
"VAR_3 += \"'%s'\" % kb.injParameter\n",
"logger.info(VAR_3)\n",
"VAR_4 = ''\n",
"VAR_0 = agent.prefixQuery(' UNION ALL SELECT NULL')\n",
"for VAR_1 in (queries[kb.dbms].comment, ''):\n",
"VAR_... | [
"def unionTest():...\n",
"\"\"\"docstring\"\"\"\n",
"logMsg = 'testing inband sql injection on parameter '\n",
"logMsg += \"'%s'\" % kb.injParameter\n",
"logger.info(logMsg)\n",
"value = ''\n",
"query = agent.prefixQuery(' UNION ALL SELECT NULL')\n",
"for comment in (queries[kb.dbms].comment, ''):\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"AugAssign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"AugAssign'",
"AugAssign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self, VAR_25):...\n",
"VAR_77 = []\n",
"if VAR_25:\n",
"VAR_77 = [VAR_3 for VAR_3 in self.comma_sep.split(VAR_25) if VAR_3 ==\n _force_ascii(VAR_3)]\n",
"return VAR_77\n"
] | [
"def run(self, tag_field):...\n",
"tags = []\n",
"if tag_field:\n",
"tags = [x for x in self.comma_sep.split(tag_field) if x == _force_ascii(x)]\n",
"return tags\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_6 = self.client.get('/api/apps')\n",
"VAR_8 = VAR_6.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n",
"VAR_5 = '/api/apps/{}/perms'.format(VAR_8)\n",
"VAR_7 = {'username': 'autotest-2'}\n",
"VAR_6 = self.client.post(... | [
"def test_create_errors(self):...\n",
"response = self.client.get('/api/apps')\n",
"app_id = response.data['results'][0]['id']\n",
"self.assertTrue(self.client.login(username='autotest-2', password='password'))\n",
"url = '/api/apps/{}/perms'.format(app_id)\n",
"body = {'username': 'autotest-2'}\n",
"re... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"return tornado.web.HTTPError\n"
] | [
"@property...\n",
"return tornado.web.HTTPError\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_27(self, VAR_15):...\n",
""
] | [
"def add(self, item):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.