lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = ['-C-source', '-C{}'.format(VAR_11.source_level), '-C-target',\n '-C{}'.format(VAR_11.target_level)]\n",
"if VAR_11.args:\n",
"VAR_69 = VAR_11.args\n",
"return VAR_42\n",
"if any('$JAVA_HOME' in a for a in VAR_11.args):\n",
"VAR_42.extend(V... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"zinc_args = ['-C-source', '-C{}'.format(settings.source_level), '-C-target',\n '-C{}'.format(settings.target_level)]\n",
"if settings.args:\n",
"settings_args = settings.args\n",
"return zinc_args\n",
"if any('$JAVA_HOME' in a for a in settings.args):... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Return'",
"For",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"@defer.inlineCallbacks...\n",
"VAR_9.setHeader('Content-type', 'application/json')\n",
"VAR_17 = VAR_9.getHeader('Origin')\n",
"if VAR_17:\n",
"VAR_9.setHeader('Access-Control-Allow-Origin', VAR_17)\n",
"VAR_9.setHeader('Access-Control-Allow-Origin', '*')\n",
"VAR_9.setHeader('Access-Control-Allow-Cred... | [
"@defer.inlineCallbacks...\n",
"request.setHeader('Content-type', 'application/json')\n",
"origin = request.getHeader('Origin')\n",
"if origin:\n",
"request.setHeader('Access-Control-Allow-Origin', origin)\n",
"request.setHeader('Access-Control-Allow-Origin', '*')\n",
"request.setHeader('Access-Control-... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Condition",
"For",
"FunctionDef'",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Condition"... |
[
"def FUNC_12(VAR_5):...\n",
"if VAR_5 == []:\n",
"return 'true'\n",
"VAR_11 = '('\n",
"for i in range(0, len(VAR_5) - 1):\n",
"VAR_11 += \" maintable.careerarea = '\" + VAR_5[i] + \"' or \"\n",
"VAR_11 += \" maintable.careerarea = '\" + VAR_5[len(VAR_5) - 1] + \"' ) \"\n",
"print('result is ' + VAR_11... | [
"def makeCareerAreas(list):...\n",
"if list == []:\n",
"return 'true'\n",
"result = '('\n",
"for i in range(0, len(list) - 1):\n",
"result += \" maintable.careerarea = '\" + list[i] + \"' or \"\n",
"result += \" maintable.careerarea = '\" + list[len(list) - 1] + \"' ) \"\n",
"print('result is ' + resu... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"For",
"AugAssign'",
"AugAssign'",
"Expr'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not os.path.exists(VAR_4):\n",
"VAR_12, VAR_13 = [], []\n",
"for filename in os.listdir(VAR_4):\n",
"VAR_5 = os.path.join(VAR_4, filename)\n",
"return VAR_12, VAR_13\n",
"if os.path.isdir(VAR_5):\n",
"VAR_12.append((filename, len(os.listdir(VAR_5)... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not os.path.exists(analysis_path):\n",
"dirs, files = [], []\n",
"for filename in os.listdir(analysis_path):\n",
"path = os.path.join(analysis_path, filename)\n",
"return dirs, files\n",
"if os.path.isdir(path):\n",
"dirs.append((filename, len(os.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_15(self, VAR_5, VAR_14):...\n",
"VAR_22 = IPixelatedSession(VAR_5.getSession())\n",
"VAR_22.user_uuid = VAR_14\n"
] | [
"def _init_http_session(self, request, user_id):...\n",
"session = IPixelatedSession(request.getSession())\n",
"session.user_uuid = user_id\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(VAR_0):...\n",
"if not VAR_0:\n",
"return ''\n",
"VAR_1 = VAR_0.split(' ')\n",
"VAR_2 = [(u'\"' + FUNC_0(word) + u'\"*') for word in VAR_1]\n",
"return ' AND '.join(VAR_2)\n"
] | [
"def to_fts_query(text):...\n",
"if not text:\n",
"return ''\n",
"words = text.split(' ')\n",
"query_list = [(u'\"' + sanitize_for_fts(word) + u'\"*') for word in words]\n",
"return ' AND '.join(query_list)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"self.window = VAR_6 = QMainWindow()\n",
"self.layout = QVBoxLayout()\n",
"VAR_6.setWindowTitle('Matisse Controller')\n",
"VAR_6.resize(600, 200)\n"
] | [
"def setup_window(self):...\n",
"self.window = window = QMainWindow()\n",
"self.layout = QVBoxLayout()\n",
"window.setWindowTitle('Matisse Controller')\n",
"window.resize(600, 200)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_10):...\n",
"self.scope = {}\n",
"self.category = VAR_10\n",
"self.cate_str = '_'.join(VAR_10.split(' '))\n",
"self.count = 0\n"
] | [
"def __init__(self, category):...\n",
"self.scope = {}\n",
"self.category = category\n",
"self.cate_str = '_'.join(category.split(' '))\n",
"self.count = 0\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_14():...\n",
"self.logger.info('recursing', VAR_52='5b8498e4-868d-413c-a67e-004516b8452c',\n VAR_56=len(self.pending), have=len(self.have) - len(self.running),\n running=len(self.running))\n"
] | [
"def log():...\n",
"self.logger.info('recursing', uuid='5b8498e4-868d-413c-a67e-004516b8452c',\n pending=len(self.pending), have=len(self.have) - len(self.running),\n running=len(self.running))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@handler('request', priority=0.1)...\n",
"if VAR_9:\n",
"VAR_7.peer_cert = VAR_9\n",
"VAR_18, VAR_0, VAR_16 = self.find_handler(VAR_4)\n",
"if VAR_18 is not None and VAR_0 is not None:\n",
"VAR_7.kwargs = parse_qs(VAR_4.qs)\n",
"process(VAR_4, VAR_7.kwargs)\n",
"if VAR_16:\n",
"VAR_7.args += tuple(... | [
"@handler('request', priority=0.1)...\n",
"if peer_cert:\n",
"event.peer_cert = peer_cert\n",
"name, channel, vpath = self.find_handler(req)\n",
"if name is not None and channel is not None:\n",
"event.kwargs = parse_qs(req.qs)\n",
"process(req, event.kwargs)\n",
"if vpath:\n",
"event.args += tuple(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"AugAssign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_0(VAR_4):...\n",
"return utils.to_str(json.dumps(VAR_4, ensure_ascii=False, cls=LazyEncoder))\n"
] | [
"def jsonify(obj):...\n",
"return utils.to_str(json.dumps(obj, ensure_ascii=False, cls=LazyEncoder))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def __init__(self, VAR_3, VAR_4, VAR_8, VAR_9=None):...\n",
"CLASS_0.__init__(self, VAR_3, VAR_4)\n",
"self.num_search_results_label = VAR_9\n",
"self.details_container = VAR_8\n",
"self.query = None\n",
"VAR_4.selectionModel().selectionChanged.connect(self._on_selection_changed)\n"
] | [
"def __init__(self, model, table_view, details_container,...\n",
"TriblerTableViewController.__init__(self, model, table_view)\n",
"self.num_search_results_label = num_search_results_label\n",
"self.details_container = details_container\n",
"self.query = None\n",
"table_view.selectionModel().selectionChan... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_8 = subprocess.Popen(['nmcli', 'connection', 'delete', 'id', VAR_6],\n stdout=subprocess.PIPE)\n",
"print(VAR_8)\n"
] | [
"def delete_WifiConn(wifiap):...\n",
"\"\"\"docstring\"\"\"\n",
"ps = subprocess.Popen(['nmcli', 'connection', 'delete', 'id', wifiap],\n stdout=subprocess.PIPE)\n",
"print(ps)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"@jwt_required...\n",
"\"\"\"docstring\"\"\"\n",
"return database_utilities.execute_query(\n f'delete from spaces where space_id = %s', (VAR_1,))\n"
] | [
"@jwt_required...\n",
"\"\"\"docstring\"\"\"\n",
"return database_utilities.execute_query(\n f'delete from spaces where space_id = %s', (space_id,))\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@login_required...\n",
"from .forms import UploadForm\n",
"VAR_15 = FUNC_8(VAR_3=candidate_id, VAR_2=request)\n",
"return HttpResponseRedirect(reverse('register'))\n",
"if VAR_15.thesis.is_locked():\n",
"return HttpResponseForbidden('Thesis has already been submitted and is locked.'\n )\n",
"if VAR_... | [
"@login_required...\n",
"from .forms import UploadForm\n",
"candidate = _get_candidate(candidate_id=candidate_id, request=request)\n",
"return HttpResponseRedirect(reverse('register'))\n",
"if candidate.thesis.is_locked():\n",
"return HttpResponseForbidden('Thesis has already been submitted and is locked.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"ImportFrom'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Expr'",
"Return'"
] |
[
"\"\"\"A helper script for wrapping url calls.\"\"\"\n",
"import hashlib\n",
"import httplib\n",
"import logging\n",
"import math\n",
"import os\n",
"import random\n",
"import socket\n",
"import time\n",
"import urllib\n",
"import urllib2\n",
"import urlparse\n",
"from common import swarm_co... | [
"\"\"\"A helper script for wrapping url calls.\"\"\"\n",
"import hashlib\n",
"import httplib\n",
"import logging\n",
"import math\n",
"import os\n",
"import random\n",
"import socket\n",
"import time\n",
"import urllib\n",
"import urllib2\n",
"import urlparse\n",
"from common import swarm_co... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Return'... |
[
"def FUNC_3(self):...\n",
"VAR_2 = self.request.get('lower_bound_commit_position')\n",
"VAR_3 = self.request.get('upper_bound_commit_position')\n",
"VAR_6 = self.request.get('key')\n",
"VAR_4 = self.request.get('iterations_to_rerun')\n",
"if not FUNC_1(VAR_2, VAR_3, VAR_4):\n",
"return {'template': 'err... | [
"def HandlePost(self):...\n",
"lower_bound_commit_position = self.request.get('lower_bound_commit_position')\n",
"upper_bound_commit_position = self.request.get('upper_bound_commit_position')\n",
"urlsafe_analysis_key = self.request.get('key')\n",
"iterations_to_rerun = self.request.get('iterations_to_rerun... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"c.get(url_for('oauthclient.login', remote_app='test'))\n",
"self.mock_response(VAR_5='test')\n",
"self.mock_response(VAR_5='test_invalid')\n",
"VAR_1 = c.get(url_for('oauthclient.authorized', remote_app='test', code='test')\n )\n",
"assert VAR_1.data == 'TEST'\n",
"assert s... | [
"def test_authorized(self):...\n",
"c.get(url_for('oauthclient.login', remote_app='test'))\n",
"self.mock_response(app='test')\n",
"self.mock_response(app='test_invalid')\n",
"resp = c.get(url_for('oauthclient.authorized', remote_app='test', code='test'))\n",
"assert resp.data == 'TEST'\n",
"assert self... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Assign'"
] |
[
"def FUNC_16(self):...\n",
"self.mock(bot_main, 'post_error_task', lambda *VAR_24: self.fail(VAR_24))\n",
"def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n",
"if VAR_23 == 'on_after_task':\n",
"VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n",
"self.mock(bot_main, 'call_hook', FUNC_24)\n",
"self.assertEqual(True, VA... | [
"def test_run_manifest_task_failure(self):...\n",
"self.mock(bot_main, 'post_error_task', lambda *args: self.fail(args))\n",
"def call_hook(_botobj, name, *args):...\n",
"if name == 'on_after_task':\n",
"failure, internal_failure, dimensions, summary = args\n",
"self.mock(bot_main, 'call_hook', call_hook)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.sql_session.close()\n"
] | [
"def on_finish(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.sql_session.close()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"def __hash__(self):...\n",
"return self._hash\n"
] | [
"def __hash__(self):...\n",
"return self._hash\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(VAR_7, VAR_10['host'], VAR_10['initiator'])\n",
"self.common.client_logout()\n"
] | [
"@utils.synchronized('3par', external=True)...\n",
"\"\"\"docstring\"\"\"\n",
"self.common.client_login()\n",
"self.common.terminate_connection(volume, connector['host'], connector[\n 'initiator'])\n",
"self.common.client_logout()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"if VAR_4 == TaskStatus.MAPPED:\n",
"VAR_6.tasks_mapped += 1\n",
"if VAR_4 == TaskStatus.VALIDATED:\n",
"if VAR_5 == 'change':\n",
"VAR_6.tasks_validated += 1\n",
"if VAR_4 == TaskStatus.BADIMAGERY:\n",
"if VAR_4 == TaskStatus.MAPPED:\n",
"if VAR_3 == TaskStatus.MAPPED:\n",
"... | [
"@staticmethod...\n",
"if new_state == TaskStatus.MAPPED:\n",
"project.tasks_mapped += 1\n",
"if new_state == TaskStatus.VALIDATED:\n",
"if action == 'change':\n",
"project.tasks_validated += 1\n",
"if new_state == TaskStatus.BADIMAGERY:\n",
"if new_state == TaskStatus.MAPPED:\n",
"if last_state == ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"Condition",
"AugAssign'",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"AugAssign'",
"Condition",
"AugAssign'",
"Conditi... |
[
"def FUNC_23(self):...\n",
"if self.limit_page_length:\n",
"return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n",
"return ''\n"
] | [
"def add_limit(self):...\n",
"if self.limit_page_length:\n",
"return 'limit %s, %s' % (self.limit_start, self.limit_page_length)\n",
"return ''\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_42(self):...\n",
"VAR_32 = list()\n",
"for VAR_14 in self.get_columns_list():\n",
"if not self.is_relation(VAR_14):\n",
"return VAR_32\n",
"VAR_38 = self.get_property_first_col(VAR_14).name\n",
"VAR_32.append(VAR_14)\n",
"if not self.is_pk(VAR_38) and not self.is_fk(VAR_38) and not self.is_i... | [
"def get_search_columns_list(self):...\n",
"ret_lst = list()\n",
"for col_name in self.get_columns_list():\n",
"if not self.is_relation(col_name):\n",
"return ret_lst\n",
"tmp_prop = self.get_property_first_col(col_name).name\n",
"ret_lst.append(col_name)\n",
"if not self.is_pk(tmp_prop) and not self.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_13(self):...\n",
"self.run_test_case(self.scenario.clone_server_group(), max_retries=5)\n"
] | [
"def test_d_clone_server_group(self):...\n",
"self.run_test_case(self.scenario.clone_server_group(), max_retries=5)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@template_utility...\n",
"return Markup('<input type=\"hidden\" name=\"_xsrf\" value=\"{}\"/>'.format(\n xhtml_escape(FUNC_2())))\n"
] | [
"@template_utility...\n",
"return Markup('<input type=\"hidden\" name=\"_xsrf\" value=\"{}\"/>'.format(\n xhtml_escape(xsrf_token())))\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_16(self, VAR_18):...\n",
"if not FUNC_3(self):\n",
"return None\n",
"print('RunScriptWebSocket: Received message ', VAR_18)\n",
"VAR_36 = json.loads(VAR_18)\n",
"VAR_37 = VAR_36['command']\n",
"print('RunScriptWebSocket: Command ', VAR_37)\n",
"if VAR_37 == 'runScript':\n",
"if VAR_11 and ... | [
"def on_message(self, message):...\n",
"if not login_get_current_user(self):\n",
"return None\n",
"print('RunScriptWebSocket: Received message ', message)\n",
"parsedMessage = json.loads(message)\n",
"command = parsedMessage['command']\n",
"print('RunScriptWebSocket: Command ', command)\n",
"if comman... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_30):...\n",
"VAR_38 = self.to_dict()\n",
"for comp in ['title', 'size', 'tags', 'torrent_date', 'tracker_info']:\n",
"if comp not in VAR_30 or str(VAR_38[comp]) == str(VAR_30[comp]):\n",
"return False\n",
"return True\n"
] | [
"def metadata_conflicting(self, b):...\n",
"a = self.to_dict()\n",
"for comp in ['title', 'size', 'tags', 'torrent_date', 'tracker_info']:\n",
"if comp not in b or str(a[comp]) == str(b[comp]):\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_44(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'LOW': 1, 'MEDIUM': 2}, 'CONFIDENCE': {'MEDIUM': 3}}\n",
"self.check_example('secret-config-option.py', VAR_2)\n"
] | [
"def test_secret_config_option(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'LOW': 1, 'MEDIUM': 2}, 'CONFIDENCE': {'MEDIUM': 3}}\n",
"self.check_example('secret-config-option.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_1, VAR_2, VAR_3='text', VAR_4=bconfig....\n",
"\"\"\"docstring\"\"\"\n",
"def FUNC_30():...\n",
"if VAR_3 == 'text':\n",
"print('Input file: %s' % VAR_75)\n",
"VAR_52 = FUNC_2(VAR_15, VAR_2, VAR_3=output_mode, VAR_4=output_limit, VAR_5\n =spires, VAR_6=match_mode, VAR_7=no_cache, VAR_8=... | [
"def output_keywords_for_sources(input_sources, taxonomy_name, output_mode=...\n",
"\"\"\"docstring\"\"\"\n",
"def process_lines():...\n",
"if output_mode == 'text':\n",
"print('Input file: %s' % source)\n",
"output = get_keywords_from_text(text_lines, taxonomy_name, output_mode=\n output_mode, output_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
7,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Condition",
"For",
"For",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",... |
[
"@mock.patch('requests.post', FUNC_0)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = self.test_release()\n",
"VAR_15 = Release.objects.get(uuid=release3['uuid'])\n",
"self.assertIn('autotest deployed ', VAR_15.summary)\n"
] | [
"@mock.patch('requests.post', mock_import_repository_task)...\n",
"\"\"\"docstring\"\"\"\n",
"release3 = self.test_release()\n",
"release = Release.objects.get(uuid=release3['uuid'])\n",
"self.assertIn('autotest deployed ', release.summary)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_44(self):...\n",
"return self._names\n"
] | [
"def keys(self):...\n",
"return self._names\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@property...\n",
"return 'null'\n"
] | [
"@property...\n",
"return 'null'\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"if self.request.GET.get('env_group_id'):\n",
"return EnvGroup.objects.get(id=self.request.GET['env_group_id']).property.all()\n",
"return EnvProperty.objects.all()\n"
] | [
"def env_properties(self):...\n",
"if self.request.GET.get('env_group_id'):\n",
"return EnvGroup.objects.get(id=self.request.GET['env_group_id']).property.all()\n",
"return EnvProperty.objects.all()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def __setstate__(self, VAR_1):...\n",
"return self.deserialize(VAR_1)\n"
] | [
"def __setstate__(self, data):...\n",
"return self.deserialize(data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6():...\n",
"if not request.method in VAR_0:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"VAR_7 = urlparse(request.environ.get('HTTP_... | [
"def check():...\n",
"if not request.method in methods:\n",
"return True\n",
"if not request.environ.get('AUTH_TYPE') == 'cookie':\n",
"return True\n",
"if config.get('skip_authentication'):\n",
"return True\n",
"if request.environ.get('HTTP_REFERER'):\n",
"ref_url = urlparse(request.environ.get('HT... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Condition",
"AugAssign'",
"Condition",
"Condition",
"Return'"
] |
[
"def FUNC_4(self, VAR_22):...\n",
"VAR_76 = CLASS_14(VAR_22)\n",
"if VAR_76.day is None:\n",
"return 'Today is {weekdayname} in the YOLD {yold:04d}'.format(VAR_31=ddt.\n weekdayname, VAR_27=ddt.yold)\n",
"return 'Today is {weekdayname}, the {card} day of {seasonname} in the YOLD {yold}'.format(\n VAR_... | [
"def _format_date(self, dt):...\n",
"ddt = DiscordianDateTime(dt)\n",
"if ddt.day is None:\n",
"return 'Today is {weekdayname} in the YOLD {yold:04d}'.format(weekdayname=\n ddt.weekdayname, yold=ddt.yold)\n",
"return 'Today is {weekdayname}, the {card} day of {seasonname} in the YOLD {yold}'.format(\n ... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_15(self, VAR_7, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_25 = None\n",
"VAR_11 = self.common._safe_hostname(VAR_10['host'])\n",
"VAR_33 = self.common.get_cpg(VAR_7, allowSnap=True)\n",
"VAR_13 = self.common.get_domain(VAR_33)\n",
"VAR_25 = self.common._get_3par_host(VAR_11)\n",
"VAR_1... | [
"def _create_host(self, volume, connector):...\n",
"\"\"\"docstring\"\"\"\n",
"host = None\n",
"hostname = self.common._safe_hostname(connector['host'])\n",
"cpg = self.common.get_cpg(volume, allowSnap=True)\n",
"domain = self.common.get_domain(cpg)\n",
"host = self.common._get_3par_host(hostname)\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_16):...\n",
"self.columns = CLASS_1.to_columns(VAR_16)\n",
"self._lookup = {}\n",
"self._flattened = []\n",
"for column in self.columns:\n",
"self._flattened.extend(column.type.flatten(column.name))\n",
"for VAR_3 in self._flattened:\n",
"if VAR_3.flattened in self._lookup:\n",... | [
"def __init__(self, columns):...\n",
"self.columns = Column.to_columns(columns)\n",
"self._lookup = {}\n",
"self._flattened = []\n",
"for column in self.columns:\n",
"self._flattened.extend(column.type.flatten(column.name))\n",
"for col in self._flattened:\n",
"if col.flattened in self._lookup:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"For",
"Condition",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(self, VAR_1, VAR_2, VAR_8=None, VAR_9='form', VAR_4=None, VAR_14...\n",
"VAR_29 = super(CLASS_0, self).fields_view_get(VAR_1, VAR_2, VAR_8, VAR_9,\n VAR_4, VAR_14=toolbar, VAR_15=submenu)\n",
"if VAR_4 is None:\n",
"VAR_4 = {}\n",
"if 'location' in VAR_4 and VAR_4['location']:\n",
"VAR_51 =... | [
"def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=...\n",
"res = super(product_product, self).fields_view_get(cr, uid, view_id,\n view_type, context, toolbar=toolbar, submenu=submenu)\n",
"if context is None:\n",
"context = {}\n",
"if 'location' in context and context['location'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"For",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition... |
[
"def FUNC_25(VAR_14, VAR_27, VAR_28):...\n",
"VAR_26.append((VAR_14, VAR_27.splitlines()[0], VAR_28))\n"
] | [
"def post_error_task(botobj, msg, task_id):...\n",
"posted.append((botobj, msg.splitlines()[0], task_id))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_3(self):...\n",
"self.set_secure_cookie('user', self.get_argument('username'))\n",
"self.redirect('/')\n"
] | [
"def post(self):...\n",
"self.set_secure_cookie('user', self.get_argument('username'))\n",
"self.redirect('/')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def __getitem__(self, VAR_12):...\n",
"return self.content[VAR_12]\n"
] | [
"def __getitem__(self, key):...\n",
"return self.content[key]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_19(self):...\n",
"return VAR_54.as_json(self.as_dict())\n"
] | [
"def as_json(self):...\n",
"return frappe.as_json(self.as_dict())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_12(VAR_1, **VAR_6):...\n",
"import sql\n",
"VAR_43 = 'syn_flood_protect.sh'\n",
"VAR_44 = sql.get_setting('tmp_config_path')\n",
"VAR_52 = 'disable' if VAR_6.get('enable') == '0' else 'disable'\n",
"os.system('cp scripts/%s .' % VAR_43)\n",
"VAR_13 = ['sudo chmod +x ' + VAR_44 + VAR_43, VAR_44... | [
"def syn_flood_protect(serv, **kwargs):...\n",
"import sql\n",
"script = 'syn_flood_protect.sh'\n",
"tmp_config_path = sql.get_setting('tmp_config_path')\n",
"enable = 'disable' if kwargs.get('enable') == '0' else 'disable'\n",
"os.system('cp scripts/%s .' % script)\n",
"commands = ['sudo chmod +x ' + t... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_32(VAR_19):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n VAR_19)\n"
] | [
"def BuildExtraConfData(extra_conf_vim_data):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n extra_conf_vim_data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"if self.check_xsrf_cookie() == False:\n",
"self.clear_cookies()\n",
"return self.redirect('/')\n"
] | [
"def check_xsrf(self):...\n",
"if self.check_xsrf_cookie() == False:\n",
"self.clear_cookies()\n",
"return self.redirect('/')\n"
] | [
0,
0,
0,
5
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Return'"
] |
[
"import psycopg2\n",
"VAR_0 = {}\n",
"def FUNC_0():...\n",
"VAR_3 = psycopg2.connect(host=config['HOST'], port=config['PORT'], database\n =config['NAME'], user=config['USER'], password=config['PASSWORD'])\n",
"VAR_4 = VAR_3.cursor()\n",
"VAR_4.execute('select * from reply_map')\n",
"VAR_5 = {}\n",
... | [
"import psycopg2\n",
"config = {}\n",
"def get_all():...\n",
"connection = psycopg2.connect(host=config['HOST'], port=config['PORT'],\n database=config['NAME'], user=config['USER'], password=config['PASSWORD'])\n",
"cur = connection.cursor()\n",
"cur.execute('select * from reply_map')\n",
"out = {}\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self, VAR_6, VAR_7):...\n",
"super().validate(VAR_6, VAR_7)\n",
"for VAR_20, VAR_21 in VAR_6.items():\n",
"if not isinstance(VAR_21, str) and VAR_21 is not None:\n"
] | [
"def validate(self, value, model_instance):...\n",
"super().validate(value, model_instance)\n",
"for key, val in value.items():\n",
"if not isinstance(val, str) and val is not None:\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"For",
"Condition"
] |
[
"def FUNC_15(self, VAR_34, VAR_29):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def read(self, fd, size):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_1(self):...\n",
"return self.content\n"
] | [
"def get(self):...\n",
"return self.content\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_3(VAR_5):...\n",
""
] | [
"def check_program(program_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_17(self):...\n",
"return '`tab{0}`.name in ({1})'.format(self.doctype, ', '.join([\"'%s'\"] *\n len(self.shared))) % tuple([frappe.db.escape(s, percent=False) for s in\n self.shared])\n"
] | [
"def get_share_condition(self):...\n",
"return '`tab{0}`.name in ({1})'.format(self.doctype, ', '.join([\"'%s'\"] *\n len(self.shared))) % tuple([frappe.db.escape(s, percent=False) for s in\n self.shared])\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"VAR_6 = BeautifulSoup(self.res_data, 'html.parser')\n",
"VAR_7 = {}\n",
"VAR_8 = VAR_6.find_all(id='submission_status')[0]\n",
"VAR_7['status'] = VAR_8.text.strip()\n",
"VAR_9 = VAR_6.find_all(id='compilation')\n",
"if VAR_9:\n",
"VAR_12 = VAR_9[0]\n",
"VAR_7['compile_outp... | [
"def get_submission_info(self):...\n",
"soup = BeautifulSoup(self.res_data, 'html.parser')\n",
"info = {}\n",
"tag = soup.find_all(id='submission_status')[0]\n",
"info['status'] = tag.text.strip()\n",
"tags = soup.find_all(id='compilation')\n",
"if tags:\n",
"content = tags[0]\n",
"info['compile_out... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_18(self):...\n",
"VAR_21 = f'{settings.MEDIA_ROOT}{str(self.fs_id)}'\n",
"VAR_22 = f'{settings.MEDIA_ROOT}{self.get_name_as_slug()}'\n",
"if bool(self.csv.name):\n",
"VAR_26 = PurePath(self.csv.path)\n",
"if os.path.isdir(VAR_21):\n",
"VAR_27 = VAR_26.parts[-2]\n",
"return VAR_21\n",
"if b... | [
"def get_dg_folder(self):...\n",
"uuid_dir = f'{settings.MEDIA_ROOT}{str(self.fs_id)}'\n",
"name_dir = f'{settings.MEDIA_ROOT}{self.get_name_as_slug()}'\n",
"if bool(self.csv.name):\n",
"p = PurePath(self.csv.path)\n",
"if os.path.isdir(uuid_dir):\n",
"csv_folder = p.parts[-2]\n",
"return uuid_dir\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_6(VAR_12):...\n",
"if isinstance(VAR_12, set):\n",
"return list(VAR_12)\n",
"if hasattr(VAR_12, '__str__'):\n",
"return str(VAR_12)\n",
"log.msg('RENDERING ERROR, cannot json serialize %s' % VAR_12, system='httprest'\n )\n"
] | [
"def render(obj):...\n",
"if isinstance(obj, set):\n",
"return list(obj)\n",
"if hasattr(obj, '__str__'):\n",
"return str(obj)\n",
"log.msg('RENDERING ERROR, cannot json serialize %s' % obj, system='httprest')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Expr'"
] |
[
"@property...\n",
"return self.storage_helper(self)\n"
] | [
"@property...\n",
"return self.storage_helper(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_1, VAR_3=None):...\n",
"FUNC_0(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = VAR_3\n",
"for VAR_36 in sa.orm.class_mapper(VAR_1).iterate_properties:\n",
"if type(VAR_36) != SynonymProperty:\n",
"for VAR_14 in VAR_1.__mapper__.colum... | [
"def __init__(self, obj, session=None):...\n",
"_include_filters(self)\n",
"self.list_columns = dict()\n",
"self.list_properties = dict()\n",
"self.session = session\n",
"for prop in sa.orm.class_mapper(obj).iterate_properties:\n",
"if type(prop) != SynonymProperty:\n",
"for col_name in obj.__mapper__... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def __init__(self, *VAR_11, **VAR_12):...\n",
"self.protocol_key = 'webclient/ajax'\n",
"super(CLASS_2, self).__init__(*VAR_11, **kwargs)\n"
] | [
"def __init__(self, *args, **kwargs):...\n",
"self.protocol_key = 'webclient/ajax'\n",
"super(AjaxWebClientSession, self).__init__(*args, **kwargs)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def __init__(self, VAR_0=None):...\n",
"self.step = VAR_0\n",
"self.body = []\n",
"self.css = []\n",
"self.data = SharedCache()\n",
"self.files = SharedCache()\n",
"self.title = self.definition.get('title')\n",
"self.subtitle = self.definition.get('subtitle')\n",
"self.summary = self.definition.get... | [
"def __init__(self, step=None):...\n",
"self.step = step\n",
"self.body = []\n",
"self.css = []\n",
"self.data = SharedCache()\n",
"self.files = SharedCache()\n",
"self.title = self.definition.get('title')\n",
"self.subtitle = self.definition.get('subtitle')\n",
"self.summary = self.definition.get('... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_3():...\n",
"import benwaonline.models\n",
"db.create_all()\n"
] | [
"def init_db():...\n",
"import benwaonline.models\n",
"db.create_all()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Expr'"
] |
[
"def FUNC_13(self, VAR_22):...\n",
"logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", VAR_22, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n",
"self.abort_with_error(403, text=str(error))\n"
] | [
"def authorization_error(self, error):...\n",
"logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", error, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n",
"self.abort_with_error(403, text=str(error))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"@staticmethod...\n",
"def FUNC_13(VAR_9, VAR_7, VAR_11, VAR_10):...\n",
"if VAR_11 == 'POST':\n",
"return CLASS_0.session.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=\n _HEADERS, VAR_10=timeout)\n",
"if VAR_11 == 'GET':\n",
"return CLASS_0.session.get(FUNC_2(VAR_7), headers=_HEADERS, VAR_10=ti... | [
"@staticmethod...\n",
"def SendRequest(data, handler, method, timeout):...\n",
"if method == 'POST':\n",
"return BaseRequest.session.post(_BuildUri(handler), data=ToUtf8Json(data),\n headers=_HEADERS, timeout=timeout)\n",
"if method == 'GET':\n",
"return BaseRequest.session.get(_BuildUri(handler), head... | [
0,
0,
0,
7,
0,
7,
0,
0,
7,
0,
0,
0,
0,
0
] | [
"Condition",
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = self.client.get('/api/apps', HTTP_X_DEIS_VERSION=__version__.rsplit\n ('.', 1)[0])\n",
"self.assertEqual(VAR_1.status_code, 200)\n"
] | [
"def test_x_deis_version_header_good(self):...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.get('/api/apps', HTTP_X_DEIS_VERSION=__version__.\n rsplit('.', 1)[0])\n",
"self.assertEqual(response.status_code, 200)\n"
] | [
0,
0,
5,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(VAR_28.size for VAR_28 in self.input)\n",
"return self._inputsize\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"if self._inputsize is None:\n",
"self._inputsize = sum(f.size for f in self.input)\n",
"return self._inputsize\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
"def test_prepare_string_argument_unsupported(self):...\n",
"for string in self.test_strings:\n",
"self.assertEqual(prepare_string_argument(string, 'WeIrD_O/S'), string)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'"
] |
[
"def FUNC_5(self):...\n",
"return False\n"
] | [
"def use_client_cert_auth(self):...\n",
"return False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_20(self, VAR_14):...\n",
""
] | [
"def is_relation_one_to_one(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_6(VAR_10):...\n",
"VAR_16 = getattr(VAR_10, 'error', None)\n",
"if VAR_16 is not None:\n",
"FUNC_7()\n",
"VAR_10.fail(VAR_16)\n"
] | [
"def check_is_test_failed(test):...\n",
"message = getattr(test, 'error', None)\n",
"if message is not None:\n",
"stop_browser()\n",
"test.fail(message)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'"
] |
[
"@retries(5, delay=0.5, backoff=1.5)...\n",
"if VAR_11 == 'POST':\n",
"return requests.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=_HEADERS)\n",
"if VAR_11 == 'GET':\n",
"return requests.get(FUNC_2(VAR_7), headers=_HEADERS)\n"
] | [
"@retries(5, delay=0.5, backoff=1.5)...\n",
"if method == 'POST':\n",
"return requests.post(_BuildUri(handler), data=ToUtf8Json(data), headers=\n _HEADERS)\n",
"if method == 'GET':\n",
"return requests.get(_BuildUri(handler), headers=_HEADERS)\n"
] | [
0,
0,
7,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_27(self):...\n",
"return 'management/get_tag.html', TestCase.objects.get(pk=self.object_pk)\n"
] | [
"def case(self):...\n",
"return 'management/get_tag.html', TestCase.objects.get(pk=self.object_pk)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_25(VAR_14, VAR_27, VAR_28):...\n",
"VAR_26.append((VAR_14, VAR_27.splitlines()[0], VAR_28))\n"
] | [
"def post_error_task(botobj, msg, task_id):...\n",
"posted.append((botobj, msg.splitlines()[0], task_id))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_10(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.to_str()\n"
] | [
"def to_json(self):...\n",
"\"\"\"docstring\"\"\"\n",
"return self.to_str()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def __init__(self, VAR_20='', **VAR_4):...\n",
"CLASS_4.__init__(self, VAR_20=channel_pk, **kwargs)\n",
"self.exclude_deleted = False\n",
"self.edit_enabled = True\n"
] | [
"def __init__(self, channel_pk='', **kwargs):...\n",
"TorrentsContentModel.__init__(self, channel_pk=channel_pk, **kwargs)\n",
"self.exclude_deleted = False\n",
"self.edit_enabled = True\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"def FUNC_6(VAR_6):...\n",
"assert VAR_6 == VAR_3\n",
"return VAR_0\n"
] | [
"def _os_walk(path):...\n",
"assert path == mock_path\n",
"return MOCK_PATHS\n"
] | [
0,
0,
1
] | [
"FunctionDef'",
"Assert'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._gates\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._gates\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_1(VAR_0, VAR_1=None):...\n",
"VAR_0.commit()\n",
"VAR_0.close()\n"
] | [
"def closeDB(conn, cursor=None):...\n",
"conn.commit()\n",
"conn.close()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_46=50, VAR_47=100):...\n",
"\"\"\"docstring\"\"\"\n",
"self.regex = re.compile(\n '((?P<value>.+)(?P=value){{{min_repeat},{max_repeat}}})$'.format(VAR_46\n =min_repeat - 1, VAR_47=max_repeat - 1))\n"
] | [
"def __init__(self, min_repeat=50, max_repeat=100):...\n",
"\"\"\"docstring\"\"\"\n",
"self.regex = re.compile(\n '((?P<value>.+)(?P=value){{{min_repeat},{max_repeat}}})$'.format(\n min_repeat=min_repeat - 1, max_repeat=max_repeat - 1))\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_9(self, *VAR_15, **VAR_75):...\n",
""
] | [
"def newfn(self, *a, **env):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"from dataclasses import dataclass\n",
"import pytz\n",
"from config import get_connection\n",
"def FUNC_0():...\n",
"VAR_0 = get_connection()\n",
"VAR_1 = VAR_0.cursor()\n",
"VAR_1.execute(f'select count(*) from visitors;')\n",
"VAR_2 = VAR_1.fetchall()\n",
"VAR_0.commit()\n",
"VAR_0.close()\n",
... | [
"from dataclasses import dataclass\n",
"import pytz\n",
"from config import get_connection\n",
"def get_visit_count():...\n",
"connection = get_connection()\n",
"cursor = connection.cursor()\n",
"cursor.execute(f'select count(*) from visitors;')\n",
"rows = cursor.fetchall()\n",
"connection.commit()... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_3.message_handler(commands=['start'])...\n",
"VAR_10 = VAR_6.from_user.id\n",
"VAR_3.send_message(VAR_10, 'string')\n",
"VAR_0.insert('user', {'name': VAR_6.from_user.username, 'telegram_id':\n VAR_10}, {'telegram_id': VAR_10})\n",
"VAR_25 = VAR_0.select('user', 'telegram_id = ' + str(VAR_10))[0]['... | [
"@bot.message_handler(commands=['start'])...\n",
"telegram_id = message.from_user.id\n",
"bot.send_message(telegram_id,\n \"\"\"- Write /start to begin\n- You can send files, images, videos, etc. and they will be stored in your current path\n- If you write a message to the bot, it will make a directory with ... | [
0,
0,
4,
0,
0,
0,
4,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_39(VAR_101):...\n",
"VAR_101.docstring = VAR_68\n",
"return VAR_101\n"
] | [
"def decorate(ruleinfo):...\n",
"ruleinfo.docstring = string\n",
"return ruleinfo\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"if not exists(self.directory):\n",
"self.checkout()\n",
"if not exists(self.directory + '/.git'):\n",
"FUNC_1(self.directory, 'Git')\n",
"if self.has_local_edit():\n",
"VAR_0.warning(\"Directory '%s' contains local modifications\" % self.directory)\n",
"if self.conf.get('sha... | [
"def update(self):...\n",
"if not exists(self.directory):\n",
"self.checkout()\n",
"if not exists(self.directory + '/.git'):\n",
"not_a_project(self.directory, 'Git')\n",
"if self.has_local_edit():\n",
"logger.warning(\"Directory '%s' contains local modifications\" % self.directory)\n",
"if self.conf.... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(VAR_2, VAR_3=False):...\n",
"VAR_4 = {}\n",
"if VAR_2:\n",
"VAR_5 = FUNC_2()\n",
"return VAR_4\n",
"VAR_4 = FUNC_5(VAR_2, VAR_5)\n",
"if VAR_3:\n",
"VAR_4 = FUNC_3(VAR_4)\n"
] | [
"def find_learning_unit_formations(objects, parents_as_instances=False):...\n",
"root_ids_by_object_id = {}\n",
"if objects:\n",
"filters = _get_root_filters()\n",
"return root_ids_by_object_id\n",
"root_ids_by_object_id = _find_related_formations(objects, filters)\n",
"if parents_as_instances:\n",
"r... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_2(VAR_0, VAR_2):...\n",
"return os.chmod(VAR_0, VAR_2, follow_symlinks=os.chmod not in os.\n supports_follow_symlinks)\n"
] | [
"def lchmod(f, mode):...\n",
"return os.chmod(f, mode, follow_symlinks=os.chmod not in os.\n supports_follow_symlinks)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@mock.patch('requests.post', FUNC_0)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = '/api/apps'\n",
"VAR_5 = self.client.post(VAR_4)\n",
"self.assertEqual(VAR_5.status_code, 201)\n",
"VAR_6 = VAR_5.data['id']\n",
"VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_5 = self.client.get(VAR_4)\... | [
"@mock.patch('requests.post', mock_import_repository_task)...\n",
"\"\"\"docstring\"\"\"\n",
"url = '/api/apps'\n",
"response = self.client.post(url)\n",
"self.assertEqual(response.status_code, 201)\n",
"app_id = response.data['id']\n",
"url = '/api/apps/{app_id}/builds'.format(**locals())\n",
"respon... | [
0,
0,
0,
5,
0,
0,
0,
5,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
5,
5
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Ex... |
[
"def FUNC_20(self):...\n",
"VAR_16 = self.mox.CreateMock(paramiko.SSHClient)\n",
"VAR_12 = self.mox.CreateMock(paramiko.Channel)\n",
"VAR_17 = self.mox.CreateMock(paramiko.Transport)\n",
"self.mox.StubOutWithMock(self.driver, '_get_output')\n",
"self.mox.StubOutWithMock(VAR_16, 'get_transport')\n",
"sel... | [
"def test_ssh_execute_error(self):...\n",
"ssh = self.mox.CreateMock(paramiko.SSHClient)\n",
"chan = self.mox.CreateMock(paramiko.Channel)\n",
"transport = self.mox.CreateMock(paramiko.Transport)\n",
"self.mox.StubOutWithMock(self.driver, '_get_output')\n",
"self.mox.StubOutWithMock(ssh, 'get_transport')\... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"\"\"\"\nCreated on Sat May 20 22:39:26 2017\n\n@author: Renondedju\n\"\"\"\n",
"import discord\n",
"import asyncio\n",
"import sys\n",
"import subprocess\n",
"import sqlite3\n",
"import re\n",
"from datetime import datetime\n",
"from osuapi import OsuApi, ReqConnector\n",
"import requests\n",
"... | [
"\"\"\"\nCreated on Sat May 20 22:39:26 2017\n\n@author: Renondedju\n\"\"\"\n",
"import discord\n",
"import asyncio\n",
"import sys\n",
"import subprocess\n",
"import sqlite3\n",
"import re\n",
"from datetime import datetime\n",
"from osuapi import OsuApi, ReqConnector\n",
"import requests\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Assig... |
[
"def FUNC_6(self, VAR_7):...\n",
"VAR_8 = self.content\n",
"while VAR_8:\n",
"yield VAR_8[:VAR_7]\n",
"VAR_8 = VAR_8[VAR_7:]\n"
] | [
"def iter_content(self, chunk_size):...\n",
"c = self.content\n",
"while c:\n",
"yield c[:chunk_size]\n",
"c = c[chunk_size:]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Assign'"
] |
[
"def FUNC_9(VAR_8, VAR_11, VAR_12=False, VAR_13=False, VAR_14=None, VAR_15=False...\n",
"def FUNC_35(VAR_29):...\n",
"VAR_40 = VAR_29.group('name')\n",
"VAR_16 = VAR_11[VAR_40]\n",
"if VAR_15:\n",
"return re.sub(VAR_5, FUNC_35, VAR_8)\n",
"if VAR_13 and VAR_16 == VAR_14:\n",
"return '{{{}}}'.format(VA... | [
"def apply_wildcards(pattern, wildcards, fill_missing=False, fail_dynamic=...\n",
"def format_match(match):...\n",
"name = match.group('name')\n",
"value = wildcards[name]\n",
"if keep_dynamic:\n",
"return re.sub(_wildcard_regex, format_match, pattern)\n",
"if fail_dynamic and value == dynamic_fill:\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self, VAR_5):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = VAR_5[:]\n",
"for request in VAR_5:\n",
"self.assertEqual(tuple, request.__class__)\n",
"self.assertEqual([], self._requests)\n",
"self.assertIn(len(request), (3, 4))\n",
"self._requests = VAR_5\n"
] | [
"def expected_requests(self, requests):...\n",
"\"\"\"docstring\"\"\"\n",
"requests = requests[:]\n",
"for request in requests:\n",
"self.assertEqual(tuple, request.__class__)\n",
"self.assertEqual([], self._requests)\n",
"self.assertIn(len(request), (3, 4))\n",
"self._requests = requests\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def __enter__(self):...\n",
"return CLASS_0()\n"
] | [
"def __enter__(self):...\n",
"return DBase()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._plasma_store_socket_name\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self._plasma_store_socket_name\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_12(**VAR_19):...\n",
"VAR_39 = {'name': VAR_19.get('name'), 'title': VAR_19.get('title')}\n",
"VAR_35 = FUNC_8('tasks/add', VAR_16=add_args)\n",
"VAR_43 = VAR_35.text\n",
"VAR_44 = re.search('/task/([0-9]+)$', VAR_35.url)\n",
"VAR_45 = re.search('/dataset/([0-9]+)', VAR_43)\n",
"if VAR_44 and ... | [
"def add_task(**kwargs):...\n",
"add_args = {'name': kwargs.get('name'), 'title': kwargs.get('title')}\n",
"r = admin_req('tasks/add', args=add_args)\n",
"response = r.text\n",
"match_task_id = re.search('/task/([0-9]+)$', r.url)\n",
"match_dataset_id = re.search('/dataset/([0-9]+)', response)\n",
"if m... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"For",
"Return'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(self, VAR_2):...\n",
"VAR_7 = self.rides[VAR_2 * 5:min(VAR_2 * 5 + 5, len(self.rides))]\n",
"for ride in VAR_7:\n",
"print(str(ride[0]) + '.', end='')\n",
"if VAR_2 * 5 + 5 < len(self.rides):\n",
"print(ride)\n",
"VAR_10 = input('string')\n",
"VAR_10 = input(\n \"To book a member on a r... | [
"def display_rides(self, page_num):...\n",
"page = self.rides[page_num * 5:min(page_num * 5 + 5, len(self.rides))]\n",
"for ride in page:\n",
"print(str(ride[0]) + '.', end='')\n",
"if page_num * 5 + 5 < len(self.rides):\n",
"print(ride)\n",
"user_input = input(\n \"To book a member on a ride, please... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_16, **VAR_17):...\n",
"VAR_13 = self._seq\n",
"self._seq += 1\n",
"return {'type': 'request', 'seq': VAR_13, 'command': VAR_16, 'arguments':\n VAR_17}\n"
] | [
"def _create_request(self, command, **args):...\n",
"seq = self._seq\n",
"self._seq += 1\n",
"return {'type': 'request', 'seq': seq, 'command': command, 'arguments': args}\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"AugAssign'",
"Return'"
] |
[
"async def FUNC_11(VAR_8):...\n",
"for sa_model in tables.Base.__subclasses__():\n",
"VAR_17 = sa_model.__table__\n",
"conn.execute(VAR_17.delete())\n"
] | [
"async def _clean_tables(app):...\n",
"for sa_model in tables.Base.__subclasses__():\n",
"table = sa_model.__table__\n",
"conn.execute(table.delete())\n"
] | [
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"For",
"Assign'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_14):...\n",
"self.lasttok = None\n",
"self.lastid = None\n",
"self.parser.parse(VAR_14, lexer=self.lexer)\n"
] | [
"def parse(self, expr):...\n",
"self.lasttok = None\n",
"self.lastid = None\n",
"self.parser.parse(expr, lexer=self.lexer)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@VAR_0.route('/', VAR_5=['POST'])...\n",
"print('login')\n",
"VAR_2 = str(request.form['username'])\n",
"VAR_3 = str(request.form['password'])\n",
"VAR_7.execute(\"SELECT * FROM users WHERE name = '{}' AND password = '{}';\".\n format(VAR_2, VAR_3))\n",
"VAR_4 = VAR_7.fetchone()\n",
"if VAR_4 != Non... | [
"@app.route('/', methods=['POST'])...\n",
"print('login')\n",
"user = str(request.form['username'])\n",
"password = str(request.form['password'])\n",
"cur.execute(\"SELECT * FROM users WHERE name = '{}' AND password = '{}';\".\n format(user, password))\n",
"response = cur.fetchone()\n",
"if response ... | [
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Expr'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.