lines
sequencelengths
1
383
raw_lines
sequencelengths
1
383
label
sequencelengths
1
383
type
sequencelengths
1
383
[ "def FUNC_48():...\n", "VAR_84 = False\n", "VAR_16 = request.form.to_dict()\n", "VAR_21 = None\n", "VAR_16['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', VAR_16[\n 'config_calibre_dir'], flags=re.IGNORECASE)\n", "VAR_84, VAR_85 = FUNC_47()\n", "ub.session.rollback()\n", "VAR_107 = os.path.join(VAR_16['config_calibre_dir'], 'metadata.db')\n", "return FUNC_51('{}'.format(ex), VAR_21)\n", "if VAR_84 or not VAR_85 or not config.db_configured:\n", "VAR_21 = FUNC_42(VAR_16)\n", "VAR_0.error('Settings DB is not Writeable')\n", "if config.config_use_google_drive and is_gdrive_ready() and not os.path.exists(\n", "if not calibre_db.setup_db(VAR_16['config_calibre_dir'], ub.app_DB_path):\n", "config.save()\n", "FUNC_51(_('Settings DB is not Writeable'), VAR_21)\n", "gdriveutils.downloadFile(None, 'metadata.db', VAR_107)\n", "return FUNC_51(_('DB Location is not Valid, Please Enter Correct Path'), VAR_21\n )\n", "ub.session.query(ub.Downloads).delete()\n", "return FUNC_51(None, VAR_21)\n", "VAR_84 = True\n", "ub.session.query(ub.ArchivedBook).delete()\n", "ub.session.query(ub.ReadBook).delete()\n", "ub.session.query(ub.BookShelf).delete()\n", "ub.session.query(ub.Bookmark).delete()\n", "ub.session.query(ub.KoboReadingState).delete()\n", "ub.session.query(ub.KoboStatistics).delete()\n", "ub.session.query(ub.KoboSyncedBooks).delete()\n", "ub.session_commit()\n", "FUNC_41(VAR_16, 'config_calibre_dir')\n", "calibre_db.update_config(config)\n", "if not os.access(os.path.join(config.config_calibre_dir, 'metadata.db'), os\n", "flash(_(u'DB is not Writeable'), category='warning')\n" ]
[ "def _db_configuration_update_helper():...\n", "db_change = False\n", "to_save = request.form.to_dict()\n", "gdrive_error = None\n", "to_save['config_calibre_dir'] = re.sub('[\\\\\\\\/]metadata\\\\.db$', '', to_save\n ['config_calibre_dir'], flags=re.IGNORECASE)\n", "db_change, db_valid = _db_simulate_change()\n", "ub.session.rollback()\n", "metadata_db = os.path.join(to_save['config_calibre_dir'], 'metadata.db')\n", "return _db_configuration_result('{}'.format(ex), gdrive_error)\n", "if db_change or not db_valid or not config.db_configured:\n", "gdrive_error = _configuration_gdrive_helper(to_save)\n", "log.error('Settings DB is not Writeable')\n", "if config.config_use_google_drive and is_gdrive_ready() and not os.path.exists(\n", "if not calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path):\n", "config.save()\n", "_db_configuration_result(_('Settings DB is not Writeable'), gdrive_error)\n", "gdriveutils.downloadFile(None, 'metadata.db', metadata_db)\n", "return _db_configuration_result(_(\n 'DB Location is not Valid, Please Enter Correct Path'), gdrive_error)\n", "ub.session.query(ub.Downloads).delete()\n", "return _db_configuration_result(None, gdrive_error)\n", "db_change = True\n", "ub.session.query(ub.ArchivedBook).delete()\n", "ub.session.query(ub.ReadBook).delete()\n", "ub.session.query(ub.BookShelf).delete()\n", "ub.session.query(ub.Bookmark).delete()\n", "ub.session.query(ub.KoboReadingState).delete()\n", "ub.session.query(ub.KoboStatistics).delete()\n", "ub.session.query(ub.KoboSyncedBooks).delete()\n", "ub.session_commit()\n", "_config_string(to_save, 'config_calibre_dir')\n", "calibre_db.update_config(config)\n", "if not os.access(os.path.join(config.config_calibre_dir, 'metadata.db'), os\n", "flash(_(u'DB is not Writeable'), category='warning')\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'", "Condition", "Assign'", "Expr'", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Return'", "Expr'", "Return'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "import asyncio\n", "import logging\n", "import os\n", "import pickle\n", "import tarfile\n", "import tempfile\n", "import warnings\n", "import zipfile\n", "import re\n", "from asyncio import AbstractEventLoop\n", "from io import BytesIO as IOReader\n", "from pathlib import Path\n", "from typing import Text, Any, Union, List, Type, Callable, TYPE_CHECKING, Pattern\n", "import rasa.shared.constants\n", "import rasa.shared.utils.io\n", "if TYPE_CHECKING:\n", "from prompt_toolkit.validation import Validator\n", "def FUNC_0(VAR_0: Text) ->None:...\n", "import coloredlogs\n", "VAR_0 = VAR_0 or os.environ.get(rasa.shared.constants.ENV_LOG_LEVEL, rasa.\n shared.constants.DEFAULT_LOG_LEVEL)\n", "VAR_15 = coloredlogs.DEFAULT_FIELD_STYLES.copy()\n", "VAR_15['asctime'] = {}\n", "VAR_16 = coloredlogs.DEFAULT_LEVEL_STYLES.copy()\n", "VAR_16['debug'] = {}\n", "coloredlogs.install(level=loglevel, use_chroot=False, fmt=\n '%(asctime)s %(levelname)-8s %(name)s - %(message)s', VAR_16=\n level_styles, VAR_15=field_styles)\n", "def FUNC_1(VAR_1: AbstractEventLoop, VAR_2: float=0.1) ->AbstractEventLoop:...\n", "logging.info('Enabling coroutine debugging. Loop id {}.'.format(id(asyncio.\n get_event_loop())))\n", "VAR_1.set_debug(True)\n", "VAR_1.slow_callback_duration = VAR_2\n", "warnings.simplefilter('always', ResourceWarning)\n", "return VAR_1\n" ]
[ "import asyncio\n", "import logging\n", "import os\n", "import pickle\n", "import tarfile\n", "import tempfile\n", "import warnings\n", "import zipfile\n", "import re\n", "from asyncio import AbstractEventLoop\n", "from io import BytesIO as IOReader\n", "from pathlib import Path\n", "from typing import Text, Any, Union, List, Type, Callable, TYPE_CHECKING, Pattern\n", "import rasa.shared.constants\n", "import rasa.shared.utils.io\n", "if TYPE_CHECKING:\n", "from prompt_toolkit.validation import Validator\n", "def configure_colored_logging(loglevel: Text) ->None:...\n", "import coloredlogs\n", "loglevel = loglevel or os.environ.get(rasa.shared.constants.ENV_LOG_LEVEL,\n rasa.shared.constants.DEFAULT_LOG_LEVEL)\n", "field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()\n", "field_styles['asctime'] = {}\n", "level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()\n", "level_styles['debug'] = {}\n", "coloredlogs.install(level=loglevel, use_chroot=False, fmt=\n '%(asctime)s %(levelname)-8s %(name)s - %(message)s', level_styles=\n level_styles, field_styles=field_styles)\n", "def enable_async_loop_debugging(event_loop: AbstractEventLoop,...\n", "logging.info('Enabling coroutine debugging. Loop id {}.'.format(id(asyncio.\n get_event_loop())))\n", "event_loop.set_debug(True)\n", "event_loop.slow_callback_duration = slow_callback_duration\n", "warnings.simplefilter('always', ResourceWarning)\n", "return event_loop\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 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Condition", "ImportFrom'", "FunctionDef'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "@FUNC_0...\n", "return EventClientSerializer(self)\n" ]
[ "@cache_in_self...\n", "return EventClientSerializer(self)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_12(self):...\n", "self.register_user('user_admin', 'pass', admin=True)\n", "VAR_8 = self.login('user_admin', 'pass')\n", "VAR_27 = self.register_user('user_nonadmin', 'pass', admin=False)\n", "VAR_22 = self.login('user_nonadmin', 'pass')\n", "VAR_29 = self.helper.upload_media(self.upload_resource, self.image_data,\n tok=non_admin_user_tok)\n", "VAR_30 = self.helper.upload_media(self.upload_resource, self.image_data,\n tok=non_admin_user_tok)\n", "VAR_33 = VAR_29['content_uri'][6:]\n", "VAR_34 = VAR_30['content_uri'][6:]\n", "VAR_0 = '/_synapse/admin/v1/user/%s/media/quarantine' % urllib.parse.quote(\n VAR_27)\n", "VAR_12, VAR_13 = self.make_request('POST', VAR_0.encode('ascii'), VAR_7=\n admin_user_tok)\n", "self.pump(1.0)\n", "self.assertEqual(200, int(VAR_13.result['code']), msg=channel.result['body'])\n", "self.assertEqual(json.loads(VAR_13.result['body'].decode('utf-8')), {\n 'num_quarantined': 2}, 'Expected 2 quarantined items')\n", "self._ensure_quarantined(VAR_8, VAR_33)\n", "self._ensure_quarantined(VAR_8, VAR_34)\n" ]
[ "def test_quarantine_all_media_by_user(self):...\n", "self.register_user('user_admin', 'pass', admin=True)\n", "admin_user_tok = self.login('user_admin', 'pass')\n", "non_admin_user = self.register_user('user_nonadmin', 'pass', admin=False)\n", "non_admin_user_tok = self.login('user_nonadmin', 'pass')\n", "response_1 = self.helper.upload_media(self.upload_resource, self.image_data,\n tok=non_admin_user_tok)\n", "response_2 = self.helper.upload_media(self.upload_resource, self.image_data,\n tok=non_admin_user_tok)\n", "server_and_media_id_1 = response_1['content_uri'][6:]\n", "server_and_media_id_2 = response_2['content_uri'][6:]\n", "url = '/_synapse/admin/v1/user/%s/media/quarantine' % urllib.parse.quote(\n non_admin_user)\n", "request, channel = self.make_request('POST', url.encode('ascii'),\n access_token=admin_user_tok)\n", "self.pump(1.0)\n", "self.assertEqual(200, int(channel.result['code']), msg=channel.result['body'])\n", "self.assertEqual(json.loads(channel.result['body'].decode('utf-8')), {\n 'num_quarantined': 2}, 'Expected 2 quarantined items')\n", "self._ensure_quarantined(admin_user_tok, server_and_media_id_1)\n", "self._ensure_quarantined(admin_user_tok, server_and_media_id_2)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_15(VAR_20):...\n", "\"\"\"docstring\"\"\"\n", "VAR_43 = FUNC_14(VAR_20)\n", "for VAR_71, example_list in VAR_43.items():\n", "if not isinstance(example_list, list):\n", "return VAR_43\n", "VAR_43[VAR_71] = [FUNC_16(VAR_45) for VAR_45 in example_list]\n" ]
[ "def preprocess_input_examples_arg_string(input_examples_str):...\n", "\"\"\"docstring\"\"\"\n", "input_dict = preprocess_input_exprs_arg_string(input_examples_str)\n", "for input_key, example_list in input_dict.items():\n", "if not isinstance(example_list, list):\n", "return input_dict\n", "input_dict[input_key] = [_create_example_string(example) for example in\n example_list]\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Assign'" ]
[ "def FUNC_31(VAR_37, VAR_38):...\n", "if VAR_37[1].get('_key', None) == 'plugin_corewizard_acl':\n", "return f'0:{to_unicode(VAR_37[0])}'\n", "if VAR_37[1].get('mandatory', False):\n", "return f'1:{to_unicode(VAR_37[0])}'\n", "return f'2:{to_unicode(VAR_37[0])}'\n" ]
[ "def wizard_key_extractor(d, k):...\n", "if d[1].get('_key', None) == 'plugin_corewizard_acl':\n", "return f'0:{to_unicode(d[0])}'\n", "if d[1].get('mandatory', False):\n", "return f'1:{to_unicode(d[0])}'\n", "return f'2:{to_unicode(d[0])}'\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Return'" ]
[ "def FUNC_29(self, VAR_76=None):...\n", "super(CLASS_3, self).parse_command_line(VAR_76)\n", "if self.extra_args:\n", "VAR_101 = self.extra_args[0]\n", "VAR_102 = os.path.abspath(VAR_101)\n", "self.argv.remove(VAR_101)\n", "if not os.path.exists(VAR_102):\n", "self.log.critical('No such file or directory: %s', VAR_102)\n", "VAR_103 = Config()\n", "self.exit(1)\n", "if os.path.isdir(VAR_102):\n", "VAR_103.NotebookApp.notebook_dir = VAR_102\n", "if os.path.isfile(VAR_102):\n", "self.update_config(VAR_103)\n", "VAR_103.NotebookApp.file_to_run = VAR_102\n" ]
[ "def parse_command_line(self, argv=None):...\n", "super(NotebookApp, self).parse_command_line(argv)\n", "if self.extra_args:\n", "arg0 = self.extra_args[0]\n", "f = os.path.abspath(arg0)\n", "self.argv.remove(arg0)\n", "if not os.path.exists(f):\n", "self.log.critical('No such file or directory: %s', f)\n", "c = Config()\n", "self.exit(1)\n", "if os.path.isdir(f):\n", "c.NotebookApp.notebook_dir = f\n", "if os.path.isfile(f):\n", "self.update_config(c)\n", "c.NotebookApp.file_to_run = f\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "def __init__(self, *VAR_0, **VAR_1):...\n", "VAR_1.setdefault('label_suffix', '')\n", "self.user = VAR_1.pop('user', None)\n", "self.page = VAR_1.pop('page', None)\n", "super().__init__(*VAR_0, **kwargs)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "kwargs.setdefault('label_suffix', '')\n", "self.user = kwargs.pop('user', None)\n", "self.page = kwargs.pop('page', None)\n", "super().__init__(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)\n" ]
[ "def testDateTimeField(self):...\n", "self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_16(self):...\n", "VAR_27 = np.array([[1], [2]])\n", "VAR_32 = os.path.join(test.get_temp_dir(), 'input.npz')\n", "np.savez(VAR_32, VAR_54=x0)\n", "VAR_21 = 'x=' + VAR_32 + '[a];y=' + VAR_32\n", "VAR_31 = saved_model_cli.load_inputs_from_input_arg_string(VAR_21, '', '')\n", "self.assertTrue(np.all(VAR_31['x'] == VAR_27))\n", "self.assertTrue(np.all(VAR_31['y'] == VAR_27))\n" ]
[ "def testInputParserNPZ(self):...\n", "x0 = np.array([[1], [2]])\n", "input_path = os.path.join(test.get_temp_dir(), 'input.npz')\n", "np.savez(input_path, a=x0)\n", "input_str = 'x=' + input_path + '[a];y=' + input_path\n", "feed_dict = saved_model_cli.load_inputs_from_input_arg_string(input_str, '', ''\n )\n", "self.assertTrue(np.all(feed_dict['x'] == x0))\n", "self.assertTrue(np.all(feed_dict['y'] == x0))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_18(self):...\n", "VAR_5 = self._makeContext()\n", "self.assertTrue(VAR_5.evaluate('x | not:exists:x'))\n" ]
[ "def test_hybrid_with_compound_expression_int_value(self):...\n", "ec = self._makeContext()\n", "self.assertTrue(ec.evaluate('x | not:exists:x'))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@VAR_2.route('/admin')...\n", "abort(403)\n" ]
[ "@admi.route('/admin')...\n", "abort(403)\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_39(VAR_33, VAR_34, VAR_101=None):...\n", "if callable(VAR_64):\n", "if VAR_34 and not isinstance(VAR_34, str):\n", "VAR_143 = VAR_64()\n", "VAR_0.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (VAR_8))\n", "from werkzeug.http import http_date\n", "if VAR_101 is None:\n", "if VAR_143:\n", "VAR_34 = http_date(VAR_34)\n", "VAR_101 = []\n", "import hashlib\n", "return VAR_143\n", "VAR_86 = hashlib.sha1()\n", "def FUNC_32(VAR_87):...\n", "VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n", "FUNC_32(octoprint.__version__)\n", "FUNC_32(get_python_version_string())\n", "FUNC_32(','.join(sorted(VAR_33)))\n", "if VAR_34:\n", "FUNC_32(VAR_34)\n", "for add in VAR_101:\n", "FUNC_32(add)\n", "return VAR_86.hexdigest()\n" ]
[ "def compute_etag(files, lastmodified, additional=None):...\n", "if callable(custom_etag):\n", "if lastmodified and not isinstance(lastmodified, str):\n", "etag = custom_etag()\n", "_logger.exception(\n 'Error while trying to retrieve custom ETag value for plugin {}'.format\n (key))\n", "from werkzeug.http import http_date\n", "if additional is None:\n", "if etag:\n", "lastmodified = http_date(lastmodified)\n", "additional = []\n", "import hashlib\n", "return etag\n", "hash = hashlib.sha1()\n", "def hash_update(value):...\n", "hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n", "hash_update(octoprint.__version__)\n", "hash_update(get_python_version_string())\n", "hash_update(','.join(sorted(files)))\n", "if lastmodified:\n", "hash_update(lastmodified)\n", "for add in additional:\n", "hash_update(add)\n", "return hash.hexdigest()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Assign'", "Expr'", "ImportFrom'", "Condition", "Condition", "Assign'", "Assign'", "Import'", "Return'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "For", "Expr'", "Return'" ]
[ "def FUNC_7(**VAR_12: str) ->str:...\n", "\"\"\"docstring\"\"\"\n", "if g.ledger.fava_options.use_external_editor:\n", "return f\"beancount://{VAR_12.get('file_path')}\" + f\"?lineno={VAR_12.get('line', 1)}\"\n", "return FUNC_6('report', VAR_19='editor', **kwargs)\n" ]
[ "def url_for_source(**kwargs: str) ->str:...\n", "\"\"\"docstring\"\"\"\n", "if g.ledger.fava_options.use_external_editor:\n", "return f\"beancount://{kwargs.get('file_path')}\" + f\"?lineno={kwargs.get('line', 1)}\"\n", "return url_for('report', report_name='editor', **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_8, VAR_9, VAR_4):...\n", "return 1\n" ]
[ "def checkPermission(self, permission, object, context):...\n", "return 1\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(VAR_4, VAR_5, VAR_6):...\n", "VAR_10 = []\n", "for inp_element in VAR_6:\n", "VAR_82 = False\n", "return VAR_10\n", "for c_elements in VAR_4:\n", "if VAR_5 == 'languages':\n", "if not VAR_82:\n", "VAR_101 = c_elements.lang_code\n", "if VAR_5 == 'custom':\n", "VAR_10.append(inp_element)\n", "if inp_element == VAR_101:\n", "VAR_101 = c_elements.value\n", "VAR_101 = c_elements.name\n", "VAR_82 = True\n" ]
[ "def search_objects_add(db_book_object, db_type, input_elements):...\n", "add_elements = []\n", "for inp_element in input_elements:\n", "found = False\n", "return add_elements\n", "for c_elements in db_book_object:\n", "if db_type == 'languages':\n", "if not found:\n", "type_elements = c_elements.lang_code\n", "if db_type == 'custom':\n", "add_elements.append(inp_element)\n", "if inp_element == type_elements:\n", "type_elements = c_elements.value\n", "type_elements = c_elements.name\n", "found = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "For", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_33(self):...\n", "self.parser = saved_model_cli.create_parser()\n", "VAR_9 = test.test_src_dir_path(VAR_0)\n", "VAR_44 = np.array([[1], [2]])\n", "VAR_45 = np.zeros((6, 3))\n", "VAR_31 = os.path.join(test.get_temp_dir(), 'testRunCommandNewOutdir_inputs.npz'\n )\n", "VAR_41 = os.path.join(test.get_temp_dir(), 'new_dir')\n", "if os.path.isdir(VAR_41):\n", "shutil.rmtree(VAR_41)\n", "np.savez(VAR_31, VAR_26=x, VAR_27=x_notused)\n", "VAR_10 = self.parser.parse_args(['run', '--dir', VAR_9, '--tag_set',\n 'serve', '--signature_def', 'serving_default', '--inputs', 'x=' +\n VAR_31 + '[x0]', '--outdir', VAR_41, '--tf_debug'])\n", "def FUNC_38(VAR_47):...\n", "return VAR_47\n" ]
[ "def testRunCommandWithDebuggerEnabled(self):...\n", "self.parser = saved_model_cli.create_parser()\n", "base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n", "x = np.array([[1], [2]])\n", "x_notused = np.zeros((6, 3))\n", "input_path = os.path.join(test.get_temp_dir(),\n 'testRunCommandNewOutdir_inputs.npz')\n", "output_dir = os.path.join(test.get_temp_dir(), 'new_dir')\n", "if os.path.isdir(output_dir):\n", "shutil.rmtree(output_dir)\n", "np.savez(input_path, x0=x, x1=x_notused)\n", "args = self.parser.parse_args(['run', '--dir', base_path, '--tag_set',\n 'serve', '--signature_def', 'serving_default', '--inputs', 'x=' +\n input_path + '[x0]', '--outdir', output_dir, '--tf_debug'])\n", "def fake_wrapper_session(sess):...\n", "return sess\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "FunctionDef'", "Return'" ]
[ "def FUNC_17(VAR_21, VAR_16):...\n", "VAR_59 = [VAR_21.strip()]\n", "VAR_59 = [x for x in VAR_59 if x != '']\n", "return FUNC_7(VAR_59, VAR_16.series, db.Series, calibre_db.session, 'series')\n" ]
[ "def edit_book_series(series, book):...\n", "input_series = [series.strip()]\n", "input_series = [x for x in input_series if x != '']\n", "return modify_database_object(input_series, book.series, db.Series,\n calibre_db.session, 'series')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_25(self, VAR_19, VAR_20, VAR_21) ->int:...\n", "\"\"\"docstring\"\"\"\n", "for sub in self._subscribers:\n", "sub.send(['message', VAR_20, VAR_21])\n", "return len(self._subscribers)\n" ]
[ "def publish(self, conn, channel, msg) ->int:...\n", "\"\"\"docstring\"\"\"\n", "for sub in self._subscribers:\n", "sub.send(['message', channel, msg])\n", "return len(self._subscribers)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'", "Return'" ]
[ "@login_required...\n", "VAR_6 = None\n", "if VAR_2:\n", "VAR_16 = get_object_or_404(VAR_0, VAR_5=user_id)\n", "VAR_7 = VAR_1.user\n", "VAR_6 = {'users': [VAR_16.st.nickname]}\n", "VAR_8 = TopicForPrivateForm(VAR_7=user, data=post_data(request))\n", "VAR_9 = CommentForm(VAR_7=user, data=post_data(request))\n", "VAR_10 = TopicPrivateManyForm(VAR_7=user, data=post_data(request), VAR_6=\n initial)\n", "if is_post(VAR_1) and all([VAR_8.is_valid(), VAR_9.is_valid(), VAR_10.\n", "if not VAR_7.st.update_post_hash(VAR_8.get_topic_hash()):\n", "return render(VAR_1=request, template_name=\n 'spirit/topic/private/publish.html', context={'tform': tform, 'cform':\n cform, 'tpform': tpform})\n", "return redirect(VAR_1.POST.get('next', None) or VAR_8.category.\n get_absolute_url())\n", "VAR_12 = VAR_8.save()\n", "VAR_9.topic = VAR_12\n", "VAR_17 = VAR_9.save()\n", "comment_posted(VAR_17=comment, mentions=None)\n", "VAR_10.topic = VAR_12\n", "VAR_10.save_m2m()\n", "TopicNotification.bulk_create(users=tpform.get_users(), VAR_17=comment)\n", "return redirect(VAR_12.get_absolute_url())\n" ]
[ "@login_required...\n", "initial = None\n", "if user_id:\n", "user_to = get_object_or_404(User, pk=user_id)\n", "user = request.user\n", "initial = {'users': [user_to.st.nickname]}\n", "tform = TopicForPrivateForm(user=user, data=post_data(request))\n", "cform = CommentForm(user=user, data=post_data(request))\n", "tpform = TopicPrivateManyForm(user=user, data=post_data(request), initial=\n initial)\n", "if is_post(request) and all([tform.is_valid(), cform.is_valid(), tpform.\n", "if not user.st.update_post_hash(tform.get_topic_hash()):\n", "return render(request=request, template_name=\n 'spirit/topic/private/publish.html', context={'tform': tform, 'cform':\n cform, 'tpform': tpform})\n", "return redirect(request.POST.get('next', None) or tform.category.\n get_absolute_url())\n", "topic = tform.save()\n", "cform.topic = topic\n", "comment = cform.save()\n", "comment_posted(comment=comment, mentions=None)\n", "tpform.topic = topic\n", "tpform.save_m2m()\n", "TopicNotification.bulk_create(users=tpform.get_users(), comment=comment)\n", "return redirect(topic.get_absolute_url())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Return'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "import configparser\n", "from flask import Flask, render_template, session, request, flash, redirect, url_for, Response, abort, jsonify, send_file\n", "import socket\n", "import os\n", "import random\n", "import copy\n", "from flask_sqlalchemy import SQLAlchemy, Model\n", "import gspread\n", "from oauth2client.service_account import ServiceAccountCredentials\n", "import json\n", "import base64\n", "from collections import namedtuple\n", "from app.common.decorator import return_500_if_errors\n", "VAR_0 = ['https://spreadsheets.google.com/feeds',\n 'https://www.googleapis.com/auth/drive']\n", "VAR_1 = socket.gethostname()\n", "VAR_2 = None\n", "VAR_3 = None\n", "if VAR_1[:7] == 'DESKTOP':\n", "VAR_2 = True\n", "VAR_2 = False\n", "VAR_4 = Flask(__name__)\n", "def FUNC_0():...\n", "VAR_6 = gspread.authorize(VAR_14).open('문학따먹기')\n", "VAR_7 = VAR_6.get_worksheet(0)\n", "VAR_8 = VAR_7.get_all_values()\n", "print(VAR_8)\n", "VAR_16 = []\n", "VAR_3 = VAR_16\n", "for row in VAR_8[1:]:\n", "print(VAR_16)\n", "VAR_31 = namedtuple('Munhak', VAR_8[0])(*row)\n", "return\n", "VAR_31 = VAR_31._replace(keywords=json.loads(row_tuple.keywords))\n", "if VAR_31.is_available == 'TRUE':\n", "VAR_16.append(VAR_31)\n" ]
[ "import configparser\n", "from flask import Flask, render_template, session, request, flash, redirect, url_for, Response, abort, jsonify, send_file\n", "import socket\n", "import os\n", "import random\n", "import copy\n", "from flask_sqlalchemy import SQLAlchemy, Model\n", "import gspread\n", "from oauth2client.service_account import ServiceAccountCredentials\n", "import json\n", "import base64\n", "from collections import namedtuple\n", "from app.common.decorator import return_500_if_errors\n", "scope = ['https://spreadsheets.google.com/feeds',\n 'https://www.googleapis.com/auth/drive']\n", "hostname = socket.gethostname()\n", "isLocal = None\n", "munhak_rows_data = None\n", "if hostname[:7] == 'DESKTOP':\n", "isLocal = True\n", "isLocal = False\n", "app = Flask(__name__)\n", "def update():...\n", "gc = gspread.authorize(credentials).open('문학따먹기')\n", "wks = gc.get_worksheet(0)\n", "rows = wks.get_all_values()\n", "print(rows)\n", "data = []\n", "munhak_rows_data = data\n", "for row in rows[1:]:\n", "print(data)\n", "row_tuple = namedtuple('Munhak', rows[0])(*row)\n", "return\n", "row_tuple = row_tuple._replace(keywords=json.loads(row_tuple.keywords))\n", "if row_tuple.is_available == 'TRUE':\n", "data.append(row_tuple)\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 ]
[ "Import'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "Expr'" ]
[ "def __init__(self):...\n", "self.cookies = {}\n", "self.redirected = False\n", "self.status = '200'\n", "self.headers = {}\n" ]
[ "def __init__(self):...\n", "self.cookies = {}\n", "self.redirected = False\n", "self.status = '200'\n", "self.headers = {}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_11(self):...\n", "VAR_29 = self.helper.create_room_as(self.user_id)\n", "VAR_22, VAR_23 = self.make_request('GET', '/rooms/%s/members' % VAR_29)\n", "self.assertEquals(200, VAR_23.code, msg=channel.result['body'])\n" ]
[ "def test_get_member_list(self):...\n", "room_id = self.helper.create_room_as(self.user_id)\n", "request, channel = self.make_request('GET', '/rooms/%s/members' % room_id)\n", "self.assertEquals(200, channel.code, msg=channel.result['body'])\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_5(VAR_0):...\n", "VAR_8 = VAR_0.MagicMock()\n", "VAR_10 = VAR_0.patch('openapi_python_client._get_project_for_url_or_path',\n return_value=project)\n", "VAR_6 = VAR_0.MagicMock()\n", "VAR_7 = VAR_0.MagicMock()\n", "from openapi_python_client import update_existing_client\n", "VAR_11 = update_existing_client(VAR_6=url, VAR_7=path)\n", "VAR_10.assert_called_once_with(VAR_6=url, VAR_7=path)\n", "VAR_8.update.assert_called_once()\n", "assert VAR_11 == VAR_8.update.return_value\n" ]
[ "def test_update_existing_client(mocker):...\n", "project = mocker.MagicMock()\n", "_get_project_for_url_or_path = mocker.patch(\n 'openapi_python_client._get_project_for_url_or_path', return_value=project)\n", "url = mocker.MagicMock()\n", "path = mocker.MagicMock()\n", "from openapi_python_client import update_existing_client\n", "result = update_existing_client(url=url, path=path)\n", "_get_project_for_url_or_path.assert_called_once_with(url=url, path=path)\n", "project.update.assert_called_once()\n", "assert result == project.update.return_value\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Assign'", "Expr'", "Expr'", "Assert'" ]
[ "def FUNC_1(VAR_8, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_8.user.has_perm('translation.add', VAR_9):\n", "if VAR_8.user.has_perm('translation.add_more', VAR_9):\n", "return CLASS_26\n", "return CLASS_27\n" ]
[ "def get_new_language_form(request, component):...\n", "\"\"\"docstring\"\"\"\n", "if not request.user.has_perm('translation.add', component):\n", "if request.user.has_perm('translation.add_more', component):\n", "return NewLanguageOwnerForm\n", "return NewLanguageForm\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_173(VAR_445):...\n", "return A(VAR_445, _href=URL(args='_search', vars=dict(q=t)))\n" ]
[ "def link(t):...\n", "return A(t, _href=URL(args='_search', vars=dict(q=t)))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_5(self, VAR_5, VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_9 = self._s3_create(VAR_5, VAR_10)\n", "return VAR_9\n" ]
[ "def create(self, context, metadata, data=None):...\n", "\"\"\"docstring\"\"\"\n", "image = self._s3_create(context, metadata)\n", "return image\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_0(self):...\n", "from openapi_python_client.parser.properties import Property\n", "VAR_4 = Property(VAR_5='test', VAR_26=True, default=None)\n", "VAR_4._type_string = 'TestType'\n", "assert VAR_4.get_type_string() == 'TestType'\n", "VAR_4.required = False\n", "assert VAR_4.get_type_string() == 'Optional[TestType]'\n" ]
[ "def test_get_type_string(self):...\n", "from openapi_python_client.parser.properties import Property\n", "p = Property(name='test', required=True, default=None)\n", "p._type_string = 'TestType'\n", "assert p.get_type_string() == 'TestType'\n", "p.required = False\n", "assert p.get_type_string() == 'Optional[TestType]'\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Assign'", "Assign'", "Assert'", "Assign'", "Assert'" ]
[ "def FUNC_77():...\n", "return '/rooms/%s/send/m.room.message/mid%s' % (self.created_rmid, str(next\n (VAR_25)))\n" ]
[ "def send_msg_path():...\n", "return '/rooms/%s/send/m.room.message/mid%s' % (self.created_rmid, str(next\n (seq)))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_11(self, VAR_44):...\n", "\"\"\"docstring\"\"\"\n", "self.tokens.append({'type': 'heading', 'level': 1 if VAR_44.group(2) == '='\n else 2, 'text': VAR_44.group(1)})\n" ]
[ "def parse_lheading(self, m):...\n", "\"\"\"docstring\"\"\"\n", "self.tokens.append({'type': 'heading', 'level': 1 if m.group(2) == '=' else\n 2, 'text': m.group(1)})\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_20(self):...\n", "assert join('/', 'foo', None, 'bar', '', 'baz') == '/foo/bar/baz'\n" ]
[ "def test_it_works_with_partially_valid_input(self):...\n", "assert join('/', 'foo', None, 'bar', '', 'baz') == '/foo/bar/baz'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assert'" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "VAR_184 = VAR_2.GET.get('format', None)\n", "if VAR_184 is not None:\n", "VAR_191 = VAR_350('download_as')\n", "VAR_191 = VAR_350('archived_files')\n", "VAR_303 = 'Export_as_%s' % VAR_184\n", "VAR_303 = 'OriginalFileDownload'\n", "VAR_185 = VAR_2.GET.get('ids')\n", "VAR_186 = VAR_2.GET.get('name', VAR_303)\n", "VAR_186 = os.path.basename(VAR_186)\n", "if VAR_185 is None:\n", "VAR_187 = VAR_185.split('|')\n", "VAR_188 = []\n", "VAR_189 = 0\n", "VAR_190 = 0\n", "if VAR_184 is None:\n", "VAR_304 = []\n", "VAR_189 = len(VAR_187)\n", "VAR_214 = []\n", "VAR_176 = '&'.join([_id.replace('-', '=') for _id in VAR_187])\n", "for VAR_318 in VAR_187:\n", "VAR_191 = VAR_191 + '?' + VAR_176\n", "if VAR_318.split('-')[0] == 'image':\n", "VAR_106 = []\n", "if VAR_184 is not None:\n", "VAR_304.append(VAR_318.split('-')[1])\n", "if VAR_318.split('-')[0] == 'well':\n", "if VAR_304:\n", "VAR_191 = VAR_191 + '&format=%s' % VAR_184\n", "VAR_53 = {'template': 'webclient/annotations/download_placeholder.html',\n 'url': VAR_191, 'defaultName': VAR_186, 'fileLists': VAR_188,\n 'fileCount': VAR_189, 'filesTotalSize': VAR_190}\n", "VAR_214.append(VAR_318.split('-')[1])\n", "VAR_106 = list(VAR_5.getObjects('Image', VAR_304))\n", "if len(VAR_106) == 0:\n", "if VAR_190 > settings.MAXIMUM_MULTIFILE_DOWNLOAD_ZIP_SIZE:\n", "VAR_305 = set()\n", "VAR_53['downloadTooLarge'] = settings.MAXIMUM_MULTIFILE_DOWNLOAD_ZIP_SIZE\n", "return VAR_53\n", "VAR_306 = set()\n", "for VAR_142 in VAR_106:\n", "VAR_365 = VAR_142.getFileset()\n", "VAR_189 = sum([len(VAR_366) for VAR_366 in VAR_188])\n", "if VAR_365 is not None:\n", "if VAR_365.id in VAR_305:\n", "VAR_284 = list(VAR_142.getImportedImageFiles())\n", "VAR_305.add(VAR_365.id)\n", "VAR_366 = []\n", "for f in VAR_284:\n", "if f.id in VAR_306:\n", "if len(VAR_366) > 0:\n", "VAR_306.add(f.id)\n", "VAR_188.append(VAR_366)\n", "VAR_366.append({'id': f.id, 'name': f.name, 'size': f.getSize()})\n", "VAR_190 += f.getSize()\n" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "format = request.GET.get('format', None)\n", "if format is not None:\n", "download_url = reverse('download_as')\n", "download_url = reverse('archived_files')\n", "zipName = 'Export_as_%s' % format\n", "zipName = 'OriginalFileDownload'\n", "targetIds = request.GET.get('ids')\n", "defaultName = request.GET.get('name', zipName)\n", "defaultName = os.path.basename(defaultName)\n", "if targetIds is None:\n", "ids = targetIds.split('|')\n", "fileLists = []\n", "fileCount = 0\n", "filesTotalSize = 0\n", "if format is None:\n", "imgIds = []\n", "fileCount = len(ids)\n", "wellIds = []\n", "query = '&'.join([_id.replace('-', '=') for _id in ids])\n", "for i in ids:\n", "download_url = download_url + '?' + query\n", "if i.split('-')[0] == 'image':\n", "images = []\n", "if format is not None:\n", "imgIds.append(i.split('-')[1])\n", "if i.split('-')[0] == 'well':\n", "if imgIds:\n", "download_url = download_url + '&format=%s' % format\n", "context = {'template': 'webclient/annotations/download_placeholder.html',\n 'url': download_url, 'defaultName': defaultName, 'fileLists': fileLists,\n 'fileCount': fileCount, 'filesTotalSize': filesTotalSize}\n", "wellIds.append(i.split('-')[1])\n", "images = list(conn.getObjects('Image', imgIds))\n", "if len(images) == 0:\n", "if filesTotalSize > settings.MAXIMUM_MULTIFILE_DOWNLOAD_ZIP_SIZE:\n", "fsIds = set()\n", "context['downloadTooLarge'] = settings.MAXIMUM_MULTIFILE_DOWNLOAD_ZIP_SIZE\n", "return context\n", "fileIds = set()\n", "for image in images:\n", "fs = image.getFileset()\n", "fileCount = sum([len(fList) for fList in fileLists])\n", "if fs is not None:\n", "if fs.id in fsIds:\n", "files = list(image.getImportedImageFiles())\n", "fsIds.add(fs.id)\n", "fList = []\n", "for f in files:\n", "if f.id in fileIds:\n", "if len(fList) > 0:\n", "fileIds.add(f.id)\n", "fileLists.append(fList)\n", "fList.append({'id': f.id, 'name': f.name, 'size': f.getSize()})\n", "filesTotalSize += f.getSize()\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Return'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Expr'", "Assign'", "For", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "AugAssign'" ]
[ "def __init__(self, *VAR_6, **VAR_7):...\n", "VAR_7['auto_id'] = 'id_zipcreate_%s'\n", "super().__init__(*VAR_6, **kwargs)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "kwargs['auto_id'] = 'id_zipcreate_%s'\n", "super().__init__(*args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_12(VAR_1):...\n", "VAR_12 = VAR_1.bind\n", "FUNC_6(VAR_12, VAR_1)\n", "FUNC_7(VAR_12, VAR_1)\n", "FUNC_10(VAR_12, VAR_1)\n", "FUNC_11(VAR_12, VAR_1)\n", "FUNC_9(VAR_12, VAR_1)\n", "VAR_89 = False\n", "conn.execute('ALTER TABLE user ADD column `sidebar_view` Integer DEFAULT 1')\n", "if VAR_89:\n", "conn.execute('string', {'side_random': constants.SIDEBAR_RANDOM,\n 'side_lang': constants.SIDEBAR_LANGUAGE, 'side_series': constants.\n SIDEBAR_SERIES, 'side_category': constants.SIDEBAR_CATEGORY, 'side_hot':\n constants.SIDEBAR_HOT, 'side_autor': constants.SIDEBAR_AUTHOR,\n 'detail_random': constants.DETAIL_RANDOM})\n", "VAR_1.query(exists().where(CLASS_1.denied_tags)).scalar()\n", "conn.execute(\"ALTER TABLE user ADD column `denied_tags` String DEFAULT ''\")\n", "VAR_1.query(exists().where(CLASS_1.view_settings)).scalar()\n", "conn.execute(\n \"ALTER TABLE user ADD column `view_settings` VARCHAR(10) DEFAULT '{}'\")\n", "VAR_1.query(exists().where(CLASS_1.kobo_only_shelves_sync)).scalar()\n", "conn.execute(\n 'ALTER TABLE user ADD column `kobo_only_shelves_sync` SMALLINT DEFAULT 0')\n", "VAR_1.query(exists().where(CLASS_1.name)).scalar()\n", "conn.execute(text('string'))\n", "if VAR_1.query(CLASS_1).filter(CLASS_1.role.op('&')(constants.\n", "VAR_1.query(exists().where(CLASS_1.sidebar_view)).scalar()\n", "VAR_1.commit()\n", "conn.execute('SELECT language_books FROM user')\n", "VAR_1.commit()\n", "conn.execute(\"ALTER TABLE user ADD column `allowed_tags` String DEFAULT ''\")\n", "VAR_1.commit()\n", "VAR_1.commit()\n", "conn.execute(text('string'))\n", "FUNC_16(VAR_1)\n", "FUNC_8(VAR_12)\n", "VAR_89 = True\n", "VAR_1.commit()\n", "conn.execute(\n \"ALTER TABLE user ADD column `denied_column_value` String DEFAULT ''\")\n", "conn.execute(text('DROP TABLE user'))\n", "conn.execute(\n \"ALTER TABLE user ADD column `allowed_column_value` String DEFAULT ''\")\n", "conn.execute(text('ALTER TABLE user_id RENAME TO user'))\n", "VAR_1.commit()\n", "VAR_1.commit()\n" ]
[ "def migrate_Database(session):...\n", "engine = session.bind\n", "add_missing_tables(engine, session)\n", "migrate_registration_table(engine, session)\n", "migrate_readBook(engine, session)\n", "migrate_remoteAuthToken(engine, session)\n", "migrate_shelfs(engine, session)\n", "create = False\n", "conn.execute('ALTER TABLE user ADD column `sidebar_view` Integer DEFAULT 1')\n", "if create:\n", "conn.execute(\n \"UPDATE user SET 'sidebar_view' = (random_books* :side_random + language_books * :side_lang + series_books * :side_series + category_books * :side_category + hot_books * :side_hot + :side_autor + :detail_random)\"\n , {'side_random': constants.SIDEBAR_RANDOM, 'side_lang': constants.\n SIDEBAR_LANGUAGE, 'side_series': constants.SIDEBAR_SERIES,\n 'side_category': constants.SIDEBAR_CATEGORY, 'side_hot': constants.\n SIDEBAR_HOT, 'side_autor': constants.SIDEBAR_AUTHOR, 'detail_random':\n constants.DETAIL_RANDOM})\n", "session.query(exists().where(User.denied_tags)).scalar()\n", "conn.execute(\"ALTER TABLE user ADD column `denied_tags` String DEFAULT ''\")\n", "session.query(exists().where(User.view_settings)).scalar()\n", "conn.execute(\n \"ALTER TABLE user ADD column `view_settings` VARCHAR(10) DEFAULT '{}'\")\n", "session.query(exists().where(User.kobo_only_shelves_sync)).scalar()\n", "conn.execute(\n 'ALTER TABLE user ADD column `kobo_only_shelves_sync` SMALLINT DEFAULT 0')\n", "session.query(exists().where(User.name)).scalar()\n", "conn.execute(text(\n 'CREATE TABLE user_id (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,name VARCHAR(64),email VARCHAR(120),role SMALLINT,password VARCHAR,kindle_mail VARCHAR(120),locale VARCHAR(2),sidebar_view INTEGER,default_language VARCHAR(3),denied_tags VARCHAR,allowed_tags VARCHAR,denied_column_value VARCHAR,allowed_column_value VARCHAR,view_settings JSON,kobo_only_shelves_sync SMALLINT,UNIQUE (name),UNIQUE (email))'\n ))\n", "if session.query(User).filter(User.role.op('&')(constants.ROLE_ANONYMOUS) ==\n", "session.query(exists().where(User.sidebar_view)).scalar()\n", "session.commit()\n", "conn.execute('SELECT language_books FROM user')\n", "session.commit()\n", "conn.execute(\"ALTER TABLE user ADD column `allowed_tags` String DEFAULT ''\")\n", "session.commit()\n", "session.commit()\n", "conn.execute(text(\n 'INSERT INTO user_id(id, name, email, role, password, kindle_mail,locale,sidebar_view, default_language, denied_tags, allowed_tags, denied_column_value, allowed_column_value, view_settings, kobo_only_shelves_sync)SELECT id, nickname, email, role, password, kindle_mail, locale,sidebar_view, default_language, denied_tags, allowed_tags, denied_column_value, allowed_column_value, view_settings, kobo_only_shelves_sync FROM user'\n ))\n", "create_anonymous_user(session)\n", "migrate_guest_password(engine)\n", "create = True\n", "session.commit()\n", "conn.execute(\n \"ALTER TABLE user ADD column `denied_column_value` String DEFAULT ''\")\n", "conn.execute(text('DROP TABLE user'))\n", "conn.execute(\n \"ALTER TABLE user ADD column `allowed_column_value` String DEFAULT ''\")\n", "conn.execute(text('ALTER TABLE user_id RENAME TO user'))\n", "session.commit()\n", "session.commit()\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, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_65(self, VAR_13, VAR_74):...\n", "\"\"\"docstring\"\"\"\n", "VAR_64 = (\n '<sup class=\"footnote-ref\" id=\"fnref-%s\"><a href=\"#fn-%s\">%d</a></sup>' %\n (VAR_19(VAR_13), VAR_19(VAR_13), VAR_74))\n", "return VAR_64\n" ]
[ "def footnote_ref(self, key, index):...\n", "\"\"\"docstring\"\"\"\n", "html = (\n '<sup class=\"footnote-ref\" id=\"fnref-%s\"><a href=\"#fn-%s\">%d</a></sup>' %\n (escape(key), escape(key), index))\n", "return html\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_18, VAR_19=0):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_18, MultiValueDict):\n", "VAR_18 = VAR_18.lists()\n", "if hasattr(VAR_18, 'items'):\n", "return urllib_parse.urlencode([(force_str(k), [force_str(VAR_23) for VAR_23 in\n v] if isinstance(v, (list, tuple)) else force_str(v)) for k, v in\n VAR_18], VAR_19)\n", "VAR_18 = VAR_18.items()\n" ]
[ "def urlencode(query, doseq=0):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(query, MultiValueDict):\n", "query = query.lists()\n", "if hasattr(query, 'items'):\n", "return urllib_parse.urlencode([(force_str(k), [force_str(i) for i in v] if\n isinstance(v, (list, tuple)) else force_str(v)) for k, v in query], doseq)\n", "query = query.items()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Return'", "Assign'" ]
[ "from __future__ import absolute_import\n", "import cgi\n", "import email.utils\n", "import json\n", "import logging\n", "import mimetypes\n", "import os\n", "import platform\n", "import re\n", "import shutil\n", "import sys\n", "from pip._vendor import requests, urllib3\n", "from pip._vendor.cachecontrol import CacheControlAdapter\n", "from pip._vendor.cachecontrol.caches import FileCache\n", "from pip._vendor.lockfile import LockError\n", "from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter\n", "from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth\n", "from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response\n", "from pip._vendor.requests.structures import CaseInsensitiveDict\n", "from pip._vendor.requests.utils import get_netrc_auth\n", "from pip._vendor.six.moves import xmlrpc_client\n", "from pip._vendor.six.moves.urllib import parse as urllib_parse\n", "from pip._vendor.six.moves.urllib import request as urllib_request\n", "from pip._vendor.urllib3.util import IS_PYOPENSSL\n", "import pip\n", "from pip._internal.exceptions import HashMismatch, InstallationError\n", "from pip._internal.locations import write_delete_marker_file\n", "from pip._internal.models.index import PyPI\n", "from pip._internal.utils.encoding import auto_decode\n", "from pip._internal.utils.filesystem import check_path_owner\n", "from pip._internal.utils.glibc import libc_ver\n", "from pip._internal.utils.misc import ARCHIVE_EXTENSIONS, ask, ask_input, ask_password, ask_path_exists, backup_dir, consume, display_path, format_size, get_installed_version, path_to_url, remove_auth_from_url, rmtree, split_auth_netloc_from_url, splitext, unpack_file\n", "from pip._internal.utils.temp_dir import TempDirectory\n", "from pip._internal.utils.typing import MYPY_CHECK_RUNNING\n", "from pip._internal.utils.ui import DownloadProgressProvider\n", "from pip._internal.vcs import vcs\n", "if MYPY_CHECK_RUNNING:\n", "from typing import Optional, Tuple, Dict, IO, Text, Union\n", "import ssl\n", "VAR_68 = None\n", "VAR_0 = VAR_68 is not None or IS_PYOPENSSL\n", "from optparse import Values\n", "__all__ = ['get_file_content', 'is_url', 'url_to_path', 'path_to_url',\n 'is_archive_file', 'unpack_vcs_link', 'unpack_file_url', 'is_vcs_url',\n 'is_file_url', 'unpack_http_url', 'unpack_url']\n", "from pip._internal.models.link import Link\n", "VAR_1 = logging.getLogger(__name__)\n", "from pip._internal.utils.hashes import Hashes\n", "import keyring\n", "VAR_69 = None\n", "VAR_2 = 'BUILD_BUILDID', 'BUILD_ID', 'CI', 'PIP_IS_CI'\n", "from pip._internal.vcs.versioncontrol import AuthInfo, VersionControl\n", "VAR_1.warning('Keyring is skipped due to an exception: %s', str(exc))\n", "def FUNC_0():...\n", "VAR_69 = None\n", "\"\"\"docstring\"\"\"\n", "return any(VAR_9 in os.environ for VAR_9 in VAR_2)\n" ]
[ "from __future__ import absolute_import\n", "import cgi\n", "import email.utils\n", "import json\n", "import logging\n", "import mimetypes\n", "import os\n", "import platform\n", "import re\n", "import shutil\n", "import sys\n", "from pip._vendor import requests, urllib3\n", "from pip._vendor.cachecontrol import CacheControlAdapter\n", "from pip._vendor.cachecontrol.caches import FileCache\n", "from pip._vendor.lockfile import LockError\n", "from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter\n", "from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth\n", "from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response\n", "from pip._vendor.requests.structures import CaseInsensitiveDict\n", "from pip._vendor.requests.utils import get_netrc_auth\n", "from pip._vendor.six.moves import xmlrpc_client\n", "from pip._vendor.six.moves.urllib import parse as urllib_parse\n", "from pip._vendor.six.moves.urllib import request as urllib_request\n", "from pip._vendor.urllib3.util import IS_PYOPENSSL\n", "import pip\n", "from pip._internal.exceptions import HashMismatch, InstallationError\n", "from pip._internal.locations import write_delete_marker_file\n", "from pip._internal.models.index import PyPI\n", "from pip._internal.utils.encoding import auto_decode\n", "from pip._internal.utils.filesystem import check_path_owner\n", "from pip._internal.utils.glibc import libc_ver\n", "from pip._internal.utils.misc import ARCHIVE_EXTENSIONS, ask, ask_input, ask_password, ask_path_exists, backup_dir, consume, display_path, format_size, get_installed_version, path_to_url, remove_auth_from_url, rmtree, split_auth_netloc_from_url, splitext, unpack_file\n", "from pip._internal.utils.temp_dir import TempDirectory\n", "from pip._internal.utils.typing import MYPY_CHECK_RUNNING\n", "from pip._internal.utils.ui import DownloadProgressProvider\n", "from pip._internal.vcs import vcs\n", "if MYPY_CHECK_RUNNING:\n", "from typing import Optional, Tuple, Dict, IO, Text, Union\n", "import ssl\n", "ssl = None\n", "HAS_TLS = ssl is not None or IS_PYOPENSSL\n", "from optparse import Values\n", "__all__ = ['get_file_content', 'is_url', 'url_to_path', 'path_to_url',\n 'is_archive_file', 'unpack_vcs_link', 'unpack_file_url', 'is_vcs_url',\n 'is_file_url', 'unpack_http_url', 'unpack_url']\n", "from pip._internal.models.link import Link\n", "logger = logging.getLogger(__name__)\n", "from pip._internal.utils.hashes import Hashes\n", "import keyring\n", "keyring = None\n", "CI_ENVIRONMENT_VARIABLES = 'BUILD_BUILDID', 'BUILD_ID', 'CI', 'PIP_IS_CI'\n", "from pip._internal.vcs.versioncontrol import AuthInfo, VersionControl\n", "logger.warning('Keyring is skipped due to an exception: %s', str(exc))\n", "def looks_like_ci():...\n", "keyring = None\n", "\"\"\"docstring\"\"\"\n", "return any(name in os.environ for name in CI_ENVIRONMENT_VARIABLES)\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, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "ImportFrom'", "Import'", "Assign'", "Assign'", "ImportFrom'", "Assign'", "ImportFrom'", "Assign'", "ImportFrom'", "Import'", "Assign'", "Assign'", "ImportFrom'", "Expr'", "FunctionDef'", "Assign'", "Docstring", "Return'" ]
[ "def FUNC_18(VAR_22):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_22.all:\n", "FUNC_8(VAR_22.dir)\n", "if VAR_22.tag_set is None:\n", "FUNC_0(VAR_22.dir)\n", "if VAR_22.signature_def is None:\n", "FUNC_1(VAR_22.dir, VAR_22.tag_set)\n", "FUNC_4(VAR_22.dir, VAR_22.tag_set, VAR_22.signature_def)\n" ]
[ "def show(args):...\n", "\"\"\"docstring\"\"\"\n", "if args.all:\n", "_show_all(args.dir)\n", "if args.tag_set is None:\n", "_show_tag_sets(args.dir)\n", "if args.signature_def is None:\n", "_show_signature_def_map_keys(args.dir, args.tag_set)\n", "_show_inputs_outputs(args.dir, args.tag_set, args.signature_def)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "async def FUNC_7(self, VAR_3: str, VAR_4: str) ->Tuple[Optional[Responder],...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = await self.store.get_cached_remote_media(VAR_3, VAR_4)\n", "if VAR_28:\n", "VAR_18 = VAR_28['filesystem_id']\n", "VAR_28 = await self._download_remote_file(VAR_3, VAR_4)\n", "VAR_28 = await self.store.get_cached_remote_media(VAR_3, VAR_4)\n", "VAR_18 = VAR_28['filesystem_id']\n", "VAR_26 = FileInfo(VAR_3, VAR_18)\n", "if not VAR_28:\n", "VAR_26 = FileInfo(VAR_3, VAR_18)\n", "if VAR_28['quarantined_by']:\n", "await self._generate_thumbnails(VAR_3, VAR_4, VAR_18, VAR_28['media_type'])\n", "VAR_0.info('Media is quarantined')\n", "VAR_30 = await self.media_storage.fetch_media(VAR_26)\n", "VAR_30 = await self.media_storage.fetch_media(VAR_26)\n", "if VAR_30:\n", "return VAR_30, VAR_28\n", "return VAR_30, VAR_28\n" ]
[ "async def _get_remote_media_impl(self, server_name: str, media_id: str...\n", "\"\"\"docstring\"\"\"\n", "media_info = await self.store.get_cached_remote_media(server_name, media_id)\n", "if media_info:\n", "file_id = media_info['filesystem_id']\n", "media_info = await self._download_remote_file(server_name, media_id)\n", "media_info = await self.store.get_cached_remote_media(server_name, media_id)\n", "file_id = media_info['filesystem_id']\n", "file_info = FileInfo(server_name, file_id)\n", "if not media_info:\n", "file_info = FileInfo(server_name, file_id)\n", "if media_info['quarantined_by']:\n", "await self._generate_thumbnails(server_name, media_id, file_id, media_info[\n 'media_type'])\n", "logger.info('Media is quarantined')\n", "responder = await self.media_storage.fetch_media(file_info)\n", "responder = await self.media_storage.fetch_media(file_info)\n", "if responder:\n", "return responder, media_info\n", "return responder, media_info\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_58(VAR_21: str, VAR_22: str, **VAR_23):...\n", "\"\"\"docstring\"\"\"\n", "VAR_76 = f\"http://localhost:{VAR_0.config['INTERNAL_PORT']}\"\n", "if VAR_22 not in ['get', 'post', 'put', 'delete']:\n", "VAR_77 = getattr(requests, VAR_22)(VAR_76 + VAR_21, **kwargs)\n", "if VAR_77.status_code != 200:\n", "return VAR_77.json()\n" ]
[ "def query_internal_api(route: str, method: str, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "INTERNAL_URL = f\"http://localhost:{gui.config['INTERNAL_PORT']}\"\n", "if method not in ['get', 'post', 'put', 'delete']:\n", "res = getattr(requests, method)(INTERNAL_URL + route, **kwargs)\n", "if res.status_code != 200:\n", "return res.json()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Condition", "Return'" ]
[ "def __repr__(self):...\n", "return '<Download %r' % self.book_id\n" ]
[ "def __repr__(self):...\n", "return '<Download %r' % self.book_id\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_13(VAR_30):...\n", "VAR_33 = VAR_30.group(1)\n", "if VAR_33.startswith('0x'):\n", "VAR_36 = int(VAR_33, 16)\n", "if VAR_33.startswith('0') and '.' not in VAR_33:\n", "VAR_13 = complex(VAR_36)\n", "VAR_36 = float(VAR_33)\n", "VAR_36 = int(VAR_33, 8)\n", "VAR_36 = int(VAR_33)\n", "if VAR_13.imag == 0:\n", "VAR_13 = VAR_13.real\n", "return str(VAR_13)\n", "return '%.16f' % VAR_13\n" ]
[ "def handleMatch(m):...\n", "s = m.group(1)\n", "if s.startswith('0x'):\n", "i = int(s, 16)\n", "if s.startswith('0') and '.' not in s:\n", "x = complex(i)\n", "i = float(s)\n", "i = int(s, 8)\n", "i = int(s)\n", "if x.imag == 0:\n", "x = x.real\n", "return str(x)\n", "return '%.16f' % x\n" ]
[ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Return'" ]
[ "def FUNC_9(self, VAR_13: str) ->bool:...\n", "return VAR_13.split(':', 1)[1] == self.hostname\n" ]
[ "def is_mine_id(self, string: str) ->bool:...\n", "return string.split(':', 1)[1] == self.hostname\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(self, VAR_9, VAR_10, **VAR_4):...\n", "self.layout.move_row_to_index(VAR_9, VAR_10)\n", "self.save_layout()\n" ]
[ "def dispatch_move_row_to_index(self, from_y, to_y, **kwargs):...\n", "self.layout.move_row_to_index(from_y, to_y)\n", "self.save_layout()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_14(self):...\n", "VAR_5 = self._makeContext()\n", "self.assertEqual(VAR_5.evaluate('x | python:1+1'), 2)\n" ]
[ "def test_hybrid_with_python_expression_int_value(self):...\n", "ec = self._makeContext()\n", "self.assertEqual(ec.evaluate('x | python:1+1'), 2)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "@VAR_2.route('/read/<int:book_id>/<book_format>')...\n", "VAR_95 = calibre_db.get_filtered_book(VAR_5)\n", "if not VAR_95:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "VAR_99 = None\n", "VAR_3.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n", "if VAR_87.is_authenticated:\n", "return redirect(url_for('web.index'))\n", "VAR_99 = ub.session.query(ub.Bookmark).filter(and_(ub.Bookmark.user_id ==\n int(VAR_87.id), ub.Bookmark.book_id == VAR_5, ub.Bookmark.format ==\n VAR_6.upper())).first()\n", "if VAR_6.lower() == 'epub':\n", "VAR_3.debug(u'Start epub reader for %d', VAR_5)\n", "if VAR_6.lower() == 'pdf':\n", "return render_title_template('read.html', bookid=book_id, VAR_150=book.\n title, VAR_99=bookmark)\n", "VAR_3.debug(u'Start pdf reader for %d', VAR_5)\n", "if VAR_6.lower() == 'txt':\n", "return render_title_template('readpdf.html', pdffile=book_id, VAR_150=book.\n title)\n", "VAR_3.debug(u'Start txt reader for %d', VAR_5)\n", "if VAR_6.lower() == 'djvu':\n", "return render_title_template('readtxt.html', txtfile=book_id, VAR_150=book.\n title)\n", "VAR_3.debug(u'Start djvu reader for %d', VAR_5)\n", "for fileExt in constants.EXTENSIONS_AUDIO:\n", "return render_title_template('readdjvu.html', djvufile=book_id, VAR_150=\n book.title)\n", "if VAR_6.lower() == fileExt:\n", "for fileExt in ['cbr', 'cbt', 'cbz']:\n", "VAR_63 = calibre_db.get_filtered_book(VAR_5)\n", "if VAR_6.lower() == fileExt:\n", "VAR_3.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n", "VAR_3.debug(u'Start mp3 listening for %d', VAR_5)\n", "VAR_149 = str(VAR_5)\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "return render_title_template('listenmp3.html', mp3file=book_id, audioformat\n =book_format.lower(), entry=entries, VAR_99=bookmark)\n", "VAR_150 = VAR_95.title\n", "return redirect(url_for('web.index'))\n", "if len(VAR_95.series):\n", "VAR_150 = VAR_150 + ' - ' + VAR_95.series[0].name\n", "VAR_3.debug(u'Start comic reader for %d', VAR_5)\n", "if VAR_95.series_index:\n", "return render_title_template('readcbr.html', comicfile=all_name, VAR_150=\n title, extension=fileExt)\n", "VAR_150 = VAR_150 + ' #' + '{0:.2f}'.format(VAR_95.series_index).rstrip('0'\n ).rstrip('.')\n" ]
[ "@web.route('/read/<int:book_id>/<book_format>')...\n", "book = calibre_db.get_filtered_book(book_id)\n", "if not book:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "bookmark = None\n", "log.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n", "if current_user.is_authenticated:\n", "return redirect(url_for('web.index'))\n", "bookmark = ub.session.query(ub.Bookmark).filter(and_(ub.Bookmark.user_id ==\n int(current_user.id), ub.Bookmark.book_id == book_id, ub.Bookmark.\n format == book_format.upper())).first()\n", "if book_format.lower() == 'epub':\n", "log.debug(u'Start epub reader for %d', book_id)\n", "if book_format.lower() == 'pdf':\n", "return render_title_template('read.html', bookid=book_id, title=book.title,\n bookmark=bookmark)\n", "log.debug(u'Start pdf reader for %d', book_id)\n", "if book_format.lower() == 'txt':\n", "return render_title_template('readpdf.html', pdffile=book_id, title=book.title)\n", "log.debug(u'Start txt reader for %d', book_id)\n", "if book_format.lower() == 'djvu':\n", "return render_title_template('readtxt.html', txtfile=book_id, title=book.title)\n", "log.debug(u'Start djvu reader for %d', book_id)\n", "for fileExt in constants.EXTENSIONS_AUDIO:\n", "return render_title_template('readdjvu.html', djvufile=book_id, title=book.\n title)\n", "if book_format.lower() == fileExt:\n", "for fileExt in ['cbr', 'cbt', 'cbz']:\n", "entries = calibre_db.get_filtered_book(book_id)\n", "if book_format.lower() == fileExt:\n", "log.debug(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n )\n", "log.debug(u'Start mp3 listening for %d', book_id)\n", "all_name = str(book_id)\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "return render_title_template('listenmp3.html', mp3file=book_id, audioformat\n =book_format.lower(), entry=entries, bookmark=bookmark)\n", "title = book.title\n", "return redirect(url_for('web.index'))\n", "if len(book.series):\n", "title = title + ' - ' + book.series[0].name\n", "log.debug(u'Start comic reader for %d', book_id)\n", "if book.series_index:\n", "return render_title_template('readcbr.html', comicfile=all_name, title=\n title, extension=fileExt)\n", "title = title + ' #' + '{0:.2f}'.format(book.series_index).rstrip('0').rstrip(\n '.')\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, 0, 0, 0, 0 ]
[ "For", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Expr'", "Condition", "Return'", "Expr'", "Condition", "Return'", "Expr'", "For", "Return'", "Condition", "For", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Expr'", "Return'", "Assign'", "Return'", "Condition", "Assign'", "Expr'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_56(VAR_99):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_99.replace(' ', '_').replace('-', '_').lower()\n" ]
[ "def scrub(txt):...\n", "\"\"\"docstring\"\"\"\n", "return txt.replace(' ', '_').replace('-', '_').lower()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@ensure_csrf_cookie...\n", "\"\"\"docstring\"\"\"\n", "VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n", "VAR_19 = get_student_from_identifier(VAR_9.GET.get('unique_student_identifier')\n )\n", "VAR_126 = reverse('student_progress', VAR_3={'course_id': course_id.\n to_deprecated_string(), 'student_id': user.id})\n", "VAR_63 = {'course_id': VAR_10.to_deprecated_string(), 'progress_url': VAR_126}\n", "return JsonResponse(VAR_63)\n" ]
[ "@ensure_csrf_cookie...\n", "\"\"\"docstring\"\"\"\n", "course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n", "user = get_student_from_identifier(request.GET.get('unique_student_identifier')\n )\n", "progress_url = reverse('student_progress', kwargs={'course_id': course_id.\n to_deprecated_string(), 'student_id': user.id})\n", "response_payload = {'course_id': course_id.to_deprecated_string(),\n 'progress_url': progress_url}\n", "return JsonResponse(response_payload)\n" ]
[ 0, 0, 0, 3, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(self, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "self.acl.exempt(VAR_4.__name__)\n", "return VAR_4\n" ]
[ "def exempt(self, view_func):...\n", "\"\"\"docstring\"\"\"\n", "self.acl.exempt(view_func.__name__)\n", "return view_func\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_2, VAR_3, VAR_4):...\n", "self.reactor.advance(1000)\n" ]
[ "def prepare(self, reactor, clock, hs):...\n", "self.reactor.advance(1000)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "async def FUNC_0(VAR_1) ->None:...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = VAR_1.server_name\n", "VAR_42, VAR_43, VAR_44 = await VAR_1.key_ready\n", "VAR_3 = VAR_1.json_object\n", "verify_signed_json(VAR_3, VAR_2, VAR_44)\n", "VAR_0.debug('Error verifying signature for %s:%s:%s with key %s: %s', VAR_2,\n VAR_44.alg, VAR_44.version, encode_verify_key_base64(VAR_44), str(e))\n" ]
[ "async def _handle_key_deferred(verify_request) ->None:...\n", "\"\"\"docstring\"\"\"\n", "server_name = verify_request.server_name\n", "_, key_id, verify_key = await verify_request.key_ready\n", "json_object = verify_request.json_object\n", "verify_signed_json(json_object, server_name, verify_key)\n", "logger.debug('Error verifying signature for %s:%s:%s with key %s: %s',\n server_name, verify_key.alg, verify_key.version,\n encode_verify_key_base64(verify_key), str(e))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_32(VAR_87):...\n", "VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n" ]
[ "def hash_update(value):...\n", "hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_29(VAR_0, VAR_1):...\n", "VAR_17 = VAR_0.config['THEME_CONF']['use_theme_dark']\n", "VAR_8 = VAR_1.post('/config', data={'submit': True,\n 'THEME_CONF-use_theme_dark': not dark_theme})\n", "assert VAR_0.config['THEME_CONF']['use_theme_dark'] == (not VAR_17)\n" ]
[ "def test_post_updated_config(test_app, client):...\n", "dark_theme = test_app.config['THEME_CONF']['use_theme_dark']\n", "resp = client.post('/config', data={'submit': True,\n 'THEME_CONF-use_theme_dark': not dark_theme})\n", "assert test_app.config['THEME_CONF']['use_theme_dark'] == (not dark_theme)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assert'" ]
[ "def FUNC_15(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.get_success(self.state_handler.get_current_state(self.room_id,\n EventTypes.CanonicalAlias, ''))\n" ]
[ "def _get_canonical_alias(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.get_success(self.state_handler.get_current_state(self.room_id,\n EventTypes.CanonicalAlias, ''))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_2(self, VAR_3, VAR_4, VAR_5, VAR_6=None, VAR_7={}):...\n", "VAR_12 = {'membership': VAR_5}\n", "VAR_12.update(VAR_7)\n", "VAR_13 = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Member, 'sender': VAR_4.to_string(), 'state_key':\n VAR_4.to_string(), 'room_id': VAR_3.to_string(), 'content': VAR_12})\n", "VAR_14, VAR_15 = self.get_success(self.event_creation_handler.\n create_new_client_event(VAR_13))\n", "self.get_success(self.storage.persistence.persist_event(VAR_14, VAR_15))\n", "return VAR_14\n" ]
[ "def inject_room_member(self, room, user, membership, replaces_state=None,...\n", "content = {'membership': membership}\n", "content.update(extra_content)\n", "builder = self.event_builder_factory.for_room_version(RoomVersions.V1, {\n 'type': EventTypes.Member, 'sender': user.to_string(), 'state_key':\n user.to_string(), 'room_id': room.to_string(), 'content': content})\n", "event, context = self.get_success(self.event_creation_handler.\n create_new_client_event(builder))\n", "self.get_success(self.storage.persistence.persist_event(event, context))\n", "return event\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "\"\"\"\nA few checks to make sure the environment is sane\n\"\"\"\n", "from __future__ import absolute_import\n", "import os\n", "import re\n", "import sys\n", "import stat\n", "import errno\n", "import socket\n", "import logging\n", "import win32file\n", "import resource\n", "from salt.log import is_console_configured\n", "from salt.log.setup import LOG_LEVELS\n", "from salt.exceptions import SaltClientError, SaltSystemExit, CommandExecutionError\n", "import salt.defaults.exitcodes\n", "import salt.utils\n", "VAR_0 = logging.getLogger(__name__)\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "import zmq\n", "return True\n", "VAR_18 = zmq.__version__\n", "VAR_19 = re.match('^(\\\\d+)\\\\.(\\\\d+)(?:\\\\.(\\\\d+))?', VAR_18)\n", "if not VAR_19:\n", "VAR_32 = \"Using untested zmq python bindings version: '{0}'\".format(VAR_18)\n", "VAR_20, VAR_21, VAR_22 = VAR_19.groups()\n", "if is_console_configured():\n", "if VAR_20.isdigit():\n", "VAR_0.warning(VAR_32)\n", "sys.stderr.write('WARNING {0}\\n'.format(VAR_32))\n", "VAR_20 = int(VAR_20)\n", "if VAR_21.isdigit():\n", "return True\n", "VAR_21 = int(VAR_21)\n", "if VAR_22 and VAR_22.isdigit():\n", "VAR_22 = int(VAR_22)\n", "if VAR_20 == 2 and VAR_21 == 1:\n", "if 'dev' in VAR_18 and not VAR_22:\n", "if VAR_20 > 2 or VAR_20 == 2 and VAR_21 > 1:\n", "VAR_32 = 'Using dev zmq module, please report unexpected results'\n", "if VAR_22 and VAR_22 >= 9:\n", "return True\n", "VAR_0.critical('ZeroMQ python bindings >= 2.1.9 are required')\n", "if is_console_configured():\n", "return True\n", "if 'salt-master' in sys.argv[0]:\n", "VAR_0.warning(VAR_32)\n", "sys.stderr.write('WARNING: {0}\\n'.format(VAR_32))\n", "VAR_32 = 'string'\n", "return False\n", "return True\n", "if is_console_configured():\n", "VAR_0.critical(VAR_32)\n", "sys.stderr.write('CRITICAL {0}\\n'.format(VAR_32))\n" ]
[ "\"\"\"\nA few checks to make sure the environment is sane\n\"\"\"\n", "from __future__ import absolute_import\n", "import os\n", "import re\n", "import sys\n", "import stat\n", "import errno\n", "import socket\n", "import logging\n", "import win32file\n", "import resource\n", "from salt.log import is_console_configured\n", "from salt.log.setup import LOG_LEVELS\n", "from salt.exceptions import SaltClientError, SaltSystemExit, CommandExecutionError\n", "import salt.defaults.exitcodes\n", "import salt.utils\n", "log = logging.getLogger(__name__)\n", "def zmq_version():...\n", "\"\"\"docstring\"\"\"\n", "import zmq\n", "return True\n", "ver = zmq.__version__\n", "match = re.match('^(\\\\d+)\\\\.(\\\\d+)(?:\\\\.(\\\\d+))?', ver)\n", "if not match:\n", "msg = \"Using untested zmq python bindings version: '{0}'\".format(ver)\n", "major, minor, point = match.groups()\n", "if is_console_configured():\n", "if major.isdigit():\n", "log.warning(msg)\n", "sys.stderr.write('WARNING {0}\\n'.format(msg))\n", "major = int(major)\n", "if minor.isdigit():\n", "return True\n", "minor = int(minor)\n", "if point and point.isdigit():\n", "point = int(point)\n", "if major == 2 and minor == 1:\n", "if 'dev' in ver and not point:\n", "if major > 2 or major == 2 and minor > 1:\n", "msg = 'Using dev zmq module, please report unexpected results'\n", "if point and point >= 9:\n", "return True\n", "log.critical('ZeroMQ python bindings >= 2.1.9 are required')\n", "if is_console_configured():\n", "return True\n", "if 'salt-master' in sys.argv[0]:\n", "log.warning(msg)\n", "sys.stderr.write('WARNING: {0}\\n'.format(msg))\n", "msg = (\n 'The Salt Master is unstable using a ZeroMQ version lower than 2.1.11 and requires this fix: http://lists.zeromq.org/pipermail/zeromq-dev/2011-June/012094.html'\n )\n", "return False\n", "return True\n", "if is_console_configured():\n", "log.critical(msg)\n", "sys.stderr.write('CRITICAL {0}\\n'.format(msg))\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Assign'", "FunctionDef'", "Docstring", "Import'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Expr'", "Expr'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Return'", "Expr'", "Condition", "Return'", "Condition", "Expr'", "Expr'", "Assign'", "Return'", "Return'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_116(VAR_129):...\n", "def FUNC_121(*VAR_79, **VAR_42):...\n", "if VAR_13.read_from_replica:\n", "FUNC_6()\n", "VAR_225 = VAR_129(*VAR_79, **get_newargs(fn, kwargs))\n", "if VAR_1 and hasattr(VAR_1, 'primary_db'):\n", "return VAR_225\n", "VAR_1.db.close()\n", "VAR_1.db = VAR_1.primary_db\n" ]
[ "def innfn(fn):...\n", "def wrapper_fn(*args, **kwargs):...\n", "if conf.read_from_replica:\n", "connect_replica()\n", "retval = fn(*args, **get_newargs(fn, kwargs))\n", "if local and hasattr(local, 'primary_db'):\n", "return retval\n", "local.db.close()\n", "local.db = local.primary_db\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_16(VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_45 = example_pb2.Example()\n", "for feature_name, feature_list in VAR_21.items():\n", "if not isinstance(feature_list, list):\n", "return VAR_45.SerializeToString()\n", "if isinstance(feature_list[0], float):\n", "VAR_45.features.feature[feature_name].float_list.value.extend(feature_list)\n", "if isinstance(feature_list[0], str):\n", "VAR_45.features.feature[feature_name].bytes_list.value.extend([f.encode(\n 'utf8') for f in feature_list])\n", "if isinstance(feature_list[0], bytes):\n", "VAR_45.features.feature[feature_name].bytes_list.value.extend(feature_list)\n", "if isinstance(feature_list[0], six.integer_types):\n", "VAR_45.features.feature[feature_name].int64_list.value.extend(feature_list)\n" ]
[ "def _create_example_string(example_dict):...\n", "\"\"\"docstring\"\"\"\n", "example = example_pb2.Example()\n", "for feature_name, feature_list in example_dict.items():\n", "if not isinstance(feature_list, list):\n", "return example.SerializeToString()\n", "if isinstance(feature_list[0], float):\n", "example.features.feature[feature_name].float_list.value.extend(feature_list)\n", "if isinstance(feature_list[0], str):\n", "example.features.feature[feature_name].bytes_list.value.extend([f.encode(\n 'utf8') for f in feature_list])\n", "if isinstance(feature_list[0], bytes):\n", "example.features.feature[feature_name].bytes_list.value.extend(feature_list)\n", "if isinstance(feature_list[0], six.integer_types):\n", "example.features.feature[feature_name].int64_list.value.extend(feature_list)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "@login_required()...\n", "" ]
[ "@login_required()...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_82(VAR_62, *VAR_79, **VAR_42):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.model.db_query\n", "return frappe.model.db_query.DatabaseQuery(VAR_62).execute(None, *VAR_79,\n **kwargs)\n" ]
[ "def get_list(doctype, *args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.model.db_query\n", "return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **\n kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Return'" ]
[ "def FUNC_37():...\n", "if callable(VAR_63):\n", "VAR_33 = FUNC_21()\n", "VAR_33 = VAR_63()\n", "VAR_0.exception('Error while trying to retrieve tracked files for plugin {}'\n .format(VAR_8))\n", "VAR_33 += FUNC_22()\n", "if VAR_33:\n", "VAR_33 += FUNC_23(g.locale.language if g.locale else 'en', 'messages')\n", "return VAR_33\n", "if callable(VAR_61):\n", "return sorted(set(VAR_33))\n", "VAR_142 = VAR_61()\n", "VAR_0.exception(\n 'Error while trying to retrieve additional tracked files for plugin {}'\n .format(VAR_8))\n", "if VAR_142:\n", "VAR_33 += VAR_142\n" ]
[ "def collect_files():...\n", "if callable(custom_files):\n", "files = _get_all_templates()\n", "files = custom_files()\n", "_logger.exception('Error while trying to retrieve tracked files for plugin {}'\n .format(key))\n", "files += _get_all_assets()\n", "if files:\n", "files += _get_all_translationfiles(g.locale.language if g.locale else 'en',\n 'messages')\n", "return files\n", "if callable(additional_files):\n", "return sorted(set(files))\n", "af = additional_files()\n", "_logger.exception(\n 'Error while trying to retrieve additional tracked files for plugin {}'\n .format(key))\n", "if af:\n", "files += af\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Expr'", "AugAssign'", "Condition", "AugAssign'", "Return'", "Condition", "Return'", "Assign'", "Expr'", "Condition", "AugAssign'" ]
[ "def FUNC_10(self):...\n", "VAR_5 = self.get_credits('html')\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertHTMLEqual(VAR_5.content.decode(), 'string')\n" ]
[ "def test_credits_view_html(self):...\n", "response = self.get_credits('html')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertHTMLEqual(response.content.decode(),\n \"\"\"<table>\n<tr>\n<th>Czech</th>\n<td><ul><li><a href=\"mailto:[email protected]\">Weblate Test</a> (1)</li></ul></td>\n</tr>\n</table>\"\"\"\n )\n" ]
[ 0, 0, 0, 2 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self):...\n", "self.auth_token = hexlify(os.urandom(4)).decode('utf-8')\n", "self.expiration = datetime.datetime.now() + datetime.timedelta(minutes=10)\n" ]
[ "def __init__(self):...\n", "self.auth_token = hexlify(os.urandom(4)).decode('utf-8')\n", "self.expiration = datetime.datetime.now() + datetime.timedelta(minutes=10)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "@app.route('/dataobj/<int:dataobj_id>')...\n", "VAR_12 = data.get_item(VAR_1)\n", "VAR_13 = lambda x: (x['title'], x['id'])\n", "VAR_14 = list(map(VAR_13, data.get_items(structured=False, load_content=False))\n )\n", "if not VAR_12:\n", "flash('Data could not be found!', 'error')\n", "if request.args.get('raw') == '1':\n", "return redirect('/')\n", "return frontmatter.dumps(VAR_12)\n", "VAR_15 = []\n", "if app.config['SEARCH_CONF']['enabled']:\n", "if app.config['SEARCH_CONF']['engine'] == 'ripgrep':\n", "VAR_16 = forms.MoveItemForm()\n", "VAR_36 = f'\\\\|{VAR_1}]]'\n", "VAR_36 = f'|{VAR_1})]]'\n", "VAR_16.path.choices = [('', 'root directory')] + [(pathname, pathname) for\n pathname in data.get_dirs()]\n", "VAR_15 = search(VAR_36, strict=True)\n", "VAR_17 = forms.TitleForm()\n", "VAR_17.title.data = VAR_12['title']\n", "VAR_18 = get_all_tags()\n", "VAR_19 = set()\n", "VAR_20 = '(?:^|\\\\n| )#(?:[-_a-zA-ZÀ-ÖØ-öø-ÿ0-9]+)#'\n", "for match in re.finditer(VAR_20, VAR_12.content):\n", "VAR_19.add(match.group(0).replace('#', '').lstrip())\n", "return render_template('dataobjs/show.html', title=dataobj['title'], VAR_12\n =dataobj, VAR_15=backlinks, current_path=dataobj['dir'], VAR_9=forms.\n DeleteDataForm(), view_only=0, search_enabled=app.config['SEARCH_CONF']\n ['enabled'], VAR_17=post_title_form, VAR_16=move_form, VAR_18=tag_list,\n VAR_19=embedded_tags, VAR_14=titles)\n" ]
[ "@app.route('/dataobj/<int:dataobj_id>')...\n", "dataobj = data.get_item(dataobj_id)\n", "get_title_id_pairs = lambda x: (x['title'], x['id'])\n", "titles = list(map(get_title_id_pairs, data.get_items(structured=False,\n load_content=False)))\n", "if not dataobj:\n", "flash('Data could not be found!', 'error')\n", "if request.args.get('raw') == '1':\n", "return redirect('/')\n", "return frontmatter.dumps(dataobj)\n", "backlinks = []\n", "if app.config['SEARCH_CONF']['enabled']:\n", "if app.config['SEARCH_CONF']['engine'] == 'ripgrep':\n", "move_form = forms.MoveItemForm()\n", "query = f'\\\\|{dataobj_id}]]'\n", "query = f'|{dataobj_id})]]'\n", "move_form.path.choices = [('', 'root directory')] + [(pathname, pathname) for\n pathname in data.get_dirs()]\n", "backlinks = search(query, strict=True)\n", "post_title_form = forms.TitleForm()\n", "post_title_form.title.data = dataobj['title']\n", "tag_list = get_all_tags()\n", "embedded_tags = set()\n", "PATTERN = '(?:^|\\\\n| )#(?:[-_a-zA-ZÀ-ÖØ-öø-ÿ0-9]+)#'\n", "for match in re.finditer(PATTERN, dataobj.content):\n", "embedded_tags.add(match.group(0).replace('#', '').lstrip())\n", "return render_template('dataobjs/show.html', title=dataobj['title'],\n dataobj=dataobj, backlinks=backlinks, current_path=dataobj['dir'], form\n =forms.DeleteDataForm(), view_only=0, search_enabled=app.config[\n 'SEARCH_CONF']['enabled'], post_title_form=post_title_form, move_form=\n move_form, tag_list=tag_list, embedded_tags=embedded_tags, titles=titles)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Return'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Return'" ]
[ "def __init__(self, VAR_24, VAR_25):...\n", "self.hs = VAR_24\n", "self.signing_key = VAR_24.signing_key\n", "self.server_name = VAR_24.hostname\n", "VAR_48 = VAR_24.get_reactor()\n", "VAR_49 = IPBlacklistingResolver(VAR_48, None, VAR_24.config.\n federation_ip_range_blacklist)\n", "def __getattr__(VAR_59, VAR_60):...\n", "if VAR_60 == 'nameResolver':\n", "return VAR_49\n", "return getattr(VAR_48, VAR_60)\n" ]
[ "def __init__(self, hs, tls_client_options_factory):...\n", "self.hs = hs\n", "self.signing_key = hs.signing_key\n", "self.server_name = hs.hostname\n", "real_reactor = hs.get_reactor()\n", "nameResolver = IPBlacklistingResolver(real_reactor, None, hs.config.\n federation_ip_range_blacklist)\n", "def __getattr__(_self, attr):...\n", "if attr == 'nameResolver':\n", "return nameResolver\n", "return getattr(real_reactor, attr)\n" ]
[ 0, 0, 0, 0, 4, 4, 0, 4, 4, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(VAR_12, VAR_7):...\n", "if VAR_12:\n", "VAR_12 = VAR_12.replace('[id]', str(VAR_7.vars.id))\n", "return URL(VAR_12)\n", "if VAR_12[0] == '/' or VAR_12[:4] == 'http':\n", "return VAR_12\n" ]
[ "def replace_id(url, form):...\n", "if url:\n", "url = url.replace('[id]', str(form.vars.id))\n", "return URL(url)\n", "if url[0] == '/' or url[:4] == 'http':\n", "return url\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Condition", "Return'" ]
[ "def FUNC_37(self, VAR_1=None, VAR_2=None):...\n", "if VAR_1 is None:\n", "VAR_1 = self._makeEngine()\n", "if VAR_2 is None:\n", "VAR_2 = {}\n", "return self._getTargetClass()(VAR_1, VAR_2)\n" ]
[ "def _makeOne(self, engine=None, contexts=None):...\n", "if engine is None:\n", "engine = self._makeEngine()\n", "if contexts is None:\n", "contexts = {}\n", "return self._getTargetClass()(engine, contexts)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@VAR_0.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/full-print',...\n", "\"\"\"docstring\"\"\"\n", "VAR_95 = FUNC_58(f'/internal/jobs/{VAR_9}/subjobs/{VAR_11}/full-print', 'get')\n", "return jsonify({'success': False, 'message': str(err)}), 400\n", "return jsonify(VAR_95)\n" ]
[ "@gui.route('/api/jobs/<int:job_id>/subjobs/<int:subjob_id>/full-print',...\n", "\"\"\"docstring\"\"\"\n", "full_print_info = query_internal_api(\n f'/internal/jobs/{job_id}/subjobs/{subjob_id}/full-print', 'get')\n", "return jsonify({'success': False, 'message': str(err)}), 400\n", "return jsonify(full_print_info)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Return'", "Return'" ]
[ "def FUNC_14(VAR_14):...\n", "VAR_32 = calibre_db.session.query(db.Custom_Columns).filter(db.\n Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n", "VAR_16 = calibre_db.get_filtered_book(VAR_14, allow_show_archived=True)\n", "if not VAR_16:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "for lang in VAR_16.languages:\n", "return redirect(url_for('web.index'))\n", "lang.language_name = isoLanguages.get_language_name(get_locale(), lang.\n lang_code)\n", "VAR_16 = calibre_db.order_authors(VAR_16)\n", "VAR_54 = []\n", "for VAR_39 in VAR_16.authors:\n", "VAR_54.append(VAR_39.name.replace('|', ','))\n", "VAR_55 = list()\n", "VAR_56 = list()\n", "VAR_57 = None\n", "if config.config_converterpath:\n", "for file in VAR_16.data:\n", "if config.config_kepubifypath and 'epub' in [file.format.lower() for file in\n", "if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM:\n", "VAR_57 = True\n", "if config.config_converterpath:\n", "VAR_55.append(file.format.lower())\n", "if not config.config_converterpath:\n", "VAR_56 = constants.EXTENSIONS_CONVERT_TO[:]\n", "if VAR_57:\n", "VAR_55.append('epub')\n", "for file in VAR_16.data:\n", "VAR_56.append('kepub')\n", "return render_title_template('book_edit.html', VAR_16=book, VAR_115=\n author_names, VAR_32=cc, VAR_38=_(u'edit metadata'), page='editbook',\n conversion_formats=allowed_conversion_formats, config=config,\n source_formats=valid_source_formats)\n", "if file.format.lower() in VAR_56:\n", "VAR_56.remove(file.format.lower())\n" ]
[ "def render_edit_book(book_id):...\n", "cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.\n datatype.notin_(db.cc_exceptions)).all()\n", "book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)\n", "if not book:\n", "flash(_(\n u'Oops! Selected book title is unavailable. File does not exist or is not accessible'\n ), category='error')\n", "for lang in book.languages:\n", "return redirect(url_for('web.index'))\n", "lang.language_name = isoLanguages.get_language_name(get_locale(), lang.\n lang_code)\n", "book = calibre_db.order_authors(book)\n", "author_names = []\n", "for authr in book.authors:\n", "author_names.append(authr.name.replace('|', ','))\n", "valid_source_formats = list()\n", "allowed_conversion_formats = list()\n", "kepub_possible = None\n", "if config.config_converterpath:\n", "for file in book.data:\n", "if config.config_kepubifypath and 'epub' in [file.format.lower() for file in\n", "if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM:\n", "kepub_possible = True\n", "if config.config_converterpath:\n", "valid_source_formats.append(file.format.lower())\n", "if not config.config_converterpath:\n", "allowed_conversion_formats = constants.EXTENSIONS_CONVERT_TO[:]\n", "if kepub_possible:\n", "valid_source_formats.append('epub')\n", "for file in book.data:\n", "allowed_conversion_formats.append('kepub')\n", "return render_title_template('book_edit.html', book=book, authors=\n author_names, cc=cc, title=_(u'edit metadata'), page='editbook',\n conversion_formats=allowed_conversion_formats, config=config,\n source_formats=valid_source_formats)\n", "if file.format.lower() in allowed_conversion_formats:\n", "allowed_conversion_formats.remove(file.format.lower())\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "For", "Return'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Assign'", "Assign'", "Condition", "For", "For", "For", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Condition", "Expr'", "For", "Expr'", "Return'", "For", "Expr'" ]
[ "def __init__(self, VAR_4, VAR_17: Unit, *VAR_6, **VAR_7):...\n", "if VAR_17 is not None:\n", "VAR_7['initial'] = {'checksum': VAR_17.checksum, 'contentsum':\n hash_to_checksum(VAR_17.content_hash), 'translationsum':\n hash_to_checksum(VAR_17.get_target_hash()), 'target': VAR_17, 'fuzzy':\n VAR_17.fuzzy, 'review': VAR_17.state, 'explanation': VAR_17.explanation}\n", "VAR_108 = VAR_7.pop('tabindex', 100)\n", "VAR_7['auto_id'] = f'id_{VAR_17.checksum}_%s'\n", "super().__init__(VAR_17, *VAR_6, **kwargs)\n", "if VAR_17.readonly:\n", "for VAR_39 in ['target', 'fuzzy', 'review']:\n", "self.user = VAR_4\n", "self.fields[VAR_39].widget.attrs['readonly'] = 1\n", "self.fields['review'].choices = [(STATE_READONLY, _('Read only'))]\n", "self.fields['target'].widget.attrs['tabindex'] = VAR_108\n", "self.fields['target'].widget.profile = VAR_4.profile\n", "self.fields['review'].widget.attrs['class'] = 'review_radio'\n", "if VAR_6:\n", "self.fields['review'].choices.append((STATE_EMPTY, ''))\n", "self.helper = FormHelper()\n", "self.helper.form_method = 'post'\n", "self.helper.form_tag = False\n", "self.helper.disable_csrf = True\n", "self.helper.layout = Layout(Field('target'), Field('fuzzy'), Field(\n 'contentsum'), Field('translationsum'), InlineRadios('review'), Field(\n 'explanation'))\n", "if VAR_17 and VAR_4.has_perm('unit.review', VAR_17.translation):\n", "self.fields['fuzzy'].widget = forms.HiddenInput()\n", "self.fields['review'].widget = forms.HiddenInput()\n", "if not VAR_17.translation.component.is_glossary:\n", "self.fields['explanation'].widget = forms.HiddenInput()\n" ]
[ "def __init__(self, user, unit: Unit, *args, **kwargs):...\n", "if unit is not None:\n", "kwargs['initial'] = {'checksum': unit.checksum, 'contentsum':\n hash_to_checksum(unit.content_hash), 'translationsum': hash_to_checksum\n (unit.get_target_hash()), 'target': unit, 'fuzzy': unit.fuzzy, 'review':\n unit.state, 'explanation': unit.explanation}\n", "tabindex = kwargs.pop('tabindex', 100)\n", "kwargs['auto_id'] = f'id_{unit.checksum}_%s'\n", "super().__init__(unit, *args, **kwargs)\n", "if unit.readonly:\n", "for field in ['target', 'fuzzy', 'review']:\n", "self.user = user\n", "self.fields[field].widget.attrs['readonly'] = 1\n", "self.fields['review'].choices = [(STATE_READONLY, _('Read only'))]\n", "self.fields['target'].widget.attrs['tabindex'] = tabindex\n", "self.fields['target'].widget.profile = user.profile\n", "self.fields['review'].widget.attrs['class'] = 'review_radio'\n", "if args:\n", "self.fields['review'].choices.append((STATE_EMPTY, ''))\n", "self.helper = FormHelper()\n", "self.helper.form_method = 'post'\n", "self.helper.form_tag = False\n", "self.helper.disable_csrf = True\n", "self.helper.layout = Layout(Field('target'), Field('fuzzy'), Field(\n 'contentsum'), Field('translationsum'), InlineRadios('review'), Field(\n 'explanation'))\n", "if unit and user.has_perm('unit.review', unit.translation):\n", "self.fields['fuzzy'].widget = forms.HiddenInput()\n", "self.fields['review'].widget = forms.HiddenInput()\n", "if not unit.translation.component.is_glossary:\n", "self.fields['explanation'].widget = forms.HiddenInput()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "@CLASS_4('gpl')...\n", "\"\"\"docstring\"\"\"\n", "return 'text/html', utils.read_file('html/license.html')\n" ]
[ "@add_handler('gpl')...\n", "\"\"\"docstring\"\"\"\n", "return 'text/html', utils.read_file('html/license.html')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_20(VAR_0, VAR_1: FlaskClient):...\n", "VAR_8 = VAR_1.post('/folders/delete', data={'dir_name': 'testing'})\n", "assert VAR_8.status_code == 404\n" ]
[ "def test_deleting_nonexisting_folder_fails(test_app, client: FlaskClient):...\n", "resp = client.post('/folders/delete', data={'dir_name': 'testing'})\n", "assert resp.status_code == 404\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assert'" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "VAR_154 = FUNC_42(VAR_2, VAR_5)\n", "VAR_114 = FUNC_43(VAR_2)\n", "VAR_155 = sum([len(VAR_114[types]) for types in VAR_114])\n", "VAR_104 = None\n", "VAR_163 = VAR_5.getEventContext().userId\n", "VAR_164 = []\n", "for obs in VAR_154.values():\n", "if len(obs) > 0:\n", "VAR_165, VAR_166 = tree.marshal_annotations(VAR_5, VAR_44=selected[\n 'projects'], VAR_45=selected['datasets'], VAR_46=selected['images'],\n VAR_47=selected['screens'], VAR_48=selected['plates'], VAR_85=selected[\n 'acquisitions'], VAR_86=selected['wells'], VAR_89='tag', VAR_88=\n ANNOTATIONS_LIMIT)\n", "VAR_5.SERVICE_OPTS.setOmeroGroup(obs[0].getDetails().group.id.val)\n", "VAR_167 = {}\n", "for VAR_232 in VAR_166:\n", "VAR_167[VAR_232['id']] = VAR_232\n", "if VAR_155 > 1:\n", "VAR_289 = {}\n", "VAR_168 = []\n", "for VAR_433 in VAR_165:\n", "for tag in VAR_165:\n", "VAR_354 = VAR_433['id']\n", "VAR_165 = [VAR_433 for VAR_433 in VAR_165 if VAR_289[VAR_433['id']] == VAR_155]\n", "VAR_290 = tag['link']['owner']['id']\n", "VAR_168.sort(VAR_310=lambda x: x[0])\n", "if VAR_354 not in VAR_289:\n", "VAR_103 = VAR_167[VAR_290]\n", "VAR_115 = {'selected': VAR_114, 'images': VAR_154['image'], 'datasets':\n VAR_154['dataset'], 'projects': VAR_154['project'], 'screens': VAR_154[\n 'screen'], 'plates': VAR_154['plate'], 'acquisitions': VAR_154[\n 'acquisition'], 'wells': VAR_154['well']}\n", "VAR_289[VAR_354] = 0\n", "if VAR_433['link']['owner']['id'] == VAR_163:\n", "VAR_291 = '%s %s' % (VAR_103['firstName'], VAR_103['lastName'])\n", "if VAR_2.method == 'POST':\n", "VAR_289[VAR_354] += 1\n", "VAR_292 = True\n", "VAR_295 = TagsAnnotationForm(VAR_115=initial, VAR_158=request.POST.copy())\n", "VAR_295 = TagsAnnotationForm(VAR_115=initial)\n", "VAR_293 = tag['link']['date']\n", "VAR_296 = NewTagsAnnotationFormSet(prefix='newtags', VAR_158=request.POST.\n copy())\n", "VAR_296 = NewTagsAnnotationFormSet(prefix='newtags')\n", "VAR_294 = VAR_290 == VAR_163\n", "if VAR_295.is_valid() and VAR_296.is_valid():\n", "VAR_53 = {'form_tags': VAR_295, 'newtags_formset': VAR_296, 'selected_tags':\n VAR_168}\n", "VAR_168.append((tag['id'], VAR_163, VAR_291, VAR_292, VAR_293, VAR_294))\n", "VAR_355 = [stag[0] for stag in VAR_168 if stag[5]]\n", "return HttpResponse(VAR_345(VAR_295.errors))\n", "VAR_54 = 'webclient/annotations/tags_form.html'\n", "VAR_355 = list(set(VAR_355))\n", "VAR_53['template'] = VAR_54\n", "VAR_356 = list(VAR_295.cleaned_data['tags'])\n", "return VAR_53\n", "VAR_164 = [tag for tag in VAR_356 if tag not in VAR_355]\n", "VAR_357 = [tag for tag in VAR_355 if tag not in VAR_356]\n", "VAR_104 = BaseContainer(VAR_5)\n", "if VAR_164:\n", "VAR_104.createAnnotationsLinks('tag', VAR_164, VAR_154)\n", "VAR_358 = []\n", "for VAR_22 in VAR_296.forms:\n", "VAR_358.append(VAR_104.createTagAnnotations(VAR_22.cleaned_data['tag'],\n VAR_22.cleaned_data['description'], VAR_154, tag_group_id=form.\n cleaned_data['tagset']))\n", "for remove in VAR_357:\n", "VAR_403 = BaseContainer(VAR_5, tag=remove)\n", "return JsonResponse({'added': VAR_164, 'removed': VAR_357, 'new': VAR_358})\n", "VAR_403.remove([('%s-%s' % (VAR_215, VAR_38.id)) for VAR_215, VAR_143 in\n VAR_154.items() for VAR_38 in VAR_143], tag_owner_id=self_id)\n" ]
[ "@login_required()...\n", "\"\"\"docstring\"\"\"\n", "oids = getObjects(request, conn)\n", "selected = getIds(request)\n", "obj_count = sum([len(selected[types]) for types in selected])\n", "manager = None\n", "self_id = conn.getEventContext().userId\n", "tags = []\n", "for obs in oids.values():\n", "if len(obs) > 0:\n", "taglist, users = tree.marshal_annotations(conn, project_ids=selected[\n 'projects'], dataset_ids=selected['datasets'], image_ids=selected[\n 'images'], screen_ids=selected['screens'], plate_ids=selected['plates'],\n run_ids=selected['acquisitions'], well_ids=selected['wells'], ann_type=\n 'tag', limit=ANNOTATIONS_LIMIT)\n", "conn.SERVICE_OPTS.setOmeroGroup(obs[0].getDetails().group.id.val)\n", "userMap = {}\n", "for exp in users:\n", "userMap[exp['id']] = exp\n", "if obj_count > 1:\n", "myLinkCount = {}\n", "selected_tags = []\n", "for t in taglist:\n", "for tag in taglist:\n", "tid = t['id']\n", "taglist = [t for t in taglist if myLinkCount[t['id']] == obj_count]\n", "linkOwnerId = tag['link']['owner']['id']\n", "selected_tags.sort(key=lambda x: x[0])\n", "if tid not in myLinkCount:\n", "owner = userMap[linkOwnerId]\n", "initial = {'selected': selected, 'images': oids['image'], 'datasets': oids[\n 'dataset'], 'projects': oids['project'], 'screens': oids['screen'],\n 'plates': oids['plate'], 'acquisitions': oids['acquisition'], 'wells':\n oids['well']}\n", "myLinkCount[tid] = 0\n", "if t['link']['owner']['id'] == self_id:\n", "ownerName = '%s %s' % (owner['firstName'], owner['lastName'])\n", "if request.method == 'POST':\n", "myLinkCount[tid] += 1\n", "canDelete = True\n", "form_tags = TagsAnnotationForm(initial=initial, data=request.POST.copy())\n", "form_tags = TagsAnnotationForm(initial=initial)\n", "created = tag['link']['date']\n", "newtags_formset = NewTagsAnnotationFormSet(prefix='newtags', data=request.\n POST.copy())\n", "newtags_formset = NewTagsAnnotationFormSet(prefix='newtags')\n", "linkOwned = linkOwnerId == self_id\n", "if form_tags.is_valid() and newtags_formset.is_valid():\n", "context = {'form_tags': form_tags, 'newtags_formset': newtags_formset,\n 'selected_tags': selected_tags}\n", "selected_tags.append((tag['id'], self_id, ownerName, canDelete, created,\n linkOwned))\n", "selected_tag_ids = [stag[0] for stag in selected_tags if stag[5]]\n", "return HttpResponse(str(form_tags.errors))\n", "template = 'webclient/annotations/tags_form.html'\n", "selected_tag_ids = list(set(selected_tag_ids))\n", "context['template'] = template\n", "post_tags = list(form_tags.cleaned_data['tags'])\n", "return context\n", "tags = [tag for tag in post_tags if tag not in selected_tag_ids]\n", "removed = [tag for tag in selected_tag_ids if tag not in post_tags]\n", "manager = BaseContainer(conn)\n", "if tags:\n", "manager.createAnnotationsLinks('tag', tags, oids)\n", "new_tags = []\n", "for form in newtags_formset.forms:\n", "new_tags.append(manager.createTagAnnotations(form.cleaned_data['tag'], form\n .cleaned_data['description'], oids, tag_group_id=form.cleaned_data[\n 'tagset']))\n", "for remove in removed:\n", "tag_manager = BaseContainer(conn, tag=remove)\n", "return JsonResponse({'added': tags, 'removed': removed, 'new': new_tags})\n", "tag_manager.remove([('%s-%s' % (dtype, obj.id)) for dtype, objs in oids.\n items() for obj in objs], tag_owner_id=self_id)\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Condition", "Assign'", "Assign'", "For", "For", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "AugAssign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "For", "Expr'", "For", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_45(self):...\n", "return json.dumps(audiotranscode.getDecoders())\n" ]
[ "def api_getdecoders(self):...\n", "return json.dumps(audiotranscode.getDecoders())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@VAR_7.route('/base/<baseidx>/mixers/<mixeridx>/keywords/<params>')...\n", "VAR_17 = FUNC_4(VAR_10, VAR_14)\n", "VAR_21 = int((VAR_11 - 1) * (1.0 / VAR_12) * len(VAR_17))\n", "VAR_22 = int(VAR_11 * (1.0 / VAR_12) * len(VAR_17))\n", "VAR_17 = VAR_17[VAR_21:VAR_22]\n", "VAR_8.info('Mixer Size {}'.format(len(VAR_17)))\n", "sys.stdout.flush()\n", "return FUNC_2(VAR_9, VAR_13, VAR_17, VAR_15, VAR_16)\n" ]
[ "@scope_blueprint.route('/base/<baseidx>/mixers/<mixeridx>/keywords/<params>')...\n", "mixer_list = get_mixer_list(mixeridx, classes)\n", "start_idx = int((index - 1) * (1.0 / total) * len(mixer_list))\n", "end_idx = int(index * (1.0 / total) * len(mixer_list))\n", "mixer_list = mixer_list[start_idx:end_idx]\n", "_log.info('Mixer Size {}'.format(len(mixer_list)))\n", "sys.stdout.flush()\n", "return get_scope(baseidx, params, mixer_list, start, limit)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_19(VAR_7):...\n", "if VAR_7 is None:\n", "return\n", "return self.get_image_id(VAR_5, VAR_7)\n", "return self._create_image_id(VAR_5, VAR_7)\n" ]
[ "def _find_or_create(image_uuid):...\n", "if image_uuid is None:\n", "return\n", "return self.get_image_id(context, image_uuid)\n", "return self._create_image_id(context, image_uuid)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'", "Return'" ]
[ "def test___post_init__(self, VAR_1):...\n", "VAR_5 = VAR_1.MagicMock()\n", "VAR_6 = VAR_1.patch('openapi_python_client.utils.snake_case')\n", "VAR_17 = VAR_1.MagicMock(class_name='MyTestEnum')\n", "VAR_18 = VAR_1.MagicMock(class_name='Deduped')\n", "VAR_19 = VAR_1.patch(f'{VAR_0}.Reference.from_ref', side_effect=[\n fake_reference, deduped_reference, deduped_reference])\n", "from openapi_python_client.parser import properties\n", "VAR_20 = VAR_1.MagicMock()\n", "properties._existing_enums = {'MyTestEnum': VAR_20}\n", "VAR_21 = {'FIRST': 'first', 'SECOND': 'second'}\n", "VAR_22 = properties.EnumProperty(VAR_5=name, VAR_26=True, default='second',\n VAR_21=values, title='a_title')\n", "assert VAR_22.default == 'Deduped.SECOND'\n", "assert VAR_22.python_name == VAR_6(VAR_5)\n", "VAR_19.assert_has_calls([VAR_1.call('a_title'), VAR_1.call('MyTestEnum1')])\n", "assert VAR_22.reference == VAR_18\n", "assert properties._existing_enums == {'MyTestEnum': VAR_20, 'Deduped': VAR_22}\n", "assert properties.EnumProperty(VAR_5=name, VAR_26=True, default='second',\n VAR_21=values, title='a_title') == VAR_22\n", "assert properties._existing_enums == {'MyTestEnum': VAR_20, 'Deduped': VAR_22}\n", "VAR_20.values = VAR_21\n", "VAR_19.reset_mock()\n", "VAR_19.side_effect = [VAR_17]\n", "VAR_22 = properties.EnumProperty(VAR_5=name, VAR_26=True, default='second',\n VAR_21=values, title='a_title')\n", "assert VAR_22.default == 'MyTestEnum.SECOND'\n", "assert VAR_22.python_name == VAR_6(VAR_5)\n", "VAR_19.assert_called_once_with('a_title')\n", "assert VAR_22.reference == VAR_17\n", "assert len(properties._existing_enums) == 2\n", "properties._existing_enums = {}\n" ]
[ "def test___post_init__(self, mocker):...\n", "name = mocker.MagicMock()\n", "snake_case = mocker.patch('openapi_python_client.utils.snake_case')\n", "fake_reference = mocker.MagicMock(class_name='MyTestEnum')\n", "deduped_reference = mocker.MagicMock(class_name='Deduped')\n", "from_ref = mocker.patch(f'{MODULE_NAME}.Reference.from_ref', side_effect=[\n fake_reference, deduped_reference, deduped_reference])\n", "from openapi_python_client.parser import properties\n", "fake_dup_enum = mocker.MagicMock()\n", "properties._existing_enums = {'MyTestEnum': fake_dup_enum}\n", "values = {'FIRST': 'first', 'SECOND': 'second'}\n", "enum_property = properties.EnumProperty(name=name, required=True, default=\n 'second', values=values, title='a_title')\n", "assert enum_property.default == 'Deduped.SECOND'\n", "assert enum_property.python_name == snake_case(name)\n", "from_ref.assert_has_calls([mocker.call('a_title'), mocker.call('MyTestEnum1')])\n", "assert enum_property.reference == deduped_reference\n", "assert properties._existing_enums == {'MyTestEnum': fake_dup_enum,\n 'Deduped': enum_property}\n", "assert properties.EnumProperty(name=name, required=True, default='second',\n values=values, title='a_title') == enum_property\n", "assert properties._existing_enums == {'MyTestEnum': fake_dup_enum,\n 'Deduped': enum_property}\n", "fake_dup_enum.values = values\n", "from_ref.reset_mock()\n", "from_ref.side_effect = [fake_reference]\n", "enum_property = properties.EnumProperty(name=name, required=True, default=\n 'second', values=values, title='a_title')\n", "assert enum_property.default == 'MyTestEnum.SECOND'\n", "assert enum_property.python_name == snake_case(name)\n", "from_ref.assert_called_once_with('a_title')\n", "assert enum_property.reference == fake_reference\n", "assert len(properties._existing_enums) == 2\n", "properties._existing_enums = {}\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Expr'", "Assert'", "Assert'", "Assert'", "Assert'", "Assign'", "Expr'", "Assign'", "Assign'", "Assert'", "Assert'", "Expr'", "Assert'", "Assert'", "Assign'" ]
[ "def FUNC_9(self, VAR_3, VAR_4):...\n", "VAR_4['choices'] = map(lambda x: (x.strip(), x.strip()), VAR_3.choices.\n split(','))\n", "return django.forms.ChoiceField(widget=django.forms.RadioSelect, **options)\n" ]
[ "def create_radio_field(self, field, options):...\n", "options['choices'] = map(lambda x: (x.strip(), x.strip()), field.choices.\n split(','))\n", "return django.forms.ChoiceField(widget=django.forms.RadioSelect, **options)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "@FUNC_0...\n", "from synapse.handlers.saml_handler import SamlHandler\n", "return SamlHandler(self)\n" ]
[ "@cache_in_self...\n", "from synapse.handlers.saml_handler import SamlHandler\n", "return SamlHandler(self)\n" ]
[ 0, 0, 0 ]
[ "Condition", "ImportFrom'", "Return'" ]
[ "def FUNC_9(VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "return saved_model_utils.get_meta_graph_def(VAR_2, VAR_3)\n" ]
[ "def get_meta_graph_def(saved_model_dir, tag_set):...\n", "\"\"\"docstring\"\"\"\n", "return saved_model_utils.get_meta_graph_def(saved_model_dir, tag_set)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_10(VAR_18: Text) ->VAR_1:...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_18 or not os.path.exists(VAR_18):\n", "return {}\n", "VAR_59 = os.path.join(VAR_18, VAR_2)\n", "if os.path.isfile(VAR_59):\n", "return rasa.shared.utils.io.read_json_file(VAR_59)\n", "return {}\n" ]
[ "def fingerprint_from_path(model_path: Text) ->Fingerprint:...\n", "\"\"\"docstring\"\"\"\n", "if not model_path or not os.path.exists(model_path):\n", "return {}\n", "fingerprint_path = os.path.join(model_path, FINGERPRINT_FILE_PATH)\n", "if os.path.isfile(fingerprint_path):\n", "return rasa.shared.utils.io.read_json_file(fingerprint_path)\n", "return {}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_78(VAR_133, VAR_134, VAR_135):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils\n", "return frappe.utils.compare(VAR_133, VAR_134, VAR_135)\n" ]
[ "def compare(val1, condition, val2):...\n", "\"\"\"docstring\"\"\"\n", "import frappe.utils\n", "return frappe.utils.compare(val1, condition, val2)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Return'" ]
[ "def FUNC_32(VAR_87):...\n", "VAR_86.update(to_bytes(VAR_87, encoding='utf-8', errors='replace'))\n" ]
[ "def hash_update(value):...\n", "hash.update(to_bytes(value, encoding='utf-8', errors='replace'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_38(VAR_47):...\n", "return VAR_47\n" ]
[ "def fake_wrapper_session(sess):...\n", "return sess\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@transaction.non_atomic_requests...\n", "\"\"\"docstring\"\"\"\n", "VAR_38 = CourseKey.from_string(VAR_10)\n", "VAR_75 = VAR_9.GET.get('csv', 'false')\n", "VAR_68 = ['course_id', 'mode', 'total_issued_certificate', 'report_run_date']\n", "VAR_76 = [('course_id', _('CourseID')), ('mode', _('Certificate Type')), (\n 'total_issued_certificate', _('Total Certificates Issued')), (\n 'report_run_date', _('Date Report Run'))]\n", "VAR_77 = instructor_analytics.basic.issued_certificates(VAR_38, VAR_68)\n", "if VAR_75.lower() == 'true':\n", "VAR_72, VAR_81 = instructor_analytics.csvs.format_dictlist(VAR_77, VAR_68)\n", "VAR_63 = {'certificates': VAR_77, 'queried_features': VAR_68,\n 'feature_names': dict(VAR_76)}\n", "return instructor_analytics.csvs.create_csv_response('issued_certificates.csv',\n [col_header for VAR_72, col_header in VAR_76], VAR_81)\n", "return JsonResponse(VAR_63)\n" ]
[ "@transaction.non_atomic_requests...\n", "\"\"\"docstring\"\"\"\n", "course_key = CourseKey.from_string(course_id)\n", "csv_required = request.GET.get('csv', 'false')\n", "query_features = ['course_id', 'mode', 'total_issued_certificate',\n 'report_run_date']\n", "query_features_names = [('course_id', _('CourseID')), ('mode', _(\n 'Certificate Type')), ('total_issued_certificate', _(\n 'Total Certificates Issued')), ('report_run_date', _('Date Report Run'))]\n", "certificates_data = instructor_analytics.basic.issued_certificates(course_key,\n query_features)\n", "if csv_required.lower() == 'true':\n", "__, data_rows = instructor_analytics.csvs.format_dictlist(certificates_data,\n query_features)\n", "response_payload = {'certificates': certificates_data, 'queried_features':\n query_features, 'feature_names': dict(query_features_names)}\n", "return instructor_analytics.csvs.create_csv_response('issued_certificates.csv',\n [col_header for __, col_header in query_features_names], data_rows)\n", "return JsonResponse(response_payload)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Return'" ]
[ "def FUNC_3(VAR_13):...\n", "if isinstance(VAR_13, complex) or VAR_13 < 0:\n", "return cmath.sqrt(VAR_13)\n", "return math.sqrt(VAR_13)\n" ]
[ "def _sqrt(x):...\n", "if isinstance(x, complex) or x < 0:\n", "return cmath.sqrt(x)\n", "return math.sqrt(x)\n" ]
[ 0, 5, 5, 5 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_9(VAR_12: Text) ->Type['Validator']:...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_14(VAR_21: Text) ->bool:...\n", "return VAR_21 is not None and VAR_21.strip() != ''\n" ]
[ "def not_empty_validator(error_message: Text) ->Type['Validator']:...\n", "\"\"\"docstring\"\"\"\n", "def is_valid(input: Text) ->bool:...\n", "return input is not None and input.strip() != ''\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Return'" ]
[ "def FUNC_23(self):...\n", "VAR_3 = self.client.post('/password_reset/custom_redirect/named/', {'email':\n '[email protected]'})\n", "self.assertEqual(VAR_3.status_code, 302)\n", "self.assertURLEqual(VAR_3.url, '/password_reset/')\n" ]
[ "def test_reset_custom_redirect_named(self):...\n", "response = self.client.post('/password_reset/custom_redirect/named/', {\n 'email': '[email protected]'})\n", "self.assertEqual(response.status_code, 302)\n", "self.assertURLEqual(response.url, '/password_reset/')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_17():...\n", "VAR_180 = []\n", "for msg_out in VAR_1.message_log:\n", "VAR_180.append(json.loads(msg_out))\n", "return VAR_180\n" ]
[ "def get_message_log():...\n", "log = []\n", "for msg_out in local.message_log:\n", "log.append(json.loads(msg_out))\n", "return log\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_36(self, *VAR_9, **VAR_13):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def _HTTP(self, *a, **b):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_18():...\n", "if len(VAR_1.message_log) > 0:\n", "VAR_1.message_log = VAR_1.message_log[:-1]\n" ]
[ "def clear_last_message():...\n", "if len(local.message_log) > 0:\n", "local.message_log = local.message_log[:-1]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'" ]
[ "def FUNC_2(self, VAR_5, *VAR_6, **VAR_4):...\n", "if not could_edit(VAR_5):\n", "self._populate_vars()\n", "if self.default_layout:\n", "self.view_config.save_default_placeholder_layout(self.placeholder_name,\n self.default_layout)\n", "return super(CLASS_0, self).dispatch(VAR_5, *VAR_6, **kwargs)\n", "VAR_23 = dict(self.request.GET.items())\n", "VAR_23.pop('default_config', None)\n", "VAR_19 = VAR_23.pop('global_type', None)\n", "if VAR_19:\n", "VAR_23['view'] = XTHEME_GLOBAL_VIEW_NAME\n", "return HttpResponseRedirect('%s?%s' % (self.request.path, urlencode(VAR_23)))\n" ]
[ "def dispatch(self, request, *args, **kwargs):...\n", "if not could_edit(request):\n", "self._populate_vars()\n", "if self.default_layout:\n", "self.view_config.save_default_placeholder_layout(self.placeholder_name,\n self.default_layout)\n", "return super(EditorView, self).dispatch(request, *args, **kwargs)\n", "get_args = dict(self.request.GET.items())\n", "get_args.pop('default_config', None)\n", "global_type = get_args.pop('global_type', None)\n", "if global_type:\n", "get_args['view'] = XTHEME_GLOBAL_VIEW_NAME\n", "return HttpResponseRedirect('%s?%s' % (self.request.path, urlencode(get_args)))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Expr'", "Return'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Return'" ]
[ "@FUNC_4...\n", "\"\"\"docstring\"\"\"\n", "VAR_38 = CourseKey.from_string(VAR_10)\n", "certs_api.generate_example_certificates(VAR_38)\n", "return redirect(FUNC_65(VAR_38, VAR_39='certificates'))\n" ]
[ "@require_global_staff...\n", "\"\"\"docstring\"\"\"\n", "course_key = CourseKey.from_string(course_id)\n", "certs_api.generate_example_certificates(course_key)\n", "return redirect(_instructor_dash_url(course_key, section='certificates'))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_21(self):...\n", "VAR_32 = '/rooms/%s/state/m.room.member/%s' % (self.room_id, self.user_id)\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '{}')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '{\"_name\":\"bo\"}')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '{\"nao')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32,\n b'[{\"_name\":\"bo\"},{\"_name\":\"jill\"}]')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, 'text only')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, '')\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n", "VAR_19 = '{\"membership\":[\"%s\",\"%s\",\"%s\"]}' % (Membership.INVITE, Membership\n .JOIN, Membership.LEAVE)\n", "VAR_22, VAR_23 = self.make_request('PUT', VAR_32, VAR_19.encode('ascii'))\n", "self.assertEquals(400, VAR_23.code, msg=channel.result['body'])\n" ]
[ "def test_invalid_puts(self):...\n", "path = '/rooms/%s/state/m.room.member/%s' % (self.room_id, self.user_id)\n", "request, channel = self.make_request('PUT', path, '{}')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('PUT', path, '{\"_name\":\"bo\"}')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('PUT', path, '{\"nao')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('PUT', path,\n b'[{\"_name\":\"bo\"},{\"_name\":\"jill\"}]')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('PUT', path, 'text only')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "request, channel = self.make_request('PUT', path, '')\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n", "content = '{\"membership\":[\"%s\",\"%s\",\"%s\"]}' % (Membership.INVITE,\n Membership.JOIN, Membership.LEAVE)\n", "request, channel = self.make_request('PUT', path, content.encode('ascii'))\n", "self.assertEquals(400, channel.code, msg=channel.result['body'])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self):...\n", "\"\"\"Model with callable polymorphic functions specified.\"\"\"\n", "@def_function.function...\n", "if VAR_55:\n", "return VAR_53 + VAR_54\n", "return VAR_53 * VAR_54\n" ]
[ "def testShowAllWithFunctions(self):...\n", "\"\"\"Model with callable polymorphic functions specified.\"\"\"\n", "@def_function.function...\n", "if c:\n", "return a + b\n", "return a * b\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(VAR_2):...\n", "VAR_4 = VAR_2.META.get('HTTP_X_FORWARDED_FOR')\n", "if VAR_4:\n", "VAR_25 = VAR_4.split(',')[-1].strip()\n", "VAR_25 = VAR_2.META.get('REMOTE_ADDR')\n", "return VAR_25\n" ]
[ "def get_client_ip(request):...\n", "x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')\n", "if x_forwarded_for:\n", "ip = x_forwarded_for.split(',')[-1].strip()\n", "ip = request.META.get('REMOTE_ADDR')\n", "return ip\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_3, VAR_4):...\n", "VAR_4['choices'] = [(x.strip(), x.strip()) for x in VAR_3.choices.split(',')]\n", "VAR_4['initial'] = [x.strip() for x in VAR_3.default_value.split(',')]\n", "return django.forms.MultipleChoiceField(widget=django.forms.\n CheckboxSelectMultiple, **options)\n" ]
[ "def create_checkboxes_field(self, field, options):...\n", "options['choices'] = [(x.strip(), x.strip()) for x in field.choices.split(',')]\n", "options['initial'] = [x.strip() for x in field.default_value.split(',')]\n", "return django.forms.MultipleChoiceField(widget=django.forms.\n CheckboxSelectMultiple, **options)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "async def FUNC_7(self, VAR_14, VAR_15):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = defaultdict(dict)\n", "for VAR_1 in VAR_15:\n", "assert not VAR_1.key_ready.called\n", "VAR_26 = await VAR_14.get_keys(VAR_28)\n", "VAR_47 = VAR_28[VAR_1.server_name]\n", "VAR_29 = []\n", "for VAR_43 in VAR_1.key_ids:\n", "for VAR_1 in VAR_15:\n", "VAR_47[VAR_43] = max(VAR_47.get(VAR_43, -1), VAR_1.minimum_valid_until_ts)\n", "VAR_2 = VAR_1.server_name\n", "VAR_15.difference_update(VAR_29)\n", "VAR_48 = VAR_26.get(VAR_2, {})\n", "for VAR_43 in VAR_1.key_ids:\n", "VAR_55 = VAR_48.get(VAR_43)\n", "if not VAR_55:\n", "if VAR_55.valid_until_ts < VAR_1.minimum_valid_until_ts:\n", "VAR_0.debug('Found key %s:%s for %s', VAR_2, VAR_43, VAR_1.request_name)\n", "self.clock.call_later(0, VAR_1.key_ready.callback, (VAR_2, VAR_43, VAR_55.\n verify_key))\n", "VAR_29.append(VAR_1)\n" ]
[ "async def _attempt_key_fetches_with_fetcher(self, fetcher, remaining_requests):...\n", "\"\"\"docstring\"\"\"\n", "missing_keys = defaultdict(dict)\n", "for verify_request in remaining_requests:\n", "assert not verify_request.key_ready.called\n", "results = await fetcher.get_keys(missing_keys)\n", "keys_for_server = missing_keys[verify_request.server_name]\n", "completed = []\n", "for key_id in verify_request.key_ids:\n", "for verify_request in remaining_requests:\n", "keys_for_server[key_id] = max(keys_for_server.get(key_id, -1),\n verify_request.minimum_valid_until_ts)\n", "server_name = verify_request.server_name\n", "remaining_requests.difference_update(completed)\n", "result_keys = results.get(server_name, {})\n", "for key_id in verify_request.key_ids:\n", "fetch_key_result = result_keys.get(key_id)\n", "if not fetch_key_result:\n", "if fetch_key_result.valid_until_ts < verify_request.minimum_valid_until_ts:\n", "logger.debug('Found key %s:%s for %s', server_name, key_id, verify_request.\n request_name)\n", "self.clock.call_later(0, verify_request.key_ready.callback, (server_name,\n key_id, fetch_key_result.verify_key))\n", "completed.append(verify_request)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "AsyncFunctionDef'", "Docstring", "Assign'", "For", "Assert'", "Assign'", "Assign'", "Assign'", "For", "For", "Assign'", "Assign'", "Expr'", "Assign'", "For", "Assign'", "Condition", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_46(self, VAR_137=2, VAR_138=False):...\n", "VAR_56 = VAR_263.request\n", "VAR_101, VAR_153 = self.db, self.table_cas()\n", "VAR_263.response.headers['Content-Type'] = 'text'\n", "VAR_264 = VAR_56.vars.ticket\n", "VAR_265 = 'renew' in VAR_56.vars\n", "VAR_266 = VAR_153(VAR_264=ticket)\n", "VAR_267 = False\n", "if VAR_266:\n", "VAR_260 = (self.settings.login_userfield or 'username' if 'username' in\n VAR_153.fields else 'email')\n", "def FUNC_159(VAR_82):...\n", "if VAR_264[0:3] == 'ST-' and not (VAR_266.renew and VAR_265) ^ VAR_265:\n", "VAR_366 = to_native(TAG['cas:serviceResponse'](VAR_82, **{'_xmlns:cas':\n 'http://www.yale.edu/tp/cas'}).xml())\n", "VAR_141 = self.table_user()(VAR_266.user_id)\n", "return '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' + VAR_366\n", "VAR_266.delete_record()\n", "VAR_267 = True\n" ]
[ "def cas_validate(self, version=2, proxy=False):...\n", "request = current.request\n", "db, table = self.db, self.table_cas()\n", "current.response.headers['Content-Type'] = 'text'\n", "ticket = request.vars.ticket\n", "renew = 'renew' in request.vars\n", "row = table(ticket=ticket)\n", "success = False\n", "if row:\n", "userfield = (self.settings.login_userfield or 'username' if 'username' in\n table.fields else 'email')\n", "def build_response(body):...\n", "if ticket[0:3] == 'ST-' and not (row.renew and renew) ^ renew:\n", "xml_body = to_native(TAG['cas:serviceResponse'](body, **{'_xmlns:cas':\n 'http://www.yale.edu/tp/cas'}).xml())\n", "user = self.table_user()(row.user_id)\n", "return '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' + xml_body\n", "row.delete_record()\n", "success = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_9(self):...\n", "return '{user}-{repo}'.format(user='Rick', repo='Morty')\n" ]
[ "def get_build_slug(self):...\n", "return '{user}-{repo}'.format(user='Rick', repo='Morty')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]