lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "def FUNC_0():...\n", "if VAR_9 in VAR_1:\n", "print('Directory already exist.')\n", "VAR_1.append(VAR_9)\n", "VAR_2.append(VAR_9)\n" ]
[ "def mkdir():...\n", "if dir in dirs:\n", "print('Directory already exist.')\n", "dirs.append(dir)\n", "path.append(dir)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute('string' + VAR_1 +\n \"' OR signature_misc.member ISNULL;\")\n" ]
[ "def query_signed_alumni(member):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute(\n \"\"\"\n SELECT DISTINCT packet.freshman_username AS username, signature_misc.member AS signed \n FROM packet LEFT OUTER JOIN signature_misc ON packet.id = signature_misc.packet_id \n WHERE signature_misc.member = '\"\"\"\n + member + \"' OR signature_misc.member ISNULL;\")\n" ]
[ 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "import json\n", "from psycopg2.extras import Json\n", "from django.contrib.postgres import forms, lookups\n", "from django.core import exceptions\n", "from django.db.models import Field, TextField, Transform, lookups as builtin_lookups\n", "from django.utils.translation import gettext_lazy as _\n", "from .mixins import CheckFieldDefaultMixin\n", "__all__ = ['JSONField']\n", "\"\"\"\n Customized psycopg2.extras.Json to allow for a custom encoder.\n \"\"\"\n", "def __init__(self, VAR_0, VAR_1=None, VAR_2=None):...\n", "self.encoder = VAR_2\n", "super().__init__(VAR_0, VAR_1=dumps)\n", "def FUNC_0(self, VAR_3):...\n", "VAR_21 = {'cls': self.encoder} if self.encoder else {}\n", "return json.dumps(VAR_3, **options)\n" ]
[ "import json\n", "from psycopg2.extras import Json\n", "from django.contrib.postgres import forms, lookups\n", "from django.core import exceptions\n", "from django.db.models import Field, TextField, Transform, lookups as builtin_lookups\n", "from django.utils.translation import gettext_lazy as _\n", "from .mixins import CheckFieldDefaultMixin\n", "__all__ = ['JSONField']\n", "\"\"\"\n Customized psycopg2.extras.Json to allow for a custom encoder.\n \"\"\"\n", "def __init__(self, adapted, dumps=None, encoder=None):...\n", "self.encoder = encoder\n", "super().__init__(adapted, dumps=dumps)\n", "def dumps(self, obj):...\n", "options = {'cls': self.encoder} if self.encoder else {}\n", "return json.dumps(obj, **options)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Return'" ]
[ "@VAR_0.route('/logout')...\n", "VAR_10.clear()\n", "flash('You are now logged out', 'success')\n", "return redirect(url_for('login'))\n" ]
[ "@app.route('/logout')...\n", "session.clear()\n", "flash('You are now logged out', 'success')\n", "return redirect(url_for('login'))\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_13(self, VAR_10, VAR_16):...\n", "VAR_15 = self.find_products_by_upc(VAR_10)\n", "self._purchase_by_product(VAR_15, VAR_16)\n" ]
[ "def purchase_by_product_upc(self, product_upc, quantity):...\n", "product = self.find_products_by_upc(product_upc)\n", "self._purchase_by_product(product, quantity)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_0(self):...\n", "self.client.login(username='Karyn', password='specialP@55word')\n" ]
[ "def setUp(self):...\n", "self.client.login(username='Karyn', password='specialP@55word')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_11(self, VAR_12):...\n", "VAR_5 = {}\n", "VAR_5['serverName'] = VAR_12['host']\n", "VAR_16 = self._cliq_run_xml('getServerInfo', VAR_5, False)\n", "VAR_33 = VAR_16.find('response')\n", "VAR_34 = VAR_33.attrib.get('result')\n", "if VAR_34 != '0':\n", "VAR_5 = {}\n", "VAR_5['serverName'] = VAR_12['host']\n", "VAR_5['initiator'] = VAR_12['initiator']\n", "self._cliq_run_xml('createServer', VAR_5)\n" ]
[ "def _create_server(self, connector):...\n", "cliq_args = {}\n", "cliq_args['serverName'] = connector['host']\n", "out = self._cliq_run_xml('getServerInfo', cliq_args, False)\n", "response = out.find('response')\n", "result = response.attrib.get('result')\n", "if result != '0':\n", "cliq_args = {}\n", "cliq_args['serverName'] = connector['host']\n", "cliq_args['initiator'] = connector['initiator']\n", "self._cliq_run_xml('createServer', cliq_args)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "super(CLASS_0, self).tearDown()\n", "if self.manager.clients_initialized:\n", "if self.servers:\n", "for VAR_7 in self.servers:\n", "self._delete_server(VAR_7)\n", "VAR_0.debug(traceback.format_exc())\n", "self.servers.remove(VAR_7)\n", "VAR_0.debug('Server was already deleted.')\n" ]
[ "def tearDown(self):...\n", "super(TestNovaNetwork, self).tearDown()\n", "if self.manager.clients_initialized:\n", "if self.servers:\n", "for server in self.servers:\n", "self._delete_server(server)\n", "LOG.debug(traceback.format_exc())\n", "self.servers.remove(server)\n", "LOG.debug('Server was already deleted.')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Condition", "For", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "import os\n", "import vim\n", "import tempfile\n", "import json\n", "import signal\n", "from subprocess import PIPE\n", "from ycm import vimsupport\n", "from ycm import utils\n", "from ycm.diagnostic_interface import DiagnosticInterface\n", "from ycm.completers.all.omni_completer import OmniCompleter\n", "from ycm.completers.general import syntax_parse\n", "from ycm.completers.completer_utils import FiletypeCompleterExistsForFiletype\n", "from ycm.client.ycmd_keepalive import YcmdKeepalive\n", "from ycm.client.base_request import BaseRequest, BuildRequestData\n", "from ycm.client.command_request import SendCommandRequest\n", "from ycm.client.completion_request import CompletionRequest\n", "from ycm.client.omni_completion_request import OmniCompletionRequest\n", "from ycm.client.event_notification import SendEventNotificationAsync, EventNotification\n", "from ycm.server.responses import ServerError\n", "from UltiSnips import UltiSnips_Manager\n", "VAR_6 = False\n", "VAR_0.environ['no_proxy'] = '127.0.0.1,localhost'\n", "VAR_6 = True\n", "signal.signal(signal.SIGINT, signal.SIG_IGN)\n", "VAR_1 = 30\n", "VAR_2 = ('The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +\n \"\"\"Stderr (last {0} lines):\n\n\"\"\".format(VAR_1))\n", "VAR_3 = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). check console output for logs!'\n )\n", "VAR_4 = 10800\n", "def __init__(self, VAR_7):...\n", "self._user_options = VAR_7\n", "self._user_notified_about_crash = False\n", "self._diag_interface = DiagnosticInterface(VAR_7)\n", "self._omnicomp = OmniCompleter(VAR_7)\n", "self._latest_completion_request = None\n", "self._latest_file_parse_request = None\n", "self._server_stdout = None\n", "self._server_stderr = None\n", "self._server_popen = None\n", "self._filetypes_with_keywords_loaded = set()\n", "self._temp_options_filename = None\n", "self._ycmd_keepalive = YcmdKeepalive()\n", "self._SetupServer()\n", "self._ycmd_keepalive.Start()\n", "def FUNC_2(self):...\n", "VAR_14 = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "VAR_21 = [utils.PathToPythonInterpreter(), FUNC_0(), '--port={0}'.format(\n VAR_14), '--options_file={0}'.format(options_file.name), '--log={0}'.\n format(self._user_options['server_log_level']),\n '--idle_suicide_seconds={0}'.format(VAR_4)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "VAR_26 = VAR_0.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log')\n", "self._server_popen = utils.SafePopen(VAR_21, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = VAR_26.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(VAR_14)\n", "self._server_stderr = VAR_26.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "VAR_21.append('--stdout={0}'.format(self._server_stdout))\n", "def FUNC_3(self):...\n", "VAR_21.append('--stderr={0}'.format(self._server_stderr))\n", "VAR_15 = self._server_popen.poll()\n", "if self._user_options['server_keep_logfiles']:\n", "return VAR_15 is None\n", "VAR_21.append('--keep_logfiles')\n" ]
[ "import os\n", "import vim\n", "import tempfile\n", "import json\n", "import signal\n", "from subprocess import PIPE\n", "from ycm import vimsupport\n", "from ycm import utils\n", "from ycm.diagnostic_interface import DiagnosticInterface\n", "from ycm.completers.all.omni_completer import OmniCompleter\n", "from ycm.completers.general import syntax_parse\n", "from ycm.completers.completer_utils import FiletypeCompleterExistsForFiletype\n", "from ycm.client.ycmd_keepalive import YcmdKeepalive\n", "from ycm.client.base_request import BaseRequest, BuildRequestData\n", "from ycm.client.command_request import SendCommandRequest\n", "from ycm.client.completion_request import CompletionRequest\n", "from ycm.client.omni_completion_request import OmniCompletionRequest\n", "from ycm.client.event_notification import SendEventNotificationAsync, EventNotification\n", "from ycm.server.responses import ServerError\n", "from UltiSnips import UltiSnips_Manager\n", "USE_ULTISNIPS_DATA = False\n", "os.environ['no_proxy'] = '127.0.0.1,localhost'\n", "USE_ULTISNIPS_DATA = True\n", "signal.signal(signal.SIGINT, signal.SIG_IGN)\n", "NUM_YCMD_STDERR_LINES_ON_CRASH = 30\n", "SERVER_CRASH_MESSAGE_STDERR_FILE = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). ' +\n \"\"\"Stderr (last {0} lines):\n\n\"\"\".format(NUM_YCMD_STDERR_LINES_ON_CRASH))\n", "SERVER_CRASH_MESSAGE_SAME_STDERR = (\n 'The ycmd server SHUT DOWN (restart with :YcmRestartServer). check console output for logs!'\n )\n", "SERVER_IDLE_SUICIDE_SECONDS = 10800\n", "def __init__(self, user_options):...\n", "self._user_options = user_options\n", "self._user_notified_about_crash = False\n", "self._diag_interface = DiagnosticInterface(user_options)\n", "self._omnicomp = OmniCompleter(user_options)\n", "self._latest_completion_request = None\n", "self._latest_file_parse_request = None\n", "self._server_stdout = None\n", "self._server_stderr = None\n", "self._server_popen = None\n", "self._filetypes_with_keywords_loaded = set()\n", "self._temp_options_filename = None\n", "self._ycmd_keepalive = YcmdKeepalive()\n", "self._SetupServer()\n", "self._ycmd_keepalive.Start()\n", "def _SetupServer(self):...\n", "server_port = utils.GetUnusedLocalhostPort()\n", "self._temp_options_filename = options_file.name\n", "json.dump(dict(self._user_options), options_file)\n", "options_file.flush()\n", "args = [utils.PathToPythonInterpreter(), _PathToServerScript(),\n '--port={0}'.format(server_port), '--options_file={0}'.format(\n options_file.name), '--log={0}'.format(self._user_options[\n 'server_log_level']), '--idle_suicide_seconds={0}'.format(\n SERVER_IDLE_SUICIDE_SECONDS)]\n", "if not self._user_options['server_use_vim_stdout']:\n", "filename_format = os.path.join(utils.PathToTempDir(), 'server_{port}_{std}.log'\n )\n", "self._server_popen = utils.SafePopen(args, stdout=PIPE, stderr=PIPE)\n", "self._server_stdout = filename_format.format(port=server_port, std='stdout')\n", "BaseRequest.server_location = 'http://localhost:' + str(server_port)\n", "self._server_stderr = filename_format.format(port=server_port, std='stderr')\n", "self._NotifyUserIfServerCrashed()\n", "args.append('--stdout={0}'.format(self._server_stdout))\n", "def _IsServerAlive(self):...\n", "args.append('--stderr={0}'.format(self._server_stderr))\n", "returncode = self._server_popen.poll()\n", "if self._user_options['server_keep_logfiles']:\n", "return returncode is None\n", "args.append('--keep_logfiles')\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, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Condition", "Return'", "Expr'" ]
[ "\"\"\"string\"\"\"\n", "from datetime import datetime\n", "import logging\n", "import os\n", "import sys\n", "from docopt import docopt\n", "from monitoring_config_generator.exceptions import MonitoringConfigGeneratorException, ConfigurationContainsUndefinedVariables, NoSuchHostname, HostUnreachableException\n", "from monitoring_config_generator import set_log_level_to_debug\n", "from monitoring_config_generator.yaml_tools.readers import Header, read_config\n", "from monitoring_config_generator.yaml_tools.config import YamlConfig\n", "from monitoring_config_generator.settings import CONFIG\n", "VAR_0 = 0\n", "VAR_1 = 1\n", "VAR_2 = 2\n", "VAR_3 = logging.getLogger('monconfgenerator')\n", "def __init__(self, VAR_4, VAR_5=False, VAR_6=None, VAR_7=False):...\n", "self.skip_checks = VAR_7\n", "self.target_dir = VAR_6 if VAR_6 else CONFIG['TARGET_DIR']\n", "self.source = VAR_4\n", "if VAR_5:\n", "set_log_level_to_debug()\n", "if not self.target_dir or not os.path.isdir(self.target_dir):\n", "VAR_3.debug('Using %s as target dir' % self.target_dir)\n", "VAR_3.debug('Using URL: %s' % self.source)\n", "VAR_3.debug(\n 'MonitoringConfigGenerator start: reading from %s, writing to %s' % (\n self.source, self.target_dir))\n", "def FUNC_1(self, VAR_8, VAR_9):...\n", "if not VAR_9:\n", "VAR_22 = self.output_path(self.create_filename(VAR_9))\n", "VAR_23 = Header.parse(VAR_22)\n", "return VAR_8.is_newer_than(VAR_23)\n" ]
[ "\"\"\"monconfgenerator\n\nCreates an Icinga monitoring configuration. It does it by querying an URL from\nwhich it receives a specially formatted yaml file. This file is transformed into\na valid Icinga configuration file.\nIf no URL is given it reads it's default configuration from file system. The\nconfiguration file is: /etc/monitoring_config_generator/config.yaml'\n\nUsage:\n monconfgenerator [--debug] [--targetdir=<directory>] [--skip-checks] [URL]\n monconfgenerator -h\n\nOptions:\n -h Show this message.\n --debug Print additional information.\n --targetdir=DIR The generated Icinga monitoring configuration is written\n into this directory. If no target directory is given its\n value is read from /etc/monitoring_config_generator/config.yaml\n --skip-checks Do not run checks on the yaml file received from the URL.\n\n\"\"\"\n", "from datetime import datetime\n", "import logging\n", "import os\n", "import sys\n", "from docopt import docopt\n", "from monitoring_config_generator.exceptions import MonitoringConfigGeneratorException, ConfigurationContainsUndefinedVariables, NoSuchHostname, HostUnreachableException\n", "from monitoring_config_generator import set_log_level_to_debug\n", "from monitoring_config_generator.yaml_tools.readers import Header, read_config\n", "from monitoring_config_generator.yaml_tools.config import YamlConfig\n", "from monitoring_config_generator.settings import CONFIG\n", "EXIT_CODE_CONFIG_WRITTEN = 0\n", "EXIT_CODE_ERROR = 1\n", "EXIT_CODE_NOT_WRITTEN = 2\n", "LOG = logging.getLogger('monconfgenerator')\n", "def __init__(self, url, debug_enabled=False, target_dir=None, skip_checks=False...\n", "self.skip_checks = skip_checks\n", "self.target_dir = target_dir if target_dir else CONFIG['TARGET_DIR']\n", "self.source = url\n", "if debug_enabled:\n", "set_log_level_to_debug()\n", "if not self.target_dir or not os.path.isdir(self.target_dir):\n", "LOG.debug('Using %s as target dir' % self.target_dir)\n", "LOG.debug('Using URL: %s' % self.source)\n", "LOG.debug('MonitoringConfigGenerator start: reading from %s, writing to %s' %\n (self.source, self.target_dir))\n", "def _is_newer(self, header_source, hostname):...\n", "if not hostname:\n", "output_path = self.output_path(self.create_filename(hostname))\n", "old_header = Header.parse(output_path)\n", "return header_source.is_newer_than(old_header)\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 ]
[ "Expr'", "ImportFrom'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_3 = XsrfTool()\n", "VAR_4 = users.get_current_user()\n", "if not (self.params.xsrf_token and VAR_3.verify_token(self.params.\n", "self.error(403)\n", "VAR_5 = 'delete', str(self.params.id)\n", "return False\n", "self.redirect('/delete', id=self.params.id, signature=reveal.sign(action))\n" ]
[ "def post(self):...\n", "xsrf_tool = XsrfTool()\n", "user = users.get_current_user()\n", "if not (self.params.xsrf_token and xsrf_tool.verify_token(self.params.\n", "self.error(403)\n", "action = 'delete', str(self.params.id)\n", "return False\n", "self.redirect('/delete', id=self.params.id, signature=reveal.sign(action))\n" ]
[ 0, 0, 0, 5, 5, 5, 5, 5 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_0(VAR_0, VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {}\n", "for count in range(0, 50):\n", "if kb.dbms == 'Oracle' and VAR_0.endswith(' FROM DUAL'):\n", "return None\n", "VAR_0 = VAR_0[:-len(' FROM DUAL')]\n", "if count:\n", "VAR_0 += ', NULL'\n", "if kb.dbms == 'Oracle':\n", "VAR_0 += ' FROM DUAL'\n", "VAR_5 = agent.postfixQuery(VAR_0, VAR_1)\n", "VAR_6 = agent.payload(newValue=commentedQuery)\n", "VAR_7 = Request.queryPage(VAR_6)\n", "if not VAR_7 in VAR_2.keys():\n", "VAR_2[VAR_7] = 1, VAR_5\n", "VAR_2[VAR_7] = VAR_2[VAR_7][0] + 1, VAR_5\n", "if count:\n", "for element in VAR_2.values():\n", "if element[0] == 1:\n", "if kb.injPlace == 'GET':\n", "VAR_4 = '%s?%s' % (conf.url, VAR_6)\n", "if kb.injPlace == 'POST':\n", "return VAR_4\n", "VAR_4 = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'Cookie':\n", "VAR_4 += \"\\nPOST:\\t'%s'\\n\" % VAR_6\n", "VAR_4 = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'User-Agent':\n", "VAR_4 += \"\\nCookie:\\t'%s'\\n\" % VAR_6\n", "VAR_4 = \"URL:\\t\\t'%s'\" % conf.url\n", "VAR_4 += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % VAR_6\n" ]
[ "def __effectiveUnionTest(query, comment):...\n", "\"\"\"docstring\"\"\"\n", "resultDict = {}\n", "for count in range(0, 50):\n", "if kb.dbms == 'Oracle' and query.endswith(' FROM DUAL'):\n", "return None\n", "query = query[:-len(' FROM DUAL')]\n", "if count:\n", "query += ', NULL'\n", "if kb.dbms == 'Oracle':\n", "query += ' FROM DUAL'\n", "commentedQuery = agent.postfixQuery(query, comment)\n", "payload = agent.payload(newValue=commentedQuery)\n", "newResult = Request.queryPage(payload)\n", "if not newResult in resultDict.keys():\n", "resultDict[newResult] = 1, commentedQuery\n", "resultDict[newResult] = resultDict[newResult][0] + 1, commentedQuery\n", "if count:\n", "for element in resultDict.values():\n", "if element[0] == 1:\n", "if kb.injPlace == 'GET':\n", "value = '%s?%s' % (conf.url, payload)\n", "if kb.injPlace == 'POST':\n", "return value\n", "value = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'Cookie':\n", "value += \"\\nPOST:\\t'%s'\\n\" % payload\n", "value = \"URL:\\t'%s'\" % conf.url\n", "if kb.injPlace == 'User-Agent':\n", "value += \"\\nCookie:\\t'%s'\\n\" % payload\n", "value = \"URL:\\t\\t'%s'\" % conf.url\n", "value += \"\"\"\nUser-Agent:\t'%s'\n\"\"\" % payload\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 2 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "For", "Condition", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Condition", "AugAssign'", "Assign'", "Condition", "AugAssign'", "Assign'", "AugAssign'" ]
[ "@web.authenticated...\n", "VAR_3 = self.contents_manager\n", "if VAR_3.is_hidden(VAR_1) and not VAR_3.allow_hidden:\n", "self.log.info('Refusing to serve hidden file, via 404 Error')\n", "VAR_1 = VAR_1.strip('/')\n", "if '/' in VAR_1:\n", "VAR_5, VAR_6 = VAR_1.rsplit('/', 1)\n", "VAR_6 = VAR_1\n", "VAR_4 = yield maybe_future(VAR_3.get(VAR_1, type='file', content=include_body))\n", "if self.get_argument('download', False):\n", "self.set_attachment_header(VAR_6)\n", "if VAR_6.lower().endswith('.ipynb'):\n", "self.set_header('Content-Type', 'application/x-ipynb+json')\n", "VAR_7 = mimetypes.guess_type(VAR_6)[0]\n", "if VAR_2:\n", "if VAR_7 == 'text/plain':\n", "if VAR_4['format'] == 'base64':\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "if VAR_7 is not None:\n", "VAR_8 = VAR_4['content'].encode('ascii')\n", "if VAR_4['format'] == 'json':\n", "self.set_header('Content-Type', VAR_7)\n", "if VAR_4['format'] == 'base64':\n", "self.write(decodebytes(VAR_8))\n", "self.write(json.dumps(VAR_4['content']))\n", "self.write(VAR_4['content'])\n", "self.set_header('Content-Type', 'application/octet-stream')\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "self.flush()\n" ]
[ "@web.authenticated...\n", "cm = self.contents_manager\n", "if cm.is_hidden(path) and not cm.allow_hidden:\n", "self.log.info('Refusing to serve hidden file, via 404 Error')\n", "path = path.strip('/')\n", "if '/' in path:\n", "_, name = path.rsplit('/', 1)\n", "name = path\n", "model = yield maybe_future(cm.get(path, type='file', content=include_body))\n", "if self.get_argument('download', False):\n", "self.set_attachment_header(name)\n", "if name.lower().endswith('.ipynb'):\n", "self.set_header('Content-Type', 'application/x-ipynb+json')\n", "cur_mime = mimetypes.guess_type(name)[0]\n", "if include_body:\n", "if cur_mime == 'text/plain':\n", "if model['format'] == 'base64':\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "if cur_mime is not None:\n", "b64_bytes = model['content'].encode('ascii')\n", "if model['format'] == 'json':\n", "self.set_header('Content-Type', cur_mime)\n", "if model['format'] == 'base64':\n", "self.write(decodebytes(b64_bytes))\n", "self.write(json.dumps(model['content']))\n", "self.write(model['content'])\n", "self.set_header('Content-Type', 'application/octet-stream')\n", "self.set_header('Content-Type', 'text/plain; charset=UTF-8')\n", "self.flush()\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 ]
[ "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "For", "Expr'", "Condition", "Assign'", "For", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_0):...\n", "VAR_2 = []\n", "VAR_3 = FUNC_4(VAR_0)\n", "VAR_4 = FUNC_3(VAR_0)\n", "for item in VAR_3:\n", "if VAR_4.get(item.name):\n", "return VAR_2\n", "VAR_9 = VAR_4[item.name]\n", "VAR_10 = {'item_group': item.item_group, 'item': item.name, 'item_name':\n item.item_name}\n", "if VAR_9.days_since_last_order > cint(VAR_0['days']):\n", "VAR_2.append(VAR_10)\n", "VAR_10 = {'territory': VAR_9.territory, 'item_group': VAR_9.item_group,\n 'item': VAR_9.name, 'item_name': VAR_9.item_name, 'customer': VAR_9.\n customer, 'last_order_date': VAR_9.last_order_date, 'qty': VAR_9.qty,\n 'days_since_last_order': VAR_9.days_since_last_order}\n", "VAR_2.append(VAR_10)\n" ]
[ "def get_data(filters):...\n", "data = []\n", "items = get_items(filters)\n", "sales_invoice_data = get_sales_details(filters)\n", "for item in items:\n", "if sales_invoice_data.get(item.name):\n", "return data\n", "item_obj = sales_invoice_data[item.name]\n", "row = {'item_group': item.item_group, 'item': item.name, 'item_name': item.\n item_name}\n", "if item_obj.days_since_last_order > cint(filters['days']):\n", "data.append(row)\n", "row = {'territory': item_obj.territory, 'item_group': item_obj.item_group,\n 'item': item_obj.name, 'item_name': item_obj.item_name, 'customer':\n item_obj.customer, 'last_order_date': item_obj.last_order_date, 'qty':\n item_obj.qty, 'days_since_last_order': item_obj.days_since_last_order}\n", "data.append(row)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.bindings\n", "VAR_15 = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "VAR_12 = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'aws', 'type': 'destroyServerGroup', 'serverGroupName': group_name,\n 'asgName': group_name, 'region': bindings['TEST_AWS_REGION'], 'regions':\n [bindings['TEST_AWS_REGION']], 'credentials': bindings[\n 'AWS_CREDENTIALS'], 'user': '[anonymous]'}], application=self.TEST_APP,\n description='DestroyServerGroup: ' + group_name)\n", "VAR_13 = aws.AwsContractBuilder(self.aws_observer)\n", "VAR_13.new_clause_builder('Auto Scaling Group Removed').collect_resources(\n 'autoscaling', 'describe-auto-scaling-groups', args=[\n '--auto-scaling-group-names', group_name], no_resources_ok=True\n ).contains_path_value('AutoScalingGroups', {'MaxSize': 0})\n", "VAR_13.new_clause_builder('Instances Are Removed', retryable_for_secs=30\n ).collect_resources('ec2', 'describe-instances', no_resources_ok=True\n ).excludes_path_value('name', VAR_15)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_server_group', data=payload, path='tasks'), VAR_6=builder.build())\n" ]
[ "def delete_server_group(self):...\n", "\"\"\"docstring\"\"\"\n", "bindings = self.bindings\n", "group_name = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'aws', 'type': 'destroyServerGroup', 'serverGroupName': group_name,\n 'asgName': group_name, 'region': bindings['TEST_AWS_REGION'], 'regions':\n [bindings['TEST_AWS_REGION']], 'credentials': bindings[\n 'AWS_CREDENTIALS'], 'user': '[anonymous]'}], application=self.TEST_APP,\n description='DestroyServerGroup: ' + group_name)\n", "builder = aws.AwsContractBuilder(self.aws_observer)\n", "builder.new_clause_builder('Auto Scaling Group Removed').collect_resources(\n 'autoscaling', 'describe-auto-scaling-groups', args=[\n '--auto-scaling-group-names', group_name], no_resources_ok=True\n ).contains_path_value('AutoScalingGroups', {'MaxSize': 0})\n", "builder.new_clause_builder('Instances Are Removed', retryable_for_secs=30\n ).collect_resources('ec2', 'describe-instances', no_resources_ok=True\n ).excludes_path_value('name', group_name)\n", "return st.OperationContract(self.new_post_operation(title=\n 'delete_server_group', data=payload, path='tasks'), contract=builder.\n build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_0(self):...\n", "" ]
[ "def run_check(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_2(self, VAR_1):...\n", "VAR_2 = self.connect()\n", "VAR_3 = \"INSERT INTO crimes (description) VALUES ('{}');\".format(VAR_1)\n", "VAR_2.close()\n", "cursor.execute(VAR_3)\n", "VAR_2.commit()\n" ]
[ "def add_input(self, data):...\n", "connection = self.connect()\n", "query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n", "connection.close()\n", "cursor.execute(query)\n", "connection.commit()\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_19(self):...\n", "VAR_25 = c.get('/test')\n", "self.assertEqual(VAR_25.status_code, 200)\n" ]
[ "def test_no_authn(self):...\n", "resp = c.get('/test')\n", "self.assertEqual(resp.status_code, 200)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_9, VAR_10):...\n", "return ' %s %s);' % (VAR_9, VAR_10)\n" ]
[ "def create_table_field_end(self, current, field):...\n", "return ' %s %s);' % (current, field)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_13(self, VAR_16):...\n", "return VAR_6 in VAR_16.bookmarks\n" ]
[ "def does_intersect_rule(self, rulectx):...\n", "return bookmark in rulectx.bookmarks\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import tornado.ioloop\n", "import tornado.web\n", "import tornado.websocket\n", "import tornado.httpclient\n", "import tornado.gen\n", "import os\n", "import random\n", "import shutil\n", "import json\n", "import multiprocessing\n", "from utilities import sort_naturally\n", "import settings\n", "import redditUserImageScraper\n", "VAR_0 = False\n", "if VAR_0:\n", "import PasswordManager\n", "VAR_1 = []\n", "VAR_2 = '.mp4', '.webm'\n", "VAR_3 = '.gif', '.jpg', '.jpeg', '.png', '.mp4', '.webm'\n", "VAR_4 = []\n", "def FUNC_0(VAR_5):...\n", "VAR_4 = []\n", "print('Creating Liked Saved cache...')\n", "for root, dirs, files in os.walk(VAR_5):\n", "for file in files:\n", "print('Finished creating Liked Saved cache ({} images/videos)'.format(len(\n VAR_4)))\n", "if file.endswith(VAR_3):\n", "def FUNC_1(VAR_6):...\n", "VAR_4.append(os.path.join(root, file))\n", "return 'output' + VAR_6.split(VAR_51.settings['Output_dir'])[1]\n" ]
[ "import tornado.ioloop\n", "import tornado.web\n", "import tornado.websocket\n", "import tornado.httpclient\n", "import tornado.gen\n", "import os\n", "import random\n", "import shutil\n", "import json\n", "import multiprocessing\n", "from utilities import sort_naturally\n", "import settings\n", "import redditUserImageScraper\n", "enable_authentication = False\n", "if enable_authentication:\n", "import PasswordManager\n", "authenticated_users = []\n", "videoExtensions = '.mp4', '.webm'\n", "supportedExtensions = '.gif', '.jpg', '.jpeg', '.png', '.mp4', '.webm'\n", "savedImagesCache = []\n", "def generateSavedImagesCache(outputDir):...\n", "savedImagesCache = []\n", "print('Creating Liked Saved cache...')\n", "for root, dirs, files in os.walk(outputDir):\n", "for file in files:\n", "print('Finished creating Liked Saved cache ({} images/videos)'.format(len(\n savedImagesCache)))\n", "if file.endswith(supportedExtensions):\n", "def outputPathToServerPath(path):...\n", "savedImagesCache.append(os.path.join(root, file))\n", "return 'output' + path.split(settings.settings['Output_dir'])[1]\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 ]
[ "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "Assign'", "Condition", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "For", "For", "Expr'", "Condition", "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_14(self, VAR_16, *VAR_9, **VAR_7):...\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n", "VAR_9 = ['-m', VAR_16] + list(VAR_9)\n", "if VAR_7.pop('nodebug', False):\n", "VAR_9.insert(0, '--nodebug')\n", "self._launch(VAR_9, **kwargs)\n", "return self._adapter, self._session\n" ]
[ "def launch_module(self, module, *argv, **kwargs):...\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n", "argv = ['-m', module] + list(argv)\n", "if kwargs.pop('nodebug', False):\n", "argv.insert(0, '--nodebug')\n", "self._launch(argv, **kwargs)\n", "return self._adapter, self._session\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Assert'", "Assign'", "Condition", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_1():...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "for arg in request.args:\n", "VAR_8 = re.findall('page_(.*)', arg)\n", "return VAR_5\n", "if VAR_8:\n", "VAR_5[VAR_8[0]] = int(request.args.get(arg))\n" ]
[ "def get_page_args():...\n", "\"\"\"docstring\"\"\"\n", "pages = {}\n", "for arg in request.args:\n", "re_match = re.findall('page_(.*)', arg)\n", "return pages\n", "if re_match:\n", "pages[re_match[0]] = int(request.args.get(arg))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Assign'", "Return'", "Condition", "Assign'" ]
[ "def FUNC_23(self, VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = self.common._cli_run('showvlun -a -showcols Port', None)\n", "VAR_36 = {}\n", "for VAR_15 in VAR_16:\n", "VAR_36[VAR_15] = 0\n", "VAR_37 = None\n", "if VAR_35:\n", "VAR_35 = VAR_35[1:]\n", "return VAR_37\n", "for line in VAR_35:\n", "VAR_15 = line.strip()\n", "VAR_41 = sys.maxint\n", "if VAR_15 in VAR_36:\n", "for VAR_15, count in VAR_36.iteritems():\n", "VAR_36[VAR_15] = VAR_36[VAR_15] + 1\n", "if count < VAR_41:\n", "VAR_37 = VAR_15\n", "VAR_41 = count\n" ]
[ "def _get_least_used_nsp(self, nspss):...\n", "\"\"\"docstring\"\"\"\n", "result = self.common._cli_run('showvlun -a -showcols Port', None)\n", "nsp_counts = {}\n", "for nsp in nspss:\n", "nsp_counts[nsp] = 0\n", "current_least_used_nsp = None\n", "if result:\n", "result = result[1:]\n", "return current_least_used_nsp\n", "for line in result:\n", "nsp = line.strip()\n", "current_smallest_count = sys.maxint\n", "if nsp in nsp_counts:\n", "for nsp, count in nsp_counts.iteritems():\n", "nsp_counts[nsp] = nsp_counts[nsp] + 1\n", "if count < current_smallest_count:\n", "current_least_used_nsp = nsp\n", "current_smallest_count = count\n" ]
[ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "For", "Assign'", "Assign'", "Condition", "For", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def FUNC_15(VAR_14):...\n", "\"\"\"docstring\"\"\"\n", "VAR_30 = get_object_or_404(Article, pk=int(request.POST['article']))\n", "VAR_31 = VAR_14.POST['body']\n", "VAR_32 = dmp.diff_main(VAR_30.content, VAR_31)\n", "dmp.diff_cleanupSemantic(VAR_32)\n", "return HttpResponse(dmp.diff_prettyHtml(VAR_32), content_type='text/html')\n" ]
[ "def article_diff(request):...\n", "\"\"\"docstring\"\"\"\n", "current_article = get_object_or_404(Article, pk=int(request.POST['article']))\n", "content = request.POST['body']\n", "diffs = dmp.diff_main(current_article.content, content)\n", "dmp.diff_cleanupSemantic(diffs)\n", "return HttpResponse(dmp.diff_prettyHtml(diffs), content_type='text/html')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_3(self):...\n", "if not self.get_option('no-database') and self.conf:\n", "return self.collect_database()\n", "return False\n" ]
[ "def run_extra_cmd(self):...\n", "if not self.get_option('no-database') and self.conf:\n", "return self.collect_database()\n", "return False\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_13(VAR_16):...\n", "\"\"\"docstring\"\"\"\n", "if FUNC_12(VAR_16, 'protected'):\n", "return VAR_19(VAR_16, 'temp')\n" ]
[ "def temp(value):...\n", "\"\"\"docstring\"\"\"\n", "if is_flagged(value, 'protected'):\n", "return flag(value, 'temp')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'" ]
[ "@staticmethod...\n", "VAR_5 = CLASS_0._get_report(VAR_1)\n", "if not VAR_5:\n", "VAR_9 = {'analysis': VAR_5}\n", "VAR_13 = CLASS_0._get_dnsinfo(VAR_5)\n", "VAR_9.update(VAR_13)\n", "return VAR_9\n" ]
[ "@staticmethod...\n", "report = AnalysisController._get_report(task_id)\n", "if not report:\n", "data = {'analysis': report}\n", "dnsinfo = AnalysisController._get_dnsinfo(report)\n", "data.update(dnsinfo)\n", "return data\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_2):...\n", "self.__proxies = VAR_2\n" ]
[ "def __init__(self, proxies):...\n", "self.__proxies = proxies\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_22(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = VAR_0[:]\n", "for user in self.company.employees:\n", "VAR_11.append((Allow, user.login, ('list_sale_products',\n 'view_sale_product', 'edit_sale_product')))\n", "return VAR_11\n" ]
[ "def get_product_acl(self):...\n", "\"\"\"docstring\"\"\"\n", "acl = DEFAULT_PERM[:]\n", "for user in self.company.employees:\n", "acl.append((Allow, user.login, ('list_sale_products', 'view_sale_product',\n 'edit_sale_product')))\n", "return acl\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Expr'", "Return'" ]
[ "def FUNC_28(self):...\n", "VAR_54 = Digraph('Deps', strict=True)\n", "VAR_54.graph_attr.update(rankdir='BT')\n", "VAR_49 = self.nodes.get('master_node')\n", "self.logger.error(\n 'Detected circular dependency reference between %s and %s!' % (ex.node1,\n ex.node2))\n", "VAR_54.view()\n", "for current in VAR_49.depends_on:\n", "VAR_54.edge(ex.node1, ex.node2, 'circular error', color='red')\n", "VAR_54.node(current.comp_name)\n", "VAR_54.edge(ex.node2, ex.node1, color='red')\n", "VAR_50 = []\n", "VAR_51 = []\n", "dep_resolve(current, VAR_50, VAR_51)\n", "for VAR_49 in VAR_50:\n", "if 'depends' in VAR_49.component:\n", "for dep in VAR_49.component['depends']:\n", "if dep not in self.nodes:\n", "VAR_54.node(dep, color='red')\n", "if VAR_49.comp_name is not 'master_node':\n", "VAR_54.edge(VAR_49.comp_name, dep, 'missing', color='red')\n", "VAR_54.edge(VAR_49.comp_name, dep)\n" ]
[ "def draw_graph(self):...\n", "deps = Digraph('Deps', strict=True)\n", "deps.graph_attr.update(rankdir='BT')\n", "node = self.nodes.get('master_node')\n", "self.logger.error(\n 'Detected circular dependency reference between %s and %s!' % (ex.node1,\n ex.node2))\n", "deps.view()\n", "for current in node.depends_on:\n", "deps.edge(ex.node1, ex.node2, 'circular error', color='red')\n", "deps.node(current.comp_name)\n", "deps.edge(ex.node2, ex.node1, color='red')\n", "res = []\n", "unres = []\n", "dep_resolve(current, res, unres)\n", "for node in res:\n", "if 'depends' in node.component:\n", "for dep in node.component['depends']:\n", "if dep not in self.nodes:\n", "deps.node(dep, color='red')\n", "if node.comp_name is not 'master_node':\n", "deps.edge(node.comp_name, dep, 'missing', color='red')\n", "deps.edge(node.comp_name, dep)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "For", "Condition", "For", "Condition", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_12(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_21)\n", "return False\n", "return VAR_24[VAR_2] == VAR_11\n" ]
[ "def islink(self, path):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(path)\n", "return False\n", "return f[A_TYPE] == T_LINK\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'", "Return'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.host_status.get(self.hostname):\n", "VAR_9 = 'ssh -F %s %s \"ps -p %s > /dev/null\"' % (config.\n CUSTOM_SSH_CONFIG_PATH, self.hostname, self.pid)\n", "return True\n", "if call(VAR_9, shell=True) == 0:\n", "return True\n", "return CLASS_6(self.comp_name, self.hostname)\n" ]
[ "def run_check(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.host_status.get(self.hostname):\n", "cmd = 'ssh -F %s %s \"ps -p %s > /dev/null\"' % (config.\n CUSTOM_SSH_CONFIG_PATH, self.hostname, self.pid)\n", "return True\n", "if call(cmd, shell=True) == 0:\n", "return True\n", "return RemoteCrashEvent(self.comp_name, self.hostname)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'", "Condition", "Return'", "Return'" ]
[ "@VAR_0.route('/')...\n", "VAR_3 = request.args.get('start', None, float)\n", "VAR_4 = request.args.get('end', None, float)\n", "VAR_5 = request.args.get('limit', 100, int)\n", "VAR_8 = request.args.get('degree', None, int)\n", "if VAR_5 > 1000:\n", "VAR_5 = 1000\n", "if VAR_5 < 0:\n", "VAR_5 = 100\n", "VAR_9 = 'Search for First Zeros of L-functions'\n", "VAR_10 = [('L-functions', url_for('l_functions.l_function_top_page')), (\n 'First Zeros Search', ' ')]\n", "return render_template('first_zeros.html', VAR_3=start, VAR_4=end, VAR_5=\n limit, VAR_8=degree, VAR_9=title, VAR_10=bread)\n" ]
[ "@FirstZeros.route('/')...\n", "start = request.args.get('start', None, float)\n", "end = request.args.get('end', None, float)\n", "limit = request.args.get('limit', 100, int)\n", "degree = request.args.get('degree', None, int)\n", "if limit > 1000:\n", "limit = 1000\n", "if limit < 0:\n", "limit = 100\n", "title = 'Search for First Zeros of L-functions'\n", "bread = [('L-functions', url_for('l_functions.l_function_top_page')), (\n 'First Zeros Search', ' ')]\n", "return render_template('first_zeros.html', start=start, end=end, limit=\n limit, degree=degree, title=title, bread=bread)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_10(self):...\n", "return [self.actors[VAR_6] for VAR_6 in self.actors.keys()]\n" ]
[ "def allActors(self):...\n", "return [self.actors[ID] for ID in self.actors.keys()]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_10(self, VAR_21, VAR_27, VAR_28, VAR_29, VAR_30, VAR_31=None):...\n", "\"\"\"docstring\"\"\"\n", "if self.newcount > 10000:\n", "if VAR_31 is None:\n", "VAR_31 = time.time()\n", "if not len(VAR_21.strip('/')):\n", "VAR_58 = self.get_path(os.path.dirname(VAR_21.strip('/')))\n", "return False\n", "VAR_58.append([os.path.basename(VAR_21), VAR_12, VAR_27, VAR_28, VAR_29,\n VAR_30, VAR_31, [], None, None])\n", "self.newcount += 1\n" ]
[ "def mkdir(self, path, uid, gid, size, mode, ctime=None):...\n", "\"\"\"docstring\"\"\"\n", "if self.newcount > 10000:\n", "if ctime is None:\n", "ctime = time.time()\n", "if not len(path.strip('/')):\n", "dir = self.get_path(os.path.dirname(path.strip('/')))\n", "return False\n", "dir.append([os.path.basename(path), T_DIR, uid, gid, size, mode, ctime, [],\n None, None])\n", "self.newcount += 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "AugAssign'" ]
[ "def FUNC_2():...\n", "for blog in frappe.db.sql_list(\n", "clear_cache(blog)\n", "clear_cache('writers')\n" ]
[ "def clear_blog_cache():...\n", "for blog in frappe.db.sql_list(\n", "clear_cache(blog)\n", "clear_cache('writers')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "Expr'" ]
[ "def FUNC_4():...\n", "VAR_22 = self.request.body\n", "VAR_23 = json.loads(VAR_22.decode('utf-8', 'ignore'))\n", "VAR_24 = VAR_23['action']\n", "VAR_25 = VAR_23['source']\n", "if type(VAR_25) == list:\n", "for VAR_33 in range(0, len(VAR_25)):\n", "VAR_25 = FUNC_1(VAR_25)\n", "VAR_25[VAR_33] = FUNC_1(VAR_25[VAR_33])\n", "if VAR_24 in ['copy', 'move']:\n", "if VAR_24 in ['rename', 'new-folder']:\n", "VAR_31 = FUNC_1(VAR_23['target'])\n", "VAR_31 = '/'\n", "if VAR_24 == 'copy':\n", "VAR_31 = VAR_23['target']\n", "VAR_31 = VAR_25\n", "for source in VAR_25:\n", "if VAR_24 == 'move':\n", "os.system('cp \"D:%s\" \"D:%s\"' % (source, VAR_31))\n", "VAR_6.set_result('')\n", "for source in VAR_25:\n", "if VAR_24 == 'delete':\n", "os.system('mv \"D:%s\" \"D:%s\"' % (source, VAR_31))\n", "for source in VAR_25:\n", "if VAR_24 == 'rename':\n", "os.system('rm \"D:%s\"' % source)\n", "os.system('rename \"D:%s\" \"%s\"' % (VAR_25, VAR_31))\n", "if VAR_24 == 'new-folder':\n", "os.system('mkdir \"D:%s%s\"' % (VAR_25, VAR_31))\n" ]
[ "def get_final_html_async():...\n", "operation_content_raw = self.request.body\n", "operation_content = json.loads(operation_content_raw.decode('utf-8', 'ignore'))\n", "action = operation_content['action']\n", "sources = operation_content['source']\n", "if type(sources) == list:\n", "for i in range(0, len(sources)):\n", "sources = decode_hexed_b64_to_str(sources)\n", "sources[i] = decode_hexed_b64_to_str(sources[i])\n", "if action in ['copy', 'move']:\n", "if action in ['rename', 'new-folder']:\n", "target = decode_hexed_b64_to_str(operation_content['target'])\n", "target = '/'\n", "if action == 'copy':\n", "target = operation_content['target']\n", "target = sources\n", "for source in sources:\n", "if action == 'move':\n", "os.system('cp \"D:%s\" \"D:%s\"' % (source, target))\n", "future.set_result('')\n", "for source in sources:\n", "if action == 'delete':\n", "os.system('mv \"D:%s\" \"D:%s\"' % (source, target))\n", "for source in sources:\n", "if action == 'rename':\n", "os.system('rm \"D:%s\"' % source)\n", "os.system('rename \"D:%s\" \"%s\"' % (sources, target))\n", "if action == 'new-folder':\n", "os.system('mkdir \"D:%s%s\"' % (sources, target))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 4, 4, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "For", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "For", "Condition", "Expr'", "Expr'", "For", "Condition", "Expr'", "For", "Condition", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def __init__(self, VAR_10, VAR_13, VAR_14, VAR_11=None):...\n", "CLASS_1.__init__(self, VAR_10, VAR_11)\n", "self.username = VAR_13\n", "self.password = VAR_14\n", "self.url = '%slogin' % self.base_url\n", "self.data = {'username': self.username, 'password': self.password, 'next': '/'}\n" ]
[ "def __init__(self, browser, username, password, base_url=None):...\n", "GenericRequest.__init__(self, browser, base_url)\n", "self.username = username\n", "self.password = password\n", "self.url = '%slogin' % self.base_url\n", "self.data = {'username': self.username, 'password': self.password, 'next': '/'}\n" ]
[ 0, 0, 0, 0, 5, 5 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "\"\"\"string\"\"\"\n", "VAR_5 = 'northwood'\n", "VAR_6 = request.json.get('username')\n", "VAR_7 = request.json.get('firstName')\n", "VAR_8 = request.json.get('lastName')\n", "VAR_9 = request.json.get('password')\n", "VAR_10 = request.json.get('bio')\n", "VAR_11 = request.json.get('institutionCode')\n", "if VAR_11 != VAR_5:\n", "return {'response': 'incorrect institution code'}, 400\n", "if not (VAR_6.isalnum() or VAR_7.isalnum() or VAR_8.isalnum()):\n", "return {'response': 'incorrect'}, 400\n", "VAR_12 = db_interac.add_user(VAR_6, VAR_7, VAR_8, VAR_10, VAR_9)\n", "if VAR_12:\n", "VAR_30 = db_interac.get_user_profiles()\n", "return {}, 500\n", "if not VAR_30:\n", "return {}, 500\n", "VAR_29 = []\n", "for user in VAR_30:\n", "VAR_29.append({'id': user[0], 'username': user[1], 'firstName': user[2],\n 'lastName': user[3], 'bio': user[4]})\n", "return VAR_29, 201\n" ]
[ "def post(self):...\n", "\"\"\"docstring\"\"\"\n", "\"\"\"\n # Check the request comes from appropriate location.\n if not utils.validate_ip(request.remote_addr)\n return {}, 403\n \"\"\"\n", "INSTITUTION_CODE = 'northwood'\n", "username = request.json.get('username')\n", "firstname = request.json.get('firstName')\n", "lastname = request.json.get('lastName')\n", "password = request.json.get('password')\n", "bio = request.json.get('bio')\n", "institution_code = request.json.get('institutionCode')\n", "if institution_code != INSTITUTION_CODE:\n", "return {'response': 'incorrect institution code'}, 400\n", "if not (username.isalnum() or firstname.isalnum() or lastname.isalnum()):\n", "return {'response': 'incorrect'}, 400\n", "posted = db_interac.add_user(username, firstname, lastname, bio, password)\n", "if posted:\n", "result = db_interac.get_user_profiles()\n", "return {}, 500\n", "if not result:\n", "return {}, 500\n", "response_obj = []\n", "for user in result:\n", "response_obj.append({'id': user[0], 'username': user[1], 'firstName': user[\n 2], 'lastName': user[3], 'bio': user[4]})\n", "return response_obj, 201\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 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Return'", "Condition", "Return'", "Assign'", "For", "Expr'", "Return'" ]
[ "@property...\n", "return 'Array of %s' % self.base_field.description\n" ]
[ "@property...\n", "return 'Array of %s' % self.base_field.description\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_25(self, VAR_73):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.message = VAR_73\n", "return VAR_101\n" ]
[ "def message(self, message):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.message = message\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_15(self):...\n", "for VAR_7 in default_fields:\n", "if VAR_7 not in self.__dict__:\n", "for VAR_7 in self.get_valid_columns():\n", "self.__dict__[VAR_7] = None\n", "if VAR_7 in ('idx', 'docstatus') and self.__dict__[VAR_7] is None:\n", "if VAR_7 not in self.__dict__:\n", "self.__dict__[VAR_7] = 0\n", "self.__dict__[VAR_7] = None\n" ]
[ "def init_valid_columns(self):...\n", "for key in default_fields:\n", "if key not in self.__dict__:\n", "for key in self.get_valid_columns():\n", "self.__dict__[key] = None\n", "if key in ('idx', 'docstatus') and self.__dict__[key] is None:\n", "if key not in self.__dict__:\n", "self.__dict__[key] = 0\n", "self.__dict__[key] = None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "For", "Assign'", "Condition", "Condition", "Assign'", "Assign'" ]
[ "@patch('invenio.ext.session.interface.SessionInterface.save_session')...\n", "from invenio.modules.oauthclient.client import oauth\n", "VAR_9 = MagicMock()\n", "VAR_9.get_id = MagicMock(return_value=1)\n", "VAR_9.is_authenticated = MagicMock(return_value=True)\n", "VAR_10 = c.get(url_for('oauthclient.login', remote_app='full'))\n", "assert VAR_10.status_code == 302\n", "assert VAR_10.location.startswith(oauth.remote_apps['full'].authorize_url)\n", "self.mock_response(VAR_5='full', VAR_6=dict(error_uri=\n 'http://developer.github.com/v3/oauth/#bad-verification-code',\n error_description='The code passed is incorrect or expired.', error=\n 'bad_verification_code'))\n", "VAR_10 = c.get(url_for('oauthclient.authorized', remote_app='full', code=\n 'test'))\n", "assert VAR_10.status_code == 302\n" ]
[ "@patch('invenio.ext.session.interface.SessionInterface.save_session')...\n", "from invenio.modules.oauthclient.client import oauth\n", "user = MagicMock()\n", "user.get_id = MagicMock(return_value=1)\n", "user.is_authenticated = MagicMock(return_value=True)\n", "res = c.get(url_for('oauthclient.login', remote_app='full'))\n", "assert res.status_code == 302\n", "assert res.location.startswith(oauth.remote_apps['full'].authorize_url)\n", "self.mock_response(app='full', data=dict(error_uri=\n 'http://developer.github.com/v3/oauth/#bad-verification-code',\n error_description='The code passed is incorrect or expired.', error=\n 'bad_verification_code'))\n", "res = c.get(url_for('oauthclient.authorized', remote_app='full', code='test'))\n", "assert res.status_code == 302\n" ]
[ 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Assign'", "Assert'", "Assert'", "Expr'", "Assign'", "Assert'" ]
[ "def FUNC_13(self, VAR_9, **VAR_4):...\n", "if self.closed:\n", "VAR_16, VAR_13 = VAR_9.command, VAR_9.seq\n", "VAR_16, VAR_13 = VAR_9['command'], VAR_9['seq']\n", "VAR_33 = {'msg': None}\n", "def FUNC_27(VAR_21):...\n", "if VAR_21.type != 'response':\n", "return False\n", "VAR_33['msg'] = VAR_21\n", "return VAR_21.request_seq == VAR_13\n" ]
[ "def _get_awaiter_for_request(self, req, **kwargs):...\n", "if self.closed:\n", "command, seq = req.command, req.seq\n", "command, seq = req['command'], req['seq']\n", "result = {'msg': None}\n", "def match(msg):...\n", "if msg.type != 'response':\n", "return False\n", "result['msg'] = msg\n", "return msg.request_seq == seq\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Condition", "Return'", "Assign'", "Return'" ]
[ "@api.public...\n", "self.response.write(json.dumps({'peer_id': api.get_peer_identity().to_bytes\n (), 'cur_id': api.get_current_identity().to_bytes()}))\n" ]
[ "@api.public...\n", "self.response.write(json.dumps({'peer_id': api.get_peer_identity().to_bytes\n (), 'cur_id': api.get_current_identity().to_bytes()}))\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import codecs\n", "import datetime\n", "import io\n", "import os\n", "import sys\n", "import time\n", "import traceback\n", "import urllib\n", "import requests\n", "VAR_0 = False\n", "def __init__(self):...\n", "self.xsrf_token = None\n", "self.session = requests.Session()\n", "def FUNC_0(self, VAR_1):...\n", "VAR_15 = self.session.get(VAR_1)\n", "for cookie in VAR_15.cookies:\n", "if cookie.name == '_xsrf':\n", "def FUNC_1(self, VAR_2):...\n", "self.xsrf_token = cookie.value\n", "self.read_xsrf_token(VAR_2.base_url)\n", "VAR_2.execute()\n", "def FUNC_2(self, VAR_1, VAR_3=None, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4 is None:\n", "if VAR_3 is None:\n", "VAR_3 = VAR_3.copy()\n", "for fobj in VAR_20.itervalues():\n", "return VAR_15\n", "VAR_15 = self.session.get(VAR_1)\n", "VAR_3 = VAR_3.copy()\n", "VAR_3['_xsrf'] = self.xsrf_token\n", "fobj.close()\n", "VAR_3['_xsrf'] = self.xsrf_token\n", "VAR_20 = dict((k, io.open(v, 'rb')) for k, v in VAR_4)\n", "VAR_15 = self.session.post(VAR_1, VAR_3)\n", "VAR_15 = self.session.post(VAR_1, VAR_3, files=file_objs)\n" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import codecs\n", "import datetime\n", "import io\n", "import os\n", "import sys\n", "import time\n", "import traceback\n", "import urllib\n", "import requests\n", "debug = False\n", "def __init__(self):...\n", "self.xsrf_token = None\n", "self.session = requests.Session()\n", "def read_xsrf_token(self, url):...\n", "response = self.session.get(url)\n", "for cookie in response.cookies:\n", "if cookie.name == '_xsrf':\n", "def login(self, login_request):...\n", "self.xsrf_token = cookie.value\n", "self.read_xsrf_token(login_request.base_url)\n", "login_request.execute()\n", "def do_request(self, url, data=None, file_names=None):...\n", "\"\"\"docstring\"\"\"\n", "if file_names is None:\n", "if data is None:\n", "data = data.copy()\n", "for fobj in file_objs.itervalues():\n", "return response\n", "response = self.session.get(url)\n", "data = data.copy()\n", "data['_xsrf'] = self.xsrf_token\n", "fobj.close()\n", "data['_xsrf'] = self.xsrf_token\n", "file_objs = dict((k, io.open(v, 'rb')) for k, v in file_names)\n", "response = self.session.post(url, data)\n", "response = self.session.post(url, data, files=file_objs)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "For", "Condition", "FunctionDef'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Docstring", "Condition", "Condition", "Assign'", "For", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_37(self):...\n", "self.compilation_ko(\"\"\"\nif not {\n discard;\n}\n\"\"\")\n" ]
[ "def test_empty_not(self):...\n", "self.compilation_ko(\"\"\"\nif not {\n discard;\n}\n\"\"\")\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_12(VAR_24):...\n", "VAR_38 = argparse.ArgumentParser(description=\n 'Reads and merges JSON configuration files specified by colon separated environment variable OS_CONFIG_FILES, unless overridden by command line option --metadata. If no files are specified this way, falls back to legacy behavior of searching the fallback metadata path for a single config file.'\n )\n", "VAR_38.add_argument('-t', '--templates', metavar='TEMPLATE_ROOT', help=\n \"\"\"path to template root directory (default:\n %(default)s)\"\"\"\n , VAR_12=TEMPLATES_DIR)\n", "VAR_38.add_argument('-o', '--output', metavar='OUT_DIR', help=\n 'root directory for output (default:%(default)s)', VAR_12='/')\n", "VAR_38.add_argument('-m', '--metadata', metavar='METADATA_FILE', nargs='*',\n help=\n 'Overrides environment variable OS_CONFIG_FILES. Specify multiple times, rather than separate files with \":\".'\n , VAR_12=[])\n", "VAR_38.add_argument('--fallback-metadata', metavar='FALLBACK_METADATA',\n nargs='*', help=\n 'Files to search when OS_CONFIG_FILES is empty. (default: %(default)s)',\n VAR_12=['/var/cache/heat-cfntools/last_metadata',\n '/var/lib/heat-cfntools/cfn-init-data',\n '/var/lib/cloud/data/cfn-init-data'])\n", "VAR_38.add_argument('-v', '--validate', help=\n 'validate only. do not write files', VAR_12=False, action='store_true')\n", "VAR_38.add_argument('--print-templates', VAR_12=False, action='store_true',\n help='Print templates root and exit.')\n", "VAR_38.add_argument('-s', '--subhash', help=\n 'use the sub-hash named by this key, instead of the full metadata hash')\n", "VAR_38.add_argument('--key', metavar='KEY', VAR_12=None, help=\n 'print the specified key and exit. (may be used with --type and --key-default)'\n )\n", "VAR_38.add_argument('--type', VAR_12='default', help=\n 'exit with error if the specified --key does not match type. Valid types are <int|default|netaddress|netdevice|dsn|swiftdevices|raw>'\n )\n", "VAR_38.add_argument('--key-default', help=\n 'This option only affects running with --key. Print this if key is not found. This value is not subject to type restrictions. If --key is specified and no default is specified, program exits with an error on missing key.'\n )\n", "VAR_38.add_argument('--version', action='version', version=version.\n version_info.version_string())\n", "VAR_38.add_argument('--os-config-files', VAR_12=OS_CONFIG_FILES_PATH, help=\n 'Set path to os_config_files.json')\n", "VAR_39 = VAR_38.parse_args(VAR_24[1:])\n", "return VAR_39\n" ]
[ "def parse_opts(argv):...\n", "parser = argparse.ArgumentParser(description=\n 'Reads and merges JSON configuration files specified by colon separated environment variable OS_CONFIG_FILES, unless overridden by command line option --metadata. If no files are specified this way, falls back to legacy behavior of searching the fallback metadata path for a single config file.'\n )\n", "parser.add_argument('-t', '--templates', metavar='TEMPLATE_ROOT', help=\n \"\"\"path to template root directory (default:\n %(default)s)\"\"\"\n , default=TEMPLATES_DIR)\n", "parser.add_argument('-o', '--output', metavar='OUT_DIR', help=\n 'root directory for output (default:%(default)s)', default='/')\n", "parser.add_argument('-m', '--metadata', metavar='METADATA_FILE', nargs='*',\n help=\n 'Overrides environment variable OS_CONFIG_FILES. Specify multiple times, rather than separate files with \":\".'\n , default=[])\n", "parser.add_argument('--fallback-metadata', metavar='FALLBACK_METADATA',\n nargs='*', help=\n 'Files to search when OS_CONFIG_FILES is empty. (default: %(default)s)',\n default=['/var/cache/heat-cfntools/last_metadata',\n '/var/lib/heat-cfntools/cfn-init-data',\n '/var/lib/cloud/data/cfn-init-data'])\n", "parser.add_argument('-v', '--validate', help=\n 'validate only. do not write files', default=False, action='store_true')\n", "parser.add_argument('--print-templates', default=False, action='store_true',\n help='Print templates root and exit.')\n", "parser.add_argument('-s', '--subhash', help=\n 'use the sub-hash named by this key, instead of the full metadata hash')\n", "parser.add_argument('--key', metavar='KEY', default=None, help=\n 'print the specified key and exit. (may be used with --type and --key-default)'\n )\n", "parser.add_argument('--type', default='default', help=\n 'exit with error if the specified --key does not match type. Valid types are <int|default|netaddress|netdevice|dsn|swiftdevices|raw>'\n )\n", "parser.add_argument('--key-default', help=\n 'This option only affects running with --key. Print this if key is not found. This value is not subject to type restrictions. If --key is specified and no default is specified, program exits with an error on missing key.'\n )\n", "parser.add_argument('--version', action='version', version=version.\n version_info.version_string())\n", "parser.add_argument('--os-config-files', default=OS_CONFIG_FILES_PATH, help\n ='Set path to os_config_files.json')\n", "opts = parser.parse_args(argv[1:])\n", "return opts\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_5(self):...\n", "return self.extracted_text\n" ]
[ "def get_extractedtext(self):...\n", "return self.extracted_text\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from datetime import datetime, timedelta\n", "import pytz\n", "from constance.admin import Config, ConstanceAdmin, ConstanceForm\n", "from cryptography.fernet import Fernet\n", "from django.conf import settings\n", "from django.contrib import admin\n", "from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin\n", "from django.contrib.auth.admin import UserAdmin as BaseUserAdmin\n", "from django.contrib.auth.models import Group, User\n", "from django.contrib.humanize.templatetags.humanize import naturaltime\n", "from django.utils.safestring import mark_safe\n", "from django_celery_beat.admin import PeriodicTaskAdmin, PeriodicTaskForm\n", "from django_celery_beat.models import CrontabSchedule, PeriodicTask\n", "from import_export import resources\n", "from import_export.admin import ImportExportModelAdmin\n", "from dashboard.internet_nl_dashboard.models import Account, DashboardUser, UploadLog, UrlList\n", "VAR_0 = PeriodicTaskAdmin.fieldsets\n", "\"\"\"string\"\"\"\n", "def FUNC_0(self):...\n", "print('cleaning')\n", "VAR_20 = super(PeriodicTaskForm, self).clean()\n", "return VAR_20\n" ]
[ "from datetime import datetime, timedelta\n", "import pytz\n", "from constance.admin import Config, ConstanceAdmin, ConstanceForm\n", "from cryptography.fernet import Fernet\n", "from django.conf import settings\n", "from django.contrib import admin\n", "from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin\n", "from django.contrib.auth.admin import UserAdmin as BaseUserAdmin\n", "from django.contrib.auth.models import Group, User\n", "from django.contrib.humanize.templatetags.humanize import naturaltime\n", "from django.utils.safestring import mark_safe\n", "from django_celery_beat.admin import PeriodicTaskAdmin, PeriodicTaskForm\n", "from django_celery_beat.models import CrontabSchedule, PeriodicTask\n", "from import_export import resources\n", "from import_export.admin import ImportExportModelAdmin\n", "from dashboard.internet_nl_dashboard.models import Account, DashboardUser, UploadLog, UrlList\n", "fieldsets = PeriodicTaskAdmin.fieldsets\n", "\"\"\"\n Interval schedule does not support due_ or something. Which is absolutely terrible and vague.\n I can't understand why there is not an is_due() for each type of schedule. This makes it very hazy\n when something will run.\n\n Because of this, we'll move to the horrifically designed absolute nightmare format Crontab.\n Crontab would be half-great if the parameters where named.\n\n Get your crontab guru going, this is the only way you'll understand what you're doing.\n https://crontab.guru/#0_21_*_*_*\n \"\"\"\n", "def clean(self):...\n", "print('cleaning')\n", "cleaned_data = super(PeriodicTaskForm, self).clean()\n", "return cleaned_data\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "Assign'", "Return'" ]
[ "import gc\n", "import os\n", "def __setattr__(self, VAR_10, VAR_11):...\n", "if self.__dict__.get(VAR_10):\n", "self.__dict__[VAR_10] = VAR_11\n", "def FUNC_0(VAR_0):...\n", "os.listdir(VAR_0)\n", "return False\n", "def FUNC_1(VAR_0):...\n", "return True\n", "VAR_12 = dict(VAR_10=path, children=[])\n", "for i in os.listdir(VAR_0):\n", "if FUNC_0(VAR_0 + '/' + i):\n", "return VAR_12\n", "VAR_12['children'].append(FUNC_1(VAR_0 + '/' + i))\n", "VAR_12['children'].append(dict(VAR_10=i))\n" ]
[ "import gc\n", "import os\n", "def __setattr__(self, name, value):...\n", "if self.__dict__.get(name):\n", "self.__dict__[name] = value\n", "def is_folder(path):...\n", "os.listdir(path)\n", "return False\n", "def traverse(path):...\n", "return True\n", "n = dict(name=path, children=[])\n", "for i in os.listdir(path):\n", "if is_folder(path + '/' + i):\n", "return n\n", "n['children'].append(traverse(path + '/' + i))\n", "n['children'].append(dict(name=i))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ "Import'", "Import'", "FunctionDef'", "Condition", "Assign'", "FunctionDef'", "Expr'", "Return'", "FunctionDef'", "Return'", "Assign'", "For", "Condition", "Return'", "Expr'", "Expr'" ]
[ "import operator\n", "from collections import deque\n", "def FUNC_0(VAR_0):...\n", "VAR_4, VAR_5 = VAR_0\n", "VAR_6 = (VAR_4 * VAR_4 + 3 * VAR_4 + 2 * VAR_4 * VAR_5 + VAR_5 + VAR_5 *\n VAR_5 + 1358)\n", "return VAR_4 >= 0 and VAR_5 >= 0 and bin(VAR_6).count('1') % 2 == 0\n" ]
[ "import operator\n", "from collections import deque\n", "def isopen(location):...\n", "x, y = location\n", "num = x * x + 3 * x + 2 * x * y + y + y * y + 1358\n", "return x >= 0 and y >= 0 and bin(num).count('1') % 2 == 0\n" ]
[ 0, 0, 0, 1, 1, 1 ]
[ "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_3(self, VAR_4, *VAR_5, **VAR_6):...\n", "return HttpResponse(self.submission.status, content_type='text/plain')\n" ]
[ "def get(self, request, *args, **kwargs):...\n", "return HttpResponse(self.submission.status, content_type='text/plain')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_9(self, VAR_0):...\n", "if not cint(self.published):\n", "VAR_0.full_name = get_fullname(self.owner)\n", "VAR_0.updated = global_date_format(self.published_on)\n", "if self.blogger:\n", "VAR_0.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n", "VAR_0.description = self.blog_intro or self.content[:140]\n", "VAR_0.metatags = {'name': self.title, 'description': VAR_0.description}\n", "if '<!-- markdown -->' in VAR_0.content:\n", "VAR_0.content = markdown(VAR_0.content)\n", "VAR_14 = find_first_image(self.content)\n", "if VAR_14:\n", "VAR_0.metatags['image'] = VAR_14\n", "VAR_0.comment_list = get_comment_list(self.doctype, self.name)\n", "if not VAR_0.comment_list:\n", "VAR_0.comment_text = _('No comments yet')\n", "if len(VAR_0.comment_list) == 1:\n", "VAR_0.category = frappe.db.get_value('Blog Category', VAR_0.doc.\n blog_category, ['title', 'route'], as_dict=1)\n", "VAR_0.comment_text = _('1 comment')\n", "VAR_0.comment_text = _('{0} comments').format(len(VAR_0.comment_list))\n", "VAR_0.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}, {'label': VAR_0.category.title, 'route': VAR_0.\n category.route}]\n" ]
[ "def get_context(self, context):...\n", "if not cint(self.published):\n", "context.full_name = get_fullname(self.owner)\n", "context.updated = global_date_format(self.published_on)\n", "if self.blogger:\n", "context.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n", "context.description = self.blog_intro or self.content[:140]\n", "context.metatags = {'name': self.title, 'description': context.description}\n", "if '<!-- markdown -->' in context.content:\n", "context.content = markdown(context.content)\n", "image = find_first_image(self.content)\n", "if image:\n", "context.metatags['image'] = image\n", "context.comment_list = get_comment_list(self.doctype, self.name)\n", "if not context.comment_list:\n", "context.comment_text = _('No comments yet')\n", "if len(context.comment_list) == 1:\n", "context.category = frappe.db.get_value('Blog Category', context.doc.\n blog_category, ['title', 'route'], as_dict=1)\n", "context.comment_text = _('1 comment')\n", "context.comment_text = _('{0} comments').format(len(context.comment_list))\n", "context.parents = [{'name': _('Home'), 'route': '/'}, {'name': 'Blog',\n 'route': '/blog'}, {'label': context.category.title, 'route': context.\n category.route}]\n" ]
[ 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'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "@require_POST...\n", "\"\"\"docstring\"\"\"\n", "VAR_51 = datetime.datetime.now()\n", "VAR_52 = VAR_0.POST.copy()\n", "VAR_1 = VAR_52.get('content_type')\n", "VAR_53 = VAR_52.get('value_type', 'str')\n", "VAR_54 = VAR_52.get('object_pk')\n", "VAR_55 = VAR_52.get('field')\n", "VAR_45 = VAR_52.get('value')\n", "VAR_56 = [int(a) for a in VAR_54.split(',')]\n", "if not VAR_55 or not VAR_45 or not VAR_56 or not VAR_1:\n", "return FUNC_6(\n 'Following fields are required - content_type, object_pk, field and value.'\n )\n", "VAR_55 = VAR_94(VAR_55)\n", "VAR_45, VAR_46 = FUNC_5(VAR_45, VAR_53)\n", "if VAR_46:\n", "return FUNC_6(VAR_46)\n", "VAR_57 = FUNC_0(VAR_0, VAR_1)\n", "if not VAR_57:\n", "return FUNC_6('Permission Dinied.')\n", "VAR_58 = apps.get_model(*VAR_1.split('.', 1))\n", "VAR_59 = VAR_58._default_manager.filter(pk__in=object_pk)\n", "if not VAR_59:\n", "return FUNC_6('No record found')\n", "if not hasattr(VAR_59[0], VAR_55):\n", "return FUNC_6('%s has no field %s' % (VAR_1, VAR_55))\n", "if hasattr(VAR_59[0], 'log_action'):\n", "for t in VAR_59:\n", "FUNC_16(VAR_59, **{field: value})\n", "t.log_action(who=request.user, VAR_68='Field {} changed from {} to {}.'.\n format(field, getattr(t, field), TestCaseRunStatus.id_to_string(value)))\n", "if hasattr(VAR_58, 'mail_scene'):\n", "from tcms.core.utils.mailto import mailto\n", "if VAR_1 == 'testruns.testcaserun' and VAR_55 == 'case_run_status':\n", "VAR_79 = VAR_58.mail_scene(VAR_13=targets, VAR_55=field, VAR_45=value,\n VAR_1=ctype, VAR_56=object_pk)\n", "for t in VAR_59:\n", "return HttpResponse(json.dumps({'rc': 0, 'response': 'ok'}))\n", "if VAR_79:\n", "VAR_55 = 'close_date'\n", "VAR_59.update(close_date=now, tested_by=request.user)\n", "VAR_79['context']['user'] = VAR_0.user\n", "t.log_action(who=request.user, VAR_68='Field %s changed from %s to %s.' % (\n field, getattr(t, field), now))\n", "mailto(**mail_context)\n", "if t.tested_by != VAR_0.user:\n", "VAR_55 = 'tested_by'\n", "VAR_55 = 'assignee'\n", "t.log_action(who=request.user, VAR_68='Field %s changed from %s to %s.' % (\n field, getattr(t, field), request.user))\n", "VAR_103 = t.assginee\n", "if VAR_103 != VAR_0.user:\n", "t.log_action(who=request.user, VAR_68='Field %s changed from %s to %s.' % (\n field, getattr(t, field), request.user))\n", "t.save()\n" ]
[ "@require_POST...\n", "\"\"\"docstring\"\"\"\n", "now = datetime.datetime.now()\n", "data = request.POST.copy()\n", "ctype = data.get('content_type')\n", "vtype = data.get('value_type', 'str')\n", "object_pk_str = data.get('object_pk')\n", "field = data.get('field')\n", "value = data.get('value')\n", "object_pk = [int(a) for a in object_pk_str.split(',')]\n", "if not field or not value or not object_pk or not ctype:\n", "return say_no(\n 'Following fields are required - content_type, object_pk, field and value.'\n )\n", "field = str(field)\n", "value, error = get_value_by_type(value, vtype)\n", "if error:\n", "return say_no(error)\n", "has_perms = check_permission(request, ctype)\n", "if not has_perms:\n", "return say_no('Permission Dinied.')\n", "model = apps.get_model(*ctype.split('.', 1))\n", "targets = model._default_manager.filter(pk__in=object_pk)\n", "if not targets:\n", "return say_no('No record found')\n", "if not hasattr(targets[0], field):\n", "return say_no('%s has no field %s' % (ctype, field))\n", "if hasattr(targets[0], 'log_action'):\n", "for t in targets:\n", "objects_update(targets, **{field: value})\n", "t.log_action(who=request.user, action='Field {} changed from {} to {}.'.\n format(field, getattr(t, field), TestCaseRunStatus.id_to_string(value)))\n", "if hasattr(model, 'mail_scene'):\n", "from tcms.core.utils.mailto import mailto\n", "if ctype == 'testruns.testcaserun' and field == 'case_run_status':\n", "mail_context = model.mail_scene(objects=targets, field=field, value=value,\n ctype=ctype, object_pk=object_pk)\n", "for t in targets:\n", "return HttpResponse(json.dumps({'rc': 0, 'response': 'ok'}))\n", "if mail_context:\n", "field = 'close_date'\n", "targets.update(close_date=now, tested_by=request.user)\n", "mail_context['context']['user'] = request.user\n", "t.log_action(who=request.user, action='Field %s changed from %s to %s.' % (\n field, getattr(t, field), now))\n", "mailto(**mail_context)\n", "if t.tested_by != request.user:\n", "field = 'tested_by'\n", "field = 'assignee'\n", "t.log_action(who=request.user, action='Field %s changed from %s to %s.' % (\n field, getattr(t, field), request.user))\n", "assignee = t.assginee\n", "if assignee != request.user:\n", "t.log_action(who=request.user, action='Field %s changed from %s to %s.' % (\n field, getattr(t, field), request.user))\n", "t.save()\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 ]
[ "Condition", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Condition", "For", "Expr'", "Expr'", "Condition", "ImportFrom'", "Condition", "Assign'", "For", "Return'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0():...\n", "VAR_6 = odict({'id': 1, 'url':\n 'https://www.mozilla.org/en-US/firefox/central/', 'title': None,\n 'rev_host': 'gro.allizom.www.', 'visit_count': 0, 'hidden': 0, 'typed':\n 0, 'favicon_id': None, 'frecency': 76, 'last_visit_date': None, 'guid':\n 'NNqZA_f2KHI1', 'foreign_count': 1, 'url_hash': 47356370932282,\n 'description': None, 'preview_image_url': None})\n", "return VAR_6\n" ]
[ "def create_test_data():...\n", "test_record = odict({'id': 1, 'url':\n 'https://www.mozilla.org/en-US/firefox/central/', 'title': None,\n 'rev_host': 'gro.allizom.www.', 'visit_count': 0, 'hidden': 0, 'typed':\n 0, 'favicon_id': None, 'frecency': 76, 'last_visit_date': None, 'guid':\n 'NNqZA_f2KHI1', 'foreign_count': 1, 'url_hash': 47356370932282,\n 'description': None, 'preview_image_url': None})\n", "return test_record\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4, VAR_5, VAR_4 = parse_magnetlink(\n 'magnet:?xt=urn:btih:APCTQFWNOWUBXZOIDAZGAJ2BA6FS6JUC')\n", "self.assertEqual(VAR_5, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n" ]
[ "def test_parse_magnetlink_uppercase(self):...\n", "\"\"\"docstring\"\"\"\n", "_, hashed, _ = parse_magnetlink(\n 'magnet:?xt=urn:btih:APCTQFWNOWUBXZOIDAZGAJ2BA6FS6JUC')\n", "self.assertEqual(hashed, \"\\x03Å8\\x16Íu¨\\x1båÈ\\x182`'A\\x07\\x8b/&\\x82\")\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_19(self):...\n", "print('INFO: Reconnecting...')\n", "return DeadConnectionDetector.reconnect(self)\n" ]
[ "def reconnect(self):...\n", "print('INFO: Reconnecting...')\n", "return DeadConnectionDetector.reconnect(self)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.get_pct_checked_numeric() >= self.QA_COMPLETE_PERCENTAGE * 100\n" ]
[ "def get_qa_status(self):...\n", "\"\"\"docstring\"\"\"\n", "return self.get_pct_checked_numeric() >= self.QA_COMPLETE_PERCENTAGE * 100\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_0(self, VAR_4):...\n", "" ]
[ "def run(self, headers):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_16(self):...\n", "return sum(e.max_points for e in self.exercises)\n" ]
[ "def max_sum(self):...\n", "return sum(e.max_points for e in self.exercises)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_14():...\n", "self.logger.info('recursing', VAR_52='5b8498e4-868d-413c-a67e-004516b8452c',\n VAR_56=len(self.pending), have=len(self.have) - len(self.running),\n running=len(self.running))\n" ]
[ "def log():...\n", "self.logger.info('recursing', uuid='5b8498e4-868d-413c-a67e-004516b8452c',\n pending=len(self.pending), have=len(self.have) - len(self.running),\n running=len(self.running))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_1(VAR_29, VAR_30, VAR_31, VAR_32, VAR_33):...\n", "VAR_31.pack_forget()\n", "VAR_10.forget()\n", "VAR_40 = VAR_32, VAR_33\n", "for key, value in VAR_25.items():\n", "if value == VAR_40:\n", "FUNC_5(VAR_29, VAR_32, VAR_33)\n", "key.destroy()\n", "FUNC_4(VAR_30)\n", "VAR_41 = Label(VAR_15, text=recipe, bg='#f8f8f8')\n", "VAR_41.grid(VAR_32=row, VAR_33=column)\n", "VAR_41.bind('<Button-1>', lambda event: FUNC_2(VAR_29))\n", "VAR_15.pack()\n" ]
[ "def add_recipe(recipe, ingredients, view, row, column):...\n", "view.pack_forget()\n", "viewRecipeFrame.forget()\n", "searchIndex = row, column\n", "for key, value in buttonDict.items():\n", "if value == searchIndex:\n", "save_weeks_recipes(recipe, row, column)\n", "key.destroy()\n", "save_ingredients(ingredients)\n", "recipeLabel = Label(menu, text=recipe, bg='#f8f8f8')\n", "recipeLabel.grid(row=row, column=column)\n", "recipeLabel.bind('<Button-1>', lambda event: callback(recipe))\n", "menu.pack()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Assign'", "For", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_6 = self.client.get('/api/apps')\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 2)\n", "VAR_8 = VAR_6.data['results'][0]['id']\n", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps')\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "for model in ['builds', 'config', 'containers', 'limits', 'releases']:\n", "VAR_6 = self.client.get('/api/apps/{}/{}/'.format(VAR_8, model))\n", "self.assertTrue(self.client.login(VAR_1='autotest-1', VAR_2='password'))\n", "self.assertEqual(VAR_6.data['detail'], 'Not found')\n", "VAR_5 = '/api/apps/{}/perms'.format(VAR_8)\n", "VAR_7 = {'username': 'autotest-2'}\n", "VAR_6 = self.client.post(VAR_5, json.dumps(VAR_7), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "self.assertTrue(self.client.login(VAR_1='autotest-2', VAR_2='password'))\n", "VAR_6 = self.client.get('/api/apps')\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 2)\n", "for model in ['builds', 'containers', 'releases']:\n", "VAR_6 = self.client.get('/api/apps/{}/{}/'.format(VAR_8, model))\n", "self.assertEqual(len(VAR_6.data['results']), 0)\n" ]
[ "def test_create(self):...\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "app_id = response.data['results'][0]['id']\n", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(len(response.data['results']), 1)\n", "for model in ['builds', 'config', 'containers', 'limits', 'releases']:\n", "response = self.client.get('/api/apps/{}/{}/'.format(app_id, model))\n", "self.assertTrue(self.client.login(username='autotest-1', password='password'))\n", "self.assertEqual(response.data['detail'], 'Not found')\n", "url = '/api/apps/{}/perms'.format(app_id)\n", "body = {'username': 'autotest-2'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "self.assertTrue(self.client.login(username='autotest-2', password='password'))\n", "response = self.client.get('/api/apps')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 2)\n", "for model in ['builds', 'containers', 'releases']:\n", "response = self.client.get('/api/apps/{}/{}/'.format(app_id, model))\n", "self.assertEqual(len(response.data['results']), 0)\n" ]
[ 0, 5, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "For", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "For", "Assign'", "Expr'" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "from api.models import Key\n", "from api.utils import fingerprint\n", "VAR_0 = 'string'\n", "VAR_1 = 'string'\n", "\"\"\"Tests cloud provider credentials\"\"\"\n", "VAR_2 = ['tests.json']\n", "def FUNC_0(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "def FUNC_1(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': '[email protected]', 'public': VAR_3}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_7 = VAR_6.data['id']\n", "VAR_6 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(len(VAR_6.data['results']), 1)\n", "VAR_4 = '/api/keys/{key_id}'.format(**locals())\n", "VAR_6 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 200)\n", "self.assertEqual(VAR_5['id'], VAR_6.data['id'])\n", "self.assertEqual(VAR_5['public'], VAR_6.data['public'])\n", "VAR_6 = self.client.delete(VAR_4)\n", "self.assertEqual(VAR_6.status_code, 204)\n", "def FUNC_2(self):...\n", "self._check_key(VAR_0)\n", "def FUNC_3(self):...\n", "self._check_key(VAR_1)\n", "def FUNC_4(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': '[email protected]', 'public': VAR_3}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 400)\n", "def FUNC_5(self):...\n", "self._check_duplicate_key(VAR_0)\n", "def FUNC_6(self):...\n", "self._check_duplicate_key(VAR_1)\n", "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/keys'\n", "VAR_5 = {'id': 'autotest', 'public': 'string'}\n", "VAR_6 = self.client.post(VAR_4, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_6.status_code, 201)\n", "VAR_8 = Key.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(VAR_8),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN [email protected]')\n", "def FUNC_8(self):...\n", "VAR_9 = fingerprint(VAR_0)\n", "self.assertEquals(VAR_9, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ "\"\"\"\nUnit tests for the Deis api app.\n\nRun the tests with \"./manage.py test api\\\"\n\"\"\"\n", "from __future__ import unicode_literals\n", "import json\n", "from django.test import TestCase\n", "from api.models import Key\n", "from api.utils import fingerprint\n", "RSA_PUBKEY = (\n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfQkkUUoxpvcNMkvv7jqnfodgs37M2eBOAPgLK+KNBMaZaaKB4GF1QhTCMfFhoiTW3rqa0J75bHJcdkoobtTHlK8XUrFqsquWyg3XhsTYr/3RQQXvO86e2sF7SVDJqVtpnbQGc5SgNrHCeHJmf5HTbXSIjCO/AJSvIjnituT/SIAMGeBw0Nq/iSltwYAek1hiKO7wSmLcIQ8U4A00KEUtalaumf2aHOcfjgPfzlbZGP0S0cuBwSqLr8b5XGPmkASNdUiuJY4MJOce7bFU14B7oMAy2xacODUs1momUeYtGI9T7X2WMowJaO7tP3GlsgBMP81VfYTfYChAyJpKp2yoP autotest@autotesting comment'\n )\n", "ECDSA_PUBKEY = (\n 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCGB0x9lmubbLJTF5NekCI0Cgjyip6jJh/t/qQQi1LAZisbREBJ8Wy+hwSn3tnbf/Imh9X+MQnrrza0jaQ3QUAQ= autotest@autotesting comment'\n )\n", "\"\"\"Tests cloud provider credentials\"\"\"\n", "fixtures = ['tests.json']\n", "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "def _check_key(self, pubkey):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': '[email protected]', 'public': pubkey}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "key_id = response.data['id']\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 1)\n", "url = '/api/keys/{key_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(body['id'], response.data['id'])\n", "self.assertEqual(body['public'], response.data['public'])\n", "response = self.client.delete(url)\n", "self.assertEqual(response.status_code, 204)\n", "def test_rsa_key(self):...\n", "self._check_key(RSA_PUBKEY)\n", "def test_ecdsa_key(self):...\n", "self._check_key(ECDSA_PUBKEY)\n", "def _check_duplicate_key(self, pubkey):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': '[email protected]', 'public': pubkey}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 400)\n", "def test_rsa_duplicate_key(self):...\n", "self._check_duplicate_key(RSA_PUBKEY)\n", "def test_ecdsa_duplicate_key(self):...\n", "self._check_duplicate_key(ECDSA_PUBKEY)\n", "def test_rsa_key_str(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/keys'\n", "body = {'id': 'autotest', 'public':\n 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzqPAwHN70xsB0LXG//KzOgcPikyhdN/KRc4x3j/RA0pmFj63Ywv0PJ2b1LcMSqfR8F11WBlrW8c9xFua0ZAKzI+gEk5uqvOR78bs/SITOtKPomW4e/1d2xEkJqOmYH30u94+NZZYwEBqYaRb34fhtrnJS70XeGF0RhXE5Qea5eh7DBbeLxPfSYd8rfHgzMSb/wmx3h2vmHdQGho20pfJktNu7DxeVkTHn9REMUphf85su7slTgTlWKq++3fASE8PdmFGzb6PkOR4c+LS5WWXd2oM6HyBQBxxiwXbA2lSgQxOdgDiM2FzT0GVSFMUklkUHMdsaG6/HJDw9QckTS0vN [email protected]'\n }\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "key = Key.objects.get(uuid=response.data['uuid'])\n", "self.assertEqual(str(key),\n 'ssh-rsa AAAAB3NzaC.../HJDw9QckTS0vN [email protected]')\n", "def test_rsa_key_fingerprint(self):...\n", "fp = fingerprint(RSA_PUBKEY)\n", "self.assertEquals(fp, '54:6d:da:1f:91:b5:2b:6f:a2:83:90:c4:f9:73:76:f5')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Expr'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_0, VAR_1):...\n", "self.has_rows = VAR_1 is not None\n", "self.keys = VAR_0\n", "self.rows = VAR_1\n" ]
[ "def __init__(self, keys, rows):...\n", "self.has_rows = rows is not None\n", "self.keys = keys\n", "self.rows = rows\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_0(VAR_0):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = os.path.join(DATA_DIRE, VAR_0 + '.db')\n", "return VAR_14\n" ]
[ "def db_path(name):...\n", "\"\"\"docstring\"\"\"\n", "fil = os.path.join(DATA_DIRE, name + '.db')\n", "return fil\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_2():...\n", "VAR_9 = []\n", "VAR_14 = re.compile('^.+SYS_(?P<syscall_name>[^ ]+)')\n", "VAR_25 = FUNC_0(VAR_0['syscall_header_file'])\n", "for line in VAR_25.split('\\n'):\n", "VAR_24 = VAR_14.match(line)\n", "return VAR_9\n", "if VAR_24:\n", "VAR_9.append(VAR_24.group('syscall_name'))\n" ]
[ "def parse_syscall_names():...\n", "syscall_names = []\n", "syscall_name_regex = re.compile('^.+SYS_(?P<syscall_name>[^ ]+)')\n", "content = read_file_content(CONFIG['syscall_header_file'])\n", "for line in content.split('\\n'):\n", "match = syscall_name_regex.match(line)\n", "return syscall_names\n", "if match:\n", "syscall_names.append(match.group('syscall_name'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_5 = database.users.get_current_user()\n", "if VAR_5:\n", "VAR_3 = db.get(db.Key.from_path('Item', int(cgi.escape(self.request.get(\n 'item_id')))))\n", "self.redirect('/')\n", "VAR_3.title = cgi.escape(self.request.get('title'))\n", "VAR_3.description = cgi.escape(self.request.get('description'))\n", "VAR_3.price = cgi.escape(self.request.get('price'))\n", "database.logging.info(\n \"\"\"Item #%s changed to:\nTitle: %s\nDescription: %s\nPrice: %s\"\"\", VAR_3.\n key().id(), VAR_3.title, VAR_3.description, VAR_3.price)\n", "VAR_3.put()\n", "self.redirect('/items/my_items')\n" ]
[ "def post(self):...\n", "user = database.users.get_current_user()\n", "if user:\n", "item = db.get(db.Key.from_path('Item', int(cgi.escape(self.request.get(\n 'item_id')))))\n", "self.redirect('/')\n", "item.title = cgi.escape(self.request.get('title'))\n", "item.description = cgi.escape(self.request.get('description'))\n", "item.price = cgi.escape(self.request.get('price'))\n", "database.logging.info(\n \"\"\"Item #%s changed to:\nTitle: %s\nDescription: %s\nPrice: %s\"\"\", item.\n key().id(), item.title, item.description, item.price)\n", "item.put()\n", "self.redirect('/items/my_items')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self):...\n", "VAR_1 = '¡'\n", "VAR_2 = VAR_1.encode('utf-8')\n", "VAR_3 = VAR_1 if PY3 else VAR_2\n", "self.assertEqual(os.environ['XXX'], VAR_3)\n", "self.assertIn('AAA', os.environ)\n", "self.assertEqual(os.environ['AAA'], VAR_3)\n", "self.assertEqual(os.environ['XXX'], VAR_3)\n" ]
[ "def test_hermetic_environment_unicode(self):...\n", "UNICODE_CHAR = '¡'\n", "ENCODED_CHAR = UNICODE_CHAR.encode('utf-8')\n", "expected_output = UNICODE_CHAR if PY3 else ENCODED_CHAR\n", "self.assertEqual(os.environ['XXX'], expected_output)\n", "self.assertIn('AAA', os.environ)\n", "self.assertEqual(os.environ['AAA'], expected_output)\n", "self.assertEqual(os.environ['XXX'], expected_output)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_43(VAR_127, VAR_96):...\n", "for VAR_121 in VAR_127['events']:\n", "if all([(match in VAR_121) for match in VAR_96]):\n", "return None\n", "return VAR_121\n" ]
[ "def get_event(events, matches):...\n", "for e in events['events']:\n", "if all([(match in e) for match in matches]):\n", "return None\n", "return e\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "For", "Return'", "Return'" ]
[ "def FUNC_16(self, VAR_66):...\n", "\"\"\"docstring\"\"\"\n", "VAR_99 = snakemake.io.load_configfile(VAR_66)\n", "update_config(VAR_85, VAR_99)\n", "update_config(VAR_85, self.overwrite_config)\n" ]
[ "def configfile(self, jsonpath):...\n", "\"\"\"docstring\"\"\"\n", "c = snakemake.io.load_configfile(jsonpath)\n", "update_config(config, c)\n", "update_config(config, self.overwrite_config)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'" ]
[ "@property...\n", "return itertools.chain(*(pe.jvm_locations for pe in self.\n _possible_environments))\n" ]
[ "@property...\n", "return itertools.chain(*(pe.jvm_locations for pe in self.\n _possible_environments))\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_30(self, VAR_78):...\n", "def FUNC_39(VAR_101):...\n", "VAR_101.version = VAR_78\n", "return VAR_101\n" ]
[ "def version(self, version):...\n", "def decorate(ruleinfo):...\n", "ruleinfo.version = version\n", "return ruleinfo\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_7):...\n", "VAR_19 = ','.join([VAR_45.encode('utf-8') for VAR_45 in VAR_7.values.keys()])\n", "VAR_20 = ','.join([VAR_45.encode('utf-8') for VAR_45 in VAR_7.values.values()])\n", "VAR_21 = 'INSERT INTO {0} ({1}) VALUES ({2})'.format(VAR_7.model_class.\n _meta.table_name, VAR_19, VAR_20)\n", "if VAR_7.on_conflict:\n", "VAR_21 += ' ON CONFLICT ({0}) DO UPDATE SET ({1}) = ({2})'.format(','.join(\n VAR_7.on_conflict), VAR_19, VAR_20)\n", "if VAR_7.return_id:\n", "VAR_21 += ' RETURNING id'\n", "VAR_21 += ';'\n", "return VAR_21\n" ]
[ "def generate_insert(self, query):...\n", "keys = ','.join([x.encode('utf-8') for x in query.values.keys()])\n", "values = ','.join([x.encode('utf-8') for x in query.values.values()])\n", "str_query = 'INSERT INTO {0} ({1}) VALUES ({2})'.format(query.model_class.\n _meta.table_name, keys, values)\n", "if query.on_conflict:\n", "str_query += ' ON CONFLICT ({0}) DO UPDATE SET ({1}) = ({2})'.format(','.\n join(query.on_conflict), keys, values)\n", "if query.return_id:\n", "str_query += ' RETURNING id'\n", "str_query += ';'\n", "return str_query\n" ]
[ 0, 0, 4, 4, 0, 4, 0, 0, 0, 4 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "AugAssign'", "Condition", "AugAssign'", "AugAssign'", "Return'" ]
[ "def FUNC_6():...\n", "VAR_13.throw(_('Invalid Search Field'), VAR_13.DataError)\n" ]
[ "def _raise_exception():...\n", "frappe.throw(_('Invalid Search Field'), frappe.DataError)\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._observables\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._observables\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_13 = threading.Thread(target=self._periodically_flush_profile_events,\n name='ray_push_profiling_information')\n", "VAR_13.daemon = True\n", "VAR_13.start()\n" ]
[ "def start_flush_thread(self):...\n", "t = threading.Thread(target=self._periodically_flush_profile_events, name=\n 'ray_push_profiling_information')\n", "t.daemon = True\n", "t.start()\n" ]
[ 0, 6, 6, 6 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_8(self, VAR_12=False):...\n", "VAR_86 = self.rules\n", "if VAR_12:\n", "VAR_86 = filterfalse(Rule.has_wildcards, VAR_86)\n", "for VAR_13 in VAR_86:\n", "logger.rule_info(VAR_10=rule.name, docstring=rule.docstring)\n" ]
[ "def list_rules(self, only_targets=False):...\n", "rules = self.rules\n", "if only_targets:\n", "rules = filterfalse(Rule.has_wildcards, rules)\n", "for rule in rules:\n", "logger.rule_info(name=rule.name, docstring=rule.docstring)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "For", "Docstring" ]
[ "def FUNC_5(VAR_8, VAR_7):...\n", "shutil.copyfileobj(file_in, file_out)\n" ]
[ "def decompress_gzip(local_file_gz, local_file):...\n", "shutil.copyfileobj(file_in, file_out)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_5(self):...\n", "VAR_1 = 'http://my.url.com'\n", "VAR_2 = 'True'\n", "url_helper.urllib2.urlopen(VAR_1, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(VAR_2))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(VAR_1, method='POST'), VAR_2)\n", "self._mox.VerifyAll()\n" ]
[ "def testUrlOpenPOSTSuccess(self):...\n", "url = 'http://my.url.com'\n", "response = 'True'\n", "url_helper.urllib2.urlopen(url, mox.IgnoreArg(), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(response))\n", "self._mox.ReplayAll()\n", "self.assertEqual(url_helper.UrlOpen(url, method='POST'), response)\n", "self._mox.VerifyAll()\n" ]
[ 0, 0, 0, 5, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_24(self, VAR_16):...\n", "" ]
[ "def local_path(self, volume):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_13(VAR_20, VAR_21):...\n", "VAR_16 = {}\n", "VAR_17 = [('manager', VAR_21)]\n", "VAR_47 = FUNC_14(VAR_20)\n", "FUNC_8('dataset/%d/managers/add' % VAR_47, VAR_17=files, VAR_16=args)\n" ]
[ "def add_manager(task_id, manager):...\n", "args = {}\n", "files = [('manager', manager)]\n", "dataset_id = get_task_active_dataset_id(task_id)\n", "admin_req('dataset/%d/managers/add' % dataset_id, files=files, args=args)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def __init__(self, VAR_2, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "super(CLASS_6, self).__init__(VAR_2)\n", "self.hostname = VAR_3\n", "self.message = 'Component %s crashed on remote host %s' % (VAR_2, VAR_3)\n" ]
[ "def __init__(self, comp_name, hostname):...\n", "\"\"\"docstring\"\"\"\n", "super(RemoteCrashEvent, self).__init__(comp_name)\n", "self.hostname = hostname\n", "self.message = 'Component %s crashed on remote host %s' % (comp_name, hostname)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'" ]
[ "def FUNC_1(VAR_3, VAR_4=1):...\n", "VAR_35 = 0\n", "VAR_36 = VAR_4\n", "while VAR_35 <= 30:\n", "VAR_7 = VAR_3.replace('###', str(VAR_4))\n", "return VAR_36\n", "print('about to check url {}'.format(VAR_7))\n", "if VAR_1:\n", "print('start is ' + str(VAR_4))\n", "VAR_6, VAR_45 = FUNC_5(VAR_7)\n", "if VAR_45 < 300 and FUNC_7(VAR_6, VAR_7=base_url):\n", "if VAR_1:\n", "VAR_35 = VAR_35 + 1\n", "print('url ' + str(VAR_7) + ' is valid')\n", "VAR_35 = 0\n", "VAR_4 = VAR_4 + 1\n", "VAR_36 = VAR_4\n" ]
[ "def _get_last_valid_url(base_url, start=1):...\n", "invalid_count = 0\n", "end = start\n", "while invalid_count <= 30:\n", "url = base_url.replace('###', str(start))\n", "return end\n", "print('about to check url {}'.format(url))\n", "if debug:\n", "print('start is ' + str(start))\n", "data, status = hit_url(url)\n", "if status < 300 and is_valid(data, url=base_url):\n", "if debug:\n", "invalid_count = invalid_count + 1\n", "print('url ' + str(url) + ' is valid')\n", "invalid_count = 0\n", "start = start + 1\n", "end = start\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Expr'", "Condition", "Expr'", "Assign'", "Condition", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'" ]
[ "@api.public...\n", "FUNC_31(self, 'PUT')\n" ]
[ "@api.public...\n", "record(self, 'PUT')\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_5(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "self.lasttok = VAR_3.type\n", "return VAR_3\n" ]
[ "def t_LPAR(self, tok):...\n", "\"\"\"docstring\"\"\"\n", "self.lasttok = tok.type\n", "return tok\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_1(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = self.language\n", "VAR_12 = 'ru-RU' if self.language == 'en-US' else 'en-US'\n", "log.info('Changing user %s language from %s to %s...', self, VAR_11, VAR_12)\n", "self.set_language(VAR_12)\n", "return VAR_12\n" ]
[ "def switch_language(self):...\n", "\"\"\"docstring\"\"\"\n", "curr_lang = self.language\n", "new_lang = 'ru-RU' if self.language == 'en-US' else 'en-US'\n", "log.info('Changing user %s language from %s to %s...', self, curr_lang,\n new_lang)\n", "self.set_language(new_lang)\n", "return new_lang\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ "def __str__(self):...\n", "return self.get_name()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_54=None, VAR_55=None, *VAR_15, **VAR_16):...\n", "self.min = VAR_54\n", "self.max = VAR_55\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, min=None, max=None, *a, **kw):...\n", "self.min = min\n", "self.max = max\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getboolean(self.section, 'syslog_debug')\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.config.getboolean(self.section, 'syslog_debug')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_3(self):...\n", "for VAR_5 in self.groups:\n", "self.add_group(VAR_5)\n" ]
[ "def populate_ancestors(self):...\n", "for group in self.groups:\n", "self.add_group(group)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'" ]
[ "def FUNC_5(self):...\n", "if self.redirected_to is None:\n", "return None\n", "VAR_14 = self.redirected_to.split('&')\n", "if len(VAR_14) != 2:\n", "VAR_0.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n", "VAR_21 = decrypt_number(VAR_14[-1])\n", "VAR_0.warning(\"Unable to decrypt user test id from page: `%s'\", self.\n redirected_to)\n", "return VAR_21\n", "return None\n", "return None\n" ]
[ "def get_user_test_id(self):...\n", "if self.redirected_to is None:\n", "return None\n", "p = self.redirected_to.split('&')\n", "if len(p) != 2:\n", "logger.warning(\"Redirected to an unexpected page: `%s'\", self.redirected_to)\n", "user_test_id = decrypt_number(p[-1])\n", "logger.warning(\"Unable to decrypt user test id from page: `%s'\", self.\n redirected_to)\n", "return user_test_id\n", "return None\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Return'", "Return'", "Return'" ]
[ "def FUNC_7(self, VAR_7=None):...\n", "\"\"\"docstring\"\"\"\n", "from .qa_group import QAGroup\n", "from .extracted_text import ExtractedText\n", "VAR_10 = self\n", "if QAGroup.objects.filter(extraction_script=es).count() == 1:\n", "return QAGroup.objects.get(extraction_script=es)\n", "if QAGroup.objects.filter(extraction_script=es).count() > 1:\n", "return QAGroup.objects.filter(extraction_script=es).first()\n", "VAR_11 = QAGroup.objects.create(extraction_script=es)\n", "VAR_12 = list(ExtractedText.objects.filter(extraction_script=es, qa_checked\n =False).values_list('pk', flat=True))\n", "if len(VAR_12) < 100 and len(VAR_12) > 0:\n", "VAR_13 = ExtractedText.objects.filter(pk__in=doc_text_ids)\n", "if len(VAR_12) >= 100:\n", "if VAR_13 is not None:\n", "VAR_15 = math.ceil(len(VAR_12) / 5)\n", "VAR_13 = None\n", "for VAR_14 in VAR_13:\n", "if VAR_7 is not None and ExtractedText.objects.filter(pk=force_doc_id).exists(\n", "shuffle(VAR_12)\n", "VAR_14.qa_group = VAR_11\n", "VAR_14 = ExtractedText.objects.get(pk=force_doc_id)\n", "return VAR_11\n", "VAR_13 = ExtractedText.objects.filter(pk__in=doc_text_ids[:random_20])\n", "VAR_14.save()\n", "VAR_14.qa_group = VAR_11\n", "VAR_14.save()\n" ]
[ "def create_qa_group(self, force_doc_id=None):...\n", "\"\"\"docstring\"\"\"\n", "from .qa_group import QAGroup\n", "from .extracted_text import ExtractedText\n", "es = self\n", "if QAGroup.objects.filter(extraction_script=es).count() == 1:\n", "return QAGroup.objects.get(extraction_script=es)\n", "if QAGroup.objects.filter(extraction_script=es).count() > 1:\n", "return QAGroup.objects.filter(extraction_script=es).first()\n", "qa_group = QAGroup.objects.create(extraction_script=es)\n", "doc_text_ids = list(ExtractedText.objects.filter(extraction_script=es,\n qa_checked=False).values_list('pk', flat=True))\n", "if len(doc_text_ids) < 100 and len(doc_text_ids) > 0:\n", "texts = ExtractedText.objects.filter(pk__in=doc_text_ids)\n", "if len(doc_text_ids) >= 100:\n", "if texts is not None:\n", "random_20 = math.ceil(len(doc_text_ids) / 5)\n", "texts = None\n", "for text in texts:\n", "if force_doc_id is not None and ExtractedText.objects.filter(pk=force_doc_id\n", "shuffle(doc_text_ids)\n", "text.qa_group = qa_group\n", "text = ExtractedText.objects.get(pk=force_doc_id)\n", "return qa_group\n", "texts = ExtractedText.objects.filter(pk__in=doc_text_ids[:random_20])\n", "text.save()\n", "text.qa_group = qa_group\n", "text.save()\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 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "ImportFrom'", "Assign'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "For", "For", "Expr'", "Assign'", "Assign'", "Return'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def __virtual__():...\n", "\"\"\"docstring\"\"\"\n", "if salt.utils.is_windows():\n", "return False\n", "return 'disk'\n" ]
[ "def __virtual__():...\n", "\"\"\"docstring\"\"\"\n", "if salt.utils.is_windows():\n", "return False\n", "return 'disk'\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(VAR_14, VAR_15, VAR_18=True):...\n", "warn('string')\n", "return FUNC_5(VAR_14, VAR_15, VAR_18)\n" ]
[ "def smartGrid(dims, files, implicitFillWidth=True):...\n", "warn(\n 'Image Frame: PIL support not yet implemented, falling back to basic grid. Some images may be distorted.'\n )\n", "return grid(dims, files, implicitFillWidth)\n" ]
[ 0, 2, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_7(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "VAR_19 = []\n", "for entry in self.entries:\n", "if entry.tag_name == VAR_9:\n", "return VAR_19\n", "VAR_19.append(entry.value)\n" ]
[ "def get_tag(self, tagname):...\n", "\"\"\"docstring\"\"\"\n", "values = []\n", "for entry in self.entries:\n", "if entry.tag_name == tagname:\n", "return values\n", "values.append(entry.value)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "Condition", "Return'", "Expr'" ]
[ "def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n", "if VAR_23 == 'on_after_task':\n", "VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n", "self.assertEqual(False, VAR_50)\n", "self.assertEqual(True, VAR_51)\n", "self.assertEqual({'pool': 'default'}, VAR_5)\n", "self.assertEqual({}, VAR_52)\n" ]
[ "def call_hook(_botobj, name, *args):...\n", "if name == 'on_after_task':\n", "failure, internal_failure, dimensions, summary = args\n", "self.assertEqual(False, failure)\n", "self.assertEqual(True, internal_failure)\n", "self.assertEqual({'pool': 'default'}, dimensions)\n", "self.assertEqual({}, summary)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_21(self, VAR_28):...\n", "\"\"\"docstring\"\"\"\n", "VAR_70 = ''\n", "VAR_58 = VAR_28,\n", "if self.execute('SELECT script_log FROM history WHERE nzo_id=?', VAR_58):\n", "return VAR_70\n", "VAR_70 = zlib.decompress(self.c.fetchone().get('script_log'))\n" ]
[ "def get_script_log(self, nzo_id):...\n", "\"\"\"docstring\"\"\"\n", "data = ''\n", "t = nzo_id,\n", "if self.execute('SELECT script_log FROM history WHERE nzo_id=?', t):\n", "return data\n", "data = zlib.decompress(self.c.fetchone().get('script_log'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Return'", "Assign'" ]