lines
sequence
raw_lines
sequence
label
sequence
type
sequence
[ "@property...\n", "return self._handler.request\n" ]
[ "@property...\n", "return self._handler.request\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@contextmanager...\n", "yield\n" ]
[ "@contextmanager...\n", "yield\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_16(VAR_23):...\n", "\"\"\"docstring\"\"\"\n", "VAR_58 = {}\n", "if VAR_23:\n", "for VAR_91, expansions in iteritems(VAR_23):\n", "return VAR_23\n", "VAR_90 = ', '.join([('%s (%d)' % expansion) for expansion in expansions])\n", "VAR_58[VAR_91] = VAR_90\n" ]
[ "def _get_acronyms(acronyms):...\n", "\"\"\"docstring\"\"\"\n", "acronyms_str = {}\n", "if acronyms:\n", "for acronym, expansions in iteritems(acronyms):\n", "return acronyms\n", "expansions_str = ', '.join([('%s (%d)' % expansion) for expansion in\n expansions])\n", "acronyms_str[acronym] = expansions_str\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "For", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_14(self, VAR_10, VAR_11):...\n", "VAR_24 = self.common._cli_run('createhost -add %s %s' % (VAR_10, ' '.join(\n VAR_11)), None)\n" ]
[ "def _modify_3par_fibrechan_host(self, hostname, wwn):...\n", "out = self.common._cli_run('createhost -add %s %s' % (hostname, ' '.join(\n wwn)), None)\n" ]
[ 0, 2 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_10(self):...\n", "return self.current_user()['email'].lower()\n" ]
[ "def current_email(self):...\n", "return self.current_user()['email'].lower()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0(self, VAR_3):...\n", "VAR_4 = super().value_from_object(VAR_3)\n", "return self.to_python(VAR_4)\n" ]
[ "def value_from_object(self, obj):...\n", "value = super().value_from_object(obj)\n", "return self.to_python(value)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "VAR_1 = 'INVALID'\n", "self.assertEqual(escape_path_argument('/home/usr/a-file', VAR_1),\n '/home/usr/a-file')\n", "self.assertEqual(escape_path_argument('/home/us r/a-file with spaces.bla',\n VAR_1), '/home/us r/a-file with spaces.bla')\n", "self.assertEqual(escape_path_argument('|home|us r|a*dir with spaces|x|',\n VAR_1), '|home|us r|a*dir with spaces|x|')\n", "self.assertEqual(escape_path_argument('system|a|b|c?d', VAR_1),\n 'system|a|b|c?d')\n" ]
[ "def test_escape_path_argument_unsupported(self):...\n", "_type = 'INVALID'\n", "self.assertEqual(escape_path_argument('/home/usr/a-file', _type),\n '/home/usr/a-file')\n", "self.assertEqual(escape_path_argument('/home/us r/a-file with spaces.bla',\n _type), '/home/us r/a-file with spaces.bla')\n", "self.assertEqual(escape_path_argument('|home|us r|a*dir with spaces|x|',\n _type), '|home|us r|a*dir with spaces|x|')\n", "self.assertEqual(escape_path_argument('system|a|b|c?d', _type),\n 'system|a|b|c?d')\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_10(self, VAR_32):...\n", "self.tables.append(VAR_32)\n", "VAR_0 = VAR_32[4:-1]\n", "if not self.flags.ignore_permissions and not frappe.has_permission(VAR_0):\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(VAR_0))\n" ]
[ "def append_table(self, table_name):...\n", "self.tables.append(table_name)\n", "doctype = table_name[4:-1]\n", "if not self.flags.ignore_permissions and not frappe.has_permission(doctype):\n", "frappe.flags.error_message = _('Insufficient Permission for {0}').format(frappe\n .bold(doctype))\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_0(self, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Updating info about user %s language in memory & database...', self)\n", "self.language = VAR_5\n", "VAR_10 = (\n f\"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'\"\n )\n", "db.add(VAR_10)\n", "log.error(\"Can't add new language of %s to the database\", self)\n", "log.debug('Language updated.')\n" ]
[ "def set_language(self, lang):...\n", "\"\"\"docstring\"\"\"\n", "log.debug('Updating info about user %s language in memory & database...', self)\n", "self.language = lang\n", "query = (\n f\"UPDATE users SET language='{self.language}' WHERE chat_id='{self.chat_id}'\"\n )\n", "db.add(query)\n", "log.error(\"Can't add new language of %s to the database\", self)\n", "log.debug('Language updated.')\n" ]
[ 0, 0, 0, 0, 4, 4, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_14(self, VAR_7):...\n", "VAR_12 = VAR_7.model_class._meta.table_name\n", "VAR_7 = \"DELETE FROM {0} WHERE {1} = '{3}' AND {2}='{4}';\".format(VAR_12,\n VAR_7.model_class._meta.sorted_fields_names[0], VAR_7.model_class._meta\n .sorted_fields_names[1], VAR_7.objs[0].id, VAR_7.objs[1].id)\n", "return VAR_7\n" ]
[ "def generate_remove(self, query):...\n", "table_name = query.model_class._meta.table_name\n", "query = \"DELETE FROM {0} WHERE {1} = '{3}' AND {2}='{4}';\".format(table_name,\n query.model_class._meta.sorted_fields_names[0], query.model_class._meta\n .sorted_fields_names[1], query.objs[0].id, query.objs[1].id)\n", "return query\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@VAR_2.route('/data/results/flot/day/')...\n", "\"\"\"docstring\"\"\"\n", "VAR_24, VAR_23 = FUNC_4(request.args)\n", "VAR_27 = ['android4.0', 'android2.3', 'linux32', 'winxp', 'win7', 'win8',\n 'osx10.6', 'osx10.7', 'osx10.8']\n", "VAR_28 = FUNC_0()\n", "VAR_29 = {}\n", "for VAR_38 in VAR_27:\n", "VAR_32 = VAR_28.cursor()\n", "VAR_28.close()\n", "VAR_32.execute('string' % ('testfailed', VAR_38, VAR_24, VAR_23))\n", "return VAR_29\n", "VAR_33 = VAR_32.fetchall()\n", "VAR_6 = []\n", "VAR_14 = {}\n", "VAR_14['failures'] = []\n", "VAR_14['totals'] = []\n", "for day, fail, VAR_46 in VAR_33:\n", "VAR_6.append(day)\n", "VAR_32.close()\n", "VAR_81 = calendar.timegm(day.timetuple()) * 1000\n", "VAR_29[VAR_38] = {'data': VAR_14, 'dates': FUNC_3(VAR_6)}\n", "VAR_14['failures'].append((VAR_81, int(fail)))\n", "VAR_14['totals'].append((VAR_81, int(VAR_46)))\n" ]
[ "@app.route('/data/results/flot/day/')...\n", "\"\"\"docstring\"\"\"\n", "start_date, end_date = clean_date_params(request.args)\n", "platforms = ['android4.0', 'android2.3', 'linux32', 'winxp', 'win7', 'win8',\n 'osx10.6', 'osx10.7', 'osx10.8']\n", "db = create_db_connnection()\n", "data_platforms = {}\n", "for platform in platforms:\n", "cursor = db.cursor()\n", "db.close()\n", "cursor.execute(\n \"\"\"select DATE(date) as day,sum(result=\"%s\") as failures,count(*) as\n totals from testjobs where platform=\"%s\" and date >= \"%s\" and date <= \"%s\"\n group by day\"\"\"\n % ('testfailed', platform, start_date, end_date))\n", "return data_platforms\n", "query_results = cursor.fetchall()\n", "dates = []\n", "data = {}\n", "data['failures'] = []\n", "data['totals'] = []\n", "for day, fail, total in query_results:\n", "dates.append(day)\n", "cursor.close()\n", "timestamp = calendar.timegm(day.timetuple()) * 1000\n", "data_platforms[platform] = {'data': data, 'dates': get_date_range(dates)}\n", "data['failures'].append((timestamp, int(fail)))\n", "data['totals'].append((timestamp, int(total)))\n" ]
[ 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'", "For", "Assign'", "Expr'", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_20(self):...\n", "print('INFO: connection recovered')\n", "return DeadConnectionDetector.connectionRecovered(self)\n" ]
[ "def connectionRecovered(self):...\n", "print('INFO: connection recovered')\n", "return DeadConnectionDetector.connectionRecovered(self)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_7=None, VAR_8=None, VAR_9=True, VAR_10=True, VAR_11=True...\n", "if VAR_7:\n", "self.param = VAR_7\n", "self.param = self.default_param\n", "self.default = VAR_8\n", "self.post, self.get, self.url = VAR_9, VAR_10, VAR_11\n" ]
[ "def __init__(self, param=None, default=None, post=True, get=True, url=True):...\n", "if param:\n", "self.param = param\n", "self.param = self.default_param\n", "self.default = default\n", "self.post, self.get, self.url = post, get, url\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_2 is None:\n", "return None\n", "if not VAR_2.startswith('models:'):\n", "return VAR_2\n", "VAR_18 = VAR_2[7:VAR_2.rfind('/')].replace('/', '.')\n", "VAR_19 = f'parlai.zoo.{VAR_18}'\n", "print(VAR_19)\n", "VAR_36 = importlib.import_module(VAR_19)\n", "return VAR_20.path.join(VAR_1, 'models', VAR_2[7:])\n", "VAR_37 = getattr(VAR_36, 'download')\n", "VAR_37(VAR_1)\n" ]
[ "def modelzoo_path(datapath, path):...\n", "\"\"\"docstring\"\"\"\n", "if path is None:\n", "return None\n", "if not path.startswith('models:'):\n", "return path\n", "animal = path[7:path.rfind('/')].replace('/', '.')\n", "module_name = f'parlai.zoo.{animal}'\n", "print(module_name)\n", "my_module = importlib.import_module(module_name)\n", "return os.path.join(datapath, 'models', path[7:])\n", "download = getattr(my_module, 'download')\n", "download(datapath)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_17(self, VAR_20):...\n", "return super().form_invalid(VAR_20)\n" ]
[ "def form_invalid(self, form):...\n", "return super().form_invalid(form)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def act(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "@receiver(VAR_5, **decorator_kwargs)...\n", "if settings.SUSPEND_SIGNALS:\n", "return\n", "return VAR_17(VAR_23, **kwargs)\n" ]
[ "@receiver(signal, **decorator_kwargs)...\n", "if settings.SUSPEND_SIGNALS:\n", "return\n", "return func(sender, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "VAR_0 = [('contenttypes', '0001_initial'), ('inheritance', '0001_initial')]\n", "VAR_1 = [migrations.CreateModel(name='BasePlugin', fields=[(\n 'modelwithinheritance_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to=\n 'inheritance.ModelWithInheritance')), ('container_pk', models.TextField\n (verbose_name='object ID')), ('title', models.CharField(max_length=64)),\n ('views', models.CharField(blank=True, max_length=255))], options={\n 'abstract': False}, bases=('inheritance.modelwithinheritance',)),\n migrations.CreateModel(name='BaseTab', fields=[(\n 'modelwithinheritance_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to=\n 'inheritance.ModelWithInheritance')), ('container_pk', models.TextField\n (verbose_name='object ID')), ('label', models.CharField(max_length=12)),\n ('title', models.CharField(max_length=64)), ('order', models.\n IntegerField(default=100)), ('opening_method', models.CharField(blank=\n True, max_length=32))], options={'ordering': ['order', 'id']}, bases=(\n 'inheritance.modelwithinheritance',)), migrations.CreateModel(name=\n 'EmbeddedTab', fields=[('basetab_ptr', models.OneToOneField(parent_link\n =True, auto_created=True, primary_key=True, serialize=False, to=\n 'apps.BaseTab')), ('content_url', models.URLField(max_length=128)), (\n 'element_id', models.CharField(blank=True, max_length=32))], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='ExternalIFramePlugin', fields=[('baseplugin_ptr', models.\n OneToOneField(parent_link=True, auto_created=True, primary_key=True,\n serialize=False, to='apps.BasePlugin')), ('service_url', models.\n URLField(max_length=255)), ('width', models.IntegerField()), ('height',\n models.IntegerField())], options={'abstract': False}, bases=(\n 'apps.baseplugin',)), migrations.CreateModel(name='ExternalIFrameTab',\n fields=[('basetab_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to='apps.BaseTab'\n )), ('content_url', models.URLField(max_length=255)), ('width', models.\n IntegerField()), ('height', models.IntegerField())], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='HTMLPlugin', fields=[('baseplugin_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BasePlugin')), ('content', models.TextField())], options={\n 'abstract': False}, bases=('apps.baseplugin',)), migrations.CreateModel\n (name='HTMLTab', fields=[('basetab_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BaseTab')), ('content', models.TextField())], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='RSSPlugin', fields=[('baseplugin_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BasePlugin')), ('feed_url', models.URLField(max_length=256))],\n options={'abstract': False}, bases=('apps.baseplugin',)), migrations.\n AddField(model_name='basetab', name='container_type', field=models.\n ForeignKey(to='contenttypes.ContentType'), preserve_default=True),\n migrations.AddField(model_name='baseplugin', name='container_type',\n field=models.ForeignKey(to='contenttypes.ContentType'),\n preserve_default=True)]\n" ]
[ "from __future__ import unicode_literals\n", "from django.db import models, migrations\n", "dependencies = [('contenttypes', '0001_initial'), ('inheritance',\n '0001_initial')]\n", "operations = [migrations.CreateModel(name='BasePlugin', fields=[(\n 'modelwithinheritance_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to=\n 'inheritance.ModelWithInheritance')), ('container_pk', models.TextField\n (verbose_name='object ID')), ('title', models.CharField(max_length=64)),\n ('views', models.CharField(blank=True, max_length=255))], options={\n 'abstract': False}, bases=('inheritance.modelwithinheritance',)),\n migrations.CreateModel(name='BaseTab', fields=[(\n 'modelwithinheritance_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to=\n 'inheritance.ModelWithInheritance')), ('container_pk', models.TextField\n (verbose_name='object ID')), ('label', models.CharField(max_length=12)),\n ('title', models.CharField(max_length=64)), ('order', models.\n IntegerField(default=100)), ('opening_method', models.CharField(blank=\n True, max_length=32))], options={'ordering': ['order', 'id']}, bases=(\n 'inheritance.modelwithinheritance',)), migrations.CreateModel(name=\n 'EmbeddedTab', fields=[('basetab_ptr', models.OneToOneField(parent_link\n =True, auto_created=True, primary_key=True, serialize=False, to=\n 'apps.BaseTab')), ('content_url', models.URLField(max_length=128)), (\n 'element_id', models.CharField(blank=True, max_length=32))], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='ExternalIFramePlugin', fields=[('baseplugin_ptr', models.\n OneToOneField(parent_link=True, auto_created=True, primary_key=True,\n serialize=False, to='apps.BasePlugin')), ('service_url', models.\n URLField(max_length=255)), ('width', models.IntegerField()), ('height',\n models.IntegerField())], options={'abstract': False}, bases=(\n 'apps.baseplugin',)), migrations.CreateModel(name='ExternalIFrameTab',\n fields=[('basetab_ptr', models.OneToOneField(parent_link=True,\n auto_created=True, primary_key=True, serialize=False, to='apps.BaseTab'\n )), ('content_url', models.URLField(max_length=255)), ('width', models.\n IntegerField()), ('height', models.IntegerField())], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='HTMLPlugin', fields=[('baseplugin_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BasePlugin')), ('content', models.TextField())], options={\n 'abstract': False}, bases=('apps.baseplugin',)), migrations.CreateModel\n (name='HTMLTab', fields=[('basetab_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BaseTab')), ('content', models.TextField())], options={\n 'abstract': False}, bases=('apps.basetab',)), migrations.CreateModel(\n name='RSSPlugin', fields=[('baseplugin_ptr', models.OneToOneField(\n parent_link=True, auto_created=True, primary_key=True, serialize=False,\n to='apps.BasePlugin')), ('feed_url', models.URLField(max_length=256))],\n options={'abstract': False}, bases=('apps.baseplugin',)), migrations.\n AddField(model_name='basetab', name='container_type', field=models.\n ForeignKey(to='contenttypes.ContentType'), preserve_default=True),\n migrations.AddField(model_name='baseplugin', name='container_type',\n field=models.ForeignKey(to='contenttypes.ContentType'),\n preserve_default=True)]\n" ]
[ 0, 0, 0, 4 ]
[ "ImportFrom'", "ImportFrom'", "Assign'", "Assign'" ]
[ "def FUNC_13(self, VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "if self.test_name is None:\n", "self.initFile('clockwise')\n", "self.testSquare(VAR_19, self.c_square)\n" ]
[ "def testCsquare(self, length):...\n", "\"\"\"docstring\"\"\"\n", "if self.test_name is None:\n", "self.initFile('clockwise')\n", "self.testSquare(length, self.c_square)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_1):...\n", "self.server = VAR_1.get('etcd_server', '127.0.0.1')\n", "self.port = int(VAR_1.get('etcd_port', 4001))\n", "self.namespace = VAR_1.get('namespace', '/custodia')\n", "self.etcd = etcd.Client(self.server, self.port)\n", "FUNC_0('Error creating namespace %s: [%r]' % (self.namespace, repr(err)))\n", "self.etcd.write(self.namespace, None, dir=True)\n" ]
[ "def __init__(self, config):...\n", "self.server = config.get('etcd_server', '127.0.0.1')\n", "self.port = int(config.get('etcd_port', 4001))\n", "self.namespace = config.get('namespace', '/custodia')\n", "self.etcd = etcd.Client(self.server, self.port)\n", "log_error('Error creating namespace %s: [%r]' % (self.namespace, repr(err)))\n", "self.etcd.write(self.namespace, None, dir=True)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_33(self):...\n", "" ]
[ "def some_other_method(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_0(VAR_0):...\n", "print(VAR_0, file=sys.stderr)\n" ]
[ "def log_error(error):...\n", "print(error, file=sys.stderr)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "from time import time\n", "from saml2.ident import code\n", "from flask import session, request, redirect, current_app\n", "from eduid_common.authn.loa import get_loa\n", "from eduid_webapp.authn.acs_registry import acs_action\n", "@acs_action('login-action')...\n", "\"\"\"docstring\"\"\"\n", "current_app.logger.info('User {!r} logging in.'.format(VAR_1))\n", "VAR_3['_saml2_session_name_id'] = code(VAR_0['name_id'])\n", "VAR_3['eduPersonPrincipalName'] = VAR_1.eppn\n", "VAR_3['user_eppn'] = VAR_1.eppn\n", "VAR_4 = get_loa(current_app.config.get('AVAILABLE_LOA'), VAR_0)\n", "VAR_3['eduPersonAssurance'] = VAR_4\n", "VAR_3.persist()\n", "VAR_5 = request.form.get('RelayState', '/')\n", "current_app.logger.debug('Redirecting to the RelayState: ' + VAR_5)\n", "VAR_6 = redirect(location=relay_state)\n", "VAR_3.set_cookie(VAR_6)\n", "current_app.logger.info('Redirecting user {!r} to {!r}'.format(VAR_1, VAR_5))\n", "return VAR_6\n" ]
[ "from time import time\n", "from saml2.ident import code\n", "from flask import session, request, redirect, current_app\n", "from eduid_common.authn.loa import get_loa\n", "from eduid_webapp.authn.acs_registry import acs_action\n", "@acs_action('login-action')...\n", "\"\"\"docstring\"\"\"\n", "current_app.logger.info('User {!r} logging in.'.format(user))\n", "session['_saml2_session_name_id'] = code(session_info['name_id'])\n", "session['eduPersonPrincipalName'] = user.eppn\n", "session['user_eppn'] = user.eppn\n", "loa = get_loa(current_app.config.get('AVAILABLE_LOA'), session_info)\n", "session['eduPersonAssurance'] = loa\n", "session.persist()\n", "relay_state = request.form.get('RelayState', '/')\n", "current_app.logger.debug('Redirecting to the RelayState: ' + relay_state)\n", "response = redirect(location=relay_state)\n", "session.set_cookie(response)\n", "current_app.logger.info('Redirecting user {!r} to {!r}'.format(user,\n relay_state))\n", "return response\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_8(VAR_13, VAR_14):...\n", "VAR_5 = self.paths[VAR_13]\n", "return VAR_5._handlers.get(VAR_14, None)\n" ]
[ "def get_handlers(path, method):...\n", "component = self.paths[path]\n", "return component._handlers.get(method, None)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_2(self, VAR_6, VAR_7):...\n", "return next(filter(lambda field: field.name == VAR_7, VAR_6._meta.fields))\n" ]
[ "def _get_model_field(self, model, name):...\n", "return next(filter(lambda field: field.name == name, model._meta.fields))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_0():...\n", "VAR_30 = []\n", "VAR_30.append('[image-original-none-http://simg4.gelbooru.com/' +\n '/images/db/1d/db1dfb62a40f5ced2043bb8966da9a98.png]')\n", "VAR_30.append('Каждый хочет дружить с ядерной бомбой.')\n", "VAR_30.append(str(random.randint(0, 9999999999)))\n", "return '\\n'.join(VAR_30)\n" ]
[ "def message():...\n", "msg = []\n", "msg.append('[image-original-none-http://simg4.gelbooru.com/' +\n '/images/db/1d/db1dfb62a40f5ced2043bb8966da9a98.png]')\n", "msg.append('Каждый хочет дружить с ядерной бомбой.')\n", "msg.append(str(random.randint(0, 9999999999)))\n", "return '\\n'.join(msg)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_37 = VAR_1.GET.get('regenerate') == 'true'\n", "return HttpResponse(status=409)\n", "VAR_39 = HttpResponse(content_type='application/binary')\n", "if VAR_37:\n", "VAR_39['Content-Disposition'] = 'attachment; filename=%s.pem' % slugify(VAR_2)\n", "api.nova.keypair_delete(VAR_1, VAR_2)\n", "VAR_38 = api.nova.keypair_create(VAR_1, VAR_2)\n", "VAR_39.write(VAR_38.private_key)\n", "VAR_39['Content-Length'] = str(len(VAR_39.content))\n", "return VAR_39\n" ]
[ "def get(self, request, keypair_name):...\n", "\"\"\"docstring\"\"\"\n", "regenerate = request.GET.get('regenerate') == 'true'\n", "return HttpResponse(status=409)\n", "response = HttpResponse(content_type='application/binary')\n", "if regenerate:\n", "response['Content-Disposition'] = 'attachment; filename=%s.pem' % slugify(\n keypair_name)\n", "api.nova.keypair_delete(request, keypair_name)\n", "keypair = api.nova.keypair_create(request, keypair_name)\n", "response.write(keypair.private_key)\n", "response['Content-Length'] = str(len(response.content))\n", "return response\n" ]
[ 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_18(self, VAR_16, VAR_20):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = ['volume', 'select', VAR_16['name'], 'access', 'create',\n 'initiator', VAR_20['initiator']]\n", "VAR_0.error(_('Failed to initialize connection to volume %s'), VAR_16['name'])\n", "if self.configuration.eqlx_use_chap:\n", "VAR_28.extend(['authmethod chap', 'username', self.configuration.\n eqlx_chap_login])\n", "self._eql_execute(*VAR_28)\n", "VAR_47 = self._get_iscsi_properties(VAR_16)\n", "return {'driver_volume_type': 'iscsi', 'data': VAR_47}\n" ]
[ "def initialize_connection(self, volume, connector):...\n", "\"\"\"docstring\"\"\"\n", "cmd = ['volume', 'select', volume['name'], 'access', 'create', 'initiator',\n connector['initiator']]\n", "LOG.error(_('Failed to initialize connection to volume %s'), volume['name'])\n", "if self.configuration.eqlx_use_chap:\n", "cmd.extend(['authmethod chap', 'username', self.configuration.eqlx_chap_login])\n", "self._eql_execute(*cmd)\n", "iscsi_properties = self._get_iscsi_properties(volume)\n", "return {'driver_volume_type': 'iscsi', 'data': iscsi_properties}\n" ]
[ 0, 0, 0, 0, 0, 2, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_28(self):...\n", "VAR_21 = self._time\n", "self._time += 0.0001\n", "return VAR_21\n" ]
[ "def time(self):...\n", "ret = self._time\n", "self._time += 0.0001\n", "return ret\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "AugAssign'", "Return'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = CLASS_1().forward('--list')\n", "VAR_5 = str(VAR_4, 'utf-8').strip().split('\\n')\n", "VAR_6 = []\n", "for line in VAR_5:\n", "VAR_13 = line.split(' tcp:')\n", "return VAR_6\n", "if len(VAR_13) != 3:\n", "VAR_6.append(int(VAR_13[1]))\n" ]
[ "def list_occupied_adb_ports():...\n", "\"\"\"docstring\"\"\"\n", "out = AdbProxy().forward('--list')\n", "clean_lines = str(out, 'utf-8').strip().split('\\n')\n", "used_ports = []\n", "for line in clean_lines:\n", "tokens = line.split(' tcp:')\n", "return used_ports\n", "if len(tokens) != 3:\n", "used_ports.append(int(tokens[1]))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'" ]
[ "def FUNC_2(VAR_7=None, VAR_8=0, VAR_9=0):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_7 is None:\n", "return True\n", "return False\n", "VAR_21 = re.match('^([^;]+)(; length=([0-9]+))?$', VAR_7, re.IGNORECASE)\n", "VAR_22 = parse_http_date(VAR_21.group(1))\n", "VAR_23 = VAR_21.group(3)\n", "if VAR_23 and int(VAR_23) != VAR_9:\n", "if int(VAR_8) > VAR_22:\n" ]
[ "def was_modified_since(header=None, mtime=0, size=0):...\n", "\"\"\"docstring\"\"\"\n", "if header is None:\n", "return True\n", "return False\n", "matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)\n", "header_mtime = parse_http_date(matches.group(1))\n", "header_len = matches.group(3)\n", "if header_len and int(header_len) != size:\n", "if int(mtime) > header_mtime:\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Condition" ]
[ "def FUNC_6(self, VAR_41):...\n", "VAR_79 = CLASS_24.run(self, VAR_41)\n", "if VAR_79:\n", "if not VAR_79._loaded:\n", "return self.error(errors.NOT_AUTHOR)\n", "VAR_79._load()\n", "if VAR_101.user_is_loggedin and VAR_79.author_id == VAR_101.user._id:\n", "return VAR_79\n" ]
[ "def run(self, fullname):...\n", "thing = VByName.run(self, fullname)\n", "if thing:\n", "if not thing._loaded:\n", "return self.error(errors.NOT_AUTHOR)\n", "thing._load()\n", "if c.user_is_loggedin and thing.author_id == c.user._id:\n", "return thing\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Condition", "Return'", "Expr'", "Condition", "Return'" ]
[ "def FUNC_6(self, VAR_10, VAR_11):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_volume_from_snapshot(self, volume, snapshot):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "@VAR_0.filter...\n", "return reverse('model-edit', VAR_5=_normal_kwargs(model_object.\n course_instance, model_name, id=model_object.id))\n" ]
[ "@register.filter...\n", "return reverse('model-edit', kwargs=_normal_kwargs(model_object.\n course_instance, model_name, id=model_object.id))\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_12(VAR_0, VAR_5):...\n", "\"\"\"docstring\"\"\"\n", "VAR_23 = pd.read_sql_table(VAR_0, db.engine)\n", "print('NORMALIZATION FAILED')\n", "VAR_23[VAR_5] = (VAR_23[VAR_5] - VAR_23[VAR_5].mean()) / VAR_23[VAR_5].std(ddof\n =0)\n", "db.engine.execute('DROP TABLE \"{0}\"'.format(VAR_0))\n", "VAR_23.to_sql(VAR_16=table_name, con=db.engine, if_exists='fail', index=False)\n" ]
[ "def normalize_attribute(table_name, attr):...\n", "\"\"\"docstring\"\"\"\n", "df = pd.read_sql_table(table_name, db.engine)\n", "print('NORMALIZATION FAILED')\n", "df[attr] = (df[attr] - df[attr].mean()) / df[attr].std(ddof=0)\n", "db.engine.execute('DROP TABLE \"{0}\"'.format(table_name))\n", "df.to_sql(name=table_name, con=db.engine, if_exists='fail', index=False)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_0 = requests.get('http://127.0.0.1:5000/profiles')\n", "self.assertEqual(VAR_0.status_code, 200)\n", "self.assertIsNotNone(VAR_0.text)\n", "print('/profiles get_user: {}'.format(VAR_0.text))\n", "VAR_1 = json.loads(VAR_0.text)\n", "for user in VAR_1:\n", "VAR_0 = requests.get('http://127.0.0.1:5000/profile/{}'.format(user['id']))\n", "VAR_4 = json.loads(VAR_0.text)\n", "print('/profile/{} get_user: {}'.format(user['id'], VAR_4))\n", "self.assertEqual(VAR_0.status_code, 200)\n", "self.assertIsNotNone(VAR_0.text)\n", "self.assertGreater(VAR_4['id'], 0)\n" ]
[ "def test_b_get_user(self):...\n", "resp = requests.get('http://127.0.0.1:5000/profiles')\n", "self.assertEqual(resp.status_code, 200)\n", "self.assertIsNotNone(resp.text)\n", "print('/profiles get_user: {}'.format(resp.text))\n", "users = json.loads(resp.text)\n", "for user in users:\n", "resp = requests.get('http://127.0.0.1:5000/profile/{}'.format(user['id']))\n", "response = json.loads(resp.text)\n", "print('/profile/{} get_user: {}'.format(user['id'], response))\n", "self.assertEqual(resp.status_code, 200)\n", "self.assertIsNotNone(resp.text)\n", "self.assertGreater(response['id'], 0)\n" ]
[ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "For", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_12(VAR_10, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "for VAR_1 in oauth.remote_apps.values():\n", "FUNC_6(VAR_1)\n" ]
[ "def oauth_logout_handler(sender_app, user=None):...\n", "\"\"\"docstring\"\"\"\n", "for remote in oauth.remote_apps.values():\n", "token_delete(remote)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "For", "Expr'" ]
[ "import os\n", "import pickle\n", "from bs4 import BeautifulSoup\n", "import urllib3\n", "import certifi\n", "import re\n", "import sys\n", "import argparse as ap\n", "VAR_0 = lambda l: [item for sublist in l for item in sublist]\n", "def FUNC_0(VAR_1):...\n", "VAR_2 = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()\n )\n", "VAR_3 = VAR_2.request('GET', VAR_1)\n", "VAR_4 = BeautifulSoup(VAR_3.data, 'lxml')\n", "VAR_5 = [a.get('href') for a in VAR_4('a') if a.get('href')]\n", "VAR_6 = [VAR_22 for VAR_22 in VAR_5 if re.match('^https://youtu\\\\.be', VAR_22)]\n", "VAR_7 = [VAR_22 for VAR_22 in VAR_5 if re.match(\n '^https://www\\\\.youtube\\\\.com/watch', VAR_22)]\n", "for lk in VAR_7:\n", "VAR_21 = re.search('v=([^&?]*)', lk)[1]\n", "return VAR_6, VAR_5\n", "if VAR_21 is None:\n", "print('Reddytt: skipping URL without video label:', lk)\n", "VAR_6.append('https://www.youtube.com/watch?v=' + VAR_21)\n" ]
[ "import os\n", "import pickle\n", "from bs4 import BeautifulSoup\n", "import urllib3\n", "import certifi\n", "import re\n", "import sys\n", "import argparse as ap\n", "flatten = lambda l: [item for sublist in l for item in sublist]\n", "def getytlinks(link):...\n", "pm = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())\n", "html_page = pm.request('GET', link)\n", "soup = BeautifulSoup(html_page.data, 'lxml')\n", "links = [a.get('href') for a in soup('a') if a.get('href')]\n", "new_links = [x for x in links if re.match('^https://youtu\\\\.be', x)]\n", "newer_links = [x for x in links if re.match(\n '^https://www\\\\.youtube\\\\.com/watch', x)]\n", "for lk in newer_links:\n", "videolabel = re.search('v=([^&?]*)', lk)[1]\n", "return new_links, links\n", "if videolabel is None:\n", "print('Reddytt: skipping URL without video label:', lk)\n", "new_links.append('https://www.youtube.com/watch?v=' + videolabel)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_2(VAR_6, VAR_7, *VAR_8, **VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "import rasterio\n", "VAR_31 = rasterio.open(VAR_6).read(1)\n", "VAR_32 = rasterio.open(VAR_7).read(1)\n", "return VAR_32 - VAR_31\n" ]
[ "def diff(x, y, *args, **kwargs):...\n", "\"\"\"docstring\"\"\"\n", "import rasterio\n", "baseline = rasterio.open(x).read(1)\n", "modeled = rasterio.open(y).read(1)\n", "return modeled - baseline\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Import'", "Assign'", "Assign'", "Return'" ]
[ "import os\n", "def __init__(self, VAR_1):...\n", "self.debug = VAR_1.debug\n", "self.path = VAR_1.path\n", "self.repos = VAR_1.repos\n", "def FUNC_1(self, VAR_2):...\n", "def FUNC_0(VAR_0):...\n", "VAR_3 = VAR_0.add_argument_group('Common parameters')\n", "VAR_3.add_argument('--debug', action='store_true', default=False, help=\n 'Show debug messages')\n", "VAR_3.add_argument('--repos', action='store_true', default=False, help=\n 'List repositories which the command operates on')\n", "VAR_3.add_argument('path', nargs='?', default=os.curdir, help=\n 'Base path to look for repositories')\n" ]
[ "import os\n", "def __init__(self, args):...\n", "self.debug = args.debug\n", "self.path = args.path\n", "self.repos = args.repos\n", "def get_command_line(self, client):...\n", "def add_common_arguments(parser):...\n", "group = parser.add_argument_group('Common parameters')\n", "group.add_argument('--debug', action='store_true', default=False, help=\n 'Show debug messages')\n", "group.add_argument('--repos', action='store_true', default=False, help=\n 'List repositories which the command operates on')\n", "group.add_argument('path', nargs='?', default=os.curdir, help=\n 'Base path to look for repositories')\n" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 ]
[ "Import'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@VAR_0.route('/users')...\n", "VAR_2 = connectToMySQL('users_db')\n", "VAR_3 = VAR_2.query_db('SELECT * FROM users;')\n", "return render_template('index.html', VAR_3=users)\n" ]
[ "@app.route('/users')...\n", "mysql = connectToMySQL('users_db')\n", "users = mysql.query_db('SELECT * FROM users;')\n", "return render_template('index.html', users=users)\n" ]
[ 0, 4, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Return'" ]
[ "import json\n", "import unittest\n", "import webtest\n", "from datamodel import Library, Version, Content\n", "from manage import app\n", "import util\n", "from google.appengine.ext import ndb\n", "from test_base import TestBase\n", "def FUNC_0(self):...\n", "TestBase.setUp(self)\n", "self.app = webtest.TestApp(app)\n", "def FUNC_1(self):...\n", "VAR_0 = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "VAR_0.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo', {'status': 304}\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n {'status': 304})\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n {'status': 304})\n", "self.app.get('/task/update/org/repo')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 0)\n", "def FUNC_2(self):...\n", "VAR_0 = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "VAR_0.put()\n", "VAR_2 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "VAR_2.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo', {'status': 404}\n )\n", "self.app.get('/task/update/org/repo')\n", "VAR_2 = Version.get_by_id('v1.0.0', parent=library.key)\n", "VAR_0 = Library.get_by_id('org/repo')\n", "self.assertIsNone(VAR_0)\n", "self.assertIsNone(VAR_2)\n", "def FUNC_3(self):...\n", "VAR_3 = self.app.get('/manage/add/element/org/repo')\n", "self.assertEqual(VAR_3.status_int, 200)\n", "self.assertEqual(VAR_3.normal_body, 'OK')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].url, util.ingest_library_task('org', 'repo',\n 'element'))\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n '[{\"ref\": \"refs/tags/v1.0.0\", \"object\": {\"sha\": \"lol\"}}]')\n", "VAR_3 = self.app.get(util.ingest_library_task('org', 'repo', 'element'))\n", "self.assertEqual(VAR_3.status_int, 200)\n", "VAR_0 = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(VAR_0)\n", "self.assertIsNone(VAR_0.error)\n", "self.assertEqual(VAR_0.kind, 'element')\n", "self.assertEqual(VAR_0.metadata, 'metadata bits')\n", "self.assertEqual(VAR_0.contributors, '[\"a\"]')\n", "self.assertEqual(VAR_0.contributor_count, 1)\n", "VAR_2 = ndb.Key(Library, 'org/repo', Version, 'v1.0.0').get()\n", "self.assertIsNone(VAR_2.error)\n", "self.assertEqual(VAR_2.sha, 'lol')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 2)\n", "self.assertEqual(VAR_1[1].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n", "def FUNC_4(self):...\n", "VAR_0 = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "VAR_2 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "VAR_0.put()\n", "VAR_2.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.0/README.md',\n 'README')\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.0/bower.json',\n '{}')\n", "self.respond_to_github('https://api.github.com/markdown', '<html>README</html>'\n )\n", "VAR_3 = self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.0'))\n", "self.assertEqual(VAR_3.status_int, 200)\n", "VAR_2 = VAR_2.key.get()\n", "self.assertIsNone(VAR_2.error)\n", "VAR_4 = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content, 'readme').get(\n )\n", "self.assertEqual(VAR_4.content, 'README')\n", "VAR_5 = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content, 'readme.html'\n ).get()\n", "self.assertEqual(VAR_5.content, '<html>README</html>')\n", "VAR_6 = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content, 'bower').get()\n", "self.assertEqual(VAR_6.content, '{}')\n", "def FUNC_5(self):...\n", "VAR_0 = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "VAR_0.tags = json.dumps(['v1.0.0', 'v1.0.1'])\n", "VAR_0.put()\n", "VAR_7 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "VAR_7.put()\n", "VAR_8 = Version(parent=library.key, id='v1.0.1', sha='lol')\n", "VAR_8.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.1/README.md',\n chr(248))\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 0)\n", "self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.1'), params={\n 'latestVersion': 'True'})\n", "VAR_8 = VAR_8.key.get()\n", "self.assertEqual(VAR_8.error, 'Could not store README.md as a utf-8 string')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n", "def FUNC_6(self):...\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.app.get(util.ingest_commit_task('org', 'repo'), params={'commit':\n 'commit-sha', 'url': 'url'})\n", "VAR_0 = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(VAR_0)\n", "self.assertIsNone(VAR_0.error)\n", "self.assertFalse(VAR_0.ingest_versions)\n", "VAR_2 = Version.get_by_id(parent=library.key, id='commit-sha')\n", "self.assertEqual(VAR_2.sha, 'commit-sha')\n", "self.assertEqual(VAR_2.url, 'url')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].url, util.ingest_version_task('org', 'repo',\n 'commit-sha'))\n", "if __name__ == '__main__':\n", "unittest.main()\n" ]
[ "import json\n", "import unittest\n", "import webtest\n", "from datamodel import Library, Version, Content\n", "from manage import app\n", "import util\n", "from google.appengine.ext import ndb\n", "from test_base import TestBase\n", "def setUp(self):...\n", "TestBase.setUp(self)\n", "self.app = webtest.TestApp(app)\n", "def test_update_respects_304(self):...\n", "library = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "library.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo', {'status': 304}\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n {'status': 304})\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n {'status': 304})\n", "self.app.get('/task/update/org/repo')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 0)\n", "def test_update_deletes(self):...\n", "library = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "library.put()\n", "version = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "version.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo', {'status': 404}\n )\n", "self.app.get('/task/update/org/repo')\n", "version = Version.get_by_id('v1.0.0', parent=library.key)\n", "library = Library.get_by_id('org/repo')\n", "self.assertIsNone(library)\n", "self.assertIsNone(version)\n", "def test_add_element(self):...\n", "response = self.app.get('/manage/add/element/org/repo')\n", "self.assertEqual(response.status_int, 200)\n", "self.assertEqual(response.normal_body, 'OK')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 1)\n", "self.assertEqual(tasks[0].url, util.ingest_library_task('org', 'repo',\n 'element'))\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n '[{\"ref\": \"refs/tags/v1.0.0\", \"object\": {\"sha\": \"lol\"}}]')\n", "response = self.app.get(util.ingest_library_task('org', 'repo', 'element'))\n", "self.assertEqual(response.status_int, 200)\n", "library = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(library)\n", "self.assertIsNone(library.error)\n", "self.assertEqual(library.kind, 'element')\n", "self.assertEqual(library.metadata, 'metadata bits')\n", "self.assertEqual(library.contributors, '[\"a\"]')\n", "self.assertEqual(library.contributor_count, 1)\n", "version = ndb.Key(Library, 'org/repo', Version, 'v1.0.0').get()\n", "self.assertIsNone(version.error)\n", "self.assertEqual(version.sha, 'lol')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 2)\n", "self.assertEqual(tasks[1].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n", "def test_ingest_version(self):...\n", "library = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "version = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "library.put()\n", "version.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.0/README.md',\n 'README')\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.0/bower.json',\n '{}')\n", "self.respond_to_github('https://api.github.com/markdown', '<html>README</html>'\n )\n", "response = self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.0'))\n", "self.assertEqual(response.status_int, 200)\n", "version = version.key.get()\n", "self.assertIsNone(version.error)\n", "readme = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content, 'readme'\n ).get()\n", "self.assertEqual(readme.content, 'README')\n", "readme_html = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content,\n 'readme.html').get()\n", "self.assertEqual(readme_html.content, '<html>README</html>')\n", "bower = ndb.Key(Library, 'org/repo', Version, 'v1.0.0', Content, 'bower').get()\n", "self.assertEqual(bower.content, '{}')\n", "def test_ingest_version_falls_back(self):...\n", "library = Library(id='org/repo', metadata=\n '{\"full_name\": \"NSS Bob\", \"stargazers_count\": 420, \"subscribers_count\": 419, \"forks\": 418, \"updated_at\": \"2011-8-10T13:47:12Z\"}'\n , contributor_count=417)\n", "library.tags = json.dumps(['v1.0.0', 'v1.0.1'])\n", "library.put()\n", "version1 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "version1.put()\n", "version2 = Version(parent=library.key, id='v1.0.1', sha='lol')\n", "version2.put()\n", "self.respond_to('https://raw.githubusercontent.com/org/repo/v1.0.1/README.md',\n chr(248))\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 0)\n", "self.app.get(util.ingest_version_task('org', 'repo', 'v1.0.1'), params={\n 'latestVersion': 'True'})\n", "version2 = version2.key.get()\n", "self.assertEqual(version2.error, 'Could not store README.md as a utf-8 string')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 1)\n", "self.assertEqual(tasks[0].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n", "def test_ingest_commit(self):...\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.app.get(util.ingest_commit_task('org', 'repo'), params={'commit':\n 'commit-sha', 'url': 'url'})\n", "library = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(library)\n", "self.assertIsNone(library.error)\n", "self.assertFalse(library.ingest_versions)\n", "version = Version.get_by_id(parent=library.key, id='commit-sha')\n", "self.assertEqual(version.sha, 'commit-sha')\n", "self.assertEqual(version.url, 'url')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 1)\n", "self.assertEqual(tasks[0].url, util.ingest_version_task('org', 'repo',\n 'commit-sha'))\n", "if __name__ == '__main__':\n", "unittest.main()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "FunctionDef'", "Expr'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_16):...\n", "self._WriteHeader('text/html')\n", "self._WriteTemplate('header.html')\n", "self.wfile.write('<table class=\"FileContents\">')\n", "VAR_31 = fp.read().replace('&', '&amp;').replace('<', '&lt;').replace('>',\n '&gt;').replace('\"', '&quot;')\n", "for i, line in enumerate(VAR_31.splitlines(), start=1):\n", "self.wfile.write('string' % {'num': i, 'quot': \"'\", 'line': line})\n", "self.wfile.write('</table>')\n", "self._WriteTemplate('footer.html')\n" ]
[ "def _DoRawSourceFile(self, full_path):...\n", "self._WriteHeader('text/html')\n", "self._WriteTemplate('header.html')\n", "self.wfile.write('<table class=\"FileContents\">')\n", "data = fp.read().replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;'\n ).replace('\"', '&quot;')\n", "for i, line in enumerate(data.splitlines(), start=1):\n", "self.wfile.write(\n '<tr class=\"u-pre u-monospace FileContents-line\"><td class=\"u-lineNum u-noSelect FileContents-lineNum\"><a name=\"%(num)s\" onclick=\"window.location.hash=%(quot)s#%(num)s%(quot)s\">%(num)s</a></td><td class=\"FileContents-lineContents\">%(line)s</td></tr>'\n % {'num': i, 'quot': \"'\", 'line': line})\n", "self.wfile.write('</table>')\n", "self._WriteTemplate('footer.html')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Assign'", "For", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.handled_resp = 1\n", "self.handled_remote = 1\n", "self.handled_args = 1\n", "self.handled_kwargs = 1\n" ]
[ "def handler_invalid(self):...\n", "self.handled_resp = 1\n", "self.handled_remote = 1\n", "self.handled_args = 1\n", "self.handled_kwargs = 1\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = 'http://www.football-data.co.uk'\n", "VAR_14 = ['Date', 'Div', 'HomeTeam', 'AwayTeam']\n", "VAR_15 = ['BbAvH', 'BbAvA', 'BbAvD', 'BbAv>2.5', 'BbAv<2.5', 'BbAHh',\n 'BbAvAHH', 'BbAvAHA']\n", "VAR_16 = ['PSH', 'PSA', 'PSD', 'BbMx>2.5', 'BbMx<2.5', 'BbAHh', 'BbMxAHH',\n 'BbMxAHA']\n", "VAR_17 = ['1617', '1718', '1819']\n", "VAR_4 = FUNC_1(VAR_4)\n", "VAR_18 = []\n", "for league_id, season in product(VAR_4, VAR_17):\n", "VAR_37 = pd.read_csv(join(VAR_13, 'mmz4281', season, league_id), usecols=\n cols + features_cols + odds_cols)\n", "VAR_18 = pd.concat(VAR_18, ignore_index=True)\n", "VAR_37['Date'] = pd.to_datetime(VAR_37['Date'], dayfirst=True)\n", "VAR_19 = pd.read_csv(join(VAR_13, 'fixtures.csv'), usecols=cols +\n features_cols + odds_cols)\n", "VAR_37['season'] = season\n", "VAR_19['Date'] = pd.to_datetime(VAR_19['Date'], dayfirst=True)\n", "VAR_18.append(VAR_37)\n", "VAR_19 = VAR_19[VAR_19['Div'].isin(VAR_4)]\n", "for VAR_48, VAR_50 in zip(['fd_historical', 'fd_fixtures'], [VAR_18, VAR_19]):\n", "VAR_50.to_sql(VAR_48, VAR_0, index=False, if_exists='replace')\n" ]
[ "def create_fd_tables(leagues_ids):...\n", "\"\"\"docstring\"\"\"\n", "base_url = 'http://www.football-data.co.uk'\n", "cols = ['Date', 'Div', 'HomeTeam', 'AwayTeam']\n", "features_cols = ['BbAvH', 'BbAvA', 'BbAvD', 'BbAv>2.5', 'BbAv<2.5', 'BbAHh',\n 'BbAvAHH', 'BbAvAHA']\n", "odds_cols = ['PSH', 'PSA', 'PSD', 'BbMx>2.5', 'BbMx<2.5', 'BbAHh',\n 'BbMxAHH', 'BbMxAHA']\n", "seasons = ['1617', '1718', '1819']\n", "leagues_ids = check_leagues_ids(leagues_ids)\n", "fd_historical = []\n", "for league_id, season in product(leagues_ids, seasons):\n", "data = pd.read_csv(join(base_url, 'mmz4281', season, league_id), usecols=\n cols + features_cols + odds_cols)\n", "fd_historical = pd.concat(fd_historical, ignore_index=True)\n", "data['Date'] = pd.to_datetime(data['Date'], dayfirst=True)\n", "fd_fixtures = pd.read_csv(join(base_url, 'fixtures.csv'), usecols=cols +\n features_cols + odds_cols)\n", "data['season'] = season\n", "fd_fixtures['Date'] = pd.to_datetime(fd_fixtures['Date'], dayfirst=True)\n", "fd_historical.append(data)\n", "fd_fixtures = fd_fixtures[fd_fixtures['Div'].isin(leagues_ids)]\n", "for name, df in zip(['fd_historical', 'fd_fixtures'], [fd_historical,\n", "df.to_sql(name, DB_CONNECTION, index=False, if_exists='replace')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "For", "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_3(self):...\n", "return self.rawchem.all()\n" ]
[ "def fetch_extracted_records(self):...\n", "return self.rawchem.all()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = 0.1\n", "VAR_23 = self.metrics['time_coeff'] * random.expovariate(self.metrics[\n 'time_lambda'])\n", "VAR_24 = int(VAR_23 / VAR_22)\n", "VAR_25 = VAR_23 - VAR_24 * VAR_22\n", "for i in xrange(VAR_24):\n", "time.sleep(VAR_22)\n", "time.sleep(VAR_25)\n", "if self.die:\n", "if self.die:\n" ]
[ "def wait_next(self):...\n", "\"\"\"docstring\"\"\"\n", "SLEEP_PERIOD = 0.1\n", "time_to_wait = self.metrics['time_coeff'] * random.expovariate(self.metrics\n ['time_lambda'])\n", "sleep_num = int(time_to_wait / SLEEP_PERIOD)\n", "remaining_sleep = time_to_wait - sleep_num * SLEEP_PERIOD\n", "for i in xrange(sleep_num):\n", "time.sleep(SLEEP_PERIOD)\n", "time.sleep(remaining_sleep)\n", "if self.die:\n", "if self.die:\n" ]
[ 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Expr'", "Condition", "Condition" ]
[ "def FUNC_2(self):...\n", "self.delete_session_cookie()\n", "self.redirect('/')\n" ]
[ "def get(self):...\n", "self.delete_session_cookie()\n", "self.redirect('/')\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_9():...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = FUNC_8('tasks')\n", "VAR_36 = re.findall('string', VAR_35.text, re.X)\n", "VAR_37 = {}\n", "for VAR_46 in VAR_36:\n", "VAR_57, VAR_58, VAR_59 = VAR_46\n", "return VAR_37\n", "VAR_57 = int(VAR_57)\n", "VAR_37[VAR_58] = {'title': VAR_59, 'id': VAR_57}\n" ]
[ "def get_tasks():...\n", "\"\"\"docstring\"\"\"\n", "r = admin_req('tasks')\n", "groups = re.findall(\n \"\"\"\n <tr>\\\\s*\n <td><a\\\\s+href=\"./task/(\\\\d+)\">(.*)</a></td>\\\\s*\n <td>(.*)</td>\\\\s*\n \"\"\"\n , r.text, re.X)\n", "tasks = {}\n", "for g in groups:\n", "id, name, title = g\n", "return tasks\n", "id = int(id)\n", "tasks[name] = {'title': title, 'id': id}\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_1(self, VAR_2):...\n", "self.read_xsrf_token(VAR_2.base_url)\n", "VAR_2.execute()\n" ]
[ "def login(self, login_request):...\n", "self.read_xsrf_token(login_request.base_url)\n", "login_request.execute()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_6(self):...\n", "if is_banned_IP(VAR_102.ip):\n", "VAR_101.errors.add(errors.BANNED_IP)\n", "return VAR_102.ip\n" ]
[ "def run(self):...\n", "if is_banned_IP(request.ip):\n", "c.errors.add(errors.BANNED_IP)\n", "return request.ip\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Return'" ]
[ "@FUNC_7...\n", "\"\"\"docstring\"\"\"\n", "VAR_16.pop(VAR_17(VAR_1.name) + '_autoregister', None)\n", "VAR_5 = FUNC_1(VAR_1, VAR_2)\n", "VAR_19 = signup_handlers[VAR_1.name]\n", "if not current_user.is_authenticated():\n", "VAR_27 = VAR_19['info'](VAR_2)\n", "if not VAR_5.remote_account.extra_data and VAR_1.name in signup_handlers:\n", "VAR_11 = oauth_get_user(VAR_1.consumer_key, VAR_27=account_info,\n access_token=token_getter(remote)[0])\n", "VAR_19['setup'](VAR_5)\n", "if request.args.get('next', None):\n", "if VAR_11 is None:\n", "return redirect(request.args.get('next'))\n", "return redirect('/')\n", "VAR_11 = oauth_register(VAR_27)\n", "if not oauth_authenticate(VAR_1.consumer_key, VAR_11, require_existing_link\n", "if VAR_11 is None:\n", "return current_app.login_manager.unauthorized()\n", "VAR_5 = FUNC_1(VAR_1, VAR_2)\n", "VAR_16[VAR_17(VAR_1.name) + '_autoregister'] = True\n", "VAR_16[VAR_17(VAR_1.name) + '_account_info'] = VAR_27\n", "return redirect(url_for('.signup', VAR_0=remote.name, next=request.args.get\n ('next', '/')))\n" ]
[ "@oauth_error_handler...\n", "\"\"\"docstring\"\"\"\n", "session.pop(token_session_key(remote.name) + '_autoregister', None)\n", "token = response_token_setter(remote, resp)\n", "handlers = signup_handlers[remote.name]\n", "if not current_user.is_authenticated():\n", "account_info = handlers['info'](resp)\n", "if not token.remote_account.extra_data and remote.name in signup_handlers:\n", "user = oauth_get_user(remote.consumer_key, account_info=account_info,\n access_token=token_getter(remote)[0])\n", "handlers['setup'](token)\n", "if request.args.get('next', None):\n", "if user is None:\n", "return redirect(request.args.get('next'))\n", "return redirect('/')\n", "user = oauth_register(account_info)\n", "if not oauth_authenticate(remote.consumer_key, user, require_existing_link=\n", "if user is None:\n", "return current_app.login_manager.unauthorized()\n", "token = response_token_setter(remote, resp)\n", "session[token_session_key(remote.name) + '_autoregister'] = True\n", "session[token_session_key(remote.name) + '_account_info'] = account_info\n", "return redirect(url_for('.signup', remote_app=remote.name, next=request.\n args.get('next', '/')))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Condition", "Return'", "Return'", "Assign'", "Condition", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_2(self, VAR_8):...\n", "\"\"\"docstring\"\"\"\n", "VAR_5 = {}\n", "VAR_5['clusterName'] = VAR_8\n", "VAR_5['searchDepth'] = '1'\n", "VAR_5['verbose'] = '0'\n", "VAR_18 = self._cliq_run_xml('getClusterInfo', VAR_5)\n", "return VAR_18\n" ]
[ "def _cliq_get_cluster_info(self, cluster_name):...\n", "\"\"\"docstring\"\"\"\n", "cliq_args = {}\n", "cliq_args['clusterName'] = cluster_name\n", "cliq_args['searchDepth'] = '1'\n", "cliq_args['verbose'] = '0'\n", "result_xml = self._cliq_run_xml('getClusterInfo', cliq_args)\n", "return result_xml\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_1(VAR_2, VAR_0, VAR_1):...\n", "VAR_5 = FUNC_0(VAR_0, VAR_1)\n", "VAR_6 = open(VAR_2, 'w')\n", "VAR_6.write(VAR_5)\n", "VAR_6.close()\n" ]
[ "def write_eb_config(dest, application_name, default_region):...\n", "contents = make_eb_config(application_name, default_region)\n", "fh = open(dest, 'w')\n", "fh.write(contents)\n", "fh.close()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_1(self, VAR_6, VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = ray.gcs_utils.GcsTableEntry.GetRootAsGcsTableEntry(VAR_7, 0)\n", "VAR_15 = VAR_14.Entries(0)\n", "VAR_16 = (ray.gcs_utils.HeartbeatBatchTableData.\n GetRootAsHeartbeatBatchTableData(VAR_15, 0))\n", "for j in range(VAR_16.BatchLength()):\n", "VAR_32 = VAR_16.Batch(j)\n", "VAR_33 = VAR_32.ResourcesAvailableLabelLength()\n", "VAR_34 = {}\n", "VAR_35 = {}\n", "for i in range(VAR_33):\n", "VAR_48 = VAR_32.ResourcesAvailableLabel(i)\n", "VAR_36 = ray.utils.binary_to_hex(VAR_32.ClientId())\n", "VAR_49 = VAR_32.ResourcesTotalLabel(i)\n", "VAR_37 = self.local_scheduler_id_to_ip_map.get(VAR_36)\n", "VAR_35[VAR_48] = VAR_32.ResourcesAvailableCapacity(i)\n", "if VAR_37:\n", "VAR_34[VAR_49] = VAR_32.ResourcesTotalCapacity(i)\n", "self.load_metrics.update(VAR_37, VAR_34, VAR_35)\n", "VAR_0.warning('Monitor: could not find ip for client {}'.format(VAR_36))\n" ]
[ "def xray_heartbeat_batch_handler(self, unused_channel, data):...\n", "\"\"\"docstring\"\"\"\n", "gcs_entries = ray.gcs_utils.GcsTableEntry.GetRootAsGcsTableEntry(data, 0)\n", "heartbeat_data = gcs_entries.Entries(0)\n", "message = (ray.gcs_utils.HeartbeatBatchTableData.\n GetRootAsHeartbeatBatchTableData(heartbeat_data, 0))\n", "for j in range(message.BatchLength()):\n", "heartbeat_message = message.Batch(j)\n", "num_resources = heartbeat_message.ResourcesAvailableLabelLength()\n", "static_resources = {}\n", "dynamic_resources = {}\n", "for i in range(num_resources):\n", "dyn = heartbeat_message.ResourcesAvailableLabel(i)\n", "client_id = ray.utils.binary_to_hex(heartbeat_message.ClientId())\n", "static = heartbeat_message.ResourcesTotalLabel(i)\n", "ip = self.local_scheduler_id_to_ip_map.get(client_id)\n", "dynamic_resources[dyn] = heartbeat_message.ResourcesAvailableCapacity(i)\n", "if ip:\n", "static_resources[static] = heartbeat_message.ResourcesTotalCapacity(i)\n", "self.load_metrics.update(ip, static_resources, dynamic_resources)\n", "logger.warning('Monitor: could not find ip for client {}'.format(client_id))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_2(self, **VAR_5):...\n", "VAR_10 = super().get_context_data(**kwargs)\n", "VAR_11 = SearchForm(self.request.GET)\n", "VAR_10['search_form'] = VAR_11\n", "VAR_12 = self.object_list.count()\n", "VAR_10['count'] = VAR_12\n", "VAR_10['30_day_labels'] = self.thirty_day_labels()\n", "VAR_10['30_day_data'] = self.thirty_day_data()\n", "return VAR_10\n" ]
[ "def get_context_data(self, **kwargs):...\n", "context = super().get_context_data(**kwargs)\n", "search_form = SearchForm(self.request.GET)\n", "context['search_form'] = search_form\n", "count = self.object_list.count()\n", "context['count'] = count\n", "context['30_day_labels'] = self.thirty_day_labels()\n", "context['30_day_data'] = self.thirty_day_data()\n", "return context\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@jwt_required...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = f'update users set user_id = %s '\n", "VAR_2 += f\"where user_id = '{VAR_1}'\"\n", "VAR_3 = request.get_json()\n", "VAR_4 = VAR_3['user_id'],\n", "database_utilities.execute_query(VAR_2, VAR_4)\n" ]
[ "@jwt_required...\n", "\"\"\"docstring\"\"\"\n", "query = f'update users set user_id = %s '\n", "query += f\"where user_id = '{user_id}'\"\n", "json_data = request.get_json()\n", "parameters = json_data['user_id'],\n", "database_utilities.execute_query(query, parameters)\n" ]
[ 0, 0, 0, 4, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "AugAssign'", "Assign'", "Assign'", "Expr'" ]
[ "def __bool__(self):...\n", "return bool(self.updated_input or self.missing_output or self.forced or\n self.updated_input_run or self.noio or self.nooutput)\n" ]
[ "def __bool__(self):...\n", "return bool(self.updated_input or self.missing_output or self.forced or\n self.updated_input_run or self.noio or self.nooutput)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@functools.wraps(VAR_7)...\n", "assert isinstance(self, webapp2.RequestHandler)\n", "assert self.request.method == 'GET'\n", "if model.is_replica():\n", "VAR_40 = model.get_replication_state().primary_url\n", "return VAR_7(self, *VAR_9, **kwargs)\n", "VAR_41 = 'http://' if utils.is_local_dev_server() else 'https://'\n", "assert VAR_40 and VAR_40.startswith(VAR_41), VAR_40\n", "assert self.request.path_qs.startswith('/'), self.request.path_qs\n", "self.redirect(VAR_40.rstrip('/') + self.request.path_qs, abort=True)\n" ]
[ "@functools.wraps(method)...\n", "assert isinstance(self, webapp2.RequestHandler)\n", "assert self.request.method == 'GET'\n", "if model.is_replica():\n", "primary_url = model.get_replication_state().primary_url\n", "return method(self, *args, **kwargs)\n", "protocol = 'http://' if utils.is_local_dev_server() else 'https://'\n", "assert primary_url and primary_url.startswith(protocol), primary_url\n", "assert self.request.path_qs.startswith('/'), self.request.path_qs\n", "self.redirect(primary_url.rstrip('/') + self.request.path_qs, abort=True)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assert'", "Assert'", "Condition", "Assign'", "Return'", "Assign'", "Assert'", "Assert'", "Expr'" ]
[ "def FUNC_3(self):...\n", "VAR_5 = {'title': 'Admin: Chrome Infra Monitoring Proxy'}\n", "self.render_response('admin.html', **context)\n" ]
[ "def get(self):...\n", "context = {'title': 'Admin: Chrome Infra Monitoring Proxy'}\n", "self.render_response('admin.html', **context)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "return VAR_10 in self._rules\n" ]
[ "def is_rule(self, name):...\n", "\"\"\"docstring\"\"\"\n", "return name in self._rules\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_16(self):...\n", "VAR_14 = ['8.9.10.11', '9.10.11.12', '10.11.12.13']\n", "VAR_15 = self.new_mocked_cluster(VAR_14, FUNC_1)\n", "self.assertEqual(3, len(VAR_15.endpoints))\n", "self.assertRaises(nsxlib_exc.ServiceClusterUnavailable, VAR_15.get,\n 'api/v1/transport-zones')\n" ]
[ "def test_cluster_validate_with_exception(self):...\n", "conf_managers = ['8.9.10.11', '9.10.11.12', '10.11.12.13']\n", "api = self.new_mocked_cluster(conf_managers, _validate_conn_down)\n", "self.assertEqual(3, len(api.endpoints))\n", "self.assertRaises(nsxlib_exc.ServiceClusterUnavailable, api.get,\n 'api/v1/transport-zones')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@staticmethod...\n", "if not isinstance(VAR_1, int):\n", "VAR_9 = {}\n", "VAR_10 = VAR_0.view_task(VAR_1, details=True)\n", "if VAR_10:\n", "VAR_19 = VAR_10.to_dict()\n", "return Exception('Task not found')\n", "VAR_19['guest'] = {}\n", "if VAR_10.guest:\n", "VAR_19['guest'] = VAR_10.guest.to_dict()\n", "VAR_19['errors'] = []\n", "for error in VAR_10.errors:\n", "VAR_19['errors'].append(error.message)\n", "VAR_19['sample'] = {}\n", "if VAR_10.sample_id:\n", "VAR_26 = VAR_0.view_sample(VAR_10.sample_id)\n", "VAR_9['task'] = VAR_19\n", "VAR_19['sample'] = VAR_26.to_dict()\n", "return VAR_9\n" ]
[ "@staticmethod...\n", "if not isinstance(task_id, int):\n", "data = {}\n", "task = db.view_task(task_id, details=True)\n", "if task:\n", "entry = task.to_dict()\n", "return Exception('Task not found')\n", "entry['guest'] = {}\n", "if task.guest:\n", "entry['guest'] = task.guest.to_dict()\n", "entry['errors'] = []\n", "for error in task.errors:\n", "entry['errors'].append(error.message)\n", "entry['sample'] = {}\n", "if task.sample_id:\n", "sample = db.view_sample(task.sample_id)\n", "data['task'] = entry\n", "entry['sample'] = sample.to_dict()\n", "return data\n" ]
[ 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@classmethod...\n", "return ()\n" ]
[ "@classmethod...\n", "return ()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "\"\"\"string\"\"\"\n", "import hashlib\n", "import json\n", "import logging\n", "import os\n", "import StringIO\n", "import zipfile\n", "VAR_0 = ('__main__.py', 'api/__init__.py', 'api/bot.py', 'api/parallel.py',\n 'api/os_utilities.py', 'api/platforms/__init__.py',\n 'api/platforms/android.py', 'api/platforms/common.py',\n 'api/platforms/gce.py', 'api/platforms/linux.py',\n 'api/platforms/osx.py', 'api/platforms/posix.py',\n 'api/platforms/win.py', 'bot_code/__init__.py', 'bot_code/bot_main.py',\n 'bot_code/common.py', 'bot_code/singleton.py',\n 'bot_code/task_runner.py', 'bot_code/xsrf_client.py', 'client/auth.py',\n 'client/isolated_format.py', 'client/isolateserver.py',\n 'client/run_isolated.py', 'config/__init__.py',\n 'third_party/__init__.py', 'third_party/colorama/__init__.py',\n 'third_party/colorama/ansi.py', 'third_party/colorama/ansitowin32.py',\n 'third_party/colorama/initialise.py', 'third_party/colorama/win32.py',\n 'third_party/colorama/winterm.py',\n 'third_party/depot_tools/__init__.py',\n 'third_party/depot_tools/fix_encoding.py',\n 'third_party/depot_tools/subcommand.py',\n 'third_party/httplib2/__init__.py', 'third_party/httplib2/cacerts.txt',\n 'third_party/httplib2/iri2uri.py', 'third_party/httplib2/socks.py',\n 'third_party/oauth2client/__init__.py',\n 'third_party/oauth2client/_helpers.py',\n 'third_party/oauth2client/_openssl_crypt.py',\n 'third_party/oauth2client/_pycrypto_crypt.py',\n 'third_party/oauth2client/client.py',\n 'third_party/oauth2client/clientsecrets.py',\n 'third_party/oauth2client/crypt.py', 'third_party/oauth2client/file.py',\n 'third_party/oauth2client/gce.py',\n 'third_party/oauth2client/keyring_storage.py',\n 'third_party/oauth2client/locked_file.py',\n 'third_party/oauth2client/multistore_file.py',\n 'third_party/oauth2client/service_account.py',\n 'third_party/oauth2client/tools.py', 'third_party/oauth2client/util.py',\n 'third_party/oauth2client/xsrfutil.py',\n 'third_party/pyasn1/pyasn1/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/ber/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/ber/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/ber/encoder.py',\n 'third_party/pyasn1/pyasn1/codec/ber/eoo.py',\n 'third_party/pyasn1/pyasn1/codec/cer/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/cer/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/cer/encoder.py',\n 'third_party/pyasn1/pyasn1/codec/der/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/der/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/der/encoder.py',\n 'third_party/pyasn1/pyasn1/compat/__init__.py',\n 'third_party/pyasn1/pyasn1/compat/binary.py',\n 'third_party/pyasn1/pyasn1/compat/octets.py',\n 'third_party/pyasn1/pyasn1/debug.py',\n 'third_party/pyasn1/pyasn1/error.py',\n 'third_party/pyasn1/pyasn1/type/__init__.py',\n 'third_party/pyasn1/pyasn1/type/base.py',\n 'third_party/pyasn1/pyasn1/type/char.py',\n 'third_party/pyasn1/pyasn1/type/constraint.py',\n 'third_party/pyasn1/pyasn1/type/error.py',\n 'third_party/pyasn1/pyasn1/type/namedtype.py',\n 'third_party/pyasn1/pyasn1/type/namedval.py',\n 'third_party/pyasn1/pyasn1/type/tag.py',\n 'third_party/pyasn1/pyasn1/type/tagmap.py',\n 'third_party/pyasn1/pyasn1/type/univ.py',\n 'third_party/pyasn1/pyasn1/type/useful.py',\n 'third_party/requests/__init__.py', 'third_party/requests/adapters.py',\n 'third_party/requests/api.py', 'third_party/requests/auth.py',\n 'third_party/requests/certs.py', 'third_party/requests/compat.py',\n 'third_party/requests/cookies.py', 'third_party/requests/exceptions.py',\n 'third_party/requests/hooks.py', 'third_party/requests/models.py',\n 'third_party/requests/packages/__init__.py',\n 'third_party/requests/packages/urllib3/__init__.py',\n 'third_party/requests/packages/urllib3/_collections.py',\n 'third_party/requests/packages/urllib3/connection.py',\n 'third_party/requests/packages/urllib3/connectionpool.py',\n 'third_party/requests/packages/urllib3/contrib/__init__.py',\n 'third_party/requests/packages/urllib3/contrib/ntlmpool.py',\n 'third_party/requests/packages/urllib3/contrib/pyopenssl.py',\n 'third_party/requests/packages/urllib3/exceptions.py',\n 'third_party/requests/packages/urllib3/fields.py',\n 'third_party/requests/packages/urllib3/filepost.py',\n 'third_party/requests/packages/urllib3/packages/__init__.py',\n 'third_party/requests/packages/urllib3/packages/ordered_dict.py',\n 'third_party/requests/packages/urllib3/packages/six.py',\n 'third_party/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py'\n ,\n 'third_party/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py'\n , 'third_party/requests/packages/urllib3/poolmanager.py',\n 'third_party/requests/packages/urllib3/request.py',\n 'third_party/requests/packages/urllib3/response.py',\n 'third_party/requests/packages/urllib3/util/__init__.py',\n 'third_party/requests/packages/urllib3/util/connection.py',\n 'third_party/requests/packages/urllib3/util/request.py',\n 'third_party/requests/packages/urllib3/util/response.py',\n 'third_party/requests/packages/urllib3/util/retry.py',\n 'third_party/requests/packages/urllib3/util/ssl_.py',\n 'third_party/requests/packages/urllib3/util/timeout.py',\n 'third_party/requests/packages/urllib3/util/url.py',\n 'third_party/requests/sessions.py',\n 'third_party/requests/status_codes.py',\n 'third_party/requests/structures.py', 'third_party/requests/utils.py',\n 'third_party/rsa/rsa/__init__.py', 'third_party/rsa/rsa/_compat.py',\n 'third_party/rsa/rsa/_version133.py',\n 'third_party/rsa/rsa/_version200.py', 'third_party/rsa/rsa/asn1.py',\n 'third_party/rsa/rsa/bigfile.py', 'third_party/rsa/rsa/cli.py',\n 'third_party/rsa/rsa/common.py', 'third_party/rsa/rsa/core.py',\n 'third_party/rsa/rsa/key.py', 'third_party/rsa/rsa/parallel.py',\n 'third_party/rsa/rsa/pem.py', 'third_party/rsa/rsa/pkcs1.py',\n 'third_party/rsa/rsa/prime.py', 'third_party/rsa/rsa/randnum.py',\n 'third_party/rsa/rsa/transform.py', 'third_party/rsa/rsa/util.py',\n 'third_party/rsa/rsa/varblock.py', 'third_party/six/__init__.py',\n 'utils/__init__.py', 'utils/cacert.pem', 'utils/file_path.py',\n 'utils/fs.py', 'utils/large.py', 'utils/logging_utils.py',\n 'utils/lru.py', 'utils/net.py', 'utils/oauth.py', 'utils/on_error.py',\n 'utils/subprocess42.py', 'utils/threading_utils.py', 'utils/tools.py',\n 'utils/zip_package.py', 'adb/__init__.py', 'adb/adb_commands.py',\n 'adb/adb_protocol.py', 'adb/common.py', 'adb/contrib/__init__.py',\n 'adb/contrib/adb_commands_safe.py', 'adb/contrib/high.py',\n 'adb/contrib/parallel.py', 'adb/fastboot.py',\n 'adb/filesync_protocol.py', 'adb/sign_pythonrsa.py',\n 'adb/usb_exceptions.py', 'python_libusb1/__init__.py',\n 'python_libusb1/libusb1.py', 'python_libusb1/usb1.py')\n", "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "return os.__file__[0] != '/'\n" ]
[ "\"\"\"Generates the swarming_bot.zip archive for the bot.\n\nUnlike the other source files, this file can be run from ../tools/bot_archive.py\nstand-alone to generate a swarming_bot.zip for local testing so it doesn't\nimport anything from the AppEngine SDK.\n\nThe hash of the content of the files in the archive is used to define the\ncurrent version of the swarming bot code.\n\"\"\"\n", "import hashlib\n", "import json\n", "import logging\n", "import os\n", "import StringIO\n", "import zipfile\n", "FILES = ('__main__.py', 'api/__init__.py', 'api/bot.py', 'api/parallel.py',\n 'api/os_utilities.py', 'api/platforms/__init__.py',\n 'api/platforms/android.py', 'api/platforms/common.py',\n 'api/platforms/gce.py', 'api/platforms/linux.py',\n 'api/platforms/osx.py', 'api/platforms/posix.py',\n 'api/platforms/win.py', 'bot_code/__init__.py', 'bot_code/bot_main.py',\n 'bot_code/common.py', 'bot_code/singleton.py',\n 'bot_code/task_runner.py', 'bot_code/xsrf_client.py', 'client/auth.py',\n 'client/isolated_format.py', 'client/isolateserver.py',\n 'client/run_isolated.py', 'config/__init__.py',\n 'third_party/__init__.py', 'third_party/colorama/__init__.py',\n 'third_party/colorama/ansi.py', 'third_party/colorama/ansitowin32.py',\n 'third_party/colorama/initialise.py', 'third_party/colorama/win32.py',\n 'third_party/colorama/winterm.py',\n 'third_party/depot_tools/__init__.py',\n 'third_party/depot_tools/fix_encoding.py',\n 'third_party/depot_tools/subcommand.py',\n 'third_party/httplib2/__init__.py', 'third_party/httplib2/cacerts.txt',\n 'third_party/httplib2/iri2uri.py', 'third_party/httplib2/socks.py',\n 'third_party/oauth2client/__init__.py',\n 'third_party/oauth2client/_helpers.py',\n 'third_party/oauth2client/_openssl_crypt.py',\n 'third_party/oauth2client/_pycrypto_crypt.py',\n 'third_party/oauth2client/client.py',\n 'third_party/oauth2client/clientsecrets.py',\n 'third_party/oauth2client/crypt.py', 'third_party/oauth2client/file.py',\n 'third_party/oauth2client/gce.py',\n 'third_party/oauth2client/keyring_storage.py',\n 'third_party/oauth2client/locked_file.py',\n 'third_party/oauth2client/multistore_file.py',\n 'third_party/oauth2client/service_account.py',\n 'third_party/oauth2client/tools.py', 'third_party/oauth2client/util.py',\n 'third_party/oauth2client/xsrfutil.py',\n 'third_party/pyasn1/pyasn1/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/ber/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/ber/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/ber/encoder.py',\n 'third_party/pyasn1/pyasn1/codec/ber/eoo.py',\n 'third_party/pyasn1/pyasn1/codec/cer/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/cer/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/cer/encoder.py',\n 'third_party/pyasn1/pyasn1/codec/der/__init__.py',\n 'third_party/pyasn1/pyasn1/codec/der/decoder.py',\n 'third_party/pyasn1/pyasn1/codec/der/encoder.py',\n 'third_party/pyasn1/pyasn1/compat/__init__.py',\n 'third_party/pyasn1/pyasn1/compat/binary.py',\n 'third_party/pyasn1/pyasn1/compat/octets.py',\n 'third_party/pyasn1/pyasn1/debug.py',\n 'third_party/pyasn1/pyasn1/error.py',\n 'third_party/pyasn1/pyasn1/type/__init__.py',\n 'third_party/pyasn1/pyasn1/type/base.py',\n 'third_party/pyasn1/pyasn1/type/char.py',\n 'third_party/pyasn1/pyasn1/type/constraint.py',\n 'third_party/pyasn1/pyasn1/type/error.py',\n 'third_party/pyasn1/pyasn1/type/namedtype.py',\n 'third_party/pyasn1/pyasn1/type/namedval.py',\n 'third_party/pyasn1/pyasn1/type/tag.py',\n 'third_party/pyasn1/pyasn1/type/tagmap.py',\n 'third_party/pyasn1/pyasn1/type/univ.py',\n 'third_party/pyasn1/pyasn1/type/useful.py',\n 'third_party/requests/__init__.py', 'third_party/requests/adapters.py',\n 'third_party/requests/api.py', 'third_party/requests/auth.py',\n 'third_party/requests/certs.py', 'third_party/requests/compat.py',\n 'third_party/requests/cookies.py', 'third_party/requests/exceptions.py',\n 'third_party/requests/hooks.py', 'third_party/requests/models.py',\n 'third_party/requests/packages/__init__.py',\n 'third_party/requests/packages/urllib3/__init__.py',\n 'third_party/requests/packages/urllib3/_collections.py',\n 'third_party/requests/packages/urllib3/connection.py',\n 'third_party/requests/packages/urllib3/connectionpool.py',\n 'third_party/requests/packages/urllib3/contrib/__init__.py',\n 'third_party/requests/packages/urllib3/contrib/ntlmpool.py',\n 'third_party/requests/packages/urllib3/contrib/pyopenssl.py',\n 'third_party/requests/packages/urllib3/exceptions.py',\n 'third_party/requests/packages/urllib3/fields.py',\n 'third_party/requests/packages/urllib3/filepost.py',\n 'third_party/requests/packages/urllib3/packages/__init__.py',\n 'third_party/requests/packages/urllib3/packages/ordered_dict.py',\n 'third_party/requests/packages/urllib3/packages/six.py',\n 'third_party/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py'\n ,\n 'third_party/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py'\n , 'third_party/requests/packages/urllib3/poolmanager.py',\n 'third_party/requests/packages/urllib3/request.py',\n 'third_party/requests/packages/urllib3/response.py',\n 'third_party/requests/packages/urllib3/util/__init__.py',\n 'third_party/requests/packages/urllib3/util/connection.py',\n 'third_party/requests/packages/urllib3/util/request.py',\n 'third_party/requests/packages/urllib3/util/response.py',\n 'third_party/requests/packages/urllib3/util/retry.py',\n 'third_party/requests/packages/urllib3/util/ssl_.py',\n 'third_party/requests/packages/urllib3/util/timeout.py',\n 'third_party/requests/packages/urllib3/util/url.py',\n 'third_party/requests/sessions.py',\n 'third_party/requests/status_codes.py',\n 'third_party/requests/structures.py', 'third_party/requests/utils.py',\n 'third_party/rsa/rsa/__init__.py', 'third_party/rsa/rsa/_compat.py',\n 'third_party/rsa/rsa/_version133.py',\n 'third_party/rsa/rsa/_version200.py', 'third_party/rsa/rsa/asn1.py',\n 'third_party/rsa/rsa/bigfile.py', 'third_party/rsa/rsa/cli.py',\n 'third_party/rsa/rsa/common.py', 'third_party/rsa/rsa/core.py',\n 'third_party/rsa/rsa/key.py', 'third_party/rsa/rsa/parallel.py',\n 'third_party/rsa/rsa/pem.py', 'third_party/rsa/rsa/pkcs1.py',\n 'third_party/rsa/rsa/prime.py', 'third_party/rsa/rsa/randnum.py',\n 'third_party/rsa/rsa/transform.py', 'third_party/rsa/rsa/util.py',\n 'third_party/rsa/rsa/varblock.py', 'third_party/six/__init__.py',\n 'utils/__init__.py', 'utils/cacert.pem', 'utils/file_path.py',\n 'utils/fs.py', 'utils/large.py', 'utils/logging_utils.py',\n 'utils/lru.py', 'utils/net.py', 'utils/oauth.py', 'utils/on_error.py',\n 'utils/subprocess42.py', 'utils/threading_utils.py', 'utils/tools.py',\n 'utils/zip_package.py', 'adb/__init__.py', 'adb/adb_commands.py',\n 'adb/adb_protocol.py', 'adb/common.py', 'adb/contrib/__init__.py',\n 'adb/contrib/adb_commands_safe.py', 'adb/contrib/high.py',\n 'adb/contrib/parallel.py', 'adb/fastboot.py',\n 'adb/filesync_protocol.py', 'adb/sign_pythonrsa.py',\n 'adb/usb_exceptions.py', 'python_libusb1/__init__.py',\n 'python_libusb1/libusb1.py', 'python_libusb1/usb1.py')\n", "def is_windows():...\n", "\"\"\"docstring\"\"\"\n", "return os.__file__[0] != '/'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Assign'", "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_7(VAR_6):...\n", "return 'dir2' not in VAR_6\n" ]
[ "def directory_filter(path):...\n", "return 'dir2' not in path\n" ]
[ 0, 1 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_17(self):...\n", "VAR_22 = mocks.MockRequestsResponse(200, jsonutils.dumps({'result': {'ok': \n 200}}))\n", "VAR_14 = self.new_mocked_client(client.JSONRESTClient, session_response=\n resp, url_prefix='api/v2/nat')\n", "VAR_22 = VAR_14.create(VAR_24={'name': 'mgmt-egress'})\n", "FUNC_2('post', VAR_14, 'https://1.2.3.4/api/v2/nat', VAR_8=jsonutils.dumps(\n {'name': 'mgmt-egress'}))\n", "self.assertEqual(VAR_22, {'result': {'ok': 200}})\n" ]
[ "def test_json_request(self):...\n", "resp = mocks.MockRequestsResponse(200, jsonutils.dumps({'result': {'ok': 200}})\n )\n", "api = self.new_mocked_client(client.JSONRESTClient, session_response=resp,\n url_prefix='api/v2/nat')\n", "resp = api.create(body={'name': 'mgmt-egress'})\n", "assert_json_call('post', api, 'https://1.2.3.4/api/v2/nat', data=jsonutils.\n dumps({'name': 'mgmt-egress'}))\n", "self.assertEqual(resp, {'result': {'ok': 200}})\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "@staticmethod...\n", "return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', VAR_0)))\n" ]
[ "@staticmethod...\n", "return ' '.join(escape_path_argument(s) for s in (sys.executable, os.path.\n join(os.path.dirname(os.path.realpath(__file__)),\n 'run_shell_command_testfiles', scriptname)))\n" ]
[ 0, 2 ]
[ "Condition", "Return'" ]
[ "def FUNC_0():...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = request.args.get('group_by')\n", "if not VAR_4:\n", "VAR_4 = ''\n", "return VAR_4\n" ]
[ "def get_group_by_args():...\n", "\"\"\"docstring\"\"\"\n", "group_by = request.args.get('group_by')\n", "if not group_by:\n", "group_by = ''\n", "return group_by\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_1(self, VAR_6):...\n", "VAR_22 = []\n", "for node in VAR_6.split('/'):\n", "if node in ['', '.']:\n", "return '/'.join(VAR_22)\n", "if node == '..':\n", "if VAR_22:\n", "VAR_22.append(node)\n", "VAR_22.pop()\n" ]
[ "def undot(self, path):...\n", "ret = []\n", "for node in path.split('/'):\n", "if node in ['', '.']:\n", "return '/'.join(ret)\n", "if node == '..':\n", "if ret:\n", "ret.append(node)\n", "ret.pop()\n" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ "FunctionDef'", "Assign'", "For", "Condition", "Return'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_0(self, VAR_1):...\n", "VAR_6 = 'string'.format(VAR_1=driver)\n", "self.cursor.execute(VAR_6)\n", "self.rides = self.cursor.fetchall()\n" ]
[ "def find_rides(self, driver):...\n", "query = (\n \"\"\"\n SELECT r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno, r.seats-COUNT(b.bno) \n FROM rides r, bookings b\n WHERE driver = '{driver}'\n AND r.rno = b.bno \n GROUP BY r.rno, r.price, r.rdate, r.seats, r.lugDesc, r.src, r.dst, r.driver, r.cno\n \"\"\"\n .format(driver=driver))\n", "self.cursor.execute(query)\n", "self.rides = self.cursor.fetchall()\n" ]
[ 0, 4, 4, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'" ]
[ "def __init__(self, VAR_7, VAR_20=True, *VAR_15, **VAR_16):...\n", "CLASS_5.__init__(self, VAR_7, *VAR_15, VAR_20=redirect, **kw)\n" ]
[ "def __init__(self, param, redirect=True, *a, **kw):...\n", "VLink.__init__(self, param, *a, redirect=redirect, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_13(VAR_9, VAR_7, VAR_11, VAR_10):...\n", "if VAR_11 == 'POST':\n", "return CLASS_0.session.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=\n _HEADERS, VAR_10=timeout)\n", "if VAR_11 == 'GET':\n", "return CLASS_0.session.get(FUNC_2(VAR_7), headers=_HEADERS, VAR_10=timeout)\n" ]
[ "def SendRequest(data, handler, method, timeout):...\n", "if method == 'POST':\n", "return BaseRequest.session.post(_BuildUri(handler), data=ToUtf8Json(data),\n headers=_HEADERS, timeout=timeout)\n", "if method == 'GET':\n", "return BaseRequest.session.get(_BuildUri(handler), headers=_HEADERS,\n timeout=timeout)\n" ]
[ 0, 0, 7, 0, 7 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import argparse\n", "import ast\n", "import io\n", "import os\n", "import sys\n", "import threading\n", "import random\n", "import time\n", "from cms import config, ServiceCoord, get_service_address\n", "from cms.db import Contest, SessionGen\n", "import cmstestsuite.web\n", "from cmstestsuite.web import Browser\n", "from cmstestsuite.web.CWSRequests import HomepageRequest, LoginRequest, TaskRequest, TaskStatementRequest, SubmitRandomRequest\n", "cmstestsuite.web.debug = True\n", "def __init__(self, VAR_2=None):...\n", "self.total = 0\n", "self.success = 0\n", "self.failure = 0\n", "self.error = 0\n", "self.undecided = 0\n", "self.total_time = 0.0\n", "self.max_time = 0.0\n", "self.log_dir = VAR_2\n", "if self.log_dir is not None:\n", "def FUNC_2(self):...\n", "os.makedirs(self.log_dir)\n", "print('TOTAL: %5d' % self.total, file=sys.stderr)\n", "print('SUCCESS: %5d' % self.success, file=sys.stderr)\n", "print('FAIL: %5d' % self.failure, file=sys.stderr)\n", "print('ERROR: %5d' % self.error, file=sys.stderr)\n", "print('UNDECIDED: %5d' % self.undecided, file=sys.stderr)\n", "print('Total time: %7.3f' % self.total_time, file=sys.stderr)\n", "print('Average time: %7.3f' % (self.total_time / self.total), file=sys.stderr)\n", "print('Max time: %7.3f' % self.max_time, file=sys.stderr)\n", "def FUNC_3(self, VAR_3):...\n", "self.total += VAR_3.total\n", "self.success += VAR_3.success\n", "self.failure += VAR_3.failure\n", "self.error += VAR_3.error\n", "self.undecided += VAR_3.undecided\n", "self.total_time += VAR_3.total_time\n", "self.max_time = max(self.max_time, VAR_3.max_time)\n", "def FUNC_4(self, VAR_4):...\n", "if self.log_dir is None:\n", "return\n", "VAR_19 = '%s_%s.log' % (VAR_4.start_time, VAR_4.__class__.__name__)\n", "VAR_20 = os.path.join(self.log_dir, VAR_19)\n", "VAR_21 = os.path.join(self.log_dir, VAR_4.__class__.__name__)\n", "VAR_4.store_to_file(fd)\n", "os.remove(VAR_21)\n", "os.symlink(VAR_19, VAR_21)\n", "\"\"\"Exception to be raised when an Actor is going to die soon. See\n Actor class.\n\n \"\"\"\n", "\"\"\"string\"\"\"\n", "def __init__(self, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9=None, VAR_10=None,...\n", "threading.Thread.__init__(self)\n", "self.username = VAR_5\n", "self.password = VAR_6\n", "self.metrics = VAR_7\n", "self.tasks = VAR_8\n", "self.log = VAR_9\n", "self.base_url = VAR_10\n", "self.submissions_path = VAR_11\n", "self.name = 'Actor thread for user %s' % self.username\n", "self.browser = Browser()\n", "self.die = False\n", "def FUNC_5(self):...\n", "print('Starting actor for user %s' % self.username, file=sys.stderr)\n", "print('Actor dying for user %s' % self.username, file=sys.stderr)\n", "def FUNC_6(self):...\n", "self.act()\n", "\"\"\"docstring\"\"\"\n", "def FUNC_7(self, VAR_4):...\n", "self.wait_next()\n", "self.log.total += 1\n", "VAR_4.execute()\n", "print('Unhandled exception while executing the request: %s' % exc, file=sys\n .stderr)\n", "self.log.__dict__[VAR_4.outcome] += 1\n", "return\n", "self.log.total_time += VAR_4.duration\n", "self.log.max_time = max(self.log.max_time, VAR_4.duration)\n", "self.log.store_to_file(VAR_4)\n", "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = 0.1\n", "VAR_23 = self.metrics['time_coeff'] * random.expovariate(self.metrics[\n 'time_lambda'])\n", "VAR_24 = int(VAR_23 / VAR_22)\n", "VAR_25 = VAR_23 - VAR_24 * VAR_22\n", "for i in xrange(VAR_24):\n", "time.sleep(VAR_22)\n", "time.sleep(VAR_25)\n", "if self.die:\n", "if self.die:\n", "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=False,\n VAR_10=self.base_url))\n", "self.do_step(LoginRequest(self.browser, self.username, self.password,\n VAR_10=self.base_url))\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=True,\n VAR_10=self.base_url))\n", "def FUNC_6(self):...\n", "self.login()\n", "while True:\n", "VAR_29 = random.random()\n", "VAR_30 = random.choice(self.tasks)\n", "if VAR_29 < 0.1 and self.submissions_path is not None:\n", "self.do_step(SubmitRandomRequest(self.browser, VAR_30, VAR_10=self.base_url,\n VAR_11=self.submissions_path))\n", "if VAR_29 < 0.6 and VAR_30[2] != []:\n", "self.do_step(TaskStatementRequest(self.browser, VAR_30[1], random.choice(\n VAR_30[2]), VAR_10=self.base_url))\n", "self.do_step(TaskRequest(self.browser, VAR_30[1], VAR_10=self.base_url))\n" ]
[ "from __future__ import absolute_import\n", "from __future__ import print_function\n", "from __future__ import unicode_literals\n", "import argparse\n", "import ast\n", "import io\n", "import os\n", "import sys\n", "import threading\n", "import random\n", "import time\n", "from cms import config, ServiceCoord, get_service_address\n", "from cms.db import Contest, SessionGen\n", "import cmstestsuite.web\n", "from cmstestsuite.web import Browser\n", "from cmstestsuite.web.CWSRequests import HomepageRequest, LoginRequest, TaskRequest, TaskStatementRequest, SubmitRandomRequest\n", "cmstestsuite.web.debug = True\n", "def __init__(self, log_dir=None):...\n", "self.total = 0\n", "self.success = 0\n", "self.failure = 0\n", "self.error = 0\n", "self.undecided = 0\n", "self.total_time = 0.0\n", "self.max_time = 0.0\n", "self.log_dir = log_dir\n", "if self.log_dir is not None:\n", "def print_stats(self):...\n", "os.makedirs(self.log_dir)\n", "print('TOTAL: %5d' % self.total, file=sys.stderr)\n", "print('SUCCESS: %5d' % self.success, file=sys.stderr)\n", "print('FAIL: %5d' % self.failure, file=sys.stderr)\n", "print('ERROR: %5d' % self.error, file=sys.stderr)\n", "print('UNDECIDED: %5d' % self.undecided, file=sys.stderr)\n", "print('Total time: %7.3f' % self.total_time, file=sys.stderr)\n", "print('Average time: %7.3f' % (self.total_time / self.total), file=sys.stderr)\n", "print('Max time: %7.3f' % self.max_time, file=sys.stderr)\n", "def merge(self, log2):...\n", "self.total += log2.total\n", "self.success += log2.success\n", "self.failure += log2.failure\n", "self.error += log2.error\n", "self.undecided += log2.undecided\n", "self.total_time += log2.total_time\n", "self.max_time = max(self.max_time, log2.max_time)\n", "def store_to_file(self, request):...\n", "if self.log_dir is None:\n", "return\n", "filename = '%s_%s.log' % (request.start_time, request.__class__.__name__)\n", "filepath = os.path.join(self.log_dir, filename)\n", "linkpath = os.path.join(self.log_dir, request.__class__.__name__)\n", "request.store_to_file(fd)\n", "os.remove(linkpath)\n", "os.symlink(filename, linkpath)\n", "\"\"\"Exception to be raised when an Actor is going to die soon. See\n Actor class.\n\n \"\"\"\n", "\"\"\"Class that simulates the behaviour of a user of the system. It\n performs some requests at randomized times (checking CMS pages,\n doing submissions, ...), checking for their success or failure.\n\n The probability that the users doing actions depends on the value\n specified in an object called \"metrics\".\n\n \"\"\"\n", "def __init__(self, username, password, metrics, tasks, log=None, base_url=...\n", "threading.Thread.__init__(self)\n", "self.username = username\n", "self.password = password\n", "self.metrics = metrics\n", "self.tasks = tasks\n", "self.log = log\n", "self.base_url = base_url\n", "self.submissions_path = submissions_path\n", "self.name = 'Actor thread for user %s' % self.username\n", "self.browser = Browser()\n", "self.die = False\n", "def run(self):...\n", "print('Starting actor for user %s' % self.username, file=sys.stderr)\n", "print('Actor dying for user %s' % self.username, file=sys.stderr)\n", "def act(self):...\n", "self.act()\n", "\"\"\"docstring\"\"\"\n", "def do_step(self, request):...\n", "self.wait_next()\n", "self.log.total += 1\n", "request.execute()\n", "print('Unhandled exception while executing the request: %s' % exc, file=sys\n .stderr)\n", "self.log.__dict__[request.outcome] += 1\n", "return\n", "self.log.total_time += request.duration\n", "self.log.max_time = max(self.log.max_time, request.duration)\n", "self.log.store_to_file(request)\n", "def wait_next(self):...\n", "\"\"\"docstring\"\"\"\n", "SLEEP_PERIOD = 0.1\n", "time_to_wait = self.metrics['time_coeff'] * random.expovariate(self.metrics\n ['time_lambda'])\n", "sleep_num = int(time_to_wait / SLEEP_PERIOD)\n", "remaining_sleep = time_to_wait - sleep_num * SLEEP_PERIOD\n", "for i in xrange(sleep_num):\n", "time.sleep(SLEEP_PERIOD)\n", "time.sleep(remaining_sleep)\n", "if self.die:\n", "if self.die:\n", "def login(self):...\n", "\"\"\"docstring\"\"\"\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=False,\n base_url=self.base_url))\n", "self.do_step(LoginRequest(self.browser, self.username, self.password,\n base_url=self.base_url))\n", "self.do_step(HomepageRequest(self.browser, self.username, loggedin=True,\n base_url=self.base_url))\n", "def act(self):...\n", "self.login()\n", "while True:\n", "choice = random.random()\n", "task = random.choice(self.tasks)\n", "if choice < 0.1 and self.submissions_path is not None:\n", "self.do_step(SubmitRandomRequest(self.browser, task, base_url=self.base_url,\n submissions_path=self.submissions_path))\n", "if choice < 0.6 and task[2] != []:\n", "self.do_step(TaskStatementRequest(self.browser, task[1], random.choice(task\n [2]), base_url=self.base_url))\n", "self.do_step(TaskRequest(self.browser, task[1], base_url=self.base_url))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "AugAssign'", "Assign'", "FunctionDef'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Docstring", "FunctionDef'", "Expr'", "AugAssign'", "Expr'", "Expr'", "AugAssign'", "Return'", "AugAssign'", "Assign'", "Expr'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Expr'", "Condition", "Condition", "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_43(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_2 = {'SEVERITY': {'HIGH': 4}, 'CONFIDENCE': {'HIGH': 3, 'MEDIUM': 1}}\n", "self.check_example('jinja2_templating.py', VAR_2)\n" ]
[ "def test_jinja2_templating(self):...\n", "\"\"\"docstring\"\"\"\n", "expect = {'SEVERITY': {'HIGH': 4}, 'CONFIDENCE': {'HIGH': 3, 'MEDIUM': 1}}\n", "self.check_example('jinja2_templating.py', expect)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'" ]
[ "def FUNC_16(self, VAR_53, VAR_39):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_39 in [self.CHOICE, self.MULTICHOICE]:\n", "if VAR_39 in self.CONVERSION_REQUIRED:\n", "int(VAR_53[0])\n", "VAR_96 = \"'{value}'\"\n", "VAR_96 = '{value}'\n", "VAR_96 = \"'{value}'\"\n", "VAR_96 = '{value}'\n", "return (VAR_96.format(VAR_54=value) for VAR_54 in VAR_53)\n" ]
[ "def _convert_values(self, values, data_type):...\n", "\"\"\"docstring\"\"\"\n", "if data_type in [self.CHOICE, self.MULTICHOICE]:\n", "if data_type in self.CONVERSION_REQUIRED:\n", "int(values[0])\n", "wrapper = \"'{value}'\"\n", "wrapper = '{value}'\n", "wrapper = \"'{value}'\"\n", "wrapper = '{value}'\n", "return (wrapper.format(value=value) for value in values)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "from django import forms\n", "VAR_0 = forms.CharField(label='', max_length=100, required=True)\n", "VAR_0.widget.attrs['class'] = 'form-control mr-sm-2 my-2'\n", "VAR_0.widget.attrs['placeholder'] = 'Lookup URL'\n" ]
[ "from django import forms\n", "keyword = forms.CharField(label='', max_length=100, required=True)\n", "keyword.widget.attrs['class'] = 'form-control mr-sm-2 my-2'\n", "keyword.widget.attrs['placeholder'] = 'Lookup URL'\n" ]
[ 0, 6, 0, 0 ]
[ "ImportFrom'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_34(self, VAR_14):...\n", "return self.list_properties[VAR_14].mapper.class_\n" ]
[ "def get_related_model(self, col_name):...\n", "return self.list_properties[col_name].mapper.class_\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_34(self):...\n", "" ]
[ "def get(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(VAR_2, VAR_3, VAR_4):...\n", "if VAR_2 is None and VAR_3 is None:\n", "return False\n", "if VAR_2 is not None:\n", "return False\n", "VAR_2 = int(VAR_2)\n", "if VAR_3 is not None:\n", "VAR_3 = int(VAR_3)\n", "VAR_4 = int(VAR_4)\n", "return True\n" ]
[ "def _ValidateInput(lower_bound_commit_position, upper_bound_commit_position,...\n", "if lower_bound_commit_position is None and upper_bound_commit_position is None:\n", "return False\n", "if lower_bound_commit_position is not None:\n", "return False\n", "lower_bound_commit_position = int(lower_bound_commit_position)\n", "if upper_bound_commit_position is not None:\n", "upper_bound_commit_position = int(upper_bound_commit_position)\n", "iterations_to_rerun = int(iterations_to_rerun)\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Return'" ]
[ "@FUNC_0...\n", "VAR_12 = await get_session(VAR_3)\n", "VAR_13 = await VAR_3.post()\n", "if set(['action', 'uname', 'psw']).issubset(VAR_13.keys()\n", "VAR_5 = VAR_13['uname']\n", "if 'action' in VAR_13:\n", "VAR_21 = VAR_13['psw']\n", "if VAR_13['action'] == 'logout' and 'uname' in VAR_12:\n", "return f\"\"\"Invalid login POST:<br/><i>{VAR_13.items()}</i><br>\nAlready logged in: {'uname' in VAR_12}\"\"\"\n", "if VAR_13['action'] == 'login':\n", "for i in ('uname', 'ignore_timeout'):\n", "VAR_25 = await database.select_user(VAR_3, VAR_5)\n", "if VAR_13['action'] == 'register' and 'psw2' in VAR_13:\n", "if i in VAR_12:\n", "return 'Logged out'\n", "if not VAR_25:\n", "if not FUNC_12(VAR_5):\n", "return 'Error: No such user.'\n", "if bcrypt.hashpw(VAR_21.encode('UTF-8'), VAR_25[0][2].encode('UTF-8')).decode(\n", "return f\"\"\"Error: invalid username: <i>{VAR_5}</i><br>\nWe only allow characters from the english alphabet plus digits\"\"\"\n", "if VAR_21 != VAR_13['psw2']:\n", "return 'Error: Wrong password'\n", "VAR_12['uname'] = VAR_5\n", "return 'Error: mismatching passwords!'\n", "VAR_26 = bcrypt.hashpw(VAR_21.encode('UTF-8'), bcrypt.gensalt()).decode('UTF-8'\n )\n", "VAR_12['login_time'] = time.time()\n", "await database.insert_user(VAR_3, VAR_5, VAR_26)\n", "return 'Error: username already taken!'\n", "return 'User created! <a href=\"/login\">login over here.</a>'\n", "if 'keep' in VAR_13 and VAR_13['keep'] == 'logged_in':\n", "VAR_12['ignore_timeout'] = True\n", "VAR_19 = 'Login successfull!'\n", "if 'return_after_login' in VAR_12:\n", "VAR_19 += f\"\"\"<br/>\n<a href=\"{VAR_12['return_after_login']}\">Go back</a>\"\"\"\n", "return VAR_19\n" ]
[ "@handle_html...\n", "session = await get_session(request)\n", "data = await request.post()\n", "if set(['action', 'uname', 'psw']).issubset(data.keys()\n", "uname = data['uname']\n", "if 'action' in data:\n", "psw = data['psw']\n", "if data['action'] == 'logout' and 'uname' in session:\n", "return f\"\"\"Invalid login POST:<br/><i>{data.items()}</i><br>\nAlready logged in: {'uname' in session}\"\"\"\n", "if data['action'] == 'login':\n", "for i in ('uname', 'ignore_timeout'):\n", "entry = await database.select_user(request, uname)\n", "if data['action'] == 'register' and 'psw2' in data:\n", "if i in session:\n", "return 'Logged out'\n", "if not entry:\n", "if not is_valid_username(uname):\n", "return 'Error: No such user.'\n", "if bcrypt.hashpw(psw.encode('UTF-8'), entry[0][2].encode('UTF-8')).decode(\n", "return f\"\"\"Error: invalid username: <i>{uname}</i><br>\nWe only allow characters from the english alphabet plus digits\"\"\"\n", "if psw != data['psw2']:\n", "return 'Error: Wrong password'\n", "session['uname'] = uname\n", "return 'Error: mismatching passwords!'\n", "bhash = bcrypt.hashpw(psw.encode('UTF-8'), bcrypt.gensalt()).decode('UTF-8')\n", "session['login_time'] = time.time()\n", "await database.insert_user(request, uname, bhash)\n", "return 'Error: username already taken!'\n", "return 'User created! <a href=\"/login\">login over here.</a>'\n", "if 'keep' in data and data['keep'] == 'logged_in':\n", "session['ignore_timeout'] = True\n", "out = 'Login successfull!'\n", "if 'return_after_login' in session:\n", "out += f\"\"\"<br/>\n<a href=\"{session['return_after_login']}\">Go back</a>\"\"\"\n", "return out\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 ]
[ "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Condition", "For", "Assign'", "Condition", "Condition", "Return'", "Condition", "Condition", "Return'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Return'", "Assign'", "Assign'", "Expr'", "Return'", "Return'", "Condition", "Assign'", "Assign'", "Condition", "AugAssign'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if not os.path.exists(VAR_4):\n", "VAR_12, VAR_13 = [], []\n", "for filename in os.listdir(VAR_4):\n", "VAR_5 = os.path.join(VAR_4, filename)\n", "return VAR_12, VAR_13\n", "if os.path.isdir(VAR_5):\n", "VAR_12.append((filename, len(os.listdir(VAR_5))))\n", "VAR_13.append(filename)\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if not os.path.exists(analysis_path):\n", "dirs, files = [], []\n", "for filename in os.listdir(analysis_path):\n", "path = os.path.join(analysis_path, filename)\n", "return dirs, files\n", "if os.path.isdir(path):\n", "dirs.append((filename, len(os.listdir(path))))\n", "files.append(filename)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Expr'" ]
[ "@VAR_0.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for VAR_1, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if VAR_1 not in oauth.remote_apps:\n", "VAR_4 = oauth.remote_app(VAR_1, **conf['params'])\n", "VAR_4 = oauth.remote_apps[VAR_1]\n", "VAR_4.tokengetter(make_token_getter(VAR_4))\n", "handlers.register(VAR_1, VAR_4.authorized_handler(make_handler(conf.get(\n 'authorized_handler', authorized_default_handler), VAR_4)))\n", "disconnect_handlers.register(VAR_1, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), VAR_4, with_response=False))\n", "def FUNC_5(VAR_4, *VAR_5, **VAR_6):...\n", "VAR_7 = conf.get('signup_handler', dict())\n", "VAR_8 = make_handler(VAR_7.get('info', FUNC_5), VAR_4, with_response=False)\n", "VAR_9 = make_handler(VAR_7.get('setup', FUNC_5), VAR_4, with_response=False)\n", "VAR_10 = make_handler(VAR_7.get('view', FUNC_5), VAR_4, with_response=False)\n", "signup_handlers.register(VAR_1, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ "@blueprint.before_app_first_request...\n", "\"\"\"docstring\"\"\"\n", "user_logged_out.connect(oauth_logout_handler)\n", "oauth.init_app(current_app)\n", "for remote_app, conf in cfg['OAUTHCLIENT_REMOTE_APPS'].items():\n", "if remote_app not in oauth.remote_apps:\n", "remote = oauth.remote_app(remote_app, **conf['params'])\n", "remote = oauth.remote_apps[remote_app]\n", "remote.tokengetter(make_token_getter(remote))\n", "handlers.register(remote_app, remote.authorized_handler(make_handler(conf.\n get('authorized_handler', authorized_default_handler), remote)))\n", "disconnect_handlers.register(remote_app, make_handler(conf.get(\n 'disconnect_handler', disconnect_handler), remote, with_response=False))\n", "def dummy_handler(remote, *args, **kargs):...\n", "signup_handler = conf.get('signup_handler', dict())\n", "account_info_handler = make_handler(signup_handler.get('info',\n dummy_handler), remote, with_response=False)\n", "account_setup_handler = make_handler(signup_handler.get('setup',\n dummy_handler), remote, with_response=False)\n", "account_view_handler = make_handler(signup_handler.get('view',\n dummy_handler), remote, with_response=False)\n", "signup_handlers.register(remote_app, dict(info=account_info_handler, setup=\n account_setup_handler, view=account_view_handler))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "For", "Docstring", "Expr'", "Expr'", "For", "Condition", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_4(VAR_9):...\n", "if VAR_9['exception']['TYPE'] == UnknownExtraConf.__name__:\n" ]
[ "def _RaiseExceptionForData(data):...\n", "if data['exception']['TYPE'] == UnknownExtraConf.__name__:\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_2(self, VAR_7):...\n", "VAR_25 = ''\n", "VAR_26 = '%s> ' % self.configuration.eqlx_group_name\n", "while not VAR_25.endswith(VAR_26):\n", "VAR_25 += VAR_7.recv(102400)\n", "VAR_0.debug(_('CLI output\\n%s'), VAR_25)\n", "return VAR_25.splitlines()\n" ]
[ "def _get_output(self, chan):...\n", "out = ''\n", "ending = '%s> ' % self.configuration.eqlx_group_name\n", "while not out.endswith(ending):\n", "out += chan.recv(102400)\n", "LOG.debug(_('CLI output\\n%s'), out)\n", "return out.splitlines()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "AugAssign'", "Expr'", "Return'" ]
[ "def FUNC_7(self, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "if not self._rules:\n", "if not VAR_10 in self._rules:\n", "return self._rules[VAR_10]\n" ]
[ "def get_rule(self, name):...\n", "\"\"\"docstring\"\"\"\n", "if not self._rules:\n", "if not name in self._rules:\n", "return self._rules[name]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'" ]
[ "def FUNC_3(self, VAR_5, VAR_6):...\n", "if not VAR_5.lower() in VAR_6:\n", "self.connect()\n", "VAR_7 = 'INSERT INTO badwords (word, badness) VALUE (%s,%s)'\n", "VAR_11 = VAR_5.lower(), 1\n", "self.cursor.execute(VAR_7, VAR_11)\n", "self.close()\n" ]
[ "def insert(self, targetWord, badwordlist):...\n", "if not targetWord.lower() in badwordlist:\n", "self.connect()\n", "sqlFormula = 'INSERT INTO badwords (word, badness) VALUE (%s,%s)'\n", "word = targetWord.lower(), 1\n", "self.cursor.execute(sqlFormula, word)\n", "self.close()\n" ]
[ 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_1(self):...\n", "VAR_16 = self.kwargs['pk']\n", "VAR_8 = Attribute.objects.filter(event=pk).order_by('id')\n", "VAR_19 = self.request.GET.get('category')\n", "VAR_20 = self.request.GET.get('type')\n", "if VAR_19 is not None:\n", "VAR_8 = VAR_8.filter(VAR_19=category)\n", "if VAR_20 is not None:\n", "VAR_8 = VAR_8.filter(VAR_20=type)\n", "return VAR_8\n" ]
[ "def get_queryset(self):...\n", "pk = self.kwargs['pk']\n", "query = Attribute.objects.filter(event=pk).order_by('id')\n", "category = self.request.GET.get('category')\n", "type = self.request.GET.get('type')\n", "if category is not None:\n", "query = query.filter(category=category)\n", "if type is not None:\n", "query = query.filter(type=type)\n", "return query\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_10(VAR_6):...\n", "VAR_0, VAR_10 = FUNC_0()\n", "VAR_18 = \"SELECT * from {} where adm_token='{}'\".format(CFG(\n 'admintoken_table_name'), VAR_6)\n", "VAR_20 = bool(FUNC_3(VAR_10, VAR_18))\n", "FUNC_1(VAR_0)\n", "return VAR_20\n" ]
[ "def isValidAdmToken(adm_token):...\n", "conn, c = connectDB()\n", "req = \"SELECT * from {} where adm_token='{}'\".format(CFG(\n 'admintoken_table_name'), adm_token)\n", "answer = bool(queryOne(c, req))\n", "closeDB(conn)\n", "return answer\n" ]
[ 0, 0, 4, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_5(VAR_10):...\n", "if not VAR_10 in new_beatmap_list:\n", "VAR_36 = open('/home/pi/DiscordBots/OsuBot/beatmapsFiles/newBeatmaps.txt', 'a')\n", "VAR_36.write('\\n' + VAR_10)\n", "VAR_36.close()\n", "print('Added ' + VAR_10 + ' to beatmap queue')\n" ]
[ "def add_beatmap_to_queue(url):...\n", "if not url in new_beatmap_list:\n", "new_beatmaps_file = open(\n '/home/pi/DiscordBots/OsuBot/beatmapsFiles/newBeatmaps.txt', 'a')\n", "new_beatmaps_file.write('\\n' + url)\n", "new_beatmaps_file.close()\n", "print('Added ' + url + ' to beatmap queue')\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_10):...\n", "if VAR_10.find('\\t') > -1:\n", "VAR_10 = VAR_10.replace('\\t', ' ')\n", "super(CLASS_1, self).__init__(docParser.parse(VAR_10, docLexer), VAR_2=self.end\n )\n", "warn(\n \"Input file has tabs, which will be considered 4 spaces; but please don't use tabs!\"\n )\n", "Config.resolve()\n", "debug('Final config', Config.effectiveConfig)\n", "CLASS_3.resolve(self.children)\n", "CLASS_4.resolve(self.children)\n", "VerbatimEnv.resolve()\n", "VAR_27 = self.splitCmd(self.docClassCmd, Config.getRaw('docclass'))\n", "for pkg in Config.effectiveConfig['packages']:\n", "VAR_27 += self.splitCmd(self.packageCmd, pkg)\n", "VAR_27 += '\\n'\n", "VAR_28 = ''\n", "for k in self.preambleCmds:\n", "if k in Config.effectiveConfig:\n", "VAR_29 = VerbatimEnv.preambleDefs\n", "VAR_28 += self.preambleCmds[k] % Config.getRaw(k)\n", "if Config.effectiveConfig.get('titlepage', 'no') in ['yes', 'y', 'true', True]:\n", "VAR_29 += self.titlePageCmd\n", "self.before = VAR_27 + VAR_28 + self.begin + VAR_29\n" ]
[ "def __init__(self, txt):...\n", "if txt.find('\\t') > -1:\n", "txt = txt.replace('\\t', ' ')\n", "super(Document, self).__init__(docParser.parse(txt, docLexer), after=self.end)\n", "warn(\n \"Input file has tabs, which will be considered 4 spaces; but please don't use tabs!\"\n )\n", "Config.resolve()\n", "debug('Final config', Config.effectiveConfig)\n", "ListItem.resolve(self.children)\n", "Column.resolve(self.children)\n", "VerbatimEnv.resolve()\n", "packageDef = self.splitCmd(self.docClassCmd, Config.getRaw('docclass'))\n", "for pkg in Config.effectiveConfig['packages']:\n", "packageDef += self.splitCmd(self.packageCmd, pkg)\n", "packageDef += '\\n'\n", "outerPreamble = ''\n", "for k in self.preambleCmds:\n", "if k in Config.effectiveConfig:\n", "innerPreamble = VerbatimEnv.preambleDefs\n", "outerPreamble += self.preambleCmds[k] % Config.getRaw(k)\n", "if Config.effectiveConfig.get('titlepage', 'no') in ['yes', 'y', 'true', True]:\n", "innerPreamble += self.titlePageCmd\n", "self.before = packageDef + outerPreamble + self.begin + innerPreamble\n" ]
[ 0, 2, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "For", "AugAssign'", "AugAssign'", "Assign'", "For", "Condition", "Assign'", "AugAssign'", "Condition", "AugAssign'", "Assign'" ]
[ "def __init__(self, VAR_45, VAR_46, VAR_47, VAR_48, VAR_49, VAR_50, VAR_51,...\n", "self.st_mode = VAR_45\n", "self.st_ino = VAR_46\n", "self.st_dev = VAR_47\n", "self.st_nlink = VAR_48\n", "self.st_uid = VAR_49\n", "self.st_gid = VAR_50\n", "self.st_size = VAR_51\n", "self.st_atime = VAR_52\n", "self.st_mtime = VAR_53\n", "self.st_ctime = VAR_54\n" ]
[ "def __init__(self, st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid,...\n", "self.st_mode = st_mode\n", "self.st_ino = st_ino\n", "self.st_dev = st_dev\n", "self.st_nlink = st_nlink\n", "self.st_uid = st_uid\n", "self.st_gid = st_gid\n", "self.st_size = st_size\n", "self.st_atime = st_atime\n", "self.st_mtime = st_mtime\n", "self.st_ctime = st_ctime\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self, VAR_7, VAR_8):...\n", "VAR_3.info('we are about to analyze scene {} with {} brackets'.format(VAR_8,\n len(VAR_7)))\n", "for url in VAR_7:\n", "VAR_11 = \"SELECT * FROM analyzed where base_url='{}'\".format(url)\n", "VAR_12 = self.db.exec(VAR_11)\n", "if len(VAR_12) == 0:\n", "VAR_26 = bracket_utils.get_display_base(url)\n", "VAR_3.info('Skpping pro bracket because it has already been analyzed: {}'.\n format(url))\n", "if 'doubles' in VAR_26.lower() or 'dubs' in VAR_26.lower():\n", "VAR_3.info(\n 'We are skipping the tournament {} because it is a doubles tournament'.\n format(VAR_26))\n", "VAR_3.info('About to process pro bracket {}'.format(url))\n", "self.data_processor.process(url, VAR_8, VAR_26)\n" ]
[ "def analyze_smashgg(self, urls, name):...\n", "LOG.info('we are about to analyze scene {} with {} brackets'.format(name,\n len(urls)))\n", "for url in urls:\n", "sql = \"SELECT * FROM analyzed where base_url='{}'\".format(url)\n", "res = self.db.exec(sql)\n", "if len(res) == 0:\n", "display_name = bracket_utils.get_display_base(url)\n", "LOG.info('Skpping pro bracket because it has already been analyzed: {}'.\n format(url))\n", "if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n", "LOG.info('We are skipping the tournament {} because it is a doubles tournament'\n .format(display_name))\n", "LOG.info('About to process pro bracket {}'.format(url))\n", "self.data_processor.process(url, name, display_name)\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "For", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_14(self, VAR_64):...\n", "self._onerror = VAR_64\n" ]
[ "def onerror(self, func):...\n", "self._onerror = func\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_18(VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "return html.escape(str(VAR_13))\n" ]
[ "def html_escape(input_string):...\n", "\"\"\"docstring\"\"\"\n", "return html.escape(str(input_string))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_17(self, VAR_25, VAR_27='', VAR_28=None):...\n", "VAR_28 = VAR_28 or {'Content-Type': 'application/json'}\n", "VAR_20 = request_mock(VAR_25=path, method='POST', VAR_27=body, VAR_28=headers)\n", "return self._render(VAR_20)\n" ]
[ "def post(self, path, body='', headers=None):...\n", "headers = headers or {'Content-Type': 'application/json'}\n", "request = request_mock(path=path, method='POST', body=body, headers=headers)\n", "return self._render(request)\n" ]
[ 0, 0, 5, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_8(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.config_file = lambda : ['config line1']\n", "VAR_6 = self.uut.generate_config_file()\n", "self.assertTrue(os.path.isfile(VAR_6))\n", "os.remove(VAR_6)\n", "self.uut.lint('filename')\n" ]
[ "def test_config_file_generator(self):...\n", "self.uut.executable = 'echo'\n", "self.uut.config_file = lambda : ['config line1']\n", "config_filename = self.uut.generate_config_file()\n", "self.assertTrue(os.path.isfile(config_filename))\n", "os.remove(config_filename)\n", "self.uut.lint('filename')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "VAR_24 = self.common.create_cloned_volume(VAR_7, VAR_8)\n", "self.common.client_logout()\n", "return {'metadata': VAR_24}\n" ]
[ "@utils.synchronized('3par', external=True)...\n", "\"\"\"docstring\"\"\"\n", "self.common.client_login()\n", "new_vol = self.common.create_cloned_volume(volume, src_vref)\n", "self.common.client_logout()\n", "return {'metadata': new_vol}\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(VAR_2, VAR_4):...\n", "if VAR_4.status == 'failed':\n", "VAR_8 = str(uuid.uuid4())\n", "os.chdir('screenshots')\n", "VAR_2.browser.save_screenshot('failed ' + str(VAR_4.name) + '_' + VAR_8 +\n '.png')\n", "FUNC_7(VAR_2, 'failed ' + str(VAR_4.name) + '_' + VAR_8 + '.html')\n", "os.chdir('../')\n" ]
[ "def after_step(context, step):...\n", "if step.status == 'failed':\n", "id = str(uuid.uuid4())\n", "os.chdir('screenshots')\n", "context.browser.save_screenshot('failed ' + str(step.name) + '_' + id + '.png')\n", "save_source(context, 'failed ' + str(step.name) + '_' + id + '.html')\n", "os.chdir('../')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]