lines
sequence
raw_lines
sequence
label
sequence
type
sequence
[ "def FUNC_21(VAR_16):...\n", "return (VAR_16.input, VAR_16.dynamic_input) if VAR_4 else (VAR_16.output,\n VAR_16.dynamic_output)\n" ]
[ "def get_io(rule):...\n", "return (rule.input, rule.dynamic_input) if input else (rule.output, rule.\n dynamic_output)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_2():...\n", "VAR_30 = VAR_10.find(' ')\n", "VAR_24 = VAR_10[:VAR_30]\n", "VAR_42 = ''\n", "VAR_12 = VAR_10[VAR_30 + 1:]\n", "self.emph = 1 if VAR_24.find('*') > -1 else 0\n", "self.uncover = 2 if VAR_24.find('+') > -1 else 0\n", "self.kind = 0\n", "self.resume = False\n", "if VAR_24.find('.') > -1:\n", "self.kind = 1\n", "if VAR_24.find(',') > -1:\n", "super(CLASS_3, self).__init__(slideParser.parse(VAR_12, slideLexer), '%s' +\n self.markers[self.kind] % (self.specs[self.emph + self.uncover], VAR_42\n ), '\\n')\n", "self.kind = 1\n", "if VAR_24.find('=') > -1:\n", "self.resume = True\n", "self.kind = 2\n", "VAR_43 = VAR_12.find('=')\n", "if VAR_43 == -1:\n", "VAR_43 = VAR_12.find(' ')\n", "if VAR_43 == -1:\n", "VAR_42 = VAR_12\n", "VAR_42 = VAR_12[:VAR_43]\n", "VAR_12 = ' '\n", "VAR_12 = VAR_12[VAR_43 + 1:]\n" ]
[ "def innerFunc():...\n", "i = txt.find(' ')\n", "marker = txt[:i]\n", "describee = ''\n", "content = txt[i + 1:]\n", "self.emph = 1 if marker.find('*') > -1 else 0\n", "self.uncover = 2 if marker.find('+') > -1 else 0\n", "self.kind = 0\n", "self.resume = False\n", "if marker.find('.') > -1:\n", "self.kind = 1\n", "if marker.find(',') > -1:\n", "super(ListItem, self).__init__(slideParser.parse(content, slideLexer), '%s' +\n self.markers[self.kind] % (self.specs[self.emph + self.uncover],\n describee), '\\n')\n", "self.kind = 1\n", "if marker.find('=') > -1:\n", "self.resume = True\n", "self.kind = 2\n", "j = content.find('=')\n", "if j == -1:\n", "j = content.find(' ')\n", "if j == -1:\n", "describee = content\n", "describee = content[:j]\n", "content = ' '\n", "content = content[j + 1:]\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_1.user.is_authenticated():\n", "VAR_5 = VAR_1.POST.get(REDIRECT_FIELD_NAME, VAR_1.GET.get(\n REDIRECT_FIELD_NAME, ''))\n", "return django_login(VAR_1, VAR_4='userprofile/login.html', extra_context={\n 'shibboleth_login': 'shibboleth_login' in settings.INSTALLED_APPS,\n 'mooc_login': 'social_django' in settings.INSTALLED_APPS,\n 'login_title_text': settings_text('LOGIN_TITLE_TEXT'),\n 'login_body_text': settings_text('LOGIN_BODY_TEXT'),\n 'login_button_text': settings_text('LOGIN_BUTTON_TEXT'),\n 'shibboleth_title_text': settings_text('SHIBBOLETH_TITLE_TEXT'),\n 'shibboleth_body_text': settings_text('SHIBBOLETH_BODY_TEXT'),\n 'shibboleth_button_text': settings_text('SHIBBOLETH_BUTTON_TEXT'),\n 'mooc_title_text': settings_text('MOOC_TITLE_TEXT'), 'mooc_body_text':\n settings_text('MOOC_BODY_TEXT')})\n", "if not is_safe_url(url=redirect_to, host=request.get_host()):\n", "VAR_5 = resolve_url(settings.LOGIN_REDIRECT_URL)\n", "return HttpResponseRedirect(VAR_5)\n" ]
[ "def login(request):...\n", "\"\"\"docstring\"\"\"\n", "if request.user.is_authenticated():\n", "redirect_to = request.POST.get(REDIRECT_FIELD_NAME, request.GET.get(\n REDIRECT_FIELD_NAME, ''))\n", "return django_login(request, template_name='userprofile/login.html',\n extra_context={'shibboleth_login': 'shibboleth_login' in settings.\n INSTALLED_APPS, 'mooc_login': 'social_django' in settings.\n INSTALLED_APPS, 'login_title_text': settings_text('LOGIN_TITLE_TEXT'),\n 'login_body_text': settings_text('LOGIN_BODY_TEXT'),\n 'login_button_text': settings_text('LOGIN_BUTTON_TEXT'),\n 'shibboleth_title_text': settings_text('SHIBBOLETH_TITLE_TEXT'),\n 'shibboleth_body_text': settings_text('SHIBBOLETH_BODY_TEXT'),\n 'shibboleth_button_text': settings_text('SHIBBOLETH_BUTTON_TEXT'),\n 'mooc_title_text': settings_text('MOOC_TITLE_TEXT'), 'mooc_body_text':\n settings_text('MOOC_BODY_TEXT')})\n", "if not is_safe_url(url=redirect_to, host=request.get_host()):\n", "redirect_to = resolve_url(settings.LOGIN_REDIRECT_URL)\n", "return HttpResponseRedirect(redirect_to)\n" ]
[ 0, 0, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_12(self, VAR_9, VAR_10, VAR_11, VAR_16={}):...\n", "get_and_check_project(VAR_9, VAR_11)\n", "VAR_28 = self.queryset.annotate(**annotate).get(VAR_10=pk, VAR_1=project_pk)\n", "return VAR_28\n" ]
[ "def get_and_check_task(self, request, pk, project_pk, annotate={}):...\n", "get_and_check_project(request, project_pk)\n", "task = self.queryset.annotate(**annotate).get(pk=pk, project=project_pk)\n", "return task\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_10(self):...\n", "if VAR_0 and PasswordManager.verify(self.get_argument('password')):\n", "VAR_21 = random.SystemRandom()\n", "print(\"Refused user {} (password doesn't match any in database)\".format(\n self.get_argument('name')))\n", "VAR_22 = str(VAR_21.getrandbits(128))\n", "self.redirect('/login')\n", "VAR_40 = self.get_argument('name') + '_' + VAR_22\n", "VAR_40 = VAR_40.encode()\n", "VAR_1.append(VAR_40)\n", "self.set_secure_cookie('user', VAR_40)\n", "print('Authenticated user {}'.format(self.get_argument('name')))\n", "self.redirect('/')\n" ]
[ "def post(self):...\n", "if enable_authentication and PasswordManager.verify(self.get_argument(\n", "randomGenerator = random.SystemRandom()\n", "print(\"Refused user {} (password doesn't match any in database)\".format(\n self.get_argument('name')))\n", "cookieSecret = str(randomGenerator.getrandbits(128))\n", "self.redirect('/login')\n", "authenticated_user = self.get_argument('name') + '_' + cookieSecret\n", "authenticated_user = authenticated_user.encode()\n", "authenticated_users.append(authenticated_user)\n", "self.set_secure_cookie('user', authenticated_user)\n", "print('Authenticated user {}'.format(self.get_argument('name')))\n", "self.redirect('/')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "import binascii\n", "import time\n", "from datetime import datetime\n", "from ipaddress import ip_address\n", "import flask\n", "from nyaa import email, forms, models\n", "from nyaa.extensions import db\n", "from nyaa.utils import sha1_hash\n", "from nyaa.views.users import get_activation_link, get_password_reset_link, get_serializer\n", "VAR_0 = VAR_14.current_app\n", "VAR_1 = VAR_14.Blueprint('account', __name__)\n", "@VAR_1.route('/login', methods=['GET', 'POST'])...\n", "if VAR_14.g.user:\n", "return VAR_14.redirect(FUNC_5())\n", "VAR_4 = forms.LoginForm(VAR_14.request.form)\n", "if VAR_14.request.method == 'POST' and VAR_4.validate():\n", "if VAR_0.config['MAINTENANCE_MODE'] and not VAR_0.config[\n", "return VAR_14.render_template('login.html', VAR_4=form)\n", "VAR_14.flash(VAR_14.Markup(\n '<strong>Logins are currently disabled.</strong>'), 'danger')\n", "VAR_12 = VAR_4.username.data.strip()\n", "return VAR_14.redirect(VAR_14.url_for('account.login'))\n", "VAR_13 = VAR_4.password.data\n", "VAR_3 = models.User.by_username(VAR_12)\n", "if not VAR_3:\n", "VAR_3 = models.User.by_email(VAR_12)\n", "if not VAR_3 or VAR_13 != VAR_3.password_hash:\n", "VAR_14.flash(VAR_14.Markup(\n '<strong>Login failed!</strong> Incorrect username or password.'), 'danger'\n )\n", "if VAR_3.is_banned:\n", "return VAR_14.redirect(VAR_14.url_for('account.login'))\n", "VAR_19 = models.Ban.banned(VAR_3.id, None).first().reason\n", "if VAR_3.status != models.UserStatusType.ACTIVE:\n", "VAR_20 = 'string'.format(VAR_19)\n", "VAR_14.flash(VAR_14.Markup(\n '<strong>Login failed!</strong> Account is not activated.'), 'danger')\n", "VAR_3.last_login_date = datetime.utcnow()\n", "VAR_14.flash(VAR_14.Markup(VAR_20), 'danger')\n", "return VAR_14.redirect(VAR_14.url_for('account.login'))\n", "VAR_3.last_login_ip = ip_address(VAR_14.request.remote_addr).packed\n", "return VAR_14.redirect(VAR_14.url_for('account.login'))\n", "if not VAR_0.config['MAINTENANCE_MODE']:\n", "db.session.add(VAR_3)\n", "VAR_14.g.user = VAR_3\n", "db.session.commit()\n", "VAR_14.session['user_id'] = VAR_3.id\n", "VAR_14.session.permanent = True\n", "VAR_14.session.modified = True\n", "return VAR_14.redirect(FUNC_5())\n" ]
[ "import binascii\n", "import time\n", "from datetime import datetime\n", "from ipaddress import ip_address\n", "import flask\n", "from nyaa import email, forms, models\n", "from nyaa.extensions import db\n", "from nyaa.utils import sha1_hash\n", "from nyaa.views.users import get_activation_link, get_password_reset_link, get_serializer\n", "app = flask.current_app\n", "bp = flask.Blueprint('account', __name__)\n", "@bp.route('/login', methods=['GET', 'POST'])...\n", "if flask.g.user:\n", "return flask.redirect(redirect_url())\n", "form = forms.LoginForm(flask.request.form)\n", "if flask.request.method == 'POST' and form.validate():\n", "if app.config['MAINTENANCE_MODE'] and not app.config['MAINTENANCE_MODE_LOGINS'\n", "return flask.render_template('login.html', form=form)\n", "flask.flash(flask.Markup('<strong>Logins are currently disabled.</strong>'),\n 'danger')\n", "username = form.username.data.strip()\n", "return flask.redirect(flask.url_for('account.login'))\n", "password = form.password.data\n", "user = models.User.by_username(username)\n", "if not user:\n", "user = models.User.by_email(username)\n", "if not user or password != user.password_hash:\n", "flask.flash(flask.Markup(\n '<strong>Login failed!</strong> Incorrect username or password.'), 'danger'\n )\n", "if user.is_banned:\n", "return flask.redirect(flask.url_for('account.login'))\n", "ban_reason = models.Ban.banned(user.id, None).first().reason\n", "if user.status != models.UserStatusType.ACTIVE:\n", "ban_str = (\n '<strong>Login failed!</strong> You are banned with the reason \"{0}\" If you believe that this is a mistake, contact a moderator on IRC.'\n .format(ban_reason))\n", "flask.flash(flask.Markup(\n '<strong>Login failed!</strong> Account is not activated.'), 'danger')\n", "user.last_login_date = datetime.utcnow()\n", "flask.flash(flask.Markup(ban_str), 'danger')\n", "return flask.redirect(flask.url_for('account.login'))\n", "user.last_login_ip = ip_address(flask.request.remote_addr).packed\n", "return flask.redirect(flask.url_for('account.login'))\n", "if not app.config['MAINTENANCE_MODE']:\n", "db.session.add(user)\n", "flask.g.user = user\n", "db.session.commit()\n", "flask.session['user_id'] = user.id\n", "flask.session.permanent = True\n", "flask.session.modified = True\n", "return flask.redirect(redirect_url())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Condition", "Condition", "Return'", "Assign'", "Condition", "Condition", "Return'", "Expr'", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'", "Return'", "Assign'", "Return'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.shutting_down:\n", "return\n", "self._logger.warning('Events connection dropped, attempting to reconnect')\n", "self.failed_attempts = 0\n", "self.connect_timer = QTimer()\n", "self.connect_timer.setSingleShot(True)\n", "self.connect_timer.timeout.connect(self.connect)\n", "self.connect_timer.start(500)\n" ]
[ "def on_finished(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.shutting_down:\n", "return\n", "self._logger.warning('Events connection dropped, attempting to reconnect')\n", "self.failed_attempts = 0\n", "self.connect_timer = QTimer()\n", "self.connect_timer.setSingleShot(True)\n", "self.connect_timer.timeout.connect(self.connect)\n", "self.connect_timer.start(500)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_43(self, VAR_41, VAR_43):...\n", "self[VAR_41:VAR_41 + 1] = VAR_43\n", "VAR_55 = len(VAR_43) - 1\n", "for VAR_40, (i, j) in self._names.items():\n", "if i > VAR_41:\n", "self._names[VAR_40] = i + VAR_55, j + VAR_55\n", "if i == VAR_41:\n", "self.set_name(VAR_40, i, VAR_42=i + len(items))\n" ]
[ "def insert_items(self, index, items):...\n", "self[index:index + 1] = items\n", "add = len(items) - 1\n", "for name, (i, j) in self._names.items():\n", "if i > index:\n", "self._names[name] = i + add, j + add\n", "if i == index:\n", "self.set_name(name, i, end=i + len(items))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_7(VAR_3):...\n", "if os.path.exists(VAR_3):\n", "if os.path.isdir(VAR_3):\n", "os.remove(VAR_3)\n", "os.removedirs(VAR_3)\n" ]
[ "def remove(file):...\n", "if os.path.exists(file):\n", "if os.path.isdir(file):\n", "os.remove(file)\n", "os.removedirs(file)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "\"\"\"docstring\"\"\"\n", "return True\n" ]
[ "def is_missing_default_route(self):...\n", "\"\"\"docstring\"\"\"\n", "return True\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_8(self, VAR_18, VAR_15=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_15:\n", "VAR_15 = self.uid\n", "self._client.write(json.dumps({'cmd': VAR_18, 'uid': VAR_15}).encode('utf8'\n ) + b'\\n')\n", "self._client.flush()\n", "return self._client.readline()\n" ]
[ "def _cmd(self, command, uid=None):...\n", "\"\"\"docstring\"\"\"\n", "if not uid:\n", "uid = self.uid\n", "self._client.write(json.dumps({'cmd': command, 'uid': uid}).encode('utf8') +\n b'\\n')\n", "self._client.flush()\n", "return self._client.readline()\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def __init__(self):...\n", "" ]
[ "def __init__(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "@property...\n", "return self._subworkflows.values()\n" ]
[ "@property...\n", "return self._subworkflows.values()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def __init__(self):...\n", "assert not app.config['USE_AUTH']\n" ]
[ "def __init__(self):...\n", "assert not app.config['USE_AUTH']\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assert'" ]
[ "def __init__(self, VAR_16):...\n", "self.flags = dict()\n" ]
[ "def __init__(self, value):...\n", "self.flags = dict()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_21(self):...\n", "return Java.global_javac_classpath(self.context.products)\n" ]
[ "def javac_classpath(self):...\n", "return Java.global_javac_classpath(self.context.products)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "VAR_22 = CLASS_1.get_user_by_id(VAR_3)\n", "VAR_22.accept_license_terms(VAR_21)\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "user = UserService.get_user_by_id(user_id)\n", "user.accept_license_terms(license_id)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Expr'" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "if VAR_21.USE_OPENID:\n", "VAR_52 = FUNC_3\n", "VAR_52 = FUNC_2\n", "return FUNC_4, VAR_52, FUNC_5\n" ]
[ "@classmethod...\n", "\"\"\"docstring\"\"\"\n", "if conf.USE_OPENID:\n", "cookie_auth = openid_cookie_authentication\n", "cookie_auth = gae_cookie_authentication\n", "return oauth_authentication, cookie_auth, service_to_service_authentication\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_18, VAR_19):...\n", "\"\"\"docstring\"\"\"\n", "self.auth = VAR_18\n", "self.data = None\n", "self.station_data = None\n", "self.station = VAR_19\n" ]
[ "def __init__(self, auth, station):...\n", "\"\"\"docstring\"\"\"\n", "self.auth = auth\n", "self.data = None\n", "self.station_data = None\n", "self.station = station\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_30(VAR_6):...\n", "return FUNC_7(VAR_6, 'Referrer-Policy', 'no-referrer')\n" ]
[ "def validate_no_referrer_policy(page):...\n", "return validate_security_header(page, 'Referrer-Policy', 'no-referrer')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_14(self):...\n", "\"\"\"docstring\"\"\"\n", "set_temp_root(self._ray_params.temp_dir)\n", "VAR_0.info('Process STDOUT and STDERR is being redirected to {}.'.format(\n get_logs_dir_path()))\n", "if self._redis_address is None:\n", "self.start_redis()\n", "self.start_plasma_store()\n", "self.start_monitor()\n", "self.start_raylet()\n", "self.start_raylet_monitor()\n", "if self._ray_params.include_log_monitor:\n", "self.start_log_monitor()\n", "if self._ray_params.include_webui:\n", "self.start_ui()\n" ]
[ "def start_ray_processes(self):...\n", "\"\"\"docstring\"\"\"\n", "set_temp_root(self._ray_params.temp_dir)\n", "logger.info('Process STDOUT and STDERR is being redirected to {}.'.format(\n get_logs_dir_path()))\n", "if self._redis_address is None:\n", "self.start_redis()\n", "self.start_plasma_store()\n", "self.start_monitor()\n", "self.start_raylet()\n", "self.start_raylet_monitor()\n", "if self._ray_params.include_log_monitor:\n", "self.start_log_monitor()\n", "if self._ray_params.include_webui:\n", "self.start_ui()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Condition", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_15(VAR_28, VAR_29):...\n", "VAR_29.setFormatter(logging.Formatter(VAR_26, datefmt=DATE_FORMAT))\n", "VAR_28.addHandler(VAR_29)\n" ]
[ "def add_handler(logger, handler):...\n", "handler.setFormatter(logging.Formatter(LOG_FORMAT, datefmt=DATE_FORMAT))\n", "logger.addHandler(handler)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_3(self, VAR_6):...\n", "if isinstance(VAR_6, str):\n", "VAR_6 = json.loads(VAR_6)\n", "return VAR_6\n" ]
[ "def to_python(self, value):...\n", "if isinstance(value, str):\n", "value = json.loads(value)\n", "return value\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'" ]
[ "@classmethod...\n", "if isinstance(VAR_2, CLASS_1):\n", "return VAR_2\n", "if isinstance(VAR_2, six.string_types):\n", "return VAR_1(*[FUNC_0(a) for a in VAR_2.split('.')])\n" ]
[ "@classmethod...\n", "if isinstance(path, TraversalPath):\n", "return path\n", "if isinstance(path, six.string_types):\n", "return cls(*[_split_atom(a) for a in path.split('.')])\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_6(self):...\n", "\"\"\"docstring\"\"\"\n", "self.netatmo_data.update()\n", "VAR_13 = self.netatmo_data.data.get(self.module_name)\n", "if VAR_13 is None:\n", "VAR_0.warning('No data found for %s', self.module_name)\n", "if self.type == 'temperature':\n", "self._state = STATE_UNKNOWN\n", "self._state = round(VAR_13['Temperature'], 1)\n", "if self.type == 'humidity':\n", "return\n", "self._state = VAR_13['Humidity']\n", "if self.type == 'rain':\n", "self._state = VAR_13['Rain']\n", "if self.type == 'sum_rain_1':\n", "self._state = VAR_13['sum_rain_1']\n", "if self.type == 'sum_rain_24':\n", "self._state = VAR_13['sum_rain_24']\n", "if self.type == 'noise':\n", "self._state = VAR_13['Noise']\n", "if self.type == 'co2':\n", "self._state = VAR_13['CO2']\n", "if self.type == 'pressure':\n", "self._state = round(VAR_13['Pressure'], 1)\n", "if self.type == 'battery_lvl':\n", "self._state = VAR_13['battery_vp']\n", "if self.type == 'battery_vp' and self.module_id == '6':\n", "if VAR_13['battery_vp'] >= 5590:\n", "if self.type == 'battery_vp' and self.module_id == '5':\n", "self._state = 'Full'\n", "if VAR_13['battery_vp'] >= 5180:\n", "if VAR_13['battery_vp'] >= 5500:\n", "if self.type == 'battery_vp' and self.module_id == '3':\n", "self._state = 'High'\n", "if VAR_13['battery_vp'] >= 4770:\n", "self._state = 'Full'\n", "if VAR_13['battery_vp'] >= 5000:\n", "if VAR_13['battery_vp'] >= 5640:\n", "if self.type == 'battery_vp' and self.module_id == '2':\n", "self._state = 'Medium'\n", "if VAR_13['battery_vp'] >= 4360:\n", "self._state = 'High'\n", "if VAR_13['battery_vp'] >= 4500:\n", "self._state = 'Full'\n", "if VAR_13['battery_vp'] >= 5280:\n", "if VAR_13['battery_vp'] >= 5500:\n", "if self.type == 'min_temp':\n", "self._state = 'Low'\n", "if VAR_13['battery_vp'] < 4360:\n", "self._state = 'Medium'\n", "if VAR_13['battery_vp'] >= 4000:\n", "self._state = 'High'\n", "if VAR_13['battery_vp'] >= 4920:\n", "self._state = 'Full'\n", "if VAR_13['battery_vp'] >= 5000:\n", "self._state = VAR_13['min_temp']\n", "if self.type == 'max_temp':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if VAR_13['battery_vp'] < 4000:\n", "self._state = 'Medium'\n", "if VAR_13['battery_vp'] >= 4560:\n", "self._state = 'High'\n", "if VAR_13['battery_vp'] >= 4500:\n", "self._state = VAR_13['max_temp']\n", "if self.type == 'windangle_value':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if VAR_13['battery_vp'] < 4560:\n", "self._state = 'Medium'\n", "if VAR_13['battery_vp'] >= 4000:\n", "self._state = VAR_13['WindAngle']\n", "if self.type == 'windangle':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if VAR_13['battery_vp'] < 4000:\n", "if VAR_13['WindAngle'] >= 330:\n", "if self.type == 'windstrength':\n", "self._state = 'Very Low'\n", "self._state = 'N (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 300:\n", "self._state = VAR_13['WindStrength']\n", "if self.type == 'gustangle_value':\n", "self._state = 'NW (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 240:\n", "self._state = VAR_13['GustAngle']\n", "if self.type == 'gustangle':\n", "self._state = 'W (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 210:\n", "if VAR_13['GustAngle'] >= 330:\n", "if self.type == 'guststrength':\n", "self._state = 'SW (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 150:\n", "self._state = 'N (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 300:\n", "self._state = VAR_13['GustStrength']\n", "if self.type == 'rf_status_lvl':\n", "self._state = 'S (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 120:\n", "self._state = 'NW (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 240:\n", "self._state = VAR_13['rf_status']\n", "if self.type == 'rf_status':\n", "self._state = 'SE (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 60:\n", "self._state = 'W (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 210:\n", "if VAR_13['rf_status'] >= 90:\n", "if self.type == 'wifi_status_lvl':\n", "self._state = 'E (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 30:\n", "self._state = 'SW (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 150:\n", "self._state = 'Low'\n", "if VAR_13['rf_status'] >= 76:\n", "self._state = VAR_13['wifi_status']\n", "if self.type == 'wifi_status':\n", "self._state = 'NE (%d°)' % VAR_13['WindAngle']\n", "if VAR_13['WindAngle'] >= 0:\n", "self._state = 'S (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 120:\n", "self._state = 'Medium'\n", "if VAR_13['rf_status'] >= 60:\n", "if VAR_13['wifi_status'] >= 86:\n", "self._state = 'N (%d°)' % VAR_13['WindAngle']\n", "self._state = 'SE (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 60:\n", "self._state = 'High'\n", "if VAR_13['rf_status'] <= 59:\n", "self._state = 'Low'\n", "if VAR_13['wifi_status'] >= 71:\n", "self._state = 'E (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 30:\n", "self._state = 'Full'\n", "self._state = 'Medium'\n", "if VAR_13['wifi_status'] >= 56:\n", "self._state = 'NE (%d°)' % VAR_13['GustAngle']\n", "if VAR_13['GustAngle'] >= 0:\n", "self._state = 'High'\n", "if VAR_13['wifi_status'] <= 55:\n", "self._state = 'N (%d°)' % VAR_13['GustAngle']\n", "self._state = 'Full'\n" ]
[ "def update(self):...\n", "\"\"\"docstring\"\"\"\n", "self.netatmo_data.update()\n", "data = self.netatmo_data.data.get(self.module_name)\n", "if data is None:\n", "_LOGGER.warning('No data found for %s', self.module_name)\n", "if self.type == 'temperature':\n", "self._state = STATE_UNKNOWN\n", "self._state = round(data['Temperature'], 1)\n", "if self.type == 'humidity':\n", "return\n", "self._state = data['Humidity']\n", "if self.type == 'rain':\n", "self._state = data['Rain']\n", "if self.type == 'sum_rain_1':\n", "self._state = data['sum_rain_1']\n", "if self.type == 'sum_rain_24':\n", "self._state = data['sum_rain_24']\n", "if self.type == 'noise':\n", "self._state = data['Noise']\n", "if self.type == 'co2':\n", "self._state = data['CO2']\n", "if self.type == 'pressure':\n", "self._state = round(data['Pressure'], 1)\n", "if self.type == 'battery_lvl':\n", "self._state = data['battery_vp']\n", "if self.type == 'battery_vp' and self.module_id == '6':\n", "if data['battery_vp'] >= 5590:\n", "if self.type == 'battery_vp' and self.module_id == '5':\n", "self._state = 'Full'\n", "if data['battery_vp'] >= 5180:\n", "if data['battery_vp'] >= 5500:\n", "if self.type == 'battery_vp' and self.module_id == '3':\n", "self._state = 'High'\n", "if data['battery_vp'] >= 4770:\n", "self._state = 'Full'\n", "if data['battery_vp'] >= 5000:\n", "if data['battery_vp'] >= 5640:\n", "if self.type == 'battery_vp' and self.module_id == '2':\n", "self._state = 'Medium'\n", "if data['battery_vp'] >= 4360:\n", "self._state = 'High'\n", "if data['battery_vp'] >= 4500:\n", "self._state = 'Full'\n", "if data['battery_vp'] >= 5280:\n", "if data['battery_vp'] >= 5500:\n", "if self.type == 'min_temp':\n", "self._state = 'Low'\n", "if data['battery_vp'] < 4360:\n", "self._state = 'Medium'\n", "if data['battery_vp'] >= 4000:\n", "self._state = 'High'\n", "if data['battery_vp'] >= 4920:\n", "self._state = 'Full'\n", "if data['battery_vp'] >= 5000:\n", "self._state = data['min_temp']\n", "if self.type == 'max_temp':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if data['battery_vp'] < 4000:\n", "self._state = 'Medium'\n", "if data['battery_vp'] >= 4560:\n", "self._state = 'High'\n", "if data['battery_vp'] >= 4500:\n", "self._state = data['max_temp']\n", "if self.type == 'windangle_value':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if data['battery_vp'] < 4560:\n", "self._state = 'Medium'\n", "if data['battery_vp'] >= 4000:\n", "self._state = data['WindAngle']\n", "if self.type == 'windangle':\n", "self._state = 'Very Low'\n", "self._state = 'Low'\n", "if data['battery_vp'] < 4000:\n", "if data['WindAngle'] >= 330:\n", "if self.type == 'windstrength':\n", "self._state = 'Very Low'\n", "self._state = 'N (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 300:\n", "self._state = data['WindStrength']\n", "if self.type == 'gustangle_value':\n", "self._state = 'NW (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 240:\n", "self._state = data['GustAngle']\n", "if self.type == 'gustangle':\n", "self._state = 'W (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 210:\n", "if data['GustAngle'] >= 330:\n", "if self.type == 'guststrength':\n", "self._state = 'SW (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 150:\n", "self._state = 'N (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 300:\n", "self._state = data['GustStrength']\n", "if self.type == 'rf_status_lvl':\n", "self._state = 'S (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 120:\n", "self._state = 'NW (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 240:\n", "self._state = data['rf_status']\n", "if self.type == 'rf_status':\n", "self._state = 'SE (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 60:\n", "self._state = 'W (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 210:\n", "if data['rf_status'] >= 90:\n", "if self.type == 'wifi_status_lvl':\n", "self._state = 'E (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 30:\n", "self._state = 'SW (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 150:\n", "self._state = 'Low'\n", "if data['rf_status'] >= 76:\n", "self._state = data['wifi_status']\n", "if self.type == 'wifi_status':\n", "self._state = 'NE (%d°)' % data['WindAngle']\n", "if data['WindAngle'] >= 0:\n", "self._state = 'S (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 120:\n", "self._state = 'Medium'\n", "if data['rf_status'] >= 60:\n", "if data['wifi_status'] >= 86:\n", "self._state = 'N (%d°)' % data['WindAngle']\n", "self._state = 'SE (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 60:\n", "self._state = 'High'\n", "if data['rf_status'] <= 59:\n", "self._state = 'Low'\n", "if data['wifi_status'] >= 71:\n", "self._state = 'E (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 30:\n", "self._state = 'Full'\n", "self._state = 'Medium'\n", "if data['wifi_status'] >= 56:\n", "self._state = 'NE (%d°)' % data['GustAngle']\n", "if data['GustAngle'] >= 0:\n", "self._state = 'High'\n", "if data['wifi_status'] <= 55:\n", "self._state = 'N (%d°)' % data['GustAngle']\n", "self._state = 'Full'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def __bool__(self):...\n", "return bool(self._r_item_)\n" ]
[ "def __bool__(self):...\n", "return bool(self._r_item_)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "from base import Field\n", "VAR_0 = 'id'\n", "VAR_1 = 'INT'\n", "def __init__(self, VAR_0=None, *VAR_2, **VAR_3):...\n", "super(CLASS_0, self).__init__(*VAR_2, **kwargs)\n", "def FUNC_0(self, VAR_0):...\n", "VAR_5 = 'id SERIAL PRIMARY KEY'\n", "return VAR_5\n" ]
[ "from base import Field\n", "name = 'id'\n", "TYPE = 'INT'\n", "def __init__(self, name=None, *args, **kwargs):...\n", "super(PrimaryKeyField, self).__init__(*args, **kwargs)\n", "def create_field(self, name):...\n", "field_string = 'id SERIAL PRIMARY KEY'\n", "return field_string\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "Assign'", "Assign'", "FunctionDef'", "Expr'", "FunctionDef'", "Assign'", "Return'" ]
[ "@api.require(lambda : True)...\n", "" ]
[ "@api.require(lambda : True)...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "@cached_property...\n", "return {VAR_46.attname: VAR_46 for VAR_46 in self.element_fields}\n" ]
[ "@cached_property...\n", "return {f.attname: f for f in self.element_fields}\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_7(VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_4:\n", "return\n", "VAR_1.info('Setting up admin users')\n", "VAR_14 = CONFIG_FILE\n", "if os.path.exists(VAR_14):\n", "VAR_15 = yaml.load(f)\n", "VAR_15 = {}\n", "VAR_15['users'] = VAR_15.get('users', {})\n", "VAR_15['users']['admin'] = list(VAR_4)\n", "yaml.dump(VAR_15, f)\n" ]
[ "def ensure_admins(admins):...\n", "\"\"\"docstring\"\"\"\n", "if not admins:\n", "return\n", "logger.info('Setting up admin users')\n", "config_path = CONFIG_FILE\n", "if os.path.exists(config_path):\n", "config = yaml.load(f)\n", "config = {}\n", "config['users'] = config.get('users', {})\n", "config['users']['admin'] = list(admins)\n", "yaml.dump(config, f)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_17(self):...\n", "self.first.wait()\n", "self.second.wait()\n" ]
[ "def wait(self):...\n", "self.first.wait()\n", "self.second.wait()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_11():...\n", "from core.boot import settings\n", "VAR_39 = lambda VAR_50: _stderr(VAR_50\n ) if settings.DEBUG_MODE is True else lambda VAR_50: None\n", "return VAR_39\n" ]
[ "def _stddebug_():...\n", "from core.boot import settings\n", "_stddebug = lambda x: _stderr(x\n ) if settings.DEBUG_MODE is True else lambda x: None\n", "return _stddebug\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "ImportFrom'", "Assign'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return os.path.realpath(self.home)\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return os.path.realpath(self.home)\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_28(self, VAR_5):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "VAR_18 = vimsupport.CurrentFiletypes()[0]\n", "if VAR_18 in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(VAR_18)\n", "VAR_5['syntax_keywords'] = list(syntax_parse.SyntaxKeywordsForCurrentBuffer())\n" ]
[ "def _AddSyntaxDataIfNeeded(self, extra_data):...\n", "if not self._user_options['seed_identifiers_with_syntax']:\n", "return\n", "filetype = vimsupport.CurrentFiletypes()[0]\n", "if filetype in self._filetypes_with_keywords_loaded:\n", "return\n", "self._filetypes_with_keywords_loaded.add(filetype)\n", "extra_data['syntax_keywords'] = list(syntax_parse.\n SyntaxKeywordsForCurrentBuffer())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Expr'", "Assign'" ]
[ "def FUNC_0(VAR_3):...\n", "VAR_6 = 0\n", "VAR_14, VAR_15 = getopt.getopt(VAR_3, 'b:t:o:', ['backdoor=', 'target=',\n 'outfile='])\n", "print('USAGE:\\tajar.py -b <backdoor.java> -t <target.jar> [-o <outfile.jar>]')\n", "for opt, arg in VAR_14:\n", "sys.exit(2)\n", "if opt == '-h':\n", "if (VAR_0 != None) & (VAR_1 != None):\n", "VAR_6 = 1\n", "if opt in ('-b', '--backdoor'):\n", "if VAR_6 != 1:\n", "FUNC_2()\n", "print('[!] An error ocurred:\\n')\n", "print('USAGE:\\tajar.py')\n", "VAR_0 = arg\n", "if opt in ('-t', '--target'):\n", "print('USAGE:\\tajar.py -b <backdoor.java> -t <target.jar> [-o <outfile.jar>]')\n", "for e in sys.exc_info():\n", "VAR_1 = arg\n", "if opt in ('-o', '--outfile'):\n", "print(e)\n", "VAR_2 = arg\n" ]
[ "def main(argv):...\n", "help = 0\n", "opts, args = getopt.getopt(argv, 'b:t:o:', ['backdoor=', 'target=', 'outfile=']\n )\n", "print('USAGE:\\tajar.py -b <backdoor.java> -t <target.jar> [-o <outfile.jar>]')\n", "for opt, arg in opts:\n", "sys.exit(2)\n", "if opt == '-h':\n", "if (backdoor != None) & (target != None):\n", "help = 1\n", "if opt in ('-b', '--backdoor'):\n", "if help != 1:\n", "start()\n", "print('[!] An error ocurred:\\n')\n", "print('USAGE:\\tajar.py')\n", "backdoor = arg\n", "if opt in ('-t', '--target'):\n", "print('USAGE:\\tajar.py -b <backdoor.java> -t <target.jar> [-o <outfile.jar>]')\n", "for e in sys.exc_info():\n", "target = arg\n", "if opt in ('-o', '--outfile'):\n", "print(e)\n", "outfile = arg\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "For", "Expr'", "Condition", "Condition", "Assign'", "Condition", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Condition", "Expr'", "For", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_4(self, VAR_5):...\n", "for oldg in VAR_5.get_ancestors():\n", "if oldg not in self.groups:\n", "if VAR_5 not in self.groups:\n", "self.add_group(oldg)\n", "self.groups.append(VAR_5)\n" ]
[ "def add_group(self, group):...\n", "for oldg in group.get_ancestors():\n", "if oldg not in self.groups:\n", "if group not in self.groups:\n", "self.add_group(oldg)\n", "self.groups.append(group)\n" ]
[ 0, 0, 0, 0, 1, 0 ]
[ "FunctionDef'", "For", "Condition", "Condition", "Expr'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.abspath + '.original'\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.abspath + '.original'\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_27(VAR_21):...\n", "if VAR_21.type != 'response':\n", "return False\n", "VAR_33['msg'] = VAR_21\n", "return VAR_21.request_seq == VAR_13\n" ]
[ "def match(msg):...\n", "if msg.type != 'response':\n", "return False\n", "result['msg'] = msg\n", "return msg.request_seq == seq\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Return'" ]
[ "def FUNC_9(self, VAR_5, VAR_6, VAR_24, VAR_27=0, VAR_26=None, VAR_28=None,...\n", "\"\"\"docstring\"\"\"\n", "if VAR_13 is None:\n", "VAR_13 = {}\n", "VAR_39 = []\n", "VAR_58 = super(CLASS_0, self).search(VAR_5, VAR_6, VAR_24, VAR_27, VAR_26,\n VAR_28, VAR_13, VAR_29)\n", "if VAR_13.get('budget_id'):\n", "VAR_63 = self.pool.get('budget.budget')\n", "VAR_39 = VAR_58\n", "VAR_64 = VAR_63.browse(VAR_5, VAR_6, VAR_13['budget_id'], VAR_13=context)\n", "return VAR_39\n", "VAR_65 = self.get_sub_items(VAR_5, [VAR_64.budget_item_id.id])\n", "VAR_39.extend([VAR_14 for VAR_14 in VAR_58 if VAR_14 in VAR_65])\n" ]
[ "def search(self, cr, uid, args, offset=0, limit=None, order=None, context=...\n", "\"\"\"docstring\"\"\"\n", "if context is None:\n", "context = {}\n", "result = []\n", "parent_result = super(budget_item, self).search(cr, uid, args, offset,\n limit, order, context, count)\n", "if context.get('budget_id'):\n", "budget_obj = self.pool.get('budget.budget')\n", "result = parent_result\n", "budget = budget_obj.browse(cr, uid, context['budget_id'], context=context)\n", "return result\n", "allowed_items = self.get_sub_items(cr, [budget.budget_item_id.id])\n", "result.extend([item for item in parent_result if item in allowed_items])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "Assign'", "Expr'" ]
[ "def FUNC_5(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_1 = self.bindings\n", "VAR_6 = VAR_1['TEST_APP_COMPONENT_NAME']\n", "VAR_7 = '{0}/targetPools/{1}-tp'.format(VAR_1['TEST_GCE_REGION'], VAR_6)\n", "VAR_8 = {'checkIntervalSec': 9, 'healthyThreshold': 3, 'unhealthyThreshold':\n 5, 'timeoutSec': 2, 'port': 80}\n", "VAR_9 = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'provider': 'gce', 'stack': bindings['TEST_STACK'], 'detail':\n bindings['TEST_COMPONENT_DETAIL'], 'credentials': bindings[\n 'GCE_CREDENTIALS'], 'region': bindings['TEST_GCE_REGION'], 'ipProtocol':\n 'TCP', 'portRange': spec['port'], 'loadBalancerName':\n load_balancer_name, 'healthCheck': {'port': spec['port'], 'timeoutSec':\n spec['timeoutSec'], 'checkIntervalSec': spec['checkIntervalSec'],\n 'healthyThreshold': spec['healthyThreshold'], 'unhealthyThreshold':\n spec['unhealthyThreshold']}, 'type': 'upsertLoadBalancer',\n 'availabilityZones': {bindings['TEST_GCE_REGION']: []}, 'user':\n '[anonymous]'}], description='Create Load Balancer: ' +\n load_balancer_name, application=self.TEST_APP)\n", "VAR_10 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_10.new_clause_builder('Health Check Added', retryable_for_secs=30\n ).list_resources('http-health-checks').contains_pred_list([jc.\n PathContainsPredicate('name', '%s-hc' % VAR_6), jc.DICT_SUBSET(VAR_8)])\n", "VAR_10.new_clause_builder('Target Pool Added', retryable_for_secs=30\n ).list_resources('target-pools').contains_path_value('name', '%s-tp' %\n VAR_6)\n", "VAR_10.new_clause_builder('Forwarding Rules Added', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', VAR_6), jc.PathContainsPredicate('target',\n VAR_7)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_load_balancer', data=payload, path='tasks'), VAR_5=builder.build())\n" ]
[ "def upsert_load_balancer(self):...\n", "\"\"\"docstring\"\"\"\n", "bindings = self.bindings\n", "load_balancer_name = bindings['TEST_APP_COMPONENT_NAME']\n", "target_pool_name = '{0}/targetPools/{1}-tp'.format(bindings[\n 'TEST_GCE_REGION'], load_balancer_name)\n", "spec = {'checkIntervalSec': 9, 'healthyThreshold': 3, 'unhealthyThreshold':\n 5, 'timeoutSec': 2, 'port': 80}\n", "payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'provider': 'gce', 'stack': bindings['TEST_STACK'], 'detail':\n bindings['TEST_COMPONENT_DETAIL'], 'credentials': bindings[\n 'GCE_CREDENTIALS'], 'region': bindings['TEST_GCE_REGION'], 'ipProtocol':\n 'TCP', 'portRange': spec['port'], 'loadBalancerName':\n load_balancer_name, 'healthCheck': {'port': spec['port'], 'timeoutSec':\n spec['timeoutSec'], 'checkIntervalSec': spec['checkIntervalSec'],\n 'healthyThreshold': spec['healthyThreshold'], 'unhealthyThreshold':\n spec['unhealthyThreshold']}, 'type': 'upsertLoadBalancer',\n 'availabilityZones': {bindings['TEST_GCE_REGION']: []}, 'user':\n '[anonymous]'}], description='Create Load Balancer: ' +\n load_balancer_name, application=self.TEST_APP)\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Health Check Added', retryable_for_secs=30\n ).list_resources('http-health-checks').contains_pred_list([jc.\n PathContainsPredicate('name', '%s-hc' % load_balancer_name), jc.\n DICT_SUBSET(spec)])\n", "builder.new_clause_builder('Target Pool Added', retryable_for_secs=30\n ).list_resources('target-pools').contains_path_value('name', '%s-tp' %\n load_balancer_name)\n", "builder.new_clause_builder('Forwarding Rules Added', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_pred_list([jc.\n PathContainsPredicate('name', load_balancer_name), jc.\n PathContainsPredicate('target', target_pool_name)])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_load_balancer', data=payload, path='tasks'), contract=builder.\n build())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def __gt__(self, VAR_16):...\n", "VAR_39 = self.workflow._ruleorder.compare(self, VAR_16)\n", "return VAR_39 > 0\n" ]
[ "def __gt__(self, rule):...\n", "comp = self.workflow._ruleorder.compare(self, rule)\n", "return comp > 0\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_16(self, VAR_1):...\n", "VAR_23 = self._validated_binaries.get(VAR_1)\n", "if not VAR_23:\n", "VAR_23 = self._validate_executable(VAR_1)\n", "return VAR_23\n", "self._validated_binaries[VAR_1] = VAR_23\n" ]
[ "def _validated_executable(self, name):...\n", "exe = self._validated_binaries.get(name)\n", "if not exe:\n", "exe = self._validate_executable(name)\n", "return exe\n", "self._validated_binaries[name] = exe\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_2(VAR_1, VAR_2):...\n", "" ]
[ "def queryAll(cursor, reqString):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_4(self):...\n", "return VAR_15['user']\n" ]
[ "def current_user(self):...\n", "return session['user']\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_20(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = VAR_21.rstrip('/')\n", "VAR_60 = os.path.basename(VAR_21)\n", "VAR_61 = os.path.dirname(VAR_21)\n", "VAR_58 = self.getfile(VAR_21, VAR_23=False)\n", "if VAR_58 == False:\n", "if VAR_58[VAR_2] != VAR_12:\n", "if len(self.get_path(VAR_21)) > 0:\n", "VAR_62 = self.get_path(VAR_61, VAR_23=True)\n", "for i in VAR_62[:]:\n", "if i[VAR_1] == VAR_60:\n", "return False\n", "VAR_62.remove(i)\n", "return True\n" ]
[ "def rmdir(self, path):...\n", "\"\"\"docstring\"\"\"\n", "path = path.rstrip('/')\n", "name = os.path.basename(path)\n", "parent = os.path.dirname(path)\n", "dir = self.getfile(path, follow_symlinks=False)\n", "if dir == False:\n", "if dir[A_TYPE] != T_DIR:\n", "if len(self.get_path(path)) > 0:\n", "pdir = self.get_path(parent, follow_symlinks=True)\n", "for i in pdir[:]:\n", "if i[A_NAME] == name:\n", "return False\n", "pdir.remove(i)\n", "return True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Condition", "Assign'", "For", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_2, *VAR_3, **VAR_4):...\n", "self.storage.clear_passphrases()\n", "return super().get(VAR_2, *VAR_3, **kwargs)\n" ]
[ "def get(self, request, *args, **kwargs):...\n", "self.storage.clear_passphrases()\n", "return super().get(request, *args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Return'" ]
[ "def FUNC_11(self, VAR_9):...\n", "\"\"\"docstring\"\"\"\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n", "self._adapter = DebugAdapter.start(VAR_9, VAR_2=self._port)\n", "return self._adapter\n" ]
[ "def start_detached(self, argv):...\n", "\"\"\"docstring\"\"\"\n", "if self.closed:\n", "if self._adapter is not None:\n", "assert self._session is None\n", "self._adapter = DebugAdapter.start(argv, port=self._port)\n", "return self._adapter\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Assert'", "Assign'", "Return'" ]
[ "@memoized_property...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = self.get_binary_path_from_tgz(VAR_10=self._relpath, VAR_6=self.\n version, VAR_11='node.tar.gz', VAR_12='node')\n", "VAR_0.debug('Node path: %s', VAR_21)\n", "return VAR_21\n" ]
[ "@memoized_property...\n", "\"\"\"docstring\"\"\"\n", "node_path = self.get_binary_path_from_tgz(supportdir=self._relpath, version\n =self.version, filename='node.tar.gz', inpackage_path='node')\n", "logger.debug('Node path: %s', node_path)\n", "return node_path\n" ]
[ 2, 0, 2, 2, 2 ]
[ "Condition", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_4(self):...\n", "if len(self.written):\n", "return self.written[0]\n" ]
[ "def getWrittenData(self):...\n", "if len(self.written):\n", "return self.written[0]\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "async def FUNC_5(self):...\n", "for key in (VAR_2, VAR_1):\n", "await FUNC_5(key % self.post_id)\n" ]
[ "async def clear_mc(self):...\n", "for key in (MC_KEY_N_COMMENTS, MC_KEY_COMMENT_LIST):\n", "await clear_mc(key % self.post_id)\n" ]
[ 0, 0, 0 ]
[ "AsyncFunctionDef'", "For", "Expr'" ]
[ "def FUNC_11(self, VAR_9, VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_14 = None\n", "def FUNC_15():...\n", "if VAR_14 not in self._timers:\n", "return\n", "self._timers.remove(VAR_14)\n", "VAR_10()\n", "logging.exception('Timer callback failed')\n", "if not self._timers_dying:\n", "VAR_14 = threading.Timer(VAR_9, FUNC_15)\n", "self._timers.append(VAR_14)\n", "VAR_14.daemon = True\n", "VAR_14.start()\n" ]
[ "def call_later(self, delay_sec, callback):...\n", "\"\"\"docstring\"\"\"\n", "timer = None\n", "def call_wrapper():...\n", "if timer not in self._timers:\n", "return\n", "self._timers.remove(timer)\n", "callback()\n", "logging.exception('Timer callback failed')\n", "if not self._timers_dying:\n", "timer = threading.Timer(delay_sec, call_wrapper)\n", "self._timers.append(timer)\n", "timer.daemon = True\n", "timer.start()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "FunctionDef'", "Condition", "Return'", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_31(VAR_1, VAR_16):...\n", "VAR_30 = VAR_1.xsrf_token_data == {'some': 'data'}\n", "VAR_12.append((VAR_16, VAR_30))\n" ]
[ "def record(request_handler, method):...\n", "is_valid = request_handler.xsrf_token_data == {'some': 'data'}\n", "calls.append((method, is_valid))\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_9(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "VAR_3 = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'delete', VAR_3['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_snapshot(VAR_3)\n" ]
[ "def test_delete_snapshot(self):...\n", "self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n", "snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n", "self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot', 'delete', snapshot['name'])\n", "self.mox.ReplayAll()\n", "self.driver.delete_snapshot(snapshot)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_3, **VAR_6):...\n", "logging.warn('url_read_json(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n", "if not self._requests:\n", "return None\n", "VAR_6.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == VAR_3:\n", "self.fail('Unknown request %s' % VAR_3)\n", "VAR_9 = self._requests.pop(i)\n", "if len(VAR_9) != 3:\n", "self.fail('Expected json request, got normal data; %s' % VAR_3)\n", "VAR_10, VAR_11, VAR_12 = VAR_9\n", "if callable(VAR_11):\n", "VAR_11(VAR_6)\n", "self.assertEqual(VAR_11, VAR_6)\n", "if VAR_12 is not None:\n", "return VAR_12\n", "return None\n" ]
[ "def _url_read_json(self, url, **kwargs):...\n", "logging.warn('url_read_json(%s, %s)', url[:500], str(kwargs)[:500])\n", "if not self._requests:\n", "return None\n", "kwargs.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == url:\n", "self.fail('Unknown request %s' % url)\n", "data = self._requests.pop(i)\n", "if len(data) != 3:\n", "self.fail('Expected json request, got normal data; %s' % url)\n", "_, expected_kwargs, result = data\n", "if callable(expected_kwargs):\n", "expected_kwargs(kwargs)\n", "self.assertEqual(expected_kwargs, kwargs)\n", "if result is not None:\n", "return result\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Return'", "Expr'", "For", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Return'", "Return'" ]
[ "def FUNC_3(self, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6, VAR_7, VAR_8 = self.redis_client.hmget(VAR_2, ['driver_id',\n 'function', 'run_on_other_drivers'])\n", "if utils.decode(VAR_8\n", "return\n", "VAR_10 = pickle.loads(VAR_7)\n", "VAR_11 = traceback.format_exc()\n", "VAR_10({'worker': self.worker})\n", "utils.push_error_to_driver(self.worker, ray_constants.\n FUNCTION_TO_RUN_PUSH_ERROR, VAR_11, VAR_6=ray.DriverID(driver_id))\n" ]
[ "def fetch_and_execute_function_to_run(self, key):...\n", "\"\"\"docstring\"\"\"\n", "driver_id, serialized_function, run_on_other_drivers = self.redis_client.hmget(\n key, ['driver_id', 'function', 'run_on_other_drivers'])\n", "if utils.decode(run_on_other_drivers\n", "return\n", "function = pickle.loads(serialized_function)\n", "traceback_str = traceback.format_exc()\n", "function({'worker': self.worker})\n", "utils.push_error_to_driver(self.worker, ray_constants.\n FUNCTION_TO_RUN_PUSH_ERROR, traceback_str, driver_id=ray.DriverID(\n driver_id))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def __init__(self):...\n", "super(CLASS_0, self).__init__()\n" ]
[ "def __init__(self):...\n", "super(Code, self).__init__()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_9(self, VAR_13):...\n", "if not VAR_13:\n" ]
[ "def p_error(self, p):...\n", "if not p:\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(VAR_5, VAR_6):...\n", "return db.fetchone(VAR_5, CLASS_0,\n f'SELECT note_id, user_id, content, created_at, updated_at FROM note WHERE note_id = {VAR_6}'\n , ())\n" ]
[ "def _find_note(cur, note_id):...\n", "return db.fetchone(cur, Note,\n f'SELECT note_id, user_id, content, created_at, updated_at FROM note WHERE note_id = {note_id}'\n , ())\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Return'" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed('string', VAR_2=\n 'If you get a red screen trying to open the Homebrew Launcher')\n" ]
[ "@commands.command()...\n", "\"\"\"docstring\"\"\"\n", "await self.simple_embed(\n \"\"\"A red screen indicates that there is no boot.3dsx on root.\nIf you have a starter folder on root, place the contents of the starter folder on root.\nIf not, redownload the [Homebrew Starter Kit](https://smealum.github.io/ninjhax2/starter.zip) and place the contents of the starter folder inside the .zip on root.\"\"\"\n , title='If you get a red screen trying to open the Homebrew Launcher')\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'" ]
[ "def FUNC_4(self, VAR_3, **VAR_6):...\n", "logging.warn('url_open(%s, %s)', VAR_3[:500], str(VAR_6)[:500])\n", "if not self._requests:\n", "return None\n", "VAR_6.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == VAR_3:\n", "self.fail('Unknown request %s' % VAR_3)\n", "VAR_9 = self._requests.pop(i)\n", "if len(VAR_9) != 4:\n", "self.fail('Expected normal request, got json data; %s' % VAR_3)\n", "VAR_10, VAR_11, VAR_12, VAR_4 = VAR_9\n", "if callable(VAR_11):\n", "VAR_11(VAR_6)\n", "self.assertEqual(VAR_11, VAR_6)\n", "if VAR_12 is not None:\n", "return FUNC_0(VAR_12, VAR_3, VAR_4)\n", "return None\n" ]
[ "def _url_open(self, url, **kwargs):...\n", "logging.warn('url_open(%s, %s)', url[:500], str(kwargs)[:500])\n", "if not self._requests:\n", "return None\n", "kwargs.pop('stream', None)\n", "for i, n in enumerate(self._requests):\n", "if n[0] == url:\n", "self.fail('Unknown request %s' % url)\n", "data = self._requests.pop(i)\n", "if len(data) != 4:\n", "self.fail('Expected normal request, got json data; %s' % url)\n", "_, expected_kwargs, result, headers = data\n", "if callable(expected_kwargs):\n", "expected_kwargs(kwargs)\n", "self.assertEqual(expected_kwargs, kwargs)\n", "if result is not None:\n", "return make_fake_response(result, url, headers)\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Return'", "Expr'", "For", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(self, VAR_1, VAR_9, VAR_11=None):...\n", "VAR_11 = deepcopy(self.content.data)\n", "VAR_19 = VAR_11['module_index']\n", "VAR_20 = VAR_11['exercise_index']\n", "VAR_21 = VAR_11['modules']\n", "VAR_22 = VAR_11['categories']\n", "VAR_23 = VAR_11['total']\n", "def FUNC_7(VAR_24):...\n", "for VAR_27 in VAR_24:\n", "if VAR_27['submittable']:\n", "for VAR_28 in VAR_21:\n", "VAR_27.update({'submission_count': 0, 'submissions': [], 'best_submission':\n None, 'points': 0, 'passed': VAR_27['points_to_pass'] == 0, 'graded': \n False, 'unofficial': False})\n", "FUNC_7(VAR_27.get('children'))\n", "VAR_28.update({'submission_count': 0, 'points': 0, 'points_by_difficulty':\n {}, 'unconfirmed_points_by_difficulty': {}, 'passed': VAR_28[\n 'points_to_pass'] == 0})\n", "for VAR_27 in VAR_22.values():\n", "FUNC_7(VAR_28['children'])\n", "VAR_27.update({'submission_count': 0, 'points': 0, 'points_by_difficulty':\n {}, 'unconfirmed_points_by_difficulty': {}, 'passed': VAR_27[\n 'points_to_pass'] == 0})\n", "VAR_23.update({'submission_count': 0, 'points': 0, 'points_by_difficulty':\n {}, 'unconfirmed_points_by_difficulty': {}})\n", "if VAR_9.is_authenticated():\n", "VAR_30 = VAR_9.userprofile.submissions.exclude_errors().filter(\n exercise__course_module__course_instance=instance).prefetch_related(\n 'exercise').only('id', 'exercise', 'submission_time', 'status', 'grade')\n", "def FUNC_8(VAR_25, VAR_24):...\n", "for VAR_40 in VAR_30:\n", "for VAR_27 in VAR_24:\n", "VAR_39 = self._by_idx(VAR_21, VAR_20[VAR_40.exercise.id])\n", "self.dirty = True\n", "VAR_27 = VAR_39[-1]\n", "if VAR_27['submittable'] and VAR_27['confirm_the_level'] and VAR_27['passed']:\n", "for VAR_28 in VAR_21:\n", "VAR_27['submission_count'] += 1 if not VAR_40.status in (Submission.STATUS.\n ERROR, Submission.STATUS.UNOFFICIAL) else 0\n", "if 'unconfirmed' in VAR_25:\n", "FUNC_8(VAR_27, VAR_27.get('children', []))\n", "FUNC_8(VAR_28, VAR_28['children'])\n", "def FUNC_9(VAR_26, VAR_27):...\n", "VAR_37 = VAR_40.status == Submission.STATUS.UNOFFICIAL\n", "for child in VAR_25.get('children', []):\n", "VAR_26['submission_count'] += VAR_27['submission_count']\n", "VAR_27['submissions'].append({'id': VAR_40.id, 'max_points': VAR_27[\n 'max_points'], 'points_to_pass': VAR_27['points_to_pass'],\n 'confirm_the_level': VAR_27.get('confirm_the_level', False),\n 'submission_count': 1, 'points': VAR_40.grade, 'graded': VAR_40.\n is_graded, 'passed': VAR_40.grade >= VAR_27['points_to_pass'],\n 'submission_status': VAR_40.status if not VAR_40.is_graded else False,\n 'unofficial': VAR_37, 'date': VAR_40.submission_time, 'url': VAR_40.\n get_url('submission-plain')})\n", "if 'unconfirmed' in child:\n", "if VAR_27.get('unofficial', False):\n", "if VAR_40.status == Submission.STATUS.READY and (VAR_27['unofficial'] or \n", "if VAR_27.get('unconfirmed', False):\n", "def FUNC_10(VAR_28, VAR_25, VAR_24):...\n", "VAR_27.update({'best_submission': VAR_40.id, 'points': VAR_40.grade,\n 'passed': not VAR_37 and VAR_40.grade >= VAR_27['points_to_pass'],\n 'graded': VAR_40.status == Submission.STATUS.READY, 'unofficial': VAR_37})\n", "if VAR_40.notifications.count() > 0:\n", "self._add_by_difficulty(VAR_26['unconfirmed_points_by_difficulty'], VAR_27[\n 'difficulty'], VAR_27['points'])\n", "VAR_26['points'] += VAR_27['points']\n", "VAR_31 = True\n", "VAR_27['notified'] = True\n", "self._add_by_difficulty(VAR_26['points_by_difficulty'], VAR_27['difficulty'\n ], VAR_27['points'])\n", "VAR_32 = 0\n", "if VAR_40.notifications.filter(seen=False).count() > 0:\n", "VAR_30 = 0\n", "VAR_27['unseen'] = True\n", "VAR_33 = 0\n", "VAR_34 = None\n", "for VAR_27 in VAR_24:\n", "if VAR_27['submittable']:\n", "if VAR_34 and VAR_30 > 0:\n", "if VAR_27['confirm_the_level']:\n", "VAR_31 = FUNC_10(VAR_28, VAR_27, VAR_27.get('children', [])) and VAR_31\n", "VAR_34['confirmable_points'] = True\n", "if VAR_25 and not VAR_25['submittable']:\n", "VAR_34 = VAR_27\n", "VAR_31 = VAR_31 and VAR_27['passed']\n", "VAR_25['max_points'] = VAR_32\n", "return VAR_31\n", "VAR_32 += VAR_27['max_points']\n", "VAR_25['submission_count'] = VAR_30\n", "VAR_30 += VAR_27['submission_count']\n", "VAR_25['points'] = VAR_33\n", "if VAR_27['graded']:\n", "VAR_33 += VAR_27['points']\n", "FUNC_9(VAR_28, VAR_27)\n", "FUNC_9(VAR_22[VAR_27['category_id']], VAR_27)\n", "FUNC_9(VAR_23, VAR_27)\n" ]
[ "def _generate_data(self, instance, user, data=None):...\n", "data = deepcopy(self.content.data)\n", "module_index = data['module_index']\n", "exercise_index = data['exercise_index']\n", "modules = data['modules']\n", "categories = data['categories']\n", "total = data['total']\n", "def r_augment(children):...\n", "for entry in children:\n", "if entry['submittable']:\n", "for module in modules:\n", "entry.update({'submission_count': 0, 'submissions': [], 'best_submission':\n None, 'points': 0, 'passed': entry['points_to_pass'] == 0, 'graded': \n False, 'unofficial': False})\n", "r_augment(entry.get('children'))\n", "module.update({'submission_count': 0, 'points': 0, 'points_by_difficulty':\n {}, 'unconfirmed_points_by_difficulty': {}, 'passed': module[\n 'points_to_pass'] == 0})\n", "for entry in categories.values():\n", "r_augment(module['children'])\n", "entry.update({'submission_count': 0, 'points': 0, 'points_by_difficulty': {\n }, 'unconfirmed_points_by_difficulty': {}, 'passed': entry[\n 'points_to_pass'] == 0})\n", "total.update({'submission_count': 0, 'points': 0, 'points_by_difficulty': {\n }, 'unconfirmed_points_by_difficulty': {}})\n", "if user.is_authenticated():\n", "submissions = user.userprofile.submissions.exclude_errors().filter(\n exercise__course_module__course_instance=instance).prefetch_related(\n 'exercise').only('id', 'exercise', 'submission_time', 'status', 'grade')\n", "def r_check(parent, children):...\n", "for submission in submissions:\n", "for entry in children:\n", "tree = self._by_idx(modules, exercise_index[submission.exercise.id])\n", "self.dirty = True\n", "entry = tree[-1]\n", "if entry['submittable'] and entry['confirm_the_level'] and entry['passed']:\n", "for module in modules:\n", "entry['submission_count'] += 1 if not submission.status in (Submission.\n STATUS.ERROR, Submission.STATUS.UNOFFICIAL) else 0\n", "if 'unconfirmed' in parent:\n", "r_check(entry, entry.get('children', []))\n", "r_check(module, module['children'])\n", "def add_to(target, entry):...\n", "unofficial = submission.status == Submission.STATUS.UNOFFICIAL\n", "for child in parent.get('children', []):\n", "target['submission_count'] += entry['submission_count']\n", "entry['submissions'].append({'id': submission.id, 'max_points': entry[\n 'max_points'], 'points_to_pass': entry['points_to_pass'],\n 'confirm_the_level': entry.get('confirm_the_level', False),\n 'submission_count': 1, 'points': submission.grade, 'graded': submission\n .is_graded, 'passed': submission.grade >= entry['points_to_pass'],\n 'submission_status': submission.status if not submission.is_graded else\n False, 'unofficial': unofficial, 'date': submission.submission_time,\n 'url': submission.get_url('submission-plain')})\n", "if 'unconfirmed' in child:\n", "if entry.get('unofficial', False):\n", "if submission.status == Submission.STATUS.READY and (entry['unofficial'] or\n", "if entry.get('unconfirmed', False):\n", "def r_collect(module, parent, children):...\n", "entry.update({'best_submission': submission.id, 'points': submission.grade,\n 'passed': not unofficial and submission.grade >= entry['points_to_pass'\n ], 'graded': submission.status == Submission.STATUS.READY, 'unofficial':\n unofficial})\n", "if submission.notifications.count() > 0:\n", "self._add_by_difficulty(target['unconfirmed_points_by_difficulty'], entry[\n 'difficulty'], entry['points'])\n", "target['points'] += entry['points']\n", "passed = True\n", "entry['notified'] = True\n", "self._add_by_difficulty(target['points_by_difficulty'], entry['difficulty'],\n entry['points'])\n", "max_points = 0\n", "if submission.notifications.filter(seen=False).count() > 0:\n", "submissions = 0\n", "entry['unseen'] = True\n", "points = 0\n", "confirm_entry = None\n", "for entry in children:\n", "if entry['submittable']:\n", "if confirm_entry and submissions > 0:\n", "if entry['confirm_the_level']:\n", "passed = r_collect(module, entry, entry.get('children', [])) and passed\n", "confirm_entry['confirmable_points'] = True\n", "if parent and not parent['submittable']:\n", "confirm_entry = entry\n", "passed = passed and entry['passed']\n", "parent['max_points'] = max_points\n", "return passed\n", "max_points += entry['max_points']\n", "parent['submission_count'] = submissions\n", "submissions += entry['submission_count']\n", "parent['points'] = points\n", "if entry['graded']:\n", "points += entry['points']\n", "add_to(module, entry)\n", "add_to(categories[entry['category_id']], entry)\n", "add_to(total, entry)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "For", "Condition", "For", "Expr'", "Expr'", "Expr'", "For", "Expr'", "Expr'", "Expr'", "Condition", "Assign'", "FunctionDef'", "For", "For", "Assign'", "Assign'", "Assign'", "Condition", "For", "AugAssign'", "Condition", "Expr'", "Expr'", "FunctionDef'", "Assign'", "For", "AugAssign'", "Expr'", "Condition", "Condition", "Condition", "Condition", "FunctionDef'", "Expr'", "Condition", "Expr'", "AugAssign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Condition", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Return'", "AugAssign'", "Assign'", "AugAssign'", "Assign'", "Condition", "AugAssign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_4(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n" ]
[ "def test_filters_2(self):...\n", "self.assertFalse({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters=[{'name': ['like', 'J%']}]))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@renderer...\n", "if self._error_msg is not None:\n", "return VAR_8(self._error_msg)\n", "return VAR_8('')\n" ]
[ "@renderer...\n", "if self._error_msg is not None:\n", "return tag(self._error_msg)\n", "return tag('')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_3(VAR_6):...\n", "for settings_key in VAR_12:\n", "assert VAR_5.registry.settings.get(settings_key)\n" ]
[ "def assert_settings_keys(keys):...\n", "for settings_key in key:\n", "assert config.registry.settings.get(settings_key)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "For", "Assert'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self._name\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_22(self, VAR_29, VAR_12):...\n", "return self.account_for(VAR_12).mail_store.add_mail('INBOX', VAR_29.raw)\n" ]
[ "def add_mail_to_user_inbox(self, input_mail, username):...\n", "return self.account_for(username).mail_store.add_mail('INBOX', input_mail.raw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_33):...\n", "self.literal = VAR_33\n" ]
[ "def __init__(self, literal):...\n", "self.literal = literal\n" ]
[ 0, 4 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_15(VAR_28, VAR_29):...\n", "VAR_29.setFormatter(logging.Formatter(VAR_26, datefmt=DATE_FORMAT))\n", "VAR_28.addHandler(VAR_29)\n" ]
[ "def add_handler(logger, handler):...\n", "handler.setFormatter(logging.Formatter(LOG_FORMAT, datefmt=DATE_FORMAT))\n", "logger.addHandler(handler)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_8(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertTrue(self.client.login(username='autotest2', password='password'))\n", "VAR_4 = 'autotest'\n", "VAR_2 = '/api/apps'\n", "VAR_5 = {'id': VAR_4}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "VAR_2 = '/api/apps/{}'.format(VAR_4)\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 200)\n", "VAR_2 = '/api/apps/{app_id}/logs'.format(**locals())\n", "VAR_3 = self.client.get(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertIn('autotest2 created initial release', VAR_3.data)\n", "VAR_2 = '/api/apps/{app_id}/run'.format(**locals())\n", "VAR_5 = {'command': 'ls -al'}\n", "VAR_3 = self.client.post(VAR_2, json.dumps(VAR_5), content_type=\n 'application/json')\n", "self.assertEqual(VAR_3.status_code, 200)\n", "self.assertEqual(VAR_3.data[0], 0)\n", "VAR_2 = '/api/apps/{}'.format(VAR_4)\n", "VAR_3 = self.client.delete(VAR_2)\n", "self.assertEqual(VAR_3.status_code, 204)\n" ]
[ "def test_admin_can_manage_other_apps(self):...\n", "\"\"\"docstring\"\"\"\n", "self.assertTrue(self.client.login(username='autotest2', password='password'))\n", "app_id = 'autotest'\n", "url = '/api/apps'\n", "body = {'id': app_id}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n", "url = '/api/apps/{}'.format(app_id)\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "url = '/api/apps/{app_id}/logs'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertIn('autotest2 created initial release', response.data)\n", "url = '/api/apps/{app_id}/run'.format(**locals())\n", "body = {'command': 'ls -al'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(response.data[0], 0)\n", "url = '/api/apps/{}'.format(app_id)\n", "response = self.client.delete(url)\n", "self.assertEqual(response.status_code, 204)\n" ]
[ 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_7(**VAR_6):...\n", "VAR_30 = 1\n", "VAR_30 = VAR_6.get('level')\n", "if not FUNC_6(VAR_29=give_level):\n", "print(\n '<center><h3 style=\"color: red\">How did you get here?! O_o You do not have need permissions</h>'\n )\n", "print('<meta http-equiv=\"refresh\" content=\"5; url=/\">')\n", "import sys\n", "sys.exit()\n" ]
[ "def page_for_admin(**kwargs):...\n", "give_level = 1\n", "give_level = kwargs.get('level')\n", "if not is_admin(level=give_level):\n", "print(\n '<center><h3 style=\"color: red\">How did you get here?! O_o You do not have need permissions</h>'\n )\n", "print('<meta http-equiv=\"refresh\" content=\"5; url=/\">')\n", "import sys\n", "sys.exit()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Expr'", "Expr'", "Import'", "Expr'" ]
[ "@web.authenticated...\n", "self.get(VAR_1, VAR_2=False)\n" ]
[ "@web.authenticated...\n", "self.get(path, include_body=False)\n" ]
[ 0, 5 ]
[ "Condition", "Expr'" ]
[ "def FUNC_0(VAR_1, VAR_2=None):...\n", "return CLASS_3(VAR_1, VAR_2=_raise)\n" ]
[ "def r(item, _raise=None):...\n", "return Roamer(item, _raise=_raise)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_24(VAR_25, VAR_23, *VAR_24):...\n", "if VAR_23 == 'on_after_task':\n", "VAR_50, VAR_51, VAR_5, VAR_52 = VAR_24\n", "self.assertEqual(False, VAR_50)\n", "self.assertEqual(True, VAR_51)\n", "self.assertEqual({'pool': 'default'}, VAR_5)\n", "self.assertEqual({}, VAR_52)\n" ]
[ "def call_hook(_botobj, name, *args):...\n", "if name == 'on_after_task':\n", "failure, internal_failure, dimensions, summary = args\n", "self.assertEqual(False, failure)\n", "self.assertEqual(True, internal_failure)\n", "self.assertEqual({'pool': 'default'}, dimensions)\n", "self.assertEqual({}, summary)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "if self.column.render_function:\n", "return self.column.render_function(self.object)\n", "VAR_10 = getattr(self.object, self.column.field_name\n ) if self.column.field_name else None\n", "if type(self.object) == dict:\n", "VAR_4 = self.object.get(self.column.field_name)\n", "if callable(VAR_10):\n", "return escape(VAR_4)\n", "VAR_4 = VAR_10() if getattr(VAR_10, 'do_not_call_in_templates', False\n ) else VAR_10\n", "VAR_27 = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n", "VAR_4 = VAR_27() if VAR_27 else VAR_10\n" ]
[ "def get_value(self):...\n", "if self.column.render_function:\n", "return self.column.render_function(self.object)\n", "field = getattr(self.object, self.column.field_name\n ) if self.column.field_name else None\n", "if type(self.object) == dict:\n", "value = self.object.get(self.column.field_name)\n", "if callable(field):\n", "return escape(value)\n", "value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n", "display_function = getattr(self.object, 'get_%s_display' % self.column.\n field_name, False)\n", "value = display_function() if display_function else field\n" ]
[ 0, 0, 3, 0, 3, 0, 0, 3, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'" ]
[ "@classmethod...\n", "if VAR_3 is None:\n", "VAR_3 = VAR_2.HOST, VAR_2.PORT\n", "VAR_12 = CLASS_0.create_client(VAR_3, VAR_6=kwargs.get('timeout'))\n", "return VAR_2(VAR_12, VAR_15=True, **kwargs)\n" ]
[ "@classmethod...\n", "if addr is None:\n", "addr = cls.HOST, cls.PORT\n", "conn = DebugSessionConnection.create_client(addr, timeout=kwargs.get('timeout')\n )\n", "return cls(conn, owned=True, **kwargs)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Condition", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_2(self, VAR_1, VAR_2, *VAR_3, **VAR_4):...\n", "self.handled_resp = VAR_1\n", "self.handled_remote = VAR_2\n", "self.handled_args = VAR_3\n", "self.handled_kwargs = VAR_4\n", "return 'TEST'\n" ]
[ "def handler(self, resp, remote, *args, **kwargs):...\n", "self.handled_resp = resp\n", "self.handled_remote = remote\n", "self.handled_args = args\n", "self.handled_kwargs = kwargs\n", "return 'TEST'\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return {'name': self.name, 'id': self.id}\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return {'name': self.name, 'id': self.id}\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_10(self):...\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 0)\n", "VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n", "VAR_8 = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'web': -1}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 400)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'web': 'one'}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 400)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'web': [1]}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 400)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'web': 1}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 204)\n" ]
[ "def test_container_scale_errors(self):...\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 0)\n", "url = '/api/apps/{app_id}/builds'.format(**locals())\n", "body = {'image': 'autotest/example', 'sha': 'a' * 40, 'procfile': json.\n dumps({'web': 'node server.js', 'worker': 'node worker.js'})}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'web': -1}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 400)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'web': 'one'}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 400)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'web': [1]}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 400)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'web': 1}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 204)\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 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_1(VAR_1):...\n", "return str(VAR_1).translate(None, ',')\n" ]
[ "def remove_commas_from_string(input_string):...\n", "return str(input_string).translate(None, ',')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_1(self):...\n", "VAR_18 = \"\"\"\n from crm_phonecall c\n \"\"\"\n", "return VAR_18\n" ]
[ "def _from(self):...\n", "from_str = \"\"\"\n from crm_phonecall c\n \"\"\"\n", "return from_str\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_3(VAR_3, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = VAR_4.get_all_permissions()\n", "VAR_18 = VAR_3.get_all_permissions()\n", "VAR_19 = []\n", "for VAR_6 in settings.CONCEPTS:\n", "VAR_29 = VAR_6.replace('.', '.add_')\n", "return VAR_19\n", "VAR_30 = apps.get_model(VAR_6)\n", "if not VAR_29 in VAR_18:\n", "VAR_31 = False\n", "VAR_32 = VAR_30._url.format('new/{}'.format(VAR_4.code))\n", "if not VAR_29 in VAR_17:\n", "VAR_31 = True\n", "VAR_19.append({'name': VAR_30._meta.verbose_name, 'url': VAR_32, 'disabled':\n VAR_31})\n", "VAR_32 = '#'\n" ]
[ "def get_available_concepts(employee, transaction):...\n", "\"\"\"docstring\"\"\"\n", "concepts_permitted_by_transaction = transaction.get_all_permissions()\n", "concepts_permitted_by_employee = employee.get_all_permissions()\n", "available_concepts = []\n", "for concept in settings.CONCEPTS:\n", "permission = concept.replace('.', '.add_')\n", "return available_concepts\n", "concept_model = apps.get_model(concept)\n", "if not permission in concepts_permitted_by_employee:\n", "disabled = False\n", "url = concept_model._url.format('new/{}'.format(transaction.code))\n", "if not permission in concepts_permitted_by_transaction:\n", "disabled = True\n", "available_concepts.append({'name': concept_model._meta.verbose_name, 'url':\n url, 'disabled': disabled})\n", "url = '#'\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.eng:\n", "self.eng.reset()\n", "self.eng, VAR_12 = sf.Engine(self.wires, VAR_11=self.hbar)\n", "self.reset()\n", "for operation in self._queue:\n", "if operation.name not in VAR_0:\n", "self.state = self.eng.run('gaussian')\n", "VAR_16 = [(x.val if isinstance(x, Variable) else x) for x in operation.params]\n", "VAR_13 = self._observe.wires\n", "VAR_17 = VAR_0[operation.name](*VAR_16)\n", "if self._observe.name == 'Fock':\n", "if isinstance(operation.wires, int):\n", "VAR_14 = self.state.mean_photon(VAR_13)\n", "if self._observe.name == 'X':\n", "VAR_17 | VAR_12[operation.wires]\n", "VAR_17 | [VAR_12[i] for i in operation.wires]\n", "VAR_15 = 0\n", "VAR_14, VAR_15 = self.state.quad_expectation(VAR_13, 0)\n", "if self._observe.name == 'P':\n", "if self.shots != 0:\n", "VAR_14, VAR_15 = self.state.quad_expectation(VAR_13, np.pi / 2)\n", "if self._observe.name == 'Homodyne':\n", "VAR_14 = np.random.normal(VAR_14, np.sqrt(VAR_15 / self.shots))\n", "self._out = VAR_14\n", "VAR_14, VAR_15 = self.state.quad_expectation(VAR_13, *self._observe.params)\n", "if self._observe.name == 'Displacement':\n", "VAR_14 = self.state.displacement(modes=reg)\n" ]
[ "def execute(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.eng:\n", "self.eng.reset()\n", "self.eng, q = sf.Engine(self.wires, hbar=self.hbar)\n", "self.reset()\n", "for operation in self._queue:\n", "if operation.name not in operator_map:\n", "self.state = self.eng.run('gaussian')\n", "p = [(x.val if isinstance(x, Variable) else x) for x in operation.params]\n", "reg = self._observe.wires\n", "op = operator_map[operation.name](*p)\n", "if self._observe.name == 'Fock':\n", "if isinstance(operation.wires, int):\n", "ex = self.state.mean_photon(reg)\n", "if self._observe.name == 'X':\n", "op | q[operation.wires]\n", "op | [q[i] for i in operation.wires]\n", "var = 0\n", "ex, var = self.state.quad_expectation(reg, 0)\n", "if self._observe.name == 'P':\n", "if self.shots != 0:\n", "ex, var = self.state.quad_expectation(reg, np.pi / 2)\n", "if self._observe.name == 'Homodyne':\n", "ex = np.random.normal(ex, np.sqrt(var / self.shots))\n", "self._out = ex\n", "ex, var = self.state.quad_expectation(reg, *self._observe.params)\n", "if self._observe.name == 'Displacement':\n", "ex = self.state.displacement(modes=reg)\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 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "Expr'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Expr'", "Expr'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_0(self, VAR_11=None, VAR_12=None):...\n", "\"\"\"docstring\"\"\"\n", "assert self.use_stdin and VAR_12 is not None or not self.use_stdin and VAR_11 is not None\n", "VAR_21 = self.generate_config_file()\n", "self.command = self._create_command(VAR_11=filename, VAR_21=config_file)\n", "VAR_22 = ''.join(VAR_12) if self.use_stdin else None\n", "VAR_23, VAR_24 = run_shell_command(self.command, stdin=stdin_input)\n", "self.stdout_output = tuple(VAR_23.splitlines(keepends=True))\n", "self.stderr_output = tuple(VAR_24.splitlines(keepends=True))\n", "VAR_25 = self.stderr_output if self.use_stderr else self.stdout_output\n", "VAR_26 = self.process_output(VAR_25, VAR_11, VAR_12)\n", "if not self.use_stderr:\n", "self._print_errors(self.stderr_output)\n", "if VAR_21:\n", "os.remove(VAR_21)\n", "return VAR_26\n" ]
[ "def lint(self, filename=None, file=None):...\n", "\"\"\"docstring\"\"\"\n", "assert self.use_stdin and file is not None or not self.use_stdin and filename is not None\n", "config_file = self.generate_config_file()\n", "self.command = self._create_command(filename=filename, config_file=config_file)\n", "stdin_input = ''.join(file) if self.use_stdin else None\n", "stdout_output, stderr_output = run_shell_command(self.command, stdin=\n stdin_input)\n", "self.stdout_output = tuple(stdout_output.splitlines(keepends=True))\n", "self.stderr_output = tuple(stderr_output.splitlines(keepends=True))\n", "results_output = self.stderr_output if self.use_stderr else self.stdout_output\n", "results = self.process_output(results_output, filename, file)\n", "if not self.use_stderr:\n", "self._print_errors(self.stderr_output)\n", "if config_file:\n", "os.remove(config_file)\n", "return results\n" ]
[ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'", "Return'" ]
[ "def FUNC_33(VAR_39):...\n", "return True\n" ]
[ "def acquire(self2):...\n", "return True\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "if self.options['inference']:\n", "self._run_pre_inference(self.target_graph)\n", "VAR_16 = find_shapes(self.shacl_graph)\n", "VAR_17 = {}\n", "for VAR_21 in VAR_16:\n", "VAR_20 = VAR_21.validate(self.target_graph)\n", "return VAR_17\n", "VAR_17[VAR_21.node] = VAR_20\n" ]
[ "def run(self):...\n", "if self.options['inference']:\n", "self._run_pre_inference(self.target_graph)\n", "shapes = find_shapes(self.shacl_graph)\n", "results = {}\n", "for s in shapes:\n", "r = s.validate(self.target_graph)\n", "return results\n", "results[s.node] = r\n" ]
[ 0, 1, 0, 0, 1, 0, 1, 1, 1 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Assign'" ]
[ "def FUNC_19(self, VAR_27):...\n", "\"\"\"docstring\"\"\"\n", "VAR_65 = 0\n", "VAR_61 = self.execute(\n \"select count(*) from History WHERE md5sum = ? AND STATUS != 'Failed'\",\n (VAR_27,))\n", "if VAR_61:\n", "return VAR_65 > 0\n", "VAR_65 = self.c.fetchone().get('count(*)')\n" ]
[ "def have_md5sum(self, md5sum):...\n", "\"\"\"docstring\"\"\"\n", "total = 0\n", "res = self.execute(\n \"select count(*) from History WHERE md5sum = ? AND STATUS != 'Failed'\",\n (md5sum,))\n", "if res:\n", "return total > 0\n", "total = self.c.fetchone().get('count(*)')\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Return'", "Assign'" ]
[ "def FUNC_5(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer())\n" ]
[ "def test_z_delete_load_balancer(self):...\n", "self.run_test_case(self.scenario.delete_load_balancer())\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_7, **VAR_8):...\n", "VAR_8['backend'] = 'Simulator'\n", "super().__init__(VAR_7, **kwargs)\n" ]
[ "def __init__(self, wires, **kwargs):...\n", "kwargs['backend'] = 'Simulator'\n", "super().__init__(wires, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_11(self, VAR_8):...\n", "if not self.current_user:\n", "return False\n", "if self.current_user.admin:\n", "return True\n", "VAR_8 = GroupList.check(self.current_user.key, VAR_8, self.sql_session)\n", "return bool(VAR_8)\n" ]
[ "def is_group_user(self, group):...\n", "if not self.current_user:\n", "return False\n", "if self.current_user.admin:\n", "return True\n", "group = GroupList.check(self.current_user.key, group, self.sql_session)\n", "return bool(group)\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'", "Assign'", "Return'" ]
[ "def FUNC_0(self):...\n", "self.wz_sock.connect(self.wz_addr)\n" ]
[ "def wz_connect(self):...\n", "self.wz_sock.connect(self.wz_addr)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_3(VAR_3, VAR_6):...\n", "VAR_8 = VAR_3.cursor()\n", "VAR_10 = VAR_8.execute(VAR_6)\n", "VAR_3.commit()\n", "print('delete data successfull')\n", "return VAR_10\n" ]
[ "def deleteDB(conn, sql_delete):...\n", "cur = conn.cursor()\n", "result = cur.execute(sql_delete)\n", "conn.commit()\n", "print('delete data successfull')\n", "return result\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_19(self):...\n", "self._diag_interface.OnCursorMoved()\n" ]
[ "def OnCursorMoved(self):...\n", "self._diag_interface.OnCursorMoved()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@mock.patch('requests.post', FUNC_0)...\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 0)\n", "VAR_4 = '/api/apps/{app_id}/builds'.format(**locals())\n", "VAR_8 = {'image': 'autotest/example', 'dockerfile':\n \"\"\"FROM busybox\nCMD /bin/true\"\"\"}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'cmd': 6}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 204)\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 6)\n", "VAR_4 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "VAR_4 = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 6)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'cmd': 3}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 204)\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 3)\n", "self.assertEqual(max(VAR_7['num'] for VAR_7 in VAR_5.data['results']), 3)\n", "VAR_4 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "VAR_4 = '/api/apps/{app_id}/scale'.format(**locals())\n", "VAR_8 = {'cmd': 0}\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_8), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 204)\n", "VAR_4 = '/api/apps/{app_id}/containers'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertEqual(len(VAR_5.data['results']), 0)\n", "VAR_4 = '/api/apps/{app_id}'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n" ]
[ "@mock.patch('requests.post', mock_import_repository_task)...\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 0)\n", "url = '/api/apps/{app_id}/builds'.format(**locals())\n", "body = {'image': 'autotest/example', 'dockerfile':\n \"\"\"FROM busybox\nCMD /bin/true\"\"\"}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 201)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'cmd': 6}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 204)\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 6)\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "url = '/api/apps/{app_id}/containers/cmd'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 6)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'cmd': 3}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 204)\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 3)\n", "self.assertEqual(max(c['num'] for c in response.data['results']), 3)\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "url = '/api/apps/{app_id}/scale'.format(**locals())\n", "body = {'cmd': 0}\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 204)\n", "url = '/api/apps/{app_id}/containers'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertEqual(len(response.data['results']), 0)\n", "url = '/api/apps/{app_id}'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'" ]
[ "@VAR_0.route('/', methods=['GET', 'POST'])...\n", "VAR_13 = ''\n", "if request.method == 'POST':\n", "return render_template('index.html', VAR_13=error)\n", "return render_template('index.html', VAR_13=error)\n", "VAR_16 = request.form['username']\n", "VAR_17 = request.form['password']\n", "VAR_14 = CLASS_0.query.filter_by(VAR_6=username).first()\n", "if sha256_crypt.verify(VAR_17, str(VAR_14.PasswordHash)):\n", "VAR_19['username'] = VAR_16\n", "VAR_13 = 'Invalid credentials, try again.'\n", "flash('you are now logged in')\n", "return redirect(url_for('upload'))\n" ]
[ "@app.route('/', methods=['GET', 'POST'])...\n", "error = ''\n", "if request.method == 'POST':\n", "return render_template('index.html', error=error)\n", "return render_template('index.html', error=error)\n", "username = request.form['username']\n", "password = request.form['password']\n", "data = users.query.filter_by(Username=username).first()\n", "if sha256_crypt.verify(password, str(data.PasswordHash)):\n", "session['username'] = username\n", "error = 'Invalid credentials, try again.'\n", "flash('you are now logged in')\n", "return redirect(url_for('upload'))\n" ]
[ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_7(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_4 = '/api/apps/{app_id}/config'.format(**locals())\n", "VAR_5 = self.client.get(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertIn('values', VAR_5.data)\n", "VAR_19 = VAR_5.data['values']\n", "VAR_20 = {'username': 'autotest', 'app': VAR_6}\n", "VAR_4 = '/api/hooks/config'.format(**locals())\n", "VAR_7 = {'receive_user': 'autotest', 'receive_repo': VAR_6}\n", "self.assertIsNone(self.client.logout())\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json')\n", "self.assertEqual(VAR_5.status_code, 403)\n", "VAR_5 = self.client.post(VAR_4, json.dumps(VAR_7), content_type=\n 'application/json', HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)\n", "self.assertEqual(VAR_5.status_code, 200)\n", "self.assertIn('values', VAR_5.data)\n", "self.assertEqual(VAR_19, VAR_5.data['values'])\n" ]
[ "def test_config_hook(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "url = '/api/apps/{app_id}/config'.format(**locals())\n", "response = self.client.get(url)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertIn('values', response.data)\n", "values = response.data['values']\n", "config = {'username': 'autotest', 'app': app_id}\n", "url = '/api/hooks/config'.format(**locals())\n", "body = {'receive_user': 'autotest', 'receive_repo': app_id}\n", "self.assertIsNone(self.client.logout())\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json')\n", "self.assertEqual(response.status_code, 403)\n", "response = self.client.post(url, json.dumps(body), content_type=\n 'application/json', HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)\n", "self.assertEqual(response.status_code, 200)\n", "self.assertIn('values', response.data)\n", "self.assertEqual(values, response.data['values'])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_5 = set(bot_main.get_dimensions(None))\n", "VAR_5.discard('hidpi')\n", "VAR_5.discard('zone')\n", "VAR_6 = {'cores', 'cpu', 'gpu', 'id', 'machine_type', 'os', 'pool'}\n", "self.assertEqual(VAR_6, VAR_5)\n" ]
[ "def test_get_dimensions(self):...\n", "dimensions = set(bot_main.get_dimensions(None))\n", "dimensions.discard('hidpi')\n", "dimensions.discard('zone')\n", "expected = {'cores', 'cpu', 'gpu', 'id', 'machine_type', 'os', 'pool'}\n", "self.assertEqual(expected, dimensions)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "@login_required...\n", "\"\"\"docstring\"\"\"\n", "return render_to_response('student_account/account_settings.html', FUNC_12(\n VAR_3))\n" ]
[ "@login_required...\n", "\"\"\"docstring\"\"\"\n", "return render_to_response('student_account/account_settings.html',\n account_settings_context(request))\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_8(self):...\n", "return b'xxxx device\\nyyyy device'\n" ]
[ "def devices(self):...\n", "return b'xxxx device\\nyyyy device'\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, *VAR_5, **VAR_6):...\n", "VAR_2 = VAR_6['campaign']\n", "super(CLASS_0, self).__init__(*VAR_5, **kwargs)\n", "VAR_27 = self.injection_choices(VAR_2, 'bit')\n", "self.filters['bit'].extra.update(VAR_4=bit_choices)\n", "self.filters['bit'].widget.attrs['size'] = min(len(VAR_27), 10)\n", "VAR_28 = self.injection_choices(VAR_2, 'checkpoint_number')\n", "self.filters['checkpoint_number'].extra.update(VAR_4=checkpoint_number_choices)\n", "self.filters['checkpoint_number'].widget.attrs['size'] = min(len(VAR_28), 10)\n", "VAR_29 = self.injection_choices(VAR_2, 'field')\n", "self.filters['field'].extra.update(VAR_4=field_choices)\n", "self.filters['field'].widget.attrs['size'] = min(len(VAR_29), 10)\n", "VAR_30 = self.injection_choices(VAR_2, 'register')\n", "self.filters['register'].extra.update(VAR_4=register_choices)\n", "self.filters['register'].widget.attrs['size'] = min(len(VAR_30), 10)\n", "VAR_31 = self.injection_choices(VAR_2, 'register_index')\n", "self.filters['register_index'].extra.update(VAR_4=register_index_choices)\n", "self.filters['register_index'].widget.attrs['size'] = min(len(VAR_31), 10)\n", "VAR_32 = FUNC_2(VAR_2, 'num_injections')\n", "self.filters['result__num_injections'].extra.update(VAR_4=\n num_injections_choices)\n", "self.filters['result__num_injections'].widget.attrs['size'] = min(len(\n VAR_32), 10)\n", "VAR_33 = FUNC_2(VAR_2, 'outcome')\n", "self.filters['result__outcome'].extra.update(VAR_4=outcome_choices)\n", "self.filters['result__outcome'].widget.attrs['size'] = min(len(VAR_33), 10)\n", "VAR_34 = FUNC_2(VAR_2, 'outcome_category')\n", "self.filters['result__outcome_category'].extra.update(VAR_4=\n outcome_category_choices)\n", "self.filters['result__outcome_category'].widget.attrs['size'] = min(len(\n VAR_34), 10)\n", "self.filters['success'].extra.update(help_text='')\n", "VAR_35 = self.injection_choices(VAR_2, 'target')\n", "self.filters['target'].extra.update(VAR_4=target_choices)\n", "self.filters['target'].widget.attrs['size'] = min(len(VAR_35), 10)\n", "VAR_36 = self.injection_choices(VAR_2, 'target_index')\n", "self.filters['target_index'].extra.update(VAR_4=target_index_choices)\n", "self.filters['target_index'].widget.attrs['size'] = min(len(VAR_36), 10)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "campaign = kwargs['campaign']\n", "super(injection_filter, self).__init__(*args, **kwargs)\n", "bit_choices = self.injection_choices(campaign, 'bit')\n", "self.filters['bit'].extra.update(choices=bit_choices)\n", "self.filters['bit'].widget.attrs['size'] = min(len(bit_choices), 10)\n", "checkpoint_number_choices = self.injection_choices(campaign,\n 'checkpoint_number')\n", "self.filters['checkpoint_number'].extra.update(choices=\n checkpoint_number_choices)\n", "self.filters['checkpoint_number'].widget.attrs['size'] = min(len(\n checkpoint_number_choices), 10)\n", "field_choices = self.injection_choices(campaign, 'field')\n", "self.filters['field'].extra.update(choices=field_choices)\n", "self.filters['field'].widget.attrs['size'] = min(len(field_choices), 10)\n", "register_choices = self.injection_choices(campaign, 'register')\n", "self.filters['register'].extra.update(choices=register_choices)\n", "self.filters['register'].widget.attrs['size'] = min(len(register_choices), 10)\n", "register_index_choices = self.injection_choices(campaign, 'register_index')\n", "self.filters['register_index'].extra.update(choices=register_index_choices)\n", "self.filters['register_index'].widget.attrs['size'] = min(len(\n register_index_choices), 10)\n", "num_injections_choices = result_choices(campaign, 'num_injections')\n", "self.filters['result__num_injections'].extra.update(choices=\n num_injections_choices)\n", "self.filters['result__num_injections'].widget.attrs['size'] = min(len(\n num_injections_choices), 10)\n", "outcome_choices = result_choices(campaign, 'outcome')\n", "self.filters['result__outcome'].extra.update(choices=outcome_choices)\n", "self.filters['result__outcome'].widget.attrs['size'] = min(len(\n outcome_choices), 10)\n", "outcome_category_choices = result_choices(campaign, 'outcome_category')\n", "self.filters['result__outcome_category'].extra.update(choices=\n outcome_category_choices)\n", "self.filters['result__outcome_category'].widget.attrs['size'] = min(len(\n outcome_category_choices), 10)\n", "self.filters['success'].extra.update(help_text='')\n", "target_choices = self.injection_choices(campaign, 'target')\n", "self.filters['target'].extra.update(choices=target_choices)\n", "self.filters['target'].widget.attrs['size'] = min(len(target_choices), 10)\n", "target_index_choices = self.injection_choices(campaign, 'target_index')\n", "self.filters['target_index'].extra.update(choices=target_index_choices)\n", "self.filters['target_index'].widget.attrs['size'] = min(len(\n target_index_choices), 10)\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 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "@property...\n", "return self._handler.response\n" ]
[ "@property...\n", "return self._handler.response\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]