lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_6(self, VAR_11, VAR_52=None):...\n",
"if VAR_52 is None and not isinstance(VAR_101.site, FakeSubreddit):\n",
"VAR_52 = VAR_101.site\n",
"if VAR_52:\n",
"if not VAR_11:\n",
"VAR_52 = None\n",
"VAR_52 = Subreddit._by_name(VAR_52)\n",
"VAR_101.errors.add(errors.SUBREDDIT_NOEXIST)\n",
"return ... | [
"def run(self, url, sr=None):...\n",
"if sr is None and not isinstance(c.site, FakeSubreddit):\n",
"sr = c.site\n",
"if sr:\n",
"if not url:\n",
"sr = None\n",
"sr = Subreddit._by_name(sr)\n",
"c.errors.add(errors.SUBREDDIT_NOEXIST)\n",
"return self.error(errors.NO_URL)\n",
"url = utils.sanitize_u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Expr'",
"Return'"
] |
[
"@staticmethod...\n",
"if callable(VAR_8):\n",
"VAR_39 = CLASS_1.validate_python_type(VAR_6, VAR_8)\n",
"if isinstance(VAR_8, collections.Mapping):\n",
"if not VAR_39:\n",
"VAR_39 = CLASS_1.validate_jmessage(VAR_6, VAR_8)\n",
"if isinstance(VAR_8, str):\n",
"log.err('-- Invalid python_type, in [%s] ex... | [
"@staticmethod...\n",
"if callable(gl_type):\n",
"retval = BaseHandler.validate_python_type(value, gl_type)\n",
"if isinstance(gl_type, collections.Mapping):\n",
"if not retval:\n",
"retval = BaseHandler.validate_jmessage(value, gl_type)\n",
"if isinstance(gl_type, str):\n",
"log.err('-- Invalid pytho... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Return'"
] |
[
"def __exit__(self, VAR_7, VAR_8, VAR_9):...\n",
""
] | [
"def __exit__(self, type, value, tb):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_6(self, VAR_11='', VAR_6=None):...\n",
"VAR_5 = self.session.query(self.obj)\n",
"VAR_5 = self._get_base_query(VAR_5=query, VAR_6=filters)\n",
"VAR_25 = VAR_5.all()\n",
"VAR_27 = GroupByDateYear(VAR_11, 'Group by Year')\n",
"return VAR_27.apply(VAR_25)\n"
] | [
"def query_year_group(self, group_by='', filters=None):...\n",
"query = self.session.query(self.obj)\n",
"query = self._get_base_query(query=query, filters=filters)\n",
"query_result = query.all()\n",
"group_year = GroupByDateYear(group_by, 'Group by Year')\n",
"return group_year.apply(query_result)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import base64\n",
"import json\n",
"import logging\n",
"import optparse\n",
"import os\n",
"import signal\n",
"import sys\n",
"import time\n",
"import xsrf_client\n",
"from utils import net\n",
"from utils import on_error\n",
"from utils import subprocess42\n",
"fr... | [
"\"\"\"Runs a Swarming task.\n\nDownloads all the necessary files to run the task, executes the command and\nstreams results back to the Swarming server.\n\nThe process exit code is 0 when the task was executed, even if the task itself\nfailed. If there's any failure in the setup or teardown, like invalid packet\nr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Docstring"... |
[
"def FUNC_0(VAR_0):...\n",
"VAR_6 = VAR_0.split('/')\n",
"VAR_7 = collections.deque()\n",
"for entry in VAR_6:\n",
"if not entry:\n",
"if VAR_6[0] == '':\n",
"if entry == '.':\n",
"VAR_7.appendleft('')\n",
"if VAR_6[-1] == '':\n",
"if entry == '..':\n",
"VAR_7.append('')\n",
"return '/'.join(V... | [
"def normpath(path):...\n",
"old_path = path.split('/')\n",
"new_path = collections.deque()\n",
"for entry in old_path:\n",
"if not entry:\n",
"if old_path[0] == '':\n",
"if entry == '.':\n",
"new_path.appendleft('')\n",
"if old_path[-1] == '':\n",
"if entry == '..':\n",
"new_path.append('')\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Condition",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.conn:\n",
"self.conn.close()\n",
"if self.tunnel:\n",
"log.info('Connection to the database has been closed.')\n",
"self.tunnel.stop()\n",
"self.tunnel_opened = False\n",
"log.info('SSH tunnel has been closed.')\n",
"return True\n"
] | [
"def disconnect(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.conn:\n",
"self.conn.close()\n",
"if self.tunnel:\n",
"log.info('Connection to the database has been closed.')\n",
"self.tunnel.stop()\n",
"self.tunnel_opened = False\n",
"log.info('SSH tunnel has been closed.')\n",
"return True\n"
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_0, **VAR_1):...\n",
"self._configure(VAR_1)\n",
"self.conn = sqlite3.connect(VAR_0.name)\n",
"self.conn.execute('string')\n",
"self.conn.commit()\n",
"self.conn.text_factory = str\n"
] | [
"def __init__(self, file, **kwargs):...\n",
"self._configure(kwargs)\n",
"self.conn = sqlite3.connect(file.name)\n",
"self.conn.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS `webpages`(\n `id` INTEGER PRIMARY KEY,\n ... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'"
] |
[
"def FUNC_27(self):...\n",
"VAR_16 = vimsupport.CurrentFiletypes()\n",
"VAR_17 = self._user_options['filetype_specific_completion_to_disable']\n",
"return not all([(x in VAR_17) for x in VAR_16])\n"
] | [
"def CurrentFiletypeCompletionEnabled(self):...\n",
"filetypes = vimsupport.CurrentFiletypes()\n",
"filetype_to_disable = self._user_options[\n 'filetype_specific_completion_to_disable']\n",
"return not all([(x in filetype_to_disable) for x in filetypes])\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_13(self):...\n",
"self.run_test_case(self.scenario.upsert_load_balancer())\n"
] | [
"def test_a_upsert_load_balancer(self):...\n",
"self.run_test_case(self.scenario.upsert_load_balancer())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, VAR_6, VAR_7=None):...\n",
"if VAR_7 is not None:\n",
"self._r_root_item_ = VAR_7._r_root_item_\n",
"self._r_root_item_ = VAR_6\n",
"self._r_steps_ = list(VAR_7._r_steps_)\n",
"self._r_steps_ = []\n"
] | [
"def __init__(self, initial_item, path_to_clone=None):...\n",
"if path_to_clone is not None:\n",
"self._r_root_item_ = path_to_clone._r_root_item_\n",
"self._r_root_item_ = initial_item\n",
"self._r_steps_ = list(path_to_clone._r_steps_)\n",
"self._r_steps_ = []\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_1(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = psycopg2.connect(database=DBNAME)\n",
"VAR_3 = VAR_2.cursor()\n",
"VAR_3.execute(\"insert into posts values('%s')\" % VAR_1)\n",
"VAR_2.commit()\n",
"VAR_2.close()\n"
] | [
"def add_post(content):...\n",
"\"\"\"docstring\"\"\"\n",
"db = psycopg2.connect(database=DBNAME)\n",
"c = db.cursor()\n",
"c.execute(\"insert into posts values('%s')\" % content)\n",
"db.commit()\n",
"db.close()\n"
] | [
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_21(VAR_27, VAR_28, VAR_29, VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_49 = len(VAR_27)\n",
"if VAR_49 <= ray_constants.PICKLE_OBJECT_WARNING_SIZE:\n",
"return\n",
"VAR_50 = 'string'.format(VAR_29, VAR_28, VAR_49)\n",
"FUNC_2(VAR_2, ray_constants.PICKLING_LARGE_OBJECT_PUSH_ERROR, VAR_50, VA... | [
"def check_oversized_pickle(pickled, name, obj_type, worker):...\n",
"\"\"\"docstring\"\"\"\n",
"length = len(pickled)\n",
"if length <= ray_constants.PICKLE_OBJECT_WARNING_SIZE:\n",
"return\n",
"warning_message = (\n 'Warning: The {} {} has size {} when pickled. It will be stored in Redis, which could... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'"
] |
[
"def FUNC_26():...\n",
"return self.closed\n"
] | [
"def stop():...\n",
"return self.closed\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self, VAR_34):...\n",
"\"\"\"docstring\"\"\"\n",
"return {VAR_52[0]: {self.FIELD_NAME: VAR_52[1], self.TABLE_NAME: VAR_52[2],\n self.DATA_TYPE: VAR_52[3]} for VAR_52 in VAR_34}\n"
] | [
"def _parse_field_mapping(self, field_mapping):...\n",
"\"\"\"docstring\"\"\"\n",
"return {field[0]: {self.FIELD_NAME: field[1], self.TABLE_NAME: field[2],\n self.DATA_TYPE: field[3]} for field in field_mapping}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@handled_slot(bool)...\n",
"print(f\"{'Locking' if VAR_4 else 'Unlocking'} slow piezo.\")\n",
"self.lock_slow_piezo_action.setChecked(not VAR_4)\n",
"self.matisse.set_slow_piezo_lock(VAR_4)\n",
"self.lock_slow_piezo_action.setChecked(VAR_4)\n"
] | [
"@handled_slot(bool)...\n",
"print(f\"{'Locking' if checked else 'Unlocking'} slow piezo.\")\n",
"self.lock_slow_piezo_action.setChecked(not checked)\n",
"self.matisse.set_slow_piezo_lock(checked)\n",
"self.lock_slow_piezo_action.setChecked(checked)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n",
"CLASS_3.__init__(self, VAR_18, errors.NO_USER, *VAR_15, **kw)\n"
] | [
"def __init__(self, item, *a, **kw):...\n",
"VRequired.__init__(self, item, errors.NO_USER, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_20(self):...\n",
"def FUNC_29(VAR_34):...\n",
"self.assertEqual(logging.WARNING, VAR_34)\n",
"self.mock(logging_utils, 'set_console_level', FUNC_29)\n",
"def FUNC_30(VAR_35):...\n",
"self.assertEqual(None, VAR_35)\n",
"return 0\n"
] | [
"def test_main(self):...\n",
"def check(x):...\n",
"self.assertEqual(logging.WARNING, x)\n",
"self.mock(logging_utils, 'set_console_level', check)\n",
"def run_bot(error):...\n",
"self.assertEqual(None, error)\n",
"return 0\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_0():...\n",
"VAR_0 = input().split(' ')\n",
"VAR_1, VAR_2 = int(VAR_0[0]), int(VAR_0[1])\n",
"VAR_3 = {i: set() for i in range(VAR_1)}\n",
"VAR_4 = {}\n",
"VAR_5 = {}\n",
"for i in range(VAR_2):\n",
"VAR_10 = input().split(' ')\n",
"return VAR_1, VAR_3, VAR_4, VAR_5\n",
"VAR_11, VAR_12, ... | [
"def inp():...\n",
"first_line = input().split(' ')\n",
"num_points, num_trails = int(first_line[0]), int(first_line[1])\n",
"adj_lst = {i: set() for i in range(num_points)}\n",
"trail_len = {}\n",
"trail_len_duplicate_count = {}\n",
"for i in range(num_trails):\n",
"trail = input().split(' ')\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"AugAssign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_11(self):...\n",
"if self.submission_count > 0:\n",
"VAR_10 = self.submissions[0]\n",
"return None\n",
"if VAR_10.submitters.count() > 0:\n",
"return StudentGroup.get_exact(self.exercise.course_instance, VAR_10.\n submitters.all())\n"
] | [
"def get_group(self):...\n",
"if self.submission_count > 0:\n",
"s = self.submissions[0]\n",
"return None\n",
"if s.submitters.count() > 0:\n",
"return StudentGroup.get_exact(self.exercise.course_instance, s.submitters.all()\n )\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_2(VAR_4):...\n",
"VAR_5 = '<title>{0}</title>'.format(self.MAIL_ADDRESS)\n",
"VAR_6 = re.findall(VAR_5, VAR_2.written[0])\n",
"self.assertEquals(len(VAR_6), 1)\n"
] | [
"def assert_response(_):...\n",
"expected = '<title>{0}</title>'.format(self.MAIL_ADDRESS)\n",
"matches = re.findall(expected, request.written[0])\n",
"self.assertEquals(len(matches), 1)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = self.run_command('hostname')\n",
"self.hostname = VAR_32['stdout'].strip()\n",
"self.log_debug('Hostname set to %s' % self.hostname)\n"
] | [
"def get_hostname(self):...\n",
"\"\"\"docstring\"\"\"\n",
"sout = self.run_command('hostname')\n",
"self.hostname = sout['stdout'].strip()\n",
"self.log_debug('Hostname set to %s' % self.hostname)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_23(self):...\n",
"VAR_74 = FUNC_1(self.request.GET, VAR_3=('info_type', 'field', 'format'))\n",
"return User.objects.filter(**query)\n"
] | [
"def users(self):...\n",
"query = strip_parameters(self.request.GET, skip_parameters=('info_type',\n 'field', 'format'))\n",
"return User.objects.filter(**query)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_0(self, VAR_1, VAR_6, VAR_7, VAR_3):...\n",
"return '<textarea name=\"%s\" rows=5 cols=40>%s</textarea>' % (html_escape(\n VAR_6), html_escape(VAR_7 or ''))\n"
] | [
"def make_input(self, version, name, value, attribute):...\n",
"return '<textarea name=\"%s\" rows=5 cols=40>%s</textarea>' % (html_escape(\n name), html_escape(value or ''))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self, VAR_14, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_28 = self._get_groupdict(VAR_14)\n",
"for VAR_33 in ('line', 'column', 'end_line', 'end_column'):\n",
"if VAR_33 in VAR_28 and VAR_28[VAR_33]:\n",
"if 'origin' in VAR_28:\n",
"VAR_28[VAR_33] = int(VAR_28[VAR_33])\n",
"VAR_28['or... | [
"def match_to_result(self, match, filename):...\n",
"\"\"\"docstring\"\"\"\n",
"groups = self._get_groupdict(match)\n",
"for variable in ('line', 'column', 'end_line', 'end_column'):\n",
"if variable in groups and groups[variable]:\n",
"if 'origin' in groups:\n",
"groups[variable] = int(groups[variable]... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.format_wildcards(self.rule.message) if self.rule.message else None\n"
] | [
"@property...\n",
"\"\"\"docstring\"\"\"\n",
"return self.format_wildcards(self.rule.message) if self.rule.message else None\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@functools.wraps(VAR_3)...\n",
"VAR_23 = VAR_5.pop('timeout', None)\n",
"VAR_24 = eventlet.spawn(VAR_3, self, *VAR_4, **kwargs)\n",
"if VAR_23 is None:\n",
"return VAR_24.wait()\n",
"VAR_36 = eventlet.spawn_after(VAR_23, VAR_24.kill)\n",
"VAR_48 = VAR_24.wait()\n",
"VAR_36.cancel()\n",
"return VAR_... | [
"@functools.wraps(f)...\n",
"timeout = kwargs.pop('timeout', None)\n",
"gt = eventlet.spawn(f, self, *args, **kwargs)\n",
"if timeout is None:\n",
"return gt.wait()\n",
"kill_thread = eventlet.spawn_after(timeout, gt.kill)\n",
"res = gt.wait()\n",
"kill_thread.cancel()\n",
"return res\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_13(self, VAR_14):...\n",
""
] | [
"def is_float(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_1(VAR_0, VAR_1, VAR_2={}, VAR_3='bqsql', VAR_4='bqcache', VAR_5=False...\n",
"VAR_8 = FUNC_0(VAR_0, VAR_1, **query_params)\n",
"VAR_9 = os.path.join(VAR_4, '{}.pkl'.format(VAR_8))\n",
"if not VAR_5 and os.path.exists(VAR_9):\n",
"VAR_10 = pd.read_pickle(VAR_9)\n",
"VAR_11 = os.path.join(VAR_3, '... | [
"def get_result(project_id, query_name, query_params={}, query_dir='bqsql',...\n",
"qhash = query_hash(project_id, query_name, **query_params)\n",
"cache_file_name = os.path.join(cache_dir, '{}.pkl'.format(qhash))\n",
"if not reload and os.path.exists(cache_file_name):\n",
"res = pd.read_pickle(cache_file_n... | [
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_31(self, VAR_17, VAR_15):...\n",
"VAR_28 = FileManager()\n",
"VAR_29 = ImageManager()\n",
"for file_col in VAR_17.files:\n",
"if self.is_file(file_col):\n",
"for file_col in VAR_17.files:\n",
"VAR_28.save_file(VAR_17.files[file_col], getattr(VAR_15, file_col))\n",
"if self.is_image(file_col)... | [
"def _add_files(self, this_request, item):...\n",
"fm = FileManager()\n",
"im = ImageManager()\n",
"for file_col in this_request.files:\n",
"if self.is_file(file_col):\n",
"for file_col in this_request.files:\n",
"fm.save_file(this_request.files[file_col], getattr(item, file_col))\n",
"if self.is_imag... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_15(VAR_20, VAR_22, VAR_23, VAR_24, VAR_25):...\n",
"VAR_17 = [('input', VAR_23), ('output', VAR_24)]\n",
"VAR_16 = {}\n",
"VAR_16['codename'] = '%03d' % VAR_22\n",
"if VAR_25:\n",
"VAR_16['public'] = '1'\n",
"VAR_47 = FUNC_14(VAR_20)\n",
"FUNC_8('dataset/%d/testcases/add' % VAR_47, VAR_17=fi... | [
"def add_testcase(task_id, num, input_file, output_file, public):...\n",
"files = [('input', input_file), ('output', output_file)]\n",
"args = {}\n",
"args['codename'] = '%03d' % num\n",
"if public:\n",
"args['public'] = '1'\n",
"dataset_id = get_task_active_dataset_id(task_id)\n",
"admin_req('dataset... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self):...\n",
"VAR_16 = request.headers.get('X-XSRF-TOKEN', '')\n",
"if not VAR_16:\n",
"return False\n",
"return safe_str_cmp(VAR_16, VAR_15.get('XSRF-TOKEN', ''))\n"
] | [
"def check_csrf_token(self):...\n",
"token = request.headers.get('X-XSRF-TOKEN', '')\n",
"if not token:\n",
"return False\n",
"return safe_str_cmp(token, session.get('XSRF-TOKEN', ''))\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_39():...\n",
"from lib.evaluators.PyQt4Evaluator import Evaluator\n",
"return Evaluator()\n"
] | [
"def ev_init():...\n",
"from lib.evaluators.PyQt4Evaluator import Evaluator\n",
"return Evaluator()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Return'"
] |
[
"def FUNC_0(self):...\n",
"super(CLASS_0, self).setUp()\n",
"VAR_3 = os.path.join(os.getcwd(), 'bandit', 'plugins')\n",
"VAR_4 = b_config.BanditConfig()\n",
"self.b_mgr = b_manager.BanditManager(VAR_4, 'file')\n",
"self.b_mgr.b_conf._settings['plugins_dir'] = VAR_3\n",
"self.b_mgr.b_ts = b_test_set.Band... | [
"def setUp(self):...\n",
"super(FunctionalTests, self).setUp()\n",
"path = os.path.join(os.getcwd(), 'bandit', 'plugins')\n",
"b_conf = b_config.BanditConfig()\n",
"self.b_mgr = b_manager.BanditManager(b_conf, 'file')\n",
"self.b_mgr.b_conf._settings['plugins_dir'] = path\n",
"self.b_mgr.b_ts = b_test_s... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_0(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
"def _init_common(self):...\n",
"return hpcommon.HP3PARCommon(self.configuration)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"\"\"\"docstring\"\"\"\n",
"tournament.editPlayer(new_name='Joan Jett')\n"
] | [
"def test_edit_missing_new_info(self):...\n",
"\"\"\"docstring\"\"\"\n",
"tournament.editPlayer(new_name='Joan Jett')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'"
] |
[
"from argparse import ArgumentParser\n",
"from ply import lex, yacc\n",
"import locale\n",
"import traceback\n",
"import sys\n",
"import git\n",
"import re\n",
"import os\n",
"def __init__(self, VAR_3, VAR_4):...\n",
"self.tok = VAR_3\n",
"self.txt = VAR_4\n",
"def __init__(self, VAR_5, VAR_4)... | [
"from argparse import ArgumentParser\n",
"from ply import lex, yacc\n",
"import locale\n",
"import traceback\n",
"import sys\n",
"import git\n",
"import re\n",
"import os\n",
"def __init__(self, tok, txt):...\n",
"self.tok = tok\n",
"self.txt = txt\n",
"def __init__(self, el, txt):...\n",
"s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = Admin(VAR_0, name='Test')\n",
"assert 'model' in record_adminview\n",
"assert 'modelview' in record_adminview\n",
"VAR_3 = record_adminview.pop('model')\n",
"VAR_4 = record_adminview.pop('modelview')\n",
"VAR_2.add_view(VAR_4(VAR_3,... | [
"def test_admin(app, db):...\n",
"\"\"\"docstring\"\"\"\n",
"admin = Admin(app, name='Test')\n",
"assert 'model' in record_adminview\n",
"assert 'modelview' in record_adminview\n",
"model = record_adminview.pop('model')\n",
"view = record_adminview.pop('modelview')\n",
"admin.add_view(view(model, db.s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Assert'",
"Assert'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assign'",
"As... |
[
"def FUNC_12(VAR_6, VAR_11, VAR_10):...\n",
"VAR_13 = CLASS_0.create_invoice_products_values_query(VAR_10, VAR_11)\n",
"print('Result:')\n",
"print(VAR_13)\n",
"VAR_12 = f\"\"\"\n INSERT INTO {VAR_4} (invoice_id, product_id, quantity)\n VALUES {VAR_13}\n \"\"\"\n",
"VAR_14... | [
"def create_invoice_products(userId, products, invoiceId):...\n",
"invoice_products_values = UsersRepository.create_invoice_products_values_query(\n invoiceId, products)\n",
"print('Result:')\n",
"print(invoice_products_values)\n",
"sql_query = f\"\"\"\n INSERT INTO {INVOICE_PRODUCTS_TABLE} (i... | [
0,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_1(VAR_1=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = 'df -i'\n",
"if VAR_1 is not None:\n",
"VAR_4 = VAR_4 + ' -' + VAR_1\n",
"VAR_2 = {}\n",
"VAR_3 = __salt__['cmd.run'](VAR_4).splitlines()\n",
"for line in VAR_3:\n",
"if line.startswith('Filesystem'):\n",
"return VAR_2\n",
"VAR_... | [
"def inodeusage(args=None):...\n",
"\"\"\"docstring\"\"\"\n",
"cmd = 'df -i'\n",
"if args is not None:\n",
"cmd = cmd + ' -' + args\n",
"ret = {}\n",
"out = __salt__['cmd.run'](cmd).splitlines()\n",
"for line in out:\n",
"if line.startswith('Filesystem'):\n",
"return ret\n",
"comps = line.split(... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@transaction.atomic...\n",
"VAR_6 = CreateCourseForm(VAR_0.POST)\n",
"if not VAR_6.is_valid():\n",
"return FUNC_0(VAR_0, VAR_3=form)\n",
"VAR_8 = Course(course_number=request.POST['course_number'], course_name=\n request.POST['course_name'], instructor=request.POST['instructor'])\n",
"VAR_8.save()\n",... | [
"@transaction.atomic...\n",
"form = CreateCourseForm(request.POST)\n",
"if not form.is_valid():\n",
"return make_view(request, create_course_form=form)\n",
"new_course = Course(course_number=request.POST['course_number'],\n course_name=request.POST['course_name'], instructor=request.POST[\n 'instructo... | [
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_26(VAR_17):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_68 = len(VAR_17)\n",
"VAR_69 = lambda x: int(float(x) / 100 * VAR_68)\n",
"VAR_70 = [VAR_17[VAR_69(start):VAR_69(end)] for start, end in bconfig.\n CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(VAR_70)\n"
] | [
"def _get_partial_text(fulltext):...\n",
"\"\"\"docstring\"\"\"\n",
"length = len(fulltext)\n",
"get_index = lambda x: int(float(x) / 100 * length)\n",
"partial_text = [fulltext[get_index(start):get_index(end)] for start, end in\n bconfig.CFG_BIBCLASSIFY_PARTIAL_TEXT]\n",
"return '\\n'.join(partial_tex... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_1):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = \"INSERT INTO crimes (description) VALUES ('{}');\".format(VAR_1)\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"VAR_2.commit()\n"
] | [
"def add_input(self, data):...\n",
"connection = self.connect()\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'"
] |
[
"def FUNC_2(VAR_0, VAR_1):...\n",
"VAR_5 = frappe.session.user\n",
"VAR_6 = get_leave_allocation_records(VAR_0.to_date)\n",
"VAR_7 = get_leave_allocation_records(VAR_0.from_date)\n",
"VAR_8 = frappe.get_all('Employee', VAR_0={'status': 'Active', 'company':\n filters.company}, fields=['name', 'employee_na... | [
"def get_data(filters, leave_types):...\n",
"user = frappe.session.user\n",
"allocation_records_based_on_to_date = get_leave_allocation_records(filters.\n to_date)\n",
"allocation_records_based_on_from_date = get_leave_allocation_records(filters\n .from_date)\n",
"active_employees = frappe.get_all('Em... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Assign'",
"For",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"AugAssign'"
] |
[
"def FUNC_4(VAR_2):...\n",
"VAR_7 = files.get_static_data('./static/files.html')\n",
"VAR_2 = FUNC_1(VAR_2)\n",
"VAR_2 = '/'\n",
"if not VAR_2:\n",
"VAR_2 = '/'\n",
"VAR_15 = VAR_2.split('/')\n",
"VAR_16 = list()\n",
"while '' in VAR_15:\n",
"VAR_15.remove('')\n",
"VAR_15 = [''] + VAR_15\n",
"... | [
"def get_final_html_async(target_path):...\n",
"file_temp = files.get_static_data('./static/files.html')\n",
"target_path = decode_hexed_b64_to_str(target_path)\n",
"target_path = '/'\n",
"if not target_path:\n",
"target_path = '/'\n",
"files_hierarchy = target_path.split('/')\n",
"files_hierarchy_lis... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"For",
"AugAssign'",
"Assign'",
"AugAssign'",
"For",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"... |
[
"def FUNC_3(self):...\n",
"VAR_4 = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n",
"VAR_5 = '/api/auth/register'\n",
"VAR_6 = self.client.post(VAR_5, json.dumps(VAR_4), content_type=\n 'application/json')\n",
"self.assertEqual(VAR_6.status_code, 201)\n",
"self.assert... | [
"def test_delete(self):...\n",
"submit = {'username': 'first', 'password': 'password', 'email':\n 'autotest@deis.io'}\n",
"url = '/api/auth/register'\n",
"response = self.client.post(url, json.dumps(submit), content_type=\n 'application/json')\n",
"self.assertEqual(response.status_code, 201)\n",
"se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_7, VAR_9, VAR_10=False):...\n",
"if isinstance(VAR_9, list) and not VAR_10:\n",
"self.__dict__[VAR_7] = []\n",
"self.__dict__[VAR_7] = VAR_9\n",
"self.extend(VAR_7, VAR_9)\n"
] | [
"def set(self, key, value, as_value=False):...\n",
"if isinstance(value, list) and not as_value:\n",
"self.__dict__[key] = []\n",
"self.__dict__[key] = value\n",
"self.extend(key, value)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_18(self):...\n",
"return Category.objects.filter(product__id=self.product_id)\n"
] | [
"def categories(self):...\n",
"return Category.objects.filter(product__id=self.product_id)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self, VAR_8):...\n",
"VAR_13 = ['\\n']\n",
"for row in VAR_8:\n",
"VAR_13.append('When: {}'.format(prettify_date(row[0])))\n",
"return '\\n'.join(VAR_13)\n",
"VAR_13.extend(row[1:])\n",
"VAR_13.append('')\n"
] | [
"def prettify_rows(self, rows):...\n",
"str_builder = ['\\n']\n",
"for row in rows:\n",
"str_builder.append('When: {}'.format(prettify_date(row[0])))\n",
"return '\\n'.join(str_builder)\n",
"str_builder.extend(row[1:])\n",
"str_builder.append('')\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_5='test', VAR_6=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from invenio.modules.oauthclient.client import oauth\n",
"oauth.remote_apps[VAR_5].handle_oauth2_response = MagicMock(return_value=\n data or {'access_token': 'test_access_token', 'scope': '', 'token_type':\n 'bearer'})\n"
] | [
"def mock_response(self, app='test', data=None):...\n",
"\"\"\"docstring\"\"\"\n",
"from invenio.modules.oauthclient.client import oauth\n",
"oauth.remote_apps[app].handle_oauth2_response = MagicMock(return_value=data or\n {'access_token': 'test_access_token', 'scope': '', 'token_type': 'bearer'})\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"Assign'"
] |
[
"def FUNC_2(self, VAR_1, VAR_7, VAR_8, VAR_9, VAR_4=None):...\n",
"if VAR_4 is None:\n",
"VAR_4 = {}\n",
"VAR_29 = super(CLASS_0, self).view_header_get(VAR_1, VAR_7, VAR_8, VAR_9, VAR_4\n )\n",
"if VAR_29:\n",
"return VAR_29\n",
"if VAR_4.get('active_id', False) and VAR_4.get('active_model'\n",
"re... | [
"def view_header_get(self, cr, user, view_id, view_type, context=None):...\n",
"if context is None:\n",
"context = {}\n",
"res = super(product_product, self).view_header_get(cr, user, view_id,\n view_type, context)\n",
"if res:\n",
"return res\n",
"if context.get('active_id', False) and context.get('... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_14(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"return partial(FUNC_5, VAR_1)\n"
] | [
"def make_token_getter(remote):...\n",
"\"\"\"docstring\"\"\"\n",
"return partial(token_getter, remote)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return kato.new_agent(VAR_2)\n"
] | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return kato.new_agent(bindings)\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@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.assertEqual(str(VAR_15), '{}-v3'.format(VAR_11['app']))\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.assertEqual(str(release), '{}-v3'.format(release3['app']))\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_2(VAR_4):...\n",
"VAR_10 = sqlite3.connect(VAR_1)\n",
"VAR_11 = VAR_10.cursor()\n",
"VAR_11.execute('UPDATE UserData SET session_id = NULL WHERE session_id = ?',\n [VAR_4])\n",
"VAR_10.commit()\n",
"VAR_10.close()\n"
] | [
"def logout(session_id):...\n",
"connection = sqlite3.connect(DATABASE_PATH)\n",
"cursor = connection.cursor()\n",
"cursor.execute('UPDATE UserData SET session_id = NULL WHERE session_id = ?',\n [session_id])\n",
"connection.commit()\n",
"connection.close()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(VAR_1):...\n",
"return frappe.db.get_value('Blog Category', {'name': VAR_1}, 'title') or VAR_1\n"
] | [
"def get_blog_category(route):...\n",
"return frappe.db.get_value('Blog Category', {'name': route}, 'title') or route\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_23(self, *VAR_69, **VAR_70):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.output = VAR_69, VAR_70\n",
"return VAR_101\n"
] | [
"def output(self, *paths, **kwpaths):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.output = paths, kwpaths\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_4, VAR_5, VAR_6):...\n",
"VAR_4.parent = VAR_5\n",
"VAR_4.put()\n"
] | [
"def save_message(message, thread, user):...\n",
"message.parent = thread\n",
"message.put()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(VAR_15, VAR_16, VAR_17):...\n",
"qm.RX(VAR_15, [0])\n",
"qm.CNOT([0, 1])\n",
"qm.RY(-1.6, [0])\n",
"qm.RY(VAR_16, [1])\n",
"qm.CNOT([1, 0])\n",
"qm.RX(VAR_17, [0])\n",
"qm.CNOT([0, 1])\n",
"qm.expectation.Hermitian(np.array([[0, 1], [1, 0]]), 0)\n"
] | [
"def node(x, y, z):...\n",
"qm.RX(x, [0])\n",
"qm.CNOT([0, 1])\n",
"qm.RY(-1.6, [0])\n",
"qm.RY(y, [1])\n",
"qm.CNOT([1, 0])\n",
"qm.RX(z, [0])\n",
"qm.CNOT([0, 1])\n",
"qm.expectation.Hermitian(np.array([[0, 1], [1, 0]]), 0)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_7, VAR_9=None):...\n",
"if VAR_9 == None:\n",
"VAR_9 = {}\n",
"if isinstance(VAR_9, (dict, CLASS_0)):\n",
"if not self.__dict__.get(VAR_7):\n",
"if getattr(self, '_metaclass', None) or self.__class__.__name__ in ('Meta',\n",
"self.__dict__[VAR_7] = []\n",
"VAR_9 = self._init_chi... | [
"def append(self, key, value=None):...\n",
"if value == None:\n",
"value = {}\n",
"if isinstance(value, (dict, BaseDocument)):\n",
"if not self.__dict__.get(key):\n",
"if getattr(self, '_metaclass', None) or self.__class__.__name__ in ('Meta',\n",
"self.__dict__[key] = []\n",
"value = self._init_child... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_12(self, VAR_14):...\n",
""
] | [
"def is_numeric(self, col_name):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@VAR_0.route('/statistics')...\n",
"VAR_28 = VAR_1.connection.cursor()\n",
"VAR_28.execute(\n 'SELECT cid FROM Crawls WHERE crawl_date = (SELECT max(crawl_date) FROM Crawls)'\n )\n",
"VAR_29 = VAR_28.fetchone()\n",
"VAR_28.close()\n",
"if VAR_29:\n",
"VAR_49 = VAR_29['cid']\n",
"flash(\n 'Th... | [
"@app.route('/statistics')...\n",
"cur = mysql.connection.cursor()\n",
"cur.execute(\n 'SELECT cid FROM Crawls WHERE crawl_date = (SELECT max(crawl_date) FROM Crawls)'\n )\n",
"result = cur.fetchone()\n",
"cur.close()\n",
"if result:\n",
"cid_last_crawl = result['cid']\n",
"flash(\n 'There ar... | [
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_7(self, VAR_10=None):...\n",
"VAR_25 = VAR_20.path.join(self.parlai_home, 'downloads')\n",
"VAR_26 = self.add_argument_group('Main ParlAI Arguments')\n",
"VAR_26.add_argument('-t', '--task', help=\n 'ParlAI task(s), e.g. \"babi:Task1\" or \"babi,cbt\"')\n",
"VAR_26.add_argument('--download-path... | [
"def add_parlai_args(self, args=None):...\n",
"default_downloads_path = os.path.join(self.parlai_home, 'downloads')\n",
"parlai = self.add_argument_group('Main ParlAI Arguments')\n",
"parlai.add_argument('-t', '--task', help=\n 'ParlAI task(s), e.g. \"babi:Task1\" or \"babi,cbt\"')\n",
"parlai.add_argume... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(self, VAR_2=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_2 is None:\n",
"VAR_2 = self.sensors\n",
"for i, _ in enumerate(VAR_2):\n",
"if random() < 0.01:\n",
"yield 'NULL'\n",
"VAR_3 = gauss(293 + 0.5 * i, 0.1)\n",
"yield f'{VAR_3:.4f}'\n"
] | [
"def read_data(self, sensors=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if sensors is None:\n",
"sensors = self.sensors\n",
"for i, _ in enumerate(sensors):\n",
"if random() < 0.01:\n",
"yield 'NULL'\n",
"value = gauss(293 + 0.5 * i, 0.1)\n",
"yield f'{value:.4f}'\n"
] | [
0,
0,
0,
0,
0,
0,
4,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"from app import database as db\n",
"import pandas as pd\n",
"import re\n",
"import numpy as np\n",
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"db.engine.execute('ALTER TABLE {0} RENAME COLUMN \"{1}\" TO \"{2}\"'.format(\n VAR_0, VAR_1, VAR_2))\n",
"print('RENAMING FAILED: ' + str(e))\n",
"def FUNC_1... | [
"from app import database as db\n",
"import pandas as pd\n",
"import re\n",
"import numpy as np\n",
"def rename_attribute(table_name, column, new_name):...\n",
"db.engine.execute('ALTER TABLE {0} RENAME COLUMN \"{1}\" TO \"{2}\"'.format(\n table_name, column, new_name))\n",
"print('RENAMING FAILED: '... | [
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
4,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Expr'",
"Expr'",
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"FunctionDef'",
"Expr'",
"Docstring",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Co... |
[
"def FUNC_2(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"VAR_1 = {'name': self.volume_name, 'size': 1}\n",
"self.driver._eql_execute('volume', 'create', VAR_1['name'], '%sG' % VAR_1[\n 'size'], 'pool', self.configuration.eqlx_pool, 'thin-provision').AndReturn... | [
"def test_create_volume(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"volume = {'name': self.volume_name, 'size': 1}\n",
"self.driver._eql_execute('volume', 'create', volume['name'], '%sG' % volume\n ['size'], 'pool', self.configuration.eqlx_pool, 'thin-provis... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_14(VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"return FUNC_13(VAR_16)\n"
] | [
"def temporary(value):...\n",
"\"\"\"docstring\"\"\"\n",
"return temp(value)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_1 = '/api/apps'\n",
"VAR_2 = self.client.post(VAR_1)\n",
"self.assertEqual(VAR_2.status_code, 201)\n",
"VAR_3 = VAR_2.data['id']\n",
"VAR_1 = '/api/apps/{app_id}/builds'.format(**locals())\n",
"VAR_4 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n d... | [
"def test_build_chaos(self):...\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",
"body = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile':... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Ass... |
[
"def FUNC_25(self):...\n",
"return False\n"
] | [
"def is_anonymous(self):...\n",
"return False\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_5, VAR_6, VAR_3='NGTREE', VAR_7=True):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = 'CSV', 'TREE', 'JSON', 'YAML', 'NGTREE'\n",
"if VAR_3 in VAR_11:\n",
"VAR_0.info('Query: Finding Switched Paths (%s --> %s) for %s', VAR_5, VAR_6,\n nglib.user)\n",
"return\n",
"VAR_23 = []\n",
"VAR_1... | [
"def get_switched_path(switch1, switch2, rtype='NGTREE', verbose=True):...\n",
"\"\"\"docstring\"\"\"\n",
"rtypes = 'CSV', 'TREE', 'JSON', 'YAML', 'NGTREE'\n",
"if rtype in rtypes:\n",
"logger.info('Query: Finding Switched Paths (%s --> %s) for %s', switch1,\n switch2, nglib.user)\n",
"return\n",
"pa... | [
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Conditi... |
[
"@VAR_1.route('/login', methods=['POST'])...\n",
"VAR_12 = request.form['email']\n",
"VAR_14 = request.form['password']\n",
"VAR_13 = query_user(VAR_12)\n",
"if VAR_13 != None:\n",
"if check_password_hash(VAR_13.password, VAR_14):\n",
"flash('Incorrect Email/Password')\n",
"VAR_18['email'] = VAR_12\n"... | [
"@app.route('/login', methods=['POST'])...\n",
"email = request.form['email']\n",
"password = request.form['password']\n",
"user = query_user(email)\n",
"if user != None:\n",
"if check_password_hash(user.password, password):\n",
"flash('Incorrect Email/Password')\n",
"session['email'] = email\n",
"r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = 'koester@jimmy.harvard.edu'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import re\n",
"import sys\n",
"import inspect\n",
"import sre_constants\n",
"from collections import defaultdict\n",
"f... | [
"__author__ = 'Johannes Köster'\n",
"__copyright__ = 'Copyright 2015, Johannes Köster'\n",
"__email__ = 'koester@jimmy.harvard.edu'\n",
"__license__ = 'MIT'\n",
"import os\n",
"import re\n",
"import sys\n",
"import inspect\n",
"import sre_constants\n",
"from collections import defaultdict\n",
"f... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"FunctionDef... |
[
"def FUNC_24(self, VAR_7, VAR_17):...\n",
"self.common.extend_volume(VAR_7, VAR_17)\n"
] | [
"def extend_volume(self, volume, new_size):...\n",
"self.common.extend_volume(volume, new_size)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self):...\n",
"self.updated_input = set()\n",
"self.updated_input_run = set()\n",
"self.missing_output = set()\n",
"self.incomplete_output = set()\n",
"self.forced = False\n",
"self.noio = False\n",
"self.nooutput = False\n",
"self.derived = True\n"
] | [
"def __init__(self):...\n",
"self.updated_input = set()\n",
"self.updated_input_run = set()\n",
"self.missing_output = set()\n",
"self.incomplete_output = set()\n",
"self.forced = False\n",
"self.noio = False\n",
"self.nooutput = False\n",
"self.derived = True\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_7(VAR_3):...\n",
"if VAR_3 and VAR_3.strip():\n",
"return False\n",
"return True\n"
] | [
"def is_blank(string):...\n",
"if string and string.strip():\n",
"return False\n",
"return True\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"if self.redirected_to is None:\n",
"return None\n",
"VAR_14 = self.redirected_to.split('&')\n",
"if len(VAR_14) != 2:\n",
"VAR_0.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n",
"VAR_21 = decrypt_number(VAR_14[-1])\n",
"VAR_0.warning(\"Unable to de... | [
"def get_user_test_id(self):...\n",
"if self.redirected_to is None:\n",
"return None\n",
"p = self.redirected_to.split('&')\n",
"if len(p) != 2:\n",
"logger.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n",
"user_test_id = decrypt_number(p[-1])\n",
"logger.warning(\"Unable to... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Return'",
"Return'",
"Return'"
] |
[
"def FUNC_1(self, VAR_2, *VAR_5, **VAR_6):...\n",
""
] | [
"def get(self, dataset, *args, **kwargs):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@app.route('/api/images/<type>', methods=['GET'])...\n",
"return FUNC_34(VAR_11).to_map()\n"
] | [
"@app.route('/api/images/<type>', methods=['GET'])...\n",
"return get_image_database(type).to_map()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_7(self):...\n",
"return {}\n"
] | [
"def Response(self):...\n",
"return {}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(VAR_2=0, VAR_3=VAR_0, VAR_4=None, VAR_5={}, VAR_6='INBOX', VAR_7...\n",
"VAR_13 = CLASS_0({'flags': VAR_3, 'mbox_uuid': VAR_6, 'type': 'flags',\n 'uid': VAR_2, 'chash': VAR_8})\n",
"if VAR_4 is None:\n",
"VAR_4 = {}\n",
"if not (VAR_4.get('received') or VAR_4.get('date')):\n",
"VAR_4.update... | [
"def leap_mail(uid=0, flags=LEAP_FLAGS, headers=None, extra_headers={},...\n",
"fdoc = TestDoc({'flags': flags, 'mbox_uuid': mbox_uuid, 'type': 'flags',\n 'uid': uid, 'chash': chash})\n",
"if headers is None:\n",
"headers = {}\n",
"if not (headers.get('received') or headers.get('date')):\n",
"headers.u... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"from odoo import fields, models, _, api, exceptions\n",
"from odoo.addons.base_crapo_workflow.mixins import crapo_automata_mixins\n",
"\"\"\"\n A state used in the context of an automaton\n \"\"\"\n",
"VAR_0 = 'crapo.state'\n",
"VAR_1 = u'State in a workflow, specific to a given model'\n",
"VAR_2 =... | [
"from odoo import fields, models, _, api, exceptions\n",
"from odoo.addons.base_crapo_workflow.mixins import crapo_automata_mixins\n",
"\"\"\"\n A state used in the context of an automaton\n \"\"\"\n",
"_name = 'crapo.state'\n",
"_description = u'State in a workflow, specific to a given model'\n",
"... | [
0,
4,
0,
0,
0,
0,
4,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Docstring",
"Condition",
"Condition",
"Return'",
"Condition",
"Assign'",
"For",
"Expr'"
] |
[
"def FUNC_14(self, VAR_11, VAR_12=None):...\n",
"self.backward_tree = Node(VAR_11)\n",
"self.add_backward_children(self.backward_tree)\n"
] | [
"def build_backward_node_tree(self, oldest_node, parent=None):...\n",
"self.backward_tree = Node(oldest_node)\n",
"self.add_backward_children(self.backward_tree)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_7(self, VAR_11):...\n",
"if VAR_0(VAR_11):\n",
"return 'jsonb'\n",
"return super().db_type(VAR_11)\n"
] | [
"def db_type(self, connection):...\n",
"if is_postgresql(connection):\n",
"return 'jsonb'\n",
"return super().db_type(connection)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_2.route('/wins')...\n",
"if VAR_0 == None:\n",
"FUNC_16()\n",
"VAR_26 = request.args.get('tag', default='christmasmike')\n",
"VAR_8 = \"SELECT * FROM matches WHERE winner = '\" + str(VAR_26\n ) + \"' ORDER BY date DESC;\"\n",
"VAR_27 = VAR_0.exec(VAR_8)\n",
"VAR_27 = [str(x) for x in VAR_27]\n"... | [
"@endpoints.route('/wins')...\n",
"if db == None:\n",
"init()\n",
"player = request.args.get('tag', default='christmasmike')\n",
"sql = \"SELECT * FROM matches WHERE winner = '\" + str(player\n ) + \"' ORDER BY date DESC;\"\n",
"result = db.exec(sql)\n",
"result = [str(x) for x in result]\n",
"resu... | [
0,
0,
0,
0,
4,
4,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@validate(VAR_0=VMeetup('id'), VAR_15=VMenu('controller', CommentSortMenu),...\n",
"VAR_18 = Link._byID(VAR_0.assoc_link)\n",
"VAR_20 = c.user.pref_num_comments or g.num_comments\n",
"VAR_21 = g.max_comments if VAR_16 == 'true' else VAR_20\n",
"VAR_22 = CommentBuilder(VAR_18, CommentSortMenu.operator(VAR_1... | [
"@validate(meetup=VMeetup('id'), sort=VMenu('controller', CommentSortMenu),...\n",
"article = Link._byID(meetup.assoc_link)\n",
"user_num = c.user.pref_num_comments or g.num_comments\n",
"num = g.max_comments if num_comments == 'true' else user_num\n",
"builder = CommentBuilder(article, CommentSortMenu.oper... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Expr'"
] |
[
"def FUNC_5(VAR_9=False, VAR_10=False, VAR_11=True):...\n",
"VAR_15 = FUNC_4()\n",
"if len(VAR_15) == 0:\n",
"if VAR_9:\n",
"VAR_16 = []\n",
"sys.stderr.write('No missing dependencies\\n')\n",
"return 0\n",
"for e in VAR_15:\n",
"VAR_16 += e.deps\n",
"VAR_17 = ' '.join(sorted(VAR_16))\n",
"if VA... | [
"def install_deps(verbosity=False, dry_run=False, allow_daemons=True):...\n",
"errors = find_missing_deps()\n",
"if len(errors) == 0:\n",
"if verbosity:\n",
"missing_pkgs = []\n",
"sys.stderr.write('No missing dependencies\\n')\n",
"return 0\n",
"for e in errors:\n",
"missing_pkgs += e.deps\n",
"d... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"For",
"AugAssign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Return'",
"Assign'"
] |
[
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.CANCEL, *VAR_13, **kwargs)\n"
] | [
"@detail_route(methods=['post'])...\n",
"return self.set_pending_action(pending_actions.CANCEL, *args, **kwargs)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def __init__(self):...\n",
"self.license_files = 0\n",
"self.exception_files = 0\n",
"self.licenses = []\n",
"self.exceptions = {}\n"
] | [
"def __init__(self):...\n",
"self.license_files = 0\n",
"self.exception_files = 0\n",
"self.licenses = []\n",
"self.exceptions = {}\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"import networkx as nx\n",
"import random\n",
"def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4):...\n",
"self.G = nx.Graph()\n",
"self.size = VAR_0\n",
"self.width = VAR_1\n",
"self.keyPoolSize = VAR_2\n",
"self.keysPerNode = VAR_3\n",
"self.commRange = VAR_4\n",
"self.genNodes()\n",
"self.... | [
"import networkx as nx\n",
"import random\n",
"def __init__(self, size, width, keyPoolSize, keysPerNode, commRange):...\n",
"self.G = nx.Graph()\n",
"self.size = size\n",
"self.width = width\n",
"self.keyPoolSize = keyPoolSize\n",
"self.keysPerNode = keysPerNode\n",
"self.commRange = commRange\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"For",
"Expr'",
"FunctionDef'",
"For",
"Expr'",
"FunctionDef'",
"For",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"As... |
[
"def FUNC_4(self, VAR_6, VAR_12, VAR_13):...\n",
"VAR_14 = []\n",
"VAR_14.append('string'.format(VAR_6))\n",
"VAR_14.append('string'.format(VAR_6, VAR_12, VAR_13))\n",
"for query in VAR_14:\n",
"self.cur.execute(query)\n",
"self.conn.commit()\n"
] | [
"def update_attendance(self, username, event_id, attending):...\n",
"sql = []\n",
"sql.append(\n \"\"\"INSERT INTO users (username)\n VALUES ('{0}')\n ON DUPLICATE KEY UPDATE username = '{0}';\n \"\"\"\n .format(username))\n",
"sql.append(\n... | [
0,
0,
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"For",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"self.objects = load_model_objects()\n",
"if settings.TEST_BROWSER == 'firefox':\n",
"self.browser = webdriver.Firefox()\n",
"self.browser = webdriver.Chrome()\n",
"FUNC_0(self)\n"
] | [
"def setUp(self):...\n",
"self.objects = load_model_objects()\n",
"if settings.TEST_BROWSER == 'firefox':\n",
"self.browser = webdriver.Firefox()\n",
"self.browser = webdriver.Chrome()\n",
"log_karyn_in(self)\n"
] | [
0,
0,
6,
6,
6,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_36(VAR_11):...\n",
"for VAR_51, VAR_58 in VAR_11.items():\n",
"if isinstance(VAR_58, str) or not isinstance(VAR_58, Iterable):\n",
"VAR_58 = [VAR_58]\n",
"yield [(VAR_51, VAR_16) for VAR_16 in VAR_58]\n"
] | [
"def flatten(wildcards):...\n",
"for wildcard, values in wildcards.items():\n",
"if isinstance(values, str) or not isinstance(values, Iterable):\n",
"values = [values]\n",
"yield [(wildcard, value) for value in values]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_5(VAR_8):...\n",
"return VAR_14.headers[VAR_8] if VAR_8 in VAR_14.headers else None\n"
] | [
"def get_from_header(field):...\n",
"return response.headers[field] if field in response.headers else None\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"return datetime.now(tz=pytz.utc).astimezone().tzinfo\n"
] | [
"def get_local_timezone(self):...\n",
"return datetime.now(tz=pytz.utc).astimezone().tzinfo\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self, VAR_11, VAR_12=None):...\n",
"self.tree = Node(VAR_11)\n",
"self.add_children(self.tree)\n"
] | [
"def build_node_tree(self, oldest_node, parent=None):...\n",
"self.tree = Node(oldest_node)\n",
"self.add_children(self.tree)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_10(self, VAR_16):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_11 = ['volume', 'select', VAR_16['name'], 'show']\n",
"self._eql_execute(*VAR_11)\n",
"if err.stdout.find('does not exist.\\n') > -1:\n",
"VAR_0.debug(_('Volume %s does not exist, it may have already been deleted'),\n VAR_16['name'])\n"... | [
"def _check_volume(self, volume):...\n",
"\"\"\"docstring\"\"\"\n",
"command = ['volume', 'select', volume['name'], 'show']\n",
"self._eql_execute(*command)\n",
"if err.stdout.find('does not exist.\\n') > -1:\n",
"LOG.debug(_('Volume %s does not exist, it may have already been deleted'),\n volume['name... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self.user = self.make_user()\n",
"self.factory = RequestFactory()\n"
] | [
"def setUp(self):...\n",
"self.user = self.make_user()\n",
"self.factory = RequestFactory()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(self, VAR_10):...\n",
"self.errors = []\n",
"VAR_21 = self.find_oldest_node(self.view.file_name())\n",
"self.tree = Node(VAR_21)\n",
"self.build_node_tree('ROOT -> ' + VAR_21)\n",
"VAR_22 = ''\n",
"for pre, fill, node in RenderTree(self.tree):\n",
"VAR_22 += '%s %s' % (pre, node.name) + '\... | [
"def run(self, edit):...\n",
"self.errors = []\n",
"oldest_known_filename = self.find_oldest_node(self.view.file_name())\n",
"self.tree = Node(oldest_known_filename)\n",
"self.build_node_tree('ROOT -> ' + oldest_known_filename)\n",
"render = ''\n",
"for pre, fill, node in RenderTree(self.tree):\n",
"r... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"For",
"AugAssign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_1=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if __grains__['kernel'] == 'Linux':\n",
"VAR_4 = 'df -P'\n",
"if __grains__['kernel'] == 'OpenBSD':\n",
"if VAR_1:\n",
"VAR_4 = 'df -kP'\n",
"VAR_4 = 'df'\n",
"VAR_4 = VAR_4 + ' -' + VAR_1\n",
"VAR_2 = {}\n",
"VAR_3 = __salt__['cmd.run'... | [
"def usage(args=None):...\n",
"\"\"\"docstring\"\"\"\n",
"if __grains__['kernel'] == 'Linux':\n",
"cmd = 'df -P'\n",
"if __grains__['kernel'] == 'OpenBSD':\n",
"if args:\n",
"cmd = 'df -kP'\n",
"cmd = 'df'\n",
"cmd = cmd + ' -' + args\n",
"ret = {}\n",
"out = __salt__['cmd.run'](cmd).splitlines(... | [
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Ass... |
[
"def __init__(self, VAR_11, VAR_23, VAR_13):...\n",
"self.cname, self.pname, self.ename = VAR_11, VAR_23, VAR_13\n"
] | [
"def __init__(self, cname, pname, ename):...\n",
"self.cname, self.pname, self.ename = cname, pname, ename\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.