lines
sequencelengths
1
444
raw_lines
sequencelengths
1
444
label
sequencelengths
1
444
type
sequencelengths
1
444
[ "@route('GET', '/-test/veil.js', VAR_1=website)...\n", "get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n", "return (as_path(__file__).dirname() / 'veil.js').text()\n" ]
[ "@route('GET', '/-test/veil.js', website=website)...\n", "get_current_http_response().set_header('Content-Type',\n 'text/javascript; charset=utf-8')\n", "return (as_path(__file__).dirname() / 'veil.js').text()\n" ]
[ 0, 0, 0 ]
[ "Condition", "Expr'", "Return'" ]
[ "def FUNC_7(self, VAR_4, VAR_5, VAR_3, VAR_6, VAR_7):...\n", "" ]
[ "def _parse_rep(self, iden, msg, reqid, seqnum, status):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "import mysql.connector\n", "from werkzeug.security import generate_password_hash, check_password_hash\n", "def __init__(self, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5):...\n", "self.connection = mysql.connector.connect(host=connection_address, user=\n user_name, VAR_4=password, db=database)\n", "self.cursor = self.connection.cursor(buffered=True)\n", "def FUNC_0(self):...\n", "VAR_14 = 'CREATE TABLE IF NOT EXISTS DPNET(why_mySQL int)'\n", "self.cursor.execute(VAR_14)\n", "self.connection.commit()\n", "def FUNC_1(self):...\n", "VAR_14 = 'DROP TABLE IF EXISTS DPNET'\n", "self.cursor.execute(VAR_14)\n", "self.connection.commit()\n", "def FUNC_2(self, VAR_6, VAR_7):...\n", "VAR_14 = \"SELECT Pass FROM user WHERE Email = '\" + VAR_6 + \"'\"\n", "self.cursor.execute(VAR_14)\n", "VAR_15 = self.cursor.fetchone()\n", "VAR_4 = ' '.join(map(str, VAR_15))\n", "return check_password_hash(VAR_4, VAR_7)\n" ]
[ "import mysql.connector\n", "from werkzeug.security import generate_password_hash, check_password_hash\n", "def __init__(self, connection_address, connection_port, user_name, password,...\n", "self.connection = mysql.connector.connect(host=connection_address, user=\n user_name, password=password, db=database)\n", "self.cursor = self.connection.cursor(buffered=True)\n", "def create_junk_table(self):...\n", "query = 'CREATE TABLE IF NOT EXISTS DPNET(why_mySQL int)'\n", "self.cursor.execute(query)\n", "self.connection.commit()\n", "def destroy_junk_table(self):...\n", "query = 'DROP TABLE IF EXISTS DPNET'\n", "self.cursor.execute(query)\n", "self.connection.commit()\n", "def verify_account(self, email, user_password):...\n", "query = \"SELECT Pass FROM user WHERE Email = '\" + email + \"'\"\n", "self.cursor.execute(query)\n", "fetch = self.cursor.fetchone()\n", "password = ' '.join(map(str, fetch))\n", "return check_password_hash(password, user_password)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "Import'", "ImportFrom'", "FunctionDef'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute('string' + VAR_1 + \"';\")\n" ]
[ "def query_signed_upperclassman(member):...\n", "\"\"\"docstring\"\"\"\n", "return db.engine.execute(\n \"\"\"\n SELECT DISTINCT packet.freshman_username AS username, signature_upper.signed AS signed FROM packet \n INNER JOIN signature_upper ON packet.id = signature_upper.packet_id \n WHERE signature_upper.member = '\"\"\"\n + member + \"';\")\n" ]
[ 0, 0, 4 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "@classmethod...\n", "return super(CLASS_0.Factory, VAR_12).subsystem_dependencies() + (\n DependencyContext, Java, ScalaPlatform)\n" ]
[ "@classmethod...\n", "return super(Zinc.Factory, cls).subsystem_dependencies() + (DependencyContext,\n Java, ScalaPlatform)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_3(VAR_0, VAR_7=None):...\n", "VAR_31 = pd.cut(VAR_0.groupby('matched_id').days.sum(), [0, 1, 2, 10, 90, \n 1000], right=False).value_counts(sort=False)\n", "VAR_31 = pd.DataFrame({'days': VAR_31.as_matrix()}, VAR_29=\n days_interval_to_text(dist.index))\n", "return VAR_31, []\n" ]
[ "def get_days_distribution(data, groups=None):...\n", "dist = pd.cut(data.groupby('matched_id').days.sum(), [0, 1, 2, 10, 90, 1000\n ], right=False).value_counts(sort=False)\n", "dist = pd.DataFrame({'days': dist.as_matrix()}, index=days_interval_to_text\n (dist.index))\n", "return dist, []\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, *VAR_3, **VAR_4):...\n", "super(CLASS_0, self).__init__(*VAR_3, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n" ]
[ "def __init__(self, *args, **kwargs):...\n", "super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)\n", "self.common = None\n", "self.configuration.append_config_values(hpcommon.hp3par_opts)\n", "self.configuration.append_config_values(san.san_opts)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "from DateTime.DateTime import DateTime\n", "from Products.PageTemplates.PageTemplateFile import PageTemplateFile\n", "from Persistence import Persistent\n", "from Acquisition import Implicit\n", "import OFS.SimpleItem, OFS.ObjectManager\n", "import zope.interface\n", "import IZMSDaemon\n", "__doc__ = 'ZMS product module.'\n", "__version__ = '0.1'\n", "__authorPermissions__ = ('manage_page_header', 'manage_page_footer',\n 'manage_tabs', 'manage_main_iframe')\n", "__viewPermissions__ = 'manage_menu',\n", "__ac_permissions__ = ('ZMS Author', __authorPermissions__), ('View',\n __viewPermissions__)\n", "VAR_0 = PageTemplateFile('zpt/object/manage', globals())\n", "VAR_1 = PageTemplateFile('zpt/object/manage', globals())\n", "VAR_2 = PageTemplateFile('zpt/ZMSObject/manage_main', globals())\n", "VAR_3 = PageTemplateFile('zpt/ZMSObject/manage_main_iframe', globals())\n", "def FUNC_0(self, *VAR_4, **VAR_5):...\n", "VAR_11 = self.REQUEST\n", "VAR_12 = VAR_11.RESPONSE\n", "return self.getBodyContent(VAR_11)\n" ]
[ "from DateTime.DateTime import DateTime\n", "from Products.PageTemplates.PageTemplateFile import PageTemplateFile\n", "from Persistence import Persistent\n", "from Acquisition import Implicit\n", "import OFS.SimpleItem, OFS.ObjectManager\n", "import zope.interface\n", "import IZMSDaemon\n", "__doc__ = 'ZMS product module.'\n", "__version__ = '0.1'\n", "__authorPermissions__ = ('manage_page_header', 'manage_page_footer',\n 'manage_tabs', 'manage_main_iframe')\n", "__viewPermissions__ = 'manage_menu',\n", "__ac_permissions__ = ('ZMS Author', __authorPermissions__), ('View',\n __viewPermissions__)\n", "manage = PageTemplateFile('zpt/object/manage', globals())\n", "manage_workspace = PageTemplateFile('zpt/object/manage', globals())\n", "manage_main = PageTemplateFile('zpt/ZMSObject/manage_main', globals())\n", "manage_main_iframe = PageTemplateFile('zpt/ZMSObject/manage_main_iframe',\n globals())\n", "def zmi_body_content(self, *args, **kwargs):...\n", "request = self.REQUEST\n", "response = request.RESPONSE\n", "return self.getBodyContent(request)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_7, *VAR_15, **VAR_16):...\n", "CLASS_0.__init__(self, VAR_7, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, *a, **kw):...\n", "Validator.__init__(self, param, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __enter__(self):...\n", "if CLASS_2._current_context is None:\n", "CLASS_2._current_context = self\n", "return self\n", "self.reset()\n" ]
[ "def __enter__(self):...\n", "if Device._current_context is None:\n", "Device._current_context = self\n", "return self\n", "self.reset()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Return'", "Expr'" ]
[ "def FUNC_3(self):...\n", "self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n", "self.socket.bind(self.server_address)\n" ]
[ "def server_bind(self):...\n", "self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n", "self.socket.bind(self.server_address)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_11(VAR_16, VAR_17, VAR_18=True):...\n", "if isinstance(VAR_16, CLASS_1):\n", "VAR_16.flags[VAR_17] = VAR_18\n", "if FUNC_10(VAR_16):\n", "return VAR_16\n", "VAR_16 = CLASS_1(VAR_16)\n", "return [VAR_19(v, VAR_17, VAR_18=flag_value) for v in VAR_16]\n", "VAR_16.flags[VAR_17] = VAR_18\n", "return VAR_16\n" ]
[ "def flag(value, flag_type, flag_value=True):...\n", "if isinstance(value, AnnotatedString):\n", "value.flags[flag_type] = flag_value\n", "if not_iterable(value):\n", "return value\n", "value = AnnotatedString(value)\n", "return [flag(v, flag_type, flag_value=flag_value) for v in value]\n", "value.flags[flag_type] = flag_value\n", "return value\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Return'", "Assign'", "Return'" ]
[ "def FUNC_2(VAR_0):...\n", "VAR_2 = []\n", "VAR_3 = FUNC_4(VAR_0)\n", "VAR_4 = FUNC_3(VAR_0)\n", "for item in VAR_3:\n", "if VAR_4.get(item.name):\n", "return VAR_2\n", "VAR_9 = VAR_4[item.name]\n", "VAR_10 = {'item_group': item.item_group, 'item': item.name, 'item_name':\n item.item_name}\n", "if VAR_9.days_since_last_order > cint(VAR_0['days']):\n", "VAR_2.append(VAR_10)\n", "VAR_10 = {'territory': VAR_9.territory, 'item_group': VAR_9.item_group,\n 'item': VAR_9.name, 'item_name': VAR_9.item_name, 'customer': VAR_9.\n customer, 'last_order_date': VAR_9.last_order_date, 'qty': VAR_9.qty,\n 'days_since_last_order': VAR_9.days_since_last_order}\n", "VAR_2.append(VAR_10)\n" ]
[ "def get_data(filters):...\n", "data = []\n", "items = get_items(filters)\n", "sales_invoice_data = get_sales_details(filters)\n", "for item in items:\n", "if sales_invoice_data.get(item.name):\n", "return data\n", "item_obj = sales_invoice_data[item.name]\n", "row = {'item_group': item.item_group, 'item': item.name, 'item_name': item.\n item_name}\n", "if item_obj.days_since_last_order > cint(filters['days']):\n", "data.append(row)\n", "row = {'territory': item_obj.territory, 'item_group': item_obj.item_group,\n 'item': item_obj.name, 'item_name': item_obj.item_name, 'customer':\n item_obj.customer, 'last_order_date': item_obj.last_order_date, 'qty':\n item_obj.qty, 'days_since_last_order': item_obj.days_since_last_order}\n", "data.append(row)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_14(self, VAR_12):...\n", "if not self._system_properties:\n", "fp.write(pkgutil.get_data(__name__, 'SystemProperties.class'))\n", "return self._system_properties\n", "VAR_45 = [VAR_12, '-cp', classpath, 'SystemProperties']\n", "VAR_46 = subprocess.Popen(VAR_45, VAR_47=subprocess.PIPE, VAR_48=subprocess\n .PIPE)\n", "VAR_47, VAR_48 = VAR_46.communicate()\n", "if VAR_46.returncode != 0:\n", "VAR_39 = {}\n", "for line in VAR_47.decode('utf-8').split(os.linesep):\n", "VAR_32, VAR_49, VAR_50 = line.partition('=')\n", "self._system_properties = VAR_39\n", "VAR_39[VAR_32] = VAR_50\n" ]
[ "def _get_system_properties(self, java):...\n", "if not self._system_properties:\n", "fp.write(pkgutil.get_data(__name__, 'SystemProperties.class'))\n", "return self._system_properties\n", "cmd = [java, '-cp', classpath, 'SystemProperties']\n", "process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n", "stdout, stderr = process.communicate()\n", "if process.returncode != 0:\n", "props = {}\n", "for line in stdout.decode('utf-8').split(os.linesep):\n", "key, _, val = line.partition('=')\n", "self._system_properties = props\n", "props[key] = val\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Return'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "if self.closed:\n", "if self._adapter is None:\n", "if self._session is not None:\n", "self._detach()\n", "self._adapter.close()\n", "self._adapter = None\n" ]
[ "def stop_debugging(self):...\n", "if self.closed:\n", "if self._adapter is None:\n", "if self._session is not None:\n", "self._detach()\n", "self._adapter.close()\n", "self._adapter = None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Condition", "Expr'", "Expr'", "Assign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return {'id': self.id, 'name': self.name, 'description': self.description,\n 'processed': self.processed, 'takeaway': self.takeaway}\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return {'id': self.id, 'name': self.name, 'description': self.description,\n 'processed': self.processed, 'takeaway': self.takeaway}\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "\"\"\" Views for a student's account information. \"\"\"\n", "import json\n", "import logging\n", "import urlparse\n", "from datetime import datetime\n", "from django.conf import settings\n", "from django.contrib import messages\n", "from django.contrib.auth import get_user_model\n", "from django.contrib.auth.decorators import login_required\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\n", "from django.shortcuts import redirect\n", "from django.utils.translation import ugettext as _\n", "from django.views.decorators.csrf import ensure_csrf_cookie\n", "from django.views.decorators.http import require_http_methods\n", "from django_countries import countries\n", "import third_party_auth\n", "from commerce.models import CommerceConfiguration\n", "from edxmako.shortcuts import render_to_response\n", "from lms.djangoapps.commerce.utils import EcommerceService\n", "from openedx.core.djangoapps.commerce.utils import ecommerce_api_client\n", "from openedx.core.djangoapps.external_auth.login_and_register import login as external_auth_login\n", "from openedx.core.djangoapps.external_auth.login_and_register import register as external_auth_register\n", "from openedx.core.djangoapps.lang_pref.api import all_languages, released_languages\n", "from openedx.core.djangoapps.programs.models import ProgramsApiConfig\n", "from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers\n", "from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site\n", "from openedx.core.djangoapps.user_api.accounts.api import request_password_change\n", "from openedx.core.djangoapps.user_api.api import RegistrationFormFactory, get_login_session_form, get_password_reset_form\n", "from openedx.core.djangoapps.user_api.errors import UserNotFound\n", "from openedx.core.lib.edx_api_utils import get_edx_api_data\n", "from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES\n", "from openedx.features.enterprise_support.api import enterprise_customer_for_request\n", "from student.helpers import destroy_oauth_tokens, get_next_url_for_login_page\n", "from student.models import UserProfile\n", "from student.views import register_user as old_register_view\n", "from student.views import signin_user as old_login_view\n", "from third_party_auth import pipeline\n", "from third_party_auth.decorators import xframe_allow_whitelisted\n", "from util.bad_request_rate_limiter import BadRequestRateLimiter\n", "from util.date_utils import strftime_localized\n", "VAR_0 = logging.getLogger('audit')\n", "VAR_1 = logging.getLogger(__name__)\n", "VAR_2 = get_user_model()\n", "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = get_next_url_for_login_page(VAR_3)\n", "if VAR_3.user.is_authenticated():\n", "return redirect(VAR_7)\n", "VAR_11 = FUNC_6(VAR_3)\n", "VAR_12 = None\n", "if '?' in VAR_7:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "VAR_38 = urlparse.parse_qs(urlparse.urlparse(VAR_7).query)\n", "if VAR_4 == 'login':\n", "VAR_13 = FUNC_7(VAR_3, VAR_4)\n", "VAR_39 = VAR_38['tpa_hint'][0]\n", "return old_login_view(VAR_3)\n", "if VAR_4 == 'register':\n", "if VAR_13 is not None:\n", "VAR_40 = third_party_auth.provider.Registry.get(VAR_39=provider_id)\n", "return old_register_view(VAR_3)\n", "return VAR_13\n", "VAR_14 = [{'message': message.message, 'tags': message.tags} for message in\n messages.get_messages(VAR_3) if 'account-activation' in message.tags]\n", "if VAR_40:\n", "VAR_5 = {'data': {'login_redirect_url': VAR_7, 'initial_mode': VAR_4,\n 'third_party_auth': FUNC_5(VAR_3, VAR_7, VAR_12),\n 'third_party_auth_hint': VAR_12 or '', 'platform_name':\n configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME\n ), 'support_link': configuration_helpers.get_value('SUPPORT_SITE_LINK',\n settings.SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': VAR_14, 'login_form_desc': json.loads(\n VAR_11['login']), 'registration_form_desc': json.loads(VAR_11[\n 'registration']), 'password_reset_form_desc': json.loads(VAR_11[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url': VAR_7,\n 'responsive': True, 'allow_iframing': True, 'disable_courseware_js': \n True, 'combined_login_and_register': True, 'disable_footer': not\n configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if VAR_40.skip_hinted_login_dialog:\n", "VAR_5 = FUNC_2(VAR_3, VAR_5)\n", "return redirect(pipeline.get_login_url(VAR_39, pipeline.AUTH_ENTRY_LOGIN,\n redirect_url=redirect_to))\n", "VAR_12 = VAR_39\n", "VAR_15 = render_to_response('student_account/login_and_register.html', VAR_5)\n", "VAR_4 = 'hinted_login'\n", "VAR_15.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return VAR_15\n" ]
[ "\"\"\" Views for a student's account information. \"\"\"\n", "import json\n", "import logging\n", "import urlparse\n", "from datetime import datetime\n", "from django.conf import settings\n", "from django.contrib import messages\n", "from django.contrib.auth import get_user_model\n", "from django.contrib.auth.decorators import login_required\n", "from django.core.urlresolvers import reverse\n", "from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\n", "from django.shortcuts import redirect\n", "from django.utils.translation import ugettext as _\n", "from django.views.decorators.csrf import ensure_csrf_cookie\n", "from django.views.decorators.http import require_http_methods\n", "from django_countries import countries\n", "import third_party_auth\n", "from commerce.models import CommerceConfiguration\n", "from edxmako.shortcuts import render_to_response\n", "from lms.djangoapps.commerce.utils import EcommerceService\n", "from openedx.core.djangoapps.commerce.utils import ecommerce_api_client\n", "from openedx.core.djangoapps.external_auth.login_and_register import login as external_auth_login\n", "from openedx.core.djangoapps.external_auth.login_and_register import register as external_auth_register\n", "from openedx.core.djangoapps.lang_pref.api import all_languages, released_languages\n", "from openedx.core.djangoapps.programs.models import ProgramsApiConfig\n", "from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers\n", "from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site\n", "from openedx.core.djangoapps.user_api.accounts.api import request_password_change\n", "from openedx.core.djangoapps.user_api.api import RegistrationFormFactory, get_login_session_form, get_password_reset_form\n", "from openedx.core.djangoapps.user_api.errors import UserNotFound\n", "from openedx.core.lib.edx_api_utils import get_edx_api_data\n", "from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES\n", "from openedx.features.enterprise_support.api import enterprise_customer_for_request\n", "from student.helpers import destroy_oauth_tokens, get_next_url_for_login_page\n", "from student.models import UserProfile\n", "from student.views import register_user as old_register_view\n", "from student.views import signin_user as old_login_view\n", "from third_party_auth import pipeline\n", "from third_party_auth.decorators import xframe_allow_whitelisted\n", "from util.bad_request_rate_limiter import BadRequestRateLimiter\n", "from util.date_utils import strftime_localized\n", "AUDIT_LOG = logging.getLogger('audit')\n", "log = logging.getLogger(__name__)\n", "User = get_user_model()\n", "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "redirect_to = get_next_url_for_login_page(request)\n", "if request.user.is_authenticated():\n", "return redirect(redirect_to)\n", "form_descriptions = _get_form_descriptions(request)\n", "third_party_auth_hint = None\n", "if '?' in redirect_to:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "next_args = urlparse.parse_qs(urlparse.urlparse(redirect_to).query)\n", "if initial_mode == 'login':\n", "ext_auth_response = _external_auth_intercept(request, initial_mode)\n", "provider_id = next_args['tpa_hint'][0]\n", "return old_login_view(request)\n", "if initial_mode == 'register':\n", "if ext_auth_response is not None:\n", "tpa_hint_provider = third_party_auth.provider.Registry.get(provider_id=\n provider_id)\n", "return old_register_view(request)\n", "return ext_auth_response\n", "account_activation_messages = [{'message': message.message, 'tags': message\n .tags} for message in messages.get_messages(request) if \n 'account-activation' in message.tags]\n", "if tpa_hint_provider:\n", "context = {'data': {'login_redirect_url': redirect_to, 'initial_mode':\n initial_mode, 'third_party_auth': _third_party_auth_context(request,\n redirect_to, third_party_auth_hint), 'third_party_auth_hint': \n third_party_auth_hint or '', 'platform_name': configuration_helpers.\n get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'support_link':\n configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.\n SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': account_activation_messages,\n 'login_form_desc': json.loads(form_descriptions['login']),\n 'registration_form_desc': json.loads(form_descriptions['registration']),\n 'password_reset_form_desc': json.loads(form_descriptions[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url':\n redirect_to, 'responsive': True, 'allow_iframing': True,\n 'disable_courseware_js': True, 'combined_login_and_register': True,\n 'disable_footer': not configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if tpa_hint_provider.skip_hinted_login_dialog:\n", "context = update_context_for_enterprise(request, context)\n", "return redirect(pipeline.get_login_url(provider_id, pipeline.\n AUTH_ENTRY_LOGIN, redirect_url=redirect_to))\n", "third_party_auth_hint = provider_id\n", "response = render_to_response('student_account/login_and_register.html',\n context)\n", "initial_mode = 'hinted_login'\n", "response.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return response\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, 6, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "Assign'", "Assign'", "Condition", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Condition", "Assign'", "Return'", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_8(VAR_10):...\n", "VAR_0 = []\n", "VAR_28 = 0\n", "VAR_11 = set()\n", "for VAR_29 in VAR_5.finditer(VAR_10):\n", "VAR_0.append(re.escape(VAR_10[VAR_28:VAR_29.start()]))\n", "VAR_0.append(re.escape(VAR_10[VAR_28:]))\n", "VAR_51 = VAR_29.group('name')\n", "VAR_0.append('$')\n", "if VAR_51 in VAR_11:\n", "return ''.join(VAR_0)\n", "if VAR_29.group('constraint'):\n", "VAR_11.add(VAR_51)\n", "VAR_0.append('(?P={})'.format(VAR_51))\n", "VAR_0.append('(?P<{}>{})'.format(VAR_51, VAR_29.group('constraint') if\n VAR_29.group('constraint') else '.+'))\n", "VAR_28 = VAR_29.end()\n" ]
[ "def regex(filepattern):...\n", "f = []\n", "last = 0\n", "wildcards = set()\n", "for match in _wildcard_regex.finditer(filepattern):\n", "f.append(re.escape(filepattern[last:match.start()]))\n", "f.append(re.escape(filepattern[last:]))\n", "wildcard = match.group('name')\n", "f.append('$')\n", "if wildcard in wildcards:\n", "return ''.join(f)\n", "if match.group('constraint'):\n", "wildcards.add(wildcard)\n", "f.append('(?P={})'.format(wildcard))\n", "f.append('(?P<{}>{})'.format(wildcard, match.group('constraint') if match.\n group('constraint') else '.+'))\n", "last = match.end()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "For", "Expr'", "Expr'", "Assign'", "Expr'", "Condition", "Return'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'" ]
[ "def __init__(self, VAR_19, VAR_18):...\n", "self.contexts = VAR_18\n", "self.context = VAR_19\n" ]
[ "def __init__(self, context, contexts):...\n", "self.contexts = contexts\n", "self.context = context\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_7(self, VAR_7, VAR_3=None):...\n", "return self.get(VAR_7, VAR_3=filters, VAR_4=1)[0]\n" ]
[ "def getone(self, key, filters=None):...\n", "return self.get(key, filters=filters, limit=1)[0]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_3(self):...\n", "self.handled_resp = 1\n", "self.handled_remote = 1\n", "self.handled_args = 1\n", "self.handled_kwargs = 1\n" ]
[ "def handler_invalid(self):...\n", "self.handled_resp = 1\n", "self.handled_remote = 1\n", "self.handled_args = 1\n", "self.handled_kwargs = 1\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(VAR_10, VAR_12, VAR_11):...\n", "VAR_17 = list()\n", "VAR_18 = VAR_10.cursor()\n", "VAR_18.execute(VAR_11)\n", "VAR_19 = VAR_18.fetchall()\n", "for row in VAR_19:\n", "for classname in VAR_12.objects:\n", "return VAR_17\n", "for obj in VAR_12.objects[classname]:\n", "if obj.id == row[0]:\n", "VAR_17.append(obj)\n" ]
[ "def GetSQLObjects(database, documentcollection, query):...\n", "ret = list()\n", "cur = database.cursor()\n", "cur.execute(query)\n", "rows = cur.fetchall()\n", "for row in rows:\n", "for classname in documentcollection.objects:\n", "return ret\n", "for obj in documentcollection.objects[classname]:\n", "if obj.id == row[0]:\n", "ret.append(obj)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "For", "For", "Return'", "For", "Condition", "Expr'" ]
[ "def FUNC_0(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = threading.Thread(target=self._run, name='ray_import_thread')\n", "VAR_3.daemon = True\n", "VAR_3.start()\n" ]
[ "def start(self):...\n", "\"\"\"docstring\"\"\"\n", "t = threading.Thread(target=self._run, name='ray_import_thread')\n", "t.daemon = True\n", "t.start()\n" ]
[ 0, 0, 6, 6, 6 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'" ]
[ "def __repr__(self):...\n", "return self.__str__()\n" ]
[ "def __repr__(self):...\n", "return self.__str__()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_23 = 'katotest-server-group'\n", "VAR_21 = self.agent.type_to_payload('upsertGoogleServerGroupTagsDescription',\n {'credentials': self.bindings['GCE_CREDENTIALS'], 'zone': self.bindings\n ['TEST_GCE_ZONE'], 'serverGroupName': 'katotest-server-group', 'tags':\n ['test-tag-1', 'test-tag-2']})\n", "VAR_20 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_20.new_clause_builder('Server Group Tags Added').inspect_resource(\n 'managed-instance-groups', VAR_23).contains_pred_list([jc.\n PathContainsPredicate('name', VAR_23), jc.PathContainsPredicate(\n 'tags/items', ['test-tag-1', 'test-tag-2'])])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_server_group_tags', data=payload, VAR_29='ops'), contract=\n builder.build())\n" ]
[ "def upsert_google_server_group_tags(self):...\n", "server_group_name = 'katotest-server-group'\n", "payload = self.agent.type_to_payload('upsertGoogleServerGroupTagsDescription',\n {'credentials': self.bindings['GCE_CREDENTIALS'], 'zone': self.bindings\n ['TEST_GCE_ZONE'], 'serverGroupName': 'katotest-server-group', 'tags':\n ['test-tag-1', 'test-tag-2']})\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Server Group Tags Added').inspect_resource(\n 'managed-instance-groups', server_group_name).contains_pred_list([jc.\n PathContainsPredicate('name', server_group_name), jc.\n PathContainsPredicate('tags/items', ['test-tag-1', 'test-tag-2'])])\n", "return st.OperationContract(self.new_post_operation(title=\n 'upsert_server_group_tags', data=payload, path='ops'), contract=builder\n .build())\n" ]
[ 0, 0, 0, 0, 1, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_5, VAR_4):...\n", "self.el = VAR_5\n", "self.txt = VAR_4\n" ]
[ "def __init__(self, el, txt):...\n", "self.el = el\n", "self.txt = txt\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'" ]
[ "def FUNC_2(VAR_2, VAR_3='main'):...\n", "VAR_8, VAR_6 = FUNC_1(VAR_2)\n", "if VAR_8 not in VAR_9.path:\n", "VAR_9.path.insert(0, VAR_8)\n", "VAR_9.modules['__tng_runfile__'] = VAR_10 = imp.load_source(VAR_6, VAR_2)\n", "if hasattr(VAR_10, VAR_3):\n", "return getattr(VAR_10, VAR_3)\n", "logging.getLogger('tng').warn('No {} function found in {}'.format(VAR_3, VAR_2)\n )\n" ]
[ "def run_file(runfile, func_to_get='main'):...\n", "import_path, name = _guess_import_path_and_name(runfile)\n", "if import_path not in sys.path:\n", "sys.path.insert(0, import_path)\n", "sys.modules['__tng_runfile__'] = module = imp.load_source(name, runfile)\n", "if hasattr(module, func_to_get):\n", "return getattr(module, func_to_get)\n", "logging.getLogger('tng').warn('No {} function found in {}'.format(\n func_to_get, runfile))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'", "Condition", "Return'", "Expr'" ]
[ "def FUNC_33(self, VAR_24):...\n", "return self.regex().match(VAR_24) or None\n" ]
[ "def match(self, target):...\n", "return self.regex().match(target) or None\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.version = VAR_78\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.version = version\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_7, VAR_14=errors.USER_DOESNT_EXIST, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_7, VAR_14, *VAR_15, **kw)\n" ]
[ "def __init__(self, param, error=errors.USER_DOESNT_EXIST, *a, **kw):...\n", "VRequired.__init__(self, param, error, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_16):...\n", "FUNC_1('LOADING APP')\n", "self.path = VAR_16\n", "VAR_21 = ['install', 'remove', 'upgrade', 'backup', 'restore']\n", "self.scripts = {f: CLASS_2(self.path, f) for f in VAR_21}\n" ]
[ "def __init__(self, path):...\n", "print_header('LOADING APP')\n", "self.path = path\n", "scripts = ['install', 'remove', 'upgrade', 'backup', 'restore']\n", "self.scripts = {f: Script(self.path, f) for f in scripts}\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_13 = self.get_secure_cookie('session_key')\n", "if not VAR_13:\n", "return None\n", "VAR_14 = Login_Session.get_by_key(VAR_13, self.sql_session)\n", "if not VAR_14:\n", "return None\n", "return User.by_key(VAR_14.userkey, self.sql_session).scalar()\n" ]
[ "def get_current_user(self):...\n", "\"\"\"docstring\"\"\"\n", "session_key = self.get_secure_cookie('session_key')\n", "if not session_key:\n", "return None\n", "login_session = Login_Session.get_by_key(session_key, self.sql_session)\n", "if not login_session:\n", "return None\n", "return User.by_key(login_session.userkey, self.sql_session).scalar()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Return'" ]
[ "@property...\n", "return os.path.exists(self.file)\n" ]
[ "@property...\n", "return os.path.exists(self.file)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_0(VAR_2, VAR_3='utf-8'):...\n", "return f.read().decode(VAR_3)\n" ]
[ "def get_resource_as_string(name, charset='utf-8'):...\n", "return f.read().decode(charset)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __init__(self, VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5=None, VAR_6=...\n", "self.logger = logging.getLogger('fuxploider')\n", "self.postData = VAR_4\n", "self.formUrl = VAR_6\n", "VAR_18 = urlparse(self.formUrl)\n", "self.schema = VAR_18.scheme\n", "self.host = VAR_18.netloc\n", "self.uploadUrl = urljoin(VAR_6, VAR_7)\n", "self.session = VAR_2\n", "self.trueRegex = VAR_1\n", "self.notRegex = VAR_0\n", "self.inputName = VAR_8\n", "self.uploadsFolder = VAR_5\n", "self.size = VAR_3\n", "self.validExtensions = []\n", "self.httpRequests = 0\n", "self.codeExecUrlPattern = None\n", "self.logLock = Lock()\n", "self.stopThreads = False\n", "self.shouldLog = True\n" ]
[ "def __init__(self, notRegex, trueRegex, session, size, postData,...\n", "self.logger = logging.getLogger('fuxploider')\n", "self.postData = postData\n", "self.formUrl = formUrl\n", "url = urlparse(self.formUrl)\n", "self.schema = url.scheme\n", "self.host = url.netloc\n", "self.uploadUrl = urljoin(formUrl, formAction)\n", "self.session = session\n", "self.trueRegex = trueRegex\n", "self.notRegex = notRegex\n", "self.inputName = inputName\n", "self.uploadsFolder = uploadsFolder\n", "self.size = size\n", "self.validExtensions = []\n", "self.httpRequests = 0\n", "self.codeExecUrlPattern = None\n", "self.logLock = Lock()\n", "self.stopThreads = False\n", "self.shouldLog = True\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_13(VAR_20, VAR_21):...\n", "VAR_16 = {}\n", "VAR_17 = [('manager', VAR_21)]\n", "VAR_47 = FUNC_14(VAR_20)\n", "FUNC_8('dataset/%d/managers/add' % VAR_47, VAR_17=files, VAR_16=args)\n" ]
[ "def add_manager(task_id, manager):...\n", "args = {}\n", "files = [('manager', manager)]\n", "dataset_id = get_task_active_dataset_id(task_id)\n", "admin_req('dataset/%d/managers/add' % dataset_id, files=files, args=args)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_6(self, VAR_64):...\n", "if not VAR_64:\n", "return None\n", "VAR_88 = [int(i, 36) for i in VAR_64.split(',')]\n", "VAR_89 = Comment._byID(VAR_88, data=True, return_dict=False)\n", "return VAR_89\n" ]
[ "def run(self, id_str):...\n", "if not id_str:\n", "return None\n", "cids = [int(i, 36) for i in id_str.split(',')]\n", "comments = Comment._byID(cids, data=True, return_dict=False)\n", "return comments\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_7(self):...\n", "self.assertFalse(DatabaseQuery('DocType').execute(filters={'name': ['in',\n None]}))\n", "self.assertTrue({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['not in', None]}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertTrue(result in DatabaseQuery('DocType').execute(filters={'name':\n ['in', 'DocType,DocField']}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertFalse(result in DatabaseQuery('DocType').execute(filters={'name':\n ['not in', 'DocType,DocField']}))\n" ]
[ "def test_in_not_in_filters(self):...\n", "self.assertFalse(DatabaseQuery('DocType').execute(filters={'name': ['in',\n None]}))\n", "self.assertTrue({'name': 'DocType'} in DatabaseQuery('DocType').execute(\n filters={'name': ['not in', None]}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertTrue(result in DatabaseQuery('DocType').execute(filters={'name':\n ['in', 'DocType,DocField']}))\n", "for result in [{'name': 'DocType'}, {'name': 'DocField'}]:\n", "self.assertFalse(result in DatabaseQuery('DocType').execute(filters={'name':\n ['not in', 'DocType,DocField']}))\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "For", "Expr'", "For", "Expr'" ]
[ "def FUNC_12(self):...\n", "VAR_14 = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "VAR_14.url_get('connections/1')\n", "FUNC_1('get', VAR_14, 'https://1.2.3.4/api/v1/ports/connections/1')\n" ]
[ "def test_client_url_get(self):...\n", "api = self.new_mocked_client(client.RESTClient, url_prefix='api/v1/ports')\n", "api.url_get('connections/1')\n", "assert_call('get', api, 'https://1.2.3.4/api/v1/ports/connections/1')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3(VAR_7):...\n", "" ]
[ "def get_pp_stats(osuId):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "from flask import Flask, g, jsonify, request\n", "from jsonschema import validate, ValidationError\n", "import argparse\n", "import functools\n", "import sqlite3\n", "\"\"\"string\"\"\"\n", "VAR_0 = Flask(__name__)\n", "VAR_1 = './tissue.db'\n", "VAR_2 = './schema.sql'\n", "def FUNC_0(VAR_3=False):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_11(VAR_9):...\n", "@functools.wraps(VAR_9)...\n", "VAR_19 = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n", "if VAR_3:\n", "VAR_19['definitions']['issue']['required'].append('id')\n", "VAR_19 = {**VAR_19, **{'type': 'object', 'properties': {'data': {'type':\n 'array', 'minItems': 1, 'items': {'$ref': '#/definitions/issue'}}}}}\n", "VAR_19['definitions']['issue']['properties']['id'] = {'type': ['integer',\n 'string']}\n", "VAR_20 = request.get_json()\n", "validate(instance=request_payload, schema=request_schema)\n", "return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n", "return VAR_9(*VAR_17, **kwargs)\n" ]
[ "from flask import Flask, g, jsonify, request\n", "from jsonschema import validate, ValidationError\n", "import argparse\n", "import functools\n", "import sqlite3\n", "\"\"\"\n[todo] Replace query string concatenations with DB-API’s parameter\nsubstitution to avoid SQL injection attacks.\n\"\"\"\n", "app = Flask(__name__)\n", "DATABASE_FILE = './tissue.db'\n", "SCHEMA_FILE = './schema.sql'\n", "def validate_request_payload(require_id=False):...\n", "\"\"\"docstring\"\"\"\n", "def decorator(func):...\n", "@functools.wraps(func)...\n", "request_schema = {'$schema': 'http://json-schema.org/draft-07/schema#',\n 'definitions': {'tag': {'type': 'object', 'required': ['namespace',\n 'predicate', 'value'], 'properties': {'namespace': {'type': 'string'},\n 'predicate': {'type': 'string'}, 'value': {'type': ['number', 'string']\n }}}, 'issue': {'type': 'object', 'required': ['title'], 'properties': {\n 'title': {'type': 'string'}, 'description': {'type': 'string'}, 'tags':\n {'type': 'array', 'default': [], 'minItems': 0, 'items': {'$ref':\n '#/definitions/tag'}}}}}}\n", "if require_id:\n", "request_schema['definitions']['issue']['required'].append('id')\n", "request_schema = {**request_schema, **{'type': 'object', 'properties': {\n 'data': {'type': 'array', 'minItems': 1, 'items': {'$ref':\n '#/definitions/issue'}}}}}\n", "request_schema['definitions']['issue']['properties']['id'] = {'type': [\n 'integer', 'string']}\n", "request_payload = request.get_json()\n", "validate(instance=request_payload, schema=request_schema)\n", "return jsonify({'data': [], 'errors': [\n 'failed to validate payload against json schema']}), 400\n", "return func(*args, **kwargs)\n" ]
[ 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Expr'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Docstring", "FunctionDef'", "Condition", "Assign'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'", "Return'" ]
[ "def FUNC_13(self):...\n", "VAR_34 = self.builder.get_object('unlock_failed_box')\n", "VAR_35 = VAR_34.get_style_context()\n", "VAR_35.add_class('NotifyRevealer')\n", "VAR_36 = self.builder.get_object('unlock_failed_revealer')\n", "VAR_36.set_reveal_child(not VAR_36.get_reveal_child())\n", "VAR_37 = threading.Timer(3.0, self.hide_unlock_failed_revealer)\n", "VAR_37.start()\n" ]
[ "def show_unlock_failed_revealer(self):...\n", "unlock_failed_box = self.builder.get_object('unlock_failed_box')\n", "context = unlock_failed_box.get_style_context()\n", "context.add_class('NotifyRevealer')\n", "unlock_failed_revealer = self.builder.get_object('unlock_failed_revealer')\n", "unlock_failed_revealer.set_reveal_child(not unlock_failed_revealer.\n get_reveal_child())\n", "revealer_timer = threading.Timer(3.0, self.hide_unlock_failed_revealer)\n", "revealer_timer.start()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_13(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ "def test_x_delete_server_group(self):...\n", "self.run_test_case(self.scenario.delete_server_group(), max_retries=5)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_16(self, VAR_11):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('BufferUnload', {'unloaded_buffer': VAR_11})\n" ]
[ "def OnBufferUnload(self, deleted_buffer_file):...\n", "if not self._IsServerAlive():\n", "return\n", "SendEventNotificationAsync('BufferUnload', {'unloaded_buffer':\n deleted_buffer_file})\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_6, (str, unicode)):\n", "return bool(re.match(VAR_8, VAR_6))\n", "return False\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(value, (str, unicode)):\n", "return bool(re.match(gl_type, value))\n", "return False\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Return'", "Return'" ]
[ "def FUNC_11(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_35 = len(self.build_graph)\n", "self.run_tracker.pantsd_stats.set_affected_targets_size(VAR_35)\n", "return VAR_35\n" ]
[ "def _set_affected_target_count_in_runtracker(self):...\n", "\"\"\"docstring\"\"\"\n", "target_count = len(self.build_graph)\n", "self.run_tracker.pantsd_stats.set_affected_targets_size(target_count)\n", "return target_count\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_7(VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = FUNC_2()\n", "VAR_6 = FUNC_3(VAR_2)['size']\n", "VAR_7 = FUNC_3(VAR_2)['age']\n", "VAR_10 = FUNC_3(VAR_2)['passes']\n", "print(VAR_11, '>', VAR_2, ' Current size: ', VAR_6, ' Last updated: ',\n VAR_7, ' Number of passes: ', VAR_10)\n", "return\n" ]
[ "def log_event(path):...\n", "\"\"\"docstring\"\"\"\n", "time_now = get_time_now()\n", "file_size = db_get_file_details(path)['size']\n", "file_age = db_get_file_details(path)['age']\n", "file_passes = db_get_file_details(path)['passes']\n", "print(time_now, '>', path, ' Current size: ', file_size, ' Last updated: ',\n file_age, ' Number of passes: ', file_passes)\n", "return\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_7(self, VAR_9):...\n", "VAR_6 = self.view.window().extract_variables()['file_name']\n", "self.view.show_popup('`' + VAR_6 + '` copied to the clipboard')\n", "sublime.set_clipboard(VAR_6)\n" ]
[ "def run(self, edit):...\n", "filename = self.view.window().extract_variables()['file_name']\n", "self.view.show_popup('`' + filename + '` copied to the clipboard')\n", "sublime.set_clipboard(filename)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_5(VAR_1, VAR_2, VAR_3, VAR_5, VAR_4=False):...\n", "\"\"\"docstring\"\"\"\n", "VAR_21 = str(VAR_3).replace(\"'\", '`')\n", "VAR_16 = f'INSERT INTO {VAR_2} {VAR_21} VALUES {VAR_5};'\n", "if VAR_4:\n", "print(VAR_16)\n", "VAR_17 = VAR_1.cursor()\n", "VAR_17.execute(VAR_16)\n", "VAR_1.commit()\n" ]
[ "def db_insert(conn, table, columns, values, debug=False):...\n", "\"\"\"docstring\"\"\"\n", "col_str = str(columns).replace(\"'\", '`')\n", "sql = f'INSERT INTO {table} {col_str} VALUES {values};'\n", "if debug:\n", "print(sql)\n", "cursor = conn.cursor()\n", "cursor.execute(sql)\n", "conn.commit()\n" ]
[ 0, 0, 4, 4, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "return False\n" ]
[ "def is_expired(self):...\n", "\"\"\"docstring\"\"\"\n", "return False\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def FUNC_27(VAR_21):...\n", "VAR_33['msg'] = VAR_21\n", "return VAR_21.type == 'event' and VAR_21.event == VAR_19 and VAR_20(VAR_21)\n" ]
[ "def match(msg):...\n", "result['msg'] = msg\n", "return msg.type == 'event' and msg.event == event and condition(msg)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_2(self):...\n", "VAR_6 = find_paths(VAR_2, 'Chaos', 'Chaos')\n", "self.assertListEqual(FUNC_0(), VAR_6)\n", "VAR_7 = find_paths(VAR_2.copy(), 'Chaos', 'Chromatic')\n", "self.assertListEqual(VAR_3, VAR_7)\n" ]
[ "def test_find_paths(self):...\n", "paths_small_same_currency = find_paths(expected_graph_small, 'Chaos', 'Chaos')\n", "self.assertListEqual(expected_paths_small_same_currency(),\n paths_small_same_currency)\n", "paths_small_different_currency = find_paths(expected_graph_small.copy(),\n 'Chaos', 'Chromatic')\n", "self.assertListEqual(expected_paths_small_different_currency,\n paths_small_different_currency)\n" ]
[ 0, 0, 1, 0, 1 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_13(self, VAR_22):...\n", "\"\"\"docstring\"\"\"\n", "logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", VAR_22, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n", "self.abort(403, detail=str(error))\n" ]
[ "def authorization_error(self, error):...\n", "\"\"\"docstring\"\"\"\n", "logging.warning(\"\"\"Authorization error.\n%s\nPeer: %s\nIP: %s\"\"\", error, api.\n get_peer_identity().to_bytes(), self.request.remote_addr)\n", "self.abort(403, detail=str(error))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'" ]
[ "@staticmethod...\n", "VAR_11 = VAR_1.split(':')[1].split(',')\n", "VAR_12 = int(VAR_11[0])\n", "VAR_13 = int(VAR_11[1])\n", "VAR_14 = int(VAR_11[2])\n", "return VAR_12, VAR_13, VAR_14\n" ]
[ "@staticmethod...\n", "board_split = board_str.split(':')[1].split(',')\n", "ghost_count = int(board_split[0])\n", "vampire_count = int(board_split[1])\n", "zombie_count = int(board_split[2])\n", "return ghost_count, vampire_count, zombie_count\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_20(self, VAR_17, VAR_16):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_export(self, context, volume):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_13(self, VAR_9, VAR_10=None, VAR_11=None):...\n", "\"\"\"docstring\"\"\"\n", "VAR_28 = self.get_and_check_task(VAR_9, VAR_10, VAR_11, VAR_16={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n", "VAR_30 = get_tile_json(VAR_28.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}}/{{x}}/{{y}}.png'.format(VAR_28.\n project.id, VAR_28.id)], VAR_28.orthophoto_area.extent)\n", "return Response(VAR_30)\n" ]
[ "def get(self, request, pk=None, project_pk=None):...\n", "\"\"\"docstring\"\"\"\n", "task = self.get_and_check_task(request, pk, project_pk, annotate={\n 'orthophoto_area': Envelope(Cast('orthophoto', GeometryField()))})\n", "json = get_tile_json(task.name, [\n '/api/projects/{}/tasks/{}/tiles/{{z}}/{{x}}/{{y}}.png'.format(task.\n project.id, task.id)], task.orthophoto_area.extent)\n", "return Response(json)\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_5(self):...\n", "VAR_1 = VAR_0.copy()\n", "VAR_1['SHIB_eppn'] = self.user.username\n", "VAR_2 = self._get(VAR_1)\n", "self.assertEqual(VAR_2.status_code, 302)\n", "self.assertEqual(User.objects.count(), 1)\n", "VAR_3 = User.objects.first()\n", "self.assertEqual(VAR_3.email, '[email protected]')\n", "self.assertEqual(VAR_3.first_name, 'Teemu')\n", "self.assertEqual(VAR_3.last_name, 'Sukunimi')\n", "self.assertEqual(VAR_3.userprofile.student_id, '123453')\n" ]
[ "def test_valid_old(self):...\n", "meta = DEF_SHIBD_META.copy()\n", "meta['SHIB_eppn'] = self.user.username\n", "response = self._get(meta)\n", "self.assertEqual(response.status_code, 302)\n", "self.assertEqual(User.objects.count(), 1)\n", "user = User.objects.first()\n", "self.assertEqual(user.email, '[email protected]')\n", "self.assertEqual(user.first_name, 'Teemu')\n", "self.assertEqual(user.last_name, 'Sukunimi')\n", "self.assertEqual(user.userprofile.student_id, '123453')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_40(self):...\n", "self.cursor.execute('create table t1(a int, b varchar(10))')\n", "VAR_28 = [(i, str(i)) for i in range(1, 6)]\n", "self.cursor.executemany('insert into t1(a, b) values (?,?)', VAR_28)\n", "VAR_26 = self.cursor.execute('select count(*) from t1').fetchone()[0]\n", "self.assertEqual(VAR_26, VAR_23(VAR_28))\n", "self.cursor.execute('select a, b from t1 order by a')\n", "VAR_29 = self.cursor.fetchall()\n", "self.assertEqual(VAR_26, VAR_23(VAR_29))\n", "for param, VAR_24 in zip(VAR_28, VAR_29):\n", "self.assertEqual(param[0], VAR_24[0])\n", "self.assertEqual(param[1], VAR_24[1])\n" ]
[ "def test_executemany(self):...\n", "self.cursor.execute('create table t1(a int, b varchar(10))')\n", "params = [(i, str(i)) for i in range(1, 6)]\n", "self.cursor.executemany('insert into t1(a, b) values (?,?)', params)\n", "count = self.cursor.execute('select count(*) from t1').fetchone()[0]\n", "self.assertEqual(count, len(params))\n", "self.cursor.execute('select a, b from t1 order by a')\n", "rows = self.cursor.fetchall()\n", "self.assertEqual(count, len(rows))\n", "for param, row in zip(params, rows):\n", "self.assertEqual(param[0], row[0])\n", "self.assertEqual(param[1], row[1])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "For", "Expr'", "Expr'" ]
[ "@VAR_0.route('/initDB')...\n", "db.create_all()\n", "return 'This is naughty and MUST not be in production!'\n" ]
[ "@app.route('/initDB')...\n", "db.create_all()\n", "return 'This is naughty and MUST not be in production!'\n" ]
[ 0, 0, 0 ]
[ "Condition", "Expr'", "Return'" ]
[ "def FUNC_33(VAR_57, VAR_22):...\n", "if not len(VAR_57):\n", "VAR_56.append('/%s' % ('/'.join(VAR_22),))\n", "if VAR_57[0] == '.':\n", "FUNC_33(VAR_57[1:], VAR_22)\n", "if VAR_57[0] == '..':\n", "FUNC_33(VAR_57[1:], VAR_22[:-1])\n", "VAR_65 = [x[VAR_1] for x in self.get_path('/'.join(VAR_22))]\n", "VAR_74 = [x for x in VAR_65 if fnmatch.fnmatchcase(x, VAR_57[0])]\n", "for match in VAR_74:\n", "FUNC_33(VAR_57[1:], VAR_22 + [match])\n" ]
[ "def foo(p, cwd):...\n", "if not len(p):\n", "found.append('/%s' % ('/'.join(cwd),))\n", "if p[0] == '.':\n", "foo(p[1:], cwd)\n", "if p[0] == '..':\n", "foo(p[1:], cwd[:-1])\n", "names = [x[A_NAME] for x in self.get_path('/'.join(cwd))]\n", "matches = [x for x in names if fnmatch.fnmatchcase(x, p[0])]\n", "for match in matches:\n", "foo(p[1:], cwd + [match])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "Assign'", "For", "Expr'" ]
[ "def FUNC_6(self, VAR_4):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_4.id is None:\n", "VAR_12 = self.__id_map[VAR_4.id]\n", "self.remove(VAR_12)\n", "self.add(VAR_4)\n" ]
[ "def replace(self, entity):...\n", "\"\"\"docstring\"\"\"\n", "if entity.id is None:\n", "old_entity = self.__id_map[entity.id]\n", "self.remove(old_entity)\n", "self.add(entity)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_4(self, VAR_9=10000):...\n", "\"\"\"docstring\"\"\"\n", "VAR_27 = [self.primary_subscribe_client]\n", "for subscribe_client in VAR_27:\n", "for _ in range(VAR_9):\n", "VAR_16 = subscribe_client.get_message()\n", "if VAR_16 is None:\n", "VAR_5 = VAR_16['channel']\n", "VAR_7 = VAR_16['data']\n", "if VAR_5 == ray.gcs_utils.XRAY_HEARTBEAT_BATCH_CHANNEL:\n", "VAR_50 = self.xray_heartbeat_batch_handler\n", "if VAR_5 == ray.gcs_utils.XRAY_DRIVER_CHANNEL:\n", "VAR_50(VAR_5, VAR_7)\n", "VAR_50 = self.xray_driver_removed_handler\n" ]
[ "def process_messages(self, max_messages=10000):...\n", "\"\"\"docstring\"\"\"\n", "subscribe_clients = [self.primary_subscribe_client]\n", "for subscribe_client in subscribe_clients:\n", "for _ in range(max_messages):\n", "message = subscribe_client.get_message()\n", "if message is None:\n", "channel = message['channel']\n", "data = message['data']\n", "if channel == ray.gcs_utils.XRAY_HEARTBEAT_BATCH_CHANNEL:\n", "message_handler = self.xray_heartbeat_batch_handler\n", "if channel == ray.gcs_utils.XRAY_DRIVER_CHANNEL:\n", "message_handler(channel, data)\n", "message_handler = self.xray_driver_removed_handler\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "For", "For", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_3(self):...\n", "VAR_3 = self.app.get('/manage/add/element/org/repo')\n", "self.assertEqual(VAR_3.status_int, 200)\n", "self.assertEqual(VAR_3.normal_body, 'OK')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 1)\n", "self.assertEqual(VAR_1[0].url, util.ingest_library_task('org', 'repo',\n 'element'))\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n '[{\"ref\": \"refs/tags/v1.0.0\", \"object\": {\"sha\": \"lol\"}}]')\n", "VAR_3 = self.app.get(util.ingest_library_task('org', 'repo', 'element'))\n", "self.assertEqual(VAR_3.status_int, 200)\n", "VAR_0 = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(VAR_0)\n", "self.assertIsNone(VAR_0.error)\n", "self.assertEqual(VAR_0.kind, 'element')\n", "self.assertEqual(VAR_0.metadata, 'metadata bits')\n", "self.assertEqual(VAR_0.contributors, '[\"a\"]')\n", "self.assertEqual(VAR_0.contributor_count, 1)\n", "VAR_2 = ndb.Key(Library, 'org/repo', Version, 'v1.0.0').get()\n", "self.assertIsNone(VAR_2.error)\n", "self.assertEqual(VAR_2.sha, 'lol')\n", "VAR_1 = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(VAR_1), 2)\n", "self.assertEqual(VAR_1[1].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n" ]
[ "def test_add_element(self):...\n", "response = self.app.get('/manage/add/element/org/repo')\n", "self.assertEqual(response.status_int, 200)\n", "self.assertEqual(response.normal_body, 'OK')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 1)\n", "self.assertEqual(tasks[0].url, util.ingest_library_task('org', 'repo',\n 'element'))\n", "self.respond_to_github('https://api.github.com/repos/org/repo', 'metadata bits'\n )\n", "self.respond_to_github('https://api.github.com/repos/org/repo/contributors',\n '[\"a\"]')\n", "self.respond_to_github('https://api.github.com/repos/org/repo/git/refs/tags',\n '[{\"ref\": \"refs/tags/v1.0.0\", \"object\": {\"sha\": \"lol\"}}]')\n", "response = self.app.get(util.ingest_library_task('org', 'repo', 'element'))\n", "self.assertEqual(response.status_int, 200)\n", "library = Library.get_by_id('org/repo')\n", "self.assertIsNotNone(library)\n", "self.assertIsNone(library.error)\n", "self.assertEqual(library.kind, 'element')\n", "self.assertEqual(library.metadata, 'metadata bits')\n", "self.assertEqual(library.contributors, '[\"a\"]')\n", "self.assertEqual(library.contributor_count, 1)\n", "version = ndb.Key(Library, 'org/repo', Version, 'v1.0.0').get()\n", "self.assertIsNone(version.error)\n", "self.assertEqual(version.sha, 'lol')\n", "tasks = self.tasks.get_filtered_tasks()\n", "self.assertEqual(len(tasks), 2)\n", "self.assertEqual(tasks[1].url, util.ingest_version_task('org', 'repo',\n 'v1.0.0') + '?latestVersion=True')\n" ]
[ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_8(VAR_10):...\n", "\"\"\"docstring\"\"\"\n", "VAR_25 = []\n", "VAR_26 = []\n", "VAR_27 = CommerceConfiguration.current()\n", "VAR_28 = {'username': VAR_10.username}\n", "VAR_29 = VAR_27.is_cache_enabled\n", "VAR_30 = VAR_27.CACHE_KEY + '.' + str(VAR_10.id) if VAR_29 else None\n", "VAR_31 = ecommerce_api_client(VAR_10)\n", "VAR_32 = get_edx_api_data(VAR_27, 'orders', VAR_31=api, querystring=\n user_query, VAR_30=cache_key)\n", "for order in VAR_32:\n", "if order['status'].lower() == 'complete':\n", "return VAR_26\n", "VAR_42 = datetime.strptime(order['date_placed'], '%Y-%m-%dT%H:%M:%SZ')\n", "VAR_43 = {'number': order['number'], 'price': order['total_excl_tax'],\n 'order_date': strftime_localized(VAR_42, 'SHORT_DATE'), 'receipt_url':\n EcommerceService().get_receipt_page_url(order['number']), 'lines':\n order['lines']}\n", "VAR_26.append(VAR_43)\n" ]
[ "def get_user_orders(user):...\n", "\"\"\"docstring\"\"\"\n", "no_data = []\n", "user_orders = []\n", "commerce_configuration = CommerceConfiguration.current()\n", "user_query = {'username': user.username}\n", "use_cache = commerce_configuration.is_cache_enabled\n", "cache_key = commerce_configuration.CACHE_KEY + '.' + str(user.id\n ) if use_cache else None\n", "api = ecommerce_api_client(user)\n", "commerce_user_orders = get_edx_api_data(commerce_configuration, 'orders',\n api=api, querystring=user_query, cache_key=cache_key)\n", "for order in commerce_user_orders:\n", "if order['status'].lower() == 'complete':\n", "return user_orders\n", "date_placed = datetime.strptime(order['date_placed'], '%Y-%m-%dT%H:%M:%SZ')\n", "order_data = {'number': order['number'], 'price': order['total_excl_tax'],\n 'order_date': strftime_localized(date_placed, 'SHORT_DATE'),\n 'receipt_url': EcommerceService().get_receipt_page_url(order['number']),\n 'lines': order['lines']}\n", "user_orders.append(order_data)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_3(self, VAR_10):...\n", "self.serial.write(bytes(VAR_10, encoding='utf-8'))\n" ]
[ "def write(self, string):...\n", "self.serial.write(bytes(string, encoding='utf-8'))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "\"\"\"\nfile descriptor\n\n\"\"\"\n", "__author__ = \"Tadhg O'Rourke\"\n", "__date__ = '29/08/2019'\n", "import sqlite3\n", "VAR_0 = sqlite3.connect('contacts.sqlite')\n", "VAR_1 = (\n \"UPDATE contacts SET email = '[email protected]' WHERE email LIKE '[email protected]'\"\n )\n", "VAR_2 = VAR_0.cursor()\n", "VAR_2.execute(VAR_1)\n", "VAR_2.connection.commit()\n", "print(VAR_2.rowcount)\n", "for row in VAR_0.execute('SELECT * FROM Contacts'):\n", "print(row)\n", "VAR_2.close()\n", "VAR_0.close()\n" ]
[ "\"\"\"\nfile descriptor\n\n\"\"\"\n", "__author__ = \"Tadhg O'Rourke\"\n", "__date__ = '29/08/2019'\n", "import sqlite3\n", "db = sqlite3.connect('contacts.sqlite')\n", "update_sql = (\n \"UPDATE contacts SET email = '[email protected]' WHERE email LIKE '[email protected]'\"\n )\n", "update_cursor = db.cursor()\n", "update_cursor.execute(update_sql)\n", "update_cursor.connection.commit()\n", "print(update_cursor.rowcount)\n", "for row in db.execute('SELECT * FROM Contacts'):\n", "print(row)\n", "update_cursor.close()\n", "db.close()\n" ]
[ 0, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Assign'", "Assign'", "Import'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "For", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_37(self, VAR_40):...\n", "\"\"\"docstring\"\"\"\n", "self.set_name(VAR_40, len(self) - 1)\n" ]
[ "def add_name(self, name):...\n", "\"\"\"docstring\"\"\"\n", "self.set_name(name, len(self) - 1)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.norun = True\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.norun = True\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_2():...\n", "super(CLASS_7, self).__init__(slideParser.parse(VAR_10, slideLexer) if\n VAR_10 else [])\n" ]
[ "def innerFunc():...\n", "super(Stretch, self).__init__(slideParser.parse(txt, slideLexer) if txt else []\n )\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "VAR_17 = [VAR_28.mtime for VAR_28 in self.input if VAR_28.exists]\n", "if VAR_17:\n", "return max(VAR_17)\n", "return None\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "existing = [f.mtime for f in self.input if f.exists]\n", "if existing:\n", "return max(existing)\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_1(self, VAR_5, VAR_6):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_5 not in ('strings', 'files'):\n", "VAR_0.error(\"Bad parameter '%s' for submit_type\", VAR_5)\n", "VAR_13 = Folders.create_temp()\n", "return False\n", "VAR_14 = {'data': [], 'errors': []}\n", "if VAR_5 == 'strings':\n", "for VAR_4 in VAR_6:\n", "if VAR_5 == 'files':\n", "self._handle_string(VAR_14, VAR_13, VAR_4)\n", "for entry in VAR_6:\n", "return Database().add_submit(VAR_13, VAR_5, VAR_14)\n", "VAR_22 = Storage.get_filename_from_path(entry['name'])\n", "VAR_18 = Files.create(VAR_13, VAR_22, entry['data'])\n", "VAR_14['data'].append({'type': 'file', 'data': VAR_18})\n" ]
[ "def pre(self, submit_type, data):...\n", "\"\"\"docstring\"\"\"\n", "if submit_type not in ('strings', 'files'):\n", "log.error(\"Bad parameter '%s' for submit_type\", submit_type)\n", "path_tmp = Folders.create_temp()\n", "return False\n", "submit_data = {'data': [], 'errors': []}\n", "if submit_type == 'strings':\n", "for line in data:\n", "if submit_type == 'files':\n", "self._handle_string(submit_data, path_tmp, line)\n", "for entry in data:\n", "return Database().add_submit(path_tmp, submit_type, submit_data)\n", "filename = Storage.get_filename_from_path(entry['name'])\n", "filepath = Files.create(path_tmp, filename, entry['data'])\n", "submit_data['data'].append({'type': 'file', 'data': filepath})\n" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Expr'", "Assign'", "Return'", "Assign'", "Condition", "For", "Condition", "Expr'", "For", "Return'", "Assign'", "Assign'", "Expr'" ]
[ "@VAR_0.route('/register', methods=['GET', 'POST'])...\n", "VAR_46 = CLASS_0(request.form)\n", "if request.method == 'POST' and VAR_46.validate():\n", "VAR_41 = VAR_46.name.data\n", "return render_template('register.html', VAR_46=form)\n", "VAR_43 = VAR_46.email.data\n", "VAR_42 = VAR_46.username.data\n", "VAR_44 = sha256_crypt.encrypt(str(VAR_46.password.data))\n", "VAR_28 = VAR_1.connection.cursor()\n", "VAR_28.execute(\n 'INSERT INTO Users(name, email, username, password) VALUES(%s, %s, %s, %s)'\n , (VAR_41, VAR_43, VAR_42, VAR_44))\n", "VAR_1.connection.commit()\n", "VAR_28.close()\n", "flash('You are now registered and can log in', 'success')\n", "return redirect(url_for('login'))\n" ]
[ "@app.route('/register', methods=['GET', 'POST'])...\n", "form = RegisterForm(request.form)\n", "if request.method == 'POST' and form.validate():\n", "name = form.name.data\n", "return render_template('register.html', form=form)\n", "email = form.email.data\n", "username = form.username.data\n", "password = sha256_crypt.encrypt(str(form.password.data))\n", "cur = mysql.connection.cursor()\n", "cur.execute(\n 'INSERT INTO Users(name, email, username, password) VALUES(%s, %s, %s, %s)'\n , (name, email, username, password))\n", "mysql.connection.commit()\n", "cur.close()\n", "flash('You are now registered and can log in', 'success')\n", "return redirect(url_for('login'))\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_6():...\n", "VAR_10 = kube_utils.get_pods(VAR_0, VAR_4, VAR_2='kube-system',\n status_phase='Running')\n", "assert len(VAR_10) >= VAR_5\n" ]
[ "def _check_pods_count():...\n", "pods = kube_utils.get_pods(host, label, namespace='kube-system',\n status_phase='Running')\n", "assert len(pods) >= min_pods_count\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assert'" ]
[ "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "VAR_7 = get_next_url_for_login_page(VAR_3)\n", "if VAR_3.user.is_authenticated():\n", "return redirect(VAR_7)\n", "VAR_11 = FUNC_6(VAR_3)\n", "VAR_12 = None\n", "if '?' in VAR_7:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "VAR_38 = urlparse.parse_qs(urlparse.urlparse(VAR_7).query)\n", "if VAR_4 == 'login':\n", "VAR_13 = FUNC_7(VAR_3, VAR_4)\n", "VAR_39 = VAR_38['tpa_hint'][0]\n", "return old_login_view(VAR_3)\n", "if VAR_4 == 'register':\n", "if VAR_13 is not None:\n", "VAR_40 = third_party_auth.provider.Registry.get(VAR_39=provider_id)\n", "return old_register_view(VAR_3)\n", "return VAR_13\n", "VAR_14 = [{'message': message.message, 'tags': message.tags} for message in\n messages.get_messages(VAR_3) if 'account-activation' in message.tags]\n", "if VAR_40:\n", "VAR_5 = {'data': {'login_redirect_url': VAR_7, 'initial_mode': VAR_4,\n 'third_party_auth': FUNC_5(VAR_3, VAR_7, VAR_12),\n 'third_party_auth_hint': VAR_12 or '', 'platform_name':\n configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME\n ), 'support_link': configuration_helpers.get_value('SUPPORT_SITE_LINK',\n settings.SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': VAR_14, 'login_form_desc': json.loads(\n VAR_11['login']), 'registration_form_desc': json.loads(VAR_11[\n 'registration']), 'password_reset_form_desc': json.loads(VAR_11[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url': VAR_7,\n 'responsive': True, 'allow_iframing': True, 'disable_courseware_js': \n True, 'combined_login_and_register': True, 'disable_footer': not\n configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if VAR_40.skip_hinted_login_dialog:\n", "VAR_5 = FUNC_2(VAR_3, VAR_5)\n", "return redirect(pipeline.get_login_url(VAR_39, pipeline.AUTH_ENTRY_LOGIN,\n redirect_url=redirect_to))\n", "VAR_12 = VAR_39\n", "VAR_15 = render_to_response('student_account/login_and_register.html', VAR_5)\n", "VAR_4 = 'hinted_login'\n", "VAR_15.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return VAR_15\n" ]
[ "@require_http_methods(['GET'])...\n", "\"\"\"docstring\"\"\"\n", "redirect_to = get_next_url_for_login_page(request)\n", "if request.user.is_authenticated():\n", "return redirect(redirect_to)\n", "form_descriptions = _get_form_descriptions(request)\n", "third_party_auth_hint = None\n", "if '?' in redirect_to:\n", "if is_request_in_themed_site() and not configuration_helpers.get_value(\n", "next_args = urlparse.parse_qs(urlparse.urlparse(redirect_to).query)\n", "if initial_mode == 'login':\n", "ext_auth_response = _external_auth_intercept(request, initial_mode)\n", "provider_id = next_args['tpa_hint'][0]\n", "return old_login_view(request)\n", "if initial_mode == 'register':\n", "if ext_auth_response is not None:\n", "tpa_hint_provider = third_party_auth.provider.Registry.get(provider_id=\n provider_id)\n", "return old_register_view(request)\n", "return ext_auth_response\n", "account_activation_messages = [{'message': message.message, 'tags': message\n .tags} for message in messages.get_messages(request) if \n 'account-activation' in message.tags]\n", "if tpa_hint_provider:\n", "context = {'data': {'login_redirect_url': redirect_to, 'initial_mode':\n initial_mode, 'third_party_auth': _third_party_auth_context(request,\n redirect_to, third_party_auth_hint), 'third_party_auth_hint': \n third_party_auth_hint or '', 'platform_name': configuration_helpers.\n get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'support_link':\n configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.\n SUPPORT_SITE_LINK), 'password_reset_support_link': \n configuration_helpers.get_value('PASSWORD_RESET_SUPPORT_LINK', settings\n .PASSWORD_RESET_SUPPORT_LINK) or settings.SUPPORT_SITE_LINK,\n 'account_activation_messages': account_activation_messages,\n 'login_form_desc': json.loads(form_descriptions['login']),\n 'registration_form_desc': json.loads(form_descriptions['registration']),\n 'password_reset_form_desc': json.loads(form_descriptions[\n 'password_reset']), 'account_creation_allowed': configuration_helpers.\n get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get(\n 'ALLOW_PUBLIC_ACCOUNT_CREATION', True))}, 'login_redirect_url':\n redirect_to, 'responsive': True, 'allow_iframing': True,\n 'disable_courseware_js': True, 'combined_login_and_register': True,\n 'disable_footer': not configuration_helpers.get_value(\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', settings.FEATURES[\n 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'])}\n", "if tpa_hint_provider.skip_hinted_login_dialog:\n", "context = update_context_for_enterprise(request, context)\n", "return redirect(pipeline.get_login_url(provider_id, pipeline.\n AUTH_ENTRY_LOGIN, redirect_url=redirect_to))\n", "third_party_auth_hint = provider_id\n", "response = render_to_response('student_account/login_and_register.html',\n context)\n", "initial_mode = 'hinted_login'\n", "response.delete_cookie(configuration_helpers.get_value(\n 'ENTERPRISE_CUSTOMER_COOKIE_NAME', settings.\n ENTERPRISE_CUSTOMER_COOKIE_NAME), domain=configuration_helpers.\n get_value('BASE_COOKIE_DOMAIN', settings.BASE_COOKIE_DOMAIN))\n", "return response\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, 6, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Condition", "Assign'", "Return'", "Return'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@property...\n", "VAR_65 = '.' if self._workdir is None else self._workdir\n", "if not os.path.isabs(VAR_65):\n", "return os.path.abspath(os.path.join(self.workflow.basedir, VAR_65))\n", "return VAR_65\n" ]
[ "@property...\n", "workdir = '.' if self._workdir is None else self._workdir\n", "if not os.path.isabs(workdir):\n", "return os.path.abspath(os.path.join(self.workflow.basedir, workdir))\n", "return workdir\n" ]
[ 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(self, VAR_10, VAR_11):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def create_volume_from_snapshot(self, volume, snapshot):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_7(self):...\n", "return self.content\n" ]
[ "def read(self):...\n", "return self.content\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_14(self, VAR_17, VAR_6):...\n", "if self.container == NotImplemented:\n", "self.create_container()\n", "VAR_40 = ContainerPage(VAR_6)\n", "VAR_41 = Gtk.HBox(False, 0)\n", "VAR_42 = Gtk.Label(VAR_17)\n", "VAR_41.pack_start(VAR_42, False, False, False)\n", "VAR_43 = Gio.ThemedIcon(name='window-close-symbolic')\n", "VAR_44 = Gtk.Image.new_from_gicon(VAR_43, Gtk.IconSize.BUTTON)\n", "VAR_45 = Gtk.Button()\n", "VAR_45.set_relief(Gtk.ReliefStyle.NONE)\n", "VAR_45.set_focus_on_click(False)\n", "VAR_45.connect('clicked', self.on_tab_close_button_clicked, VAR_40)\n", "VAR_45.add(VAR_44)\n", "VAR_41.pack_start(VAR_45, False, False, False)\n", "VAR_41.show_all()\n", "self.container.append_page(VAR_40, VAR_41)\n", "self.container.set_current_page(self.container.page_num(VAR_40))\n", "self.update_tab_bar_visibility()\n", "return VAR_40\n" ]
[ "def create_tab(self, title, headerbar):...\n", "if self.container == NotImplemented:\n", "self.create_container()\n", "page_instance = ContainerPage(headerbar)\n", "tab_hbox = Gtk.HBox(False, 0)\n", "tab_label = Gtk.Label(title)\n", "tab_hbox.pack_start(tab_label, False, False, False)\n", "icon = Gio.ThemedIcon(name='window-close-symbolic')\n", "close_image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)\n", "close_button = Gtk.Button()\n", "close_button.set_relief(Gtk.ReliefStyle.NONE)\n", "close_button.set_focus_on_click(False)\n", "close_button.connect('clicked', self.on_tab_close_button_clicked, page_instance\n )\n", "close_button.add(close_image)\n", "tab_hbox.pack_start(close_button, False, False, False)\n", "tab_hbox.show_all()\n", "self.container.append_page(page_instance, tab_hbox)\n", "self.container.set_current_page(self.container.page_num(page_instance))\n", "self.update_tab_bar_visibility()\n", "return page_instance\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_17(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_7, VAR_12 = self.make_xsrf_handling_app(VAR_3='X-Some')\n", "VAR_17 = VAR_7.get('/request').body\n", "VAR_7.post('/request', VAR_20={'X-Some': token})\n", "self.assertEqual([('POST', True)], VAR_12)\n" ]
[ "def test_xsrf_token_uses_xsrf_token_header(self):...\n", "\"\"\"docstring\"\"\"\n", "app, calls = self.make_xsrf_handling_app(xsrf_token_header='X-Some')\n", "token = app.get('/request').body\n", "app.post('/request', headers={'X-Some': token})\n", "self.assertEqual([('POST', True)], calls)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_29(self, VAR_5):...\n", "def FUNC_31():...\n", "VAR_24 = vim.eval('tagfiles()')\n", "VAR_25 = VAR_0.getcwd()\n", "return [VAR_0.path.join(VAR_25, x) for x in VAR_24]\n" ]
[ "def _AddTagsFilesIfNeeded(self, extra_data):...\n", "def GetTagFiles():...\n", "tag_files = vim.eval('tagfiles()')\n", "current_working_directory = os.getcwd()\n", "return [os.path.join(current_working_directory, x) for x in tag_files]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if 'network' in VAR_5 and 'domains' in VAR_5['network']:\n", "VAR_20 = dict((i['domain'], i['ip']) for i in VAR_5['network']['domains'])\n", "VAR_20 = dict()\n", "VAR_21 = dict((i['ip'], i['domain']) for i in VAR_5['network']['domains'])\n", "VAR_21 = dict()\n", "for i in VAR_5['network']['dns']:\n", "return {'domainlookups': VAR_20, 'iplookups': VAR_21}\n", "for VAR_29 in i['answers']:\n", "VAR_21[VAR_29['data']] = i['request']\n" ]
[ "@staticmethod...\n", "\"\"\"docstring\"\"\"\n", "if 'network' in report and 'domains' in report['network']:\n", "domainlookups = dict((i['domain'], i['ip']) for i in report['network'][\n 'domains'])\n", "domainlookups = dict()\n", "iplookups = dict((i['ip'], i['domain']) for i in report['network']['domains'])\n", "iplookups = dict()\n", "for i in report['network']['dns']:\n", "return {'domainlookups': domainlookups, 'iplookups': iplookups}\n", "for a in i['answers']:\n", "iplookups[a['data']] = i['request']\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Return'", "For", "Assign'" ]
[ "def FUNC_11(VAR_4):...\n", "VAR_0, VAR_10 = FUNC_0()\n", "VAR_18 = \"SELECT * from {} where token='{}'\".format(CFG('tokens_table_name'\n ), VAR_4)\n", "VAR_20 = bool(FUNC_3(VAR_10, VAR_18))\n", "FUNC_1(VAR_0)\n", "return VAR_20\n" ]
[ "def isValidToken(token):...\n", "conn, c = connectDB()\n", "req = \"SELECT * from {} where token='{}'\".format(CFG('tokens_table_name'),\n token)\n", "answer = bool(queryOne(c, req))\n", "closeDB(conn)\n", "return answer\n" ]
[ 0, 0, 4, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def FUNC_16(VAR_19=['Christmas Mike', 'christmasmike'], VAR_20=VAR_0):...\n", "VAR_18 = []\n", "for VAR_125 in VAR_20:\n", "VAR_4, VAR_36 = FUNC_2(VAR_125)\n", "return VAR_18\n", "for VAR_94 in range(VAR_4, VAR_36 + 1):\n", "VAR_15 = VAR_125.replace('###', str(VAR_94))\n", "VAR_14 = FUNC_10(VAR_15)\n", "for VAR_17 in VAR_19:\n", "if VAR_14 and FUNC_14(VAR_17, VAR_14=bracket):\n", "VAR_18.append(VAR_15)\n" ]
[ "def get_urls_with_players(players=['Christmas Mike', 'christmasmike'],...\n", "urls = []\n", "for base in base_urls:\n", "start, end = get_valid_url_range(base)\n", "return urls\n", "for i in range(start, end + 1):\n", "bracket_url = base.replace('###', str(i))\n", "bracket = get_sanitized_bracket(bracket_url)\n", "for player in players:\n", "if bracket and player_in_bracket(player, bracket=bracket):\n", "urls.append(bracket_url)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Assign'", "Return'", "For", "Assign'", "Assign'", "For", "Condition", "Expr'" ]
[ "def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n", "CLASS_3.__init__(self, VAR_18, errors.NO_URL, *VAR_15, **kw)\n" ]
[ "def __init__(self, item, *a, **kw):...\n", "VRequired.__init__(self, item, errors.NO_URL, *a, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_5 = [{'cloudProvider': 'gce', 'loadBalancerName': self.__lb_name,\n 'ipProtocol': 'TCP', 'portRange': '8080', 'provider': 'gce', 'stack':\n self.TEST_STACK, 'detail': 'frontend', 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'region': self.TEST_REGION, 'listeners': [{\n 'protocol': 'TCP', 'portRange': '8080', 'healthCheck': False}], 'name':\n self.__lb_name, 'type': 'upsertLoadBalancer', 'availabilityZones': {\n self.TEST_REGION: []}, 'user': 'integration-tests'}]\n", "VAR_6 = gcp.GceContractBuilder(self.gce_observer)\n", "VAR_6.new_clause_builder('Load Balancer Created', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_path_value('name', self.\n __lb_name)\n", "VAR_7 = self.agent.make_json_payload_from_kwargs(VAR_5=job, description=\n 'Server Group Test - create load balancer', application=self.TEST_APP)\n", "return st.OperationContract(self.new_post_operation(title=\n 'create_load_balancer', data=payload, path=self.__path), contract=\n builder.build())\n" ]
[ "def create_load_balancer(self):...\n", "job = [{'cloudProvider': 'gce', 'loadBalancerName': self.__lb_name,\n 'ipProtocol': 'TCP', 'portRange': '8080', 'provider': 'gce', 'stack':\n self.TEST_STACK, 'detail': 'frontend', 'credentials': self.bindings[\n 'GCE_CREDENTIALS'], 'region': self.TEST_REGION, 'listeners': [{\n 'protocol': 'TCP', 'portRange': '8080', 'healthCheck': False}], 'name':\n self.__lb_name, 'type': 'upsertLoadBalancer', 'availabilityZones': {\n self.TEST_REGION: []}, 'user': 'integration-tests'}]\n", "builder = gcp.GceContractBuilder(self.gce_observer)\n", "builder.new_clause_builder('Load Balancer Created', retryable_for_secs=30\n ).list_resources('forwarding-rules').contains_path_value('name', self.\n __lb_name)\n", "payload = self.agent.make_json_payload_from_kwargs(job=job, description=\n 'Server Group Test - create load balancer', application=self.TEST_APP)\n", "return st.OperationContract(self.new_post_operation(title=\n 'create_load_balancer', data=payload, path=self.__path), contract=\n builder.build())\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Return'" ]
[ "def FUNC_4(VAR_5):...\n", "VAR_13 = 'user:%s' % VAR_5\n", "if VAR_2.hlen(VAR_13) == 0:\n", "return None\n", "VAR_14 = VAR_2.hgetall(VAR_13)\n", "VAR_6 = CLASS_0()\n", "VAR_6.user_id = VAR_14['user_id']\n", "VAR_6.email = VAR_14['email']\n", "VAR_6.password_hash = generate_password_hash(VAR_14['password_hash'])\n", "return VAR_6\n" ]
[ "def auth_get_user_by_id(user_id):...\n", "key = 'user:%s' % user_id\n", "if db.hlen(key) == 0:\n", "return None\n", "user_data = db.hgetall(key)\n", "user = User()\n", "user.user_id = user_data['user_id']\n", "user.email = user_data['email']\n", "user.password_hash = generate_password_hash(user_data['password_hash'])\n", "return user\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Return'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_11(self, VAR_13):...\n", "\"\"\"docstring\"\"\"\n", "VAR_26 = self.add_argument_group('ParlAI Image Preprocessing Arguments')\n", "VAR_26.add_argument('--image-size', type=int, default=256, help=\n 'resizing dimension for images')\n", "VAR_26.add_argument('--image-cropsize', type=int, default=224, help=\n 'crop dimension for images')\n" ]
[ "def add_image_args(self, image_mode):...\n", "\"\"\"docstring\"\"\"\n", "parlai = self.add_argument_group('ParlAI Image Preprocessing Arguments')\n", "parlai.add_argument('--image-size', type=int, default=256, help=\n 'resizing dimension for images')\n", "parlai.add_argument('--image-cropsize', type=int, default=224, help=\n 'crop dimension for images')\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Expr'" ]
[ "def __lt__(self, VAR_16):...\n", "VAR_39 = self.workflow._ruleorder.compare(self, VAR_16)\n", "return VAR_39 < 0\n" ]
[ "def __lt__(self, rule):...\n", "comp = self.workflow._ruleorder.compare(self, rule)\n", "return comp < 0\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_17(self, VAR_54, VAR_39):...\n", "\"\"\"docstring\"\"\"\n", "if VAR_39 == self.INTEGER:\n", "if VAR_39 == self.DATE:\n", "int(VAR_54)\n", "if VAR_39 == self.DATE_TIME:\n", "datetime.datetime.strptime(VAR_54, '%Y-%m-%d')\n", "datetime.datetime.strptime(VAR_54, '%Y-%m-%dT%H:%M:%S')\n" ]
[ "def _sanitize_value(self, value, data_type):...\n", "\"\"\"docstring\"\"\"\n", "if data_type == self.INTEGER:\n", "if data_type == self.DATE:\n", "int(value)\n", "if data_type == self.DATE_TIME:\n", "datetime.datetime.strptime(value, '%Y-%m-%d')\n", "datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Expr'", "Condition", "Expr'", "Expr'" ]
[ "def FUNC_2(self, VAR_6, VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(VAR_7, unicode):\n", "if isinstance(VAR_7, str):\n", "return u'<input name=\"%s\" value=\"%s\" size=%d>' % (html_escape(VAR_6),\n html_escape(VAR_7), self.input_size)\n", "VAR_7 = VAR_7.decode('utf-8')\n", "if VAR_7 is not None:\n", "VAR_7 = str(VAR_7)\n", "VAR_7 = ''\n" ]
[ "def text_input(self, name, value):...\n", "\"\"\"docstring\"\"\"\n", "if isinstance(value, unicode):\n", "if isinstance(value, str):\n", "return u'<input name=\"%s\" value=\"%s\" size=%d>' % (html_escape(name),\n html_escape(value), self.input_size)\n", "value = value.decode('utf-8')\n", "if value is not None:\n", "value = str(value)\n", "value = ''\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Assign'" ]
[ "def __init__(self, VAR_18, VAR_35=10000, **VAR_16):...\n", "CLASS_17.__init__(self, VAR_18, VAR_35=length, VAR_36=errors.NO_MSG_BODY, **kw)\n" ]
[ "def __init__(self, item, length=10000, **kw):...\n", "VLength.__init__(self, item, length=length, empty_error=errors.NO_MSG_BODY,\n **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def __init__(self, VAR_7=True, VAR_8=False):...\n", "\"\"\"docstring\"\"\"\n", "super().__init__(description='ParlAI parser.', allow_abbrev=False,\n conflict_handler='resolve')\n", "self.register('type', 'bool', FUNC_0)\n", "self.register('type', 'class', FUNC_1)\n", "self.parlai_home = VAR_20.path.dirname(VAR_20.path.dirname(VAR_20.path.\n dirname(VAR_20.path.realpath(__file__))))\n", "VAR_20.environ['PARLAI_HOME'] = self.parlai_home\n", "self.add_arg = self.add_argument\n", "self.cli_args = sys.argv\n", "self.overridable = {}\n", "if VAR_7:\n", "self.add_parlai_args()\n", "if VAR_8:\n", "self.add_model_args()\n" ]
[ "def __init__(self, add_parlai_args=True, add_model_args=False):...\n", "\"\"\"docstring\"\"\"\n", "super().__init__(description='ParlAI parser.', allow_abbrev=False,\n conflict_handler='resolve')\n", "self.register('type', 'bool', str2bool)\n", "self.register('type', 'class', str2class)\n", "self.parlai_home = os.path.dirname(os.path.dirname(os.path.dirname(os.path.\n realpath(__file__))))\n", "os.environ['PARLAI_HOME'] = self.parlai_home\n", "self.add_arg = self.add_argument\n", "self.cli_args = sys.argv\n", "self.overridable = {}\n", "if add_parlai_args:\n", "self.add_parlai_args()\n", "if add_model_args:\n", "self.add_model_args()\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_59, VAR_60):...\n", "if self.remember:\n", "VAR_96 = '%s_%s' % (VAR_60, self.nav.get_param)\n", "if VAR_59 not in self.nav.options:\n", "VAR_97 = copy(VAR_101.user.sort_options) if VAR_101.user else {}\n", "VAR_59 = self.nav.default\n", "if self.remember and VAR_101.user_is_loggedin and VAR_59 != VAR_98:\n", "VAR_98 = VAR_97.get(VAR_96)\n", "VAR_97[VAR_96] = VAR_59\n", "return VAR_59\n", "if not VAR_59:\n", "VAR_101.user.sort_options = VAR_97\n", "VAR_59 = VAR_98\n", "VAR_82 = VAR_101.user\n", "utils.worker.do(lambda : VAR_82._commit())\n" ]
[ "def run(self, sort, where):...\n", "if self.remember:\n", "pref = '%s_%s' % (where, self.nav.get_param)\n", "if sort not in self.nav.options:\n", "user_prefs = copy(c.user.sort_options) if c.user else {}\n", "sort = self.nav.default\n", "if self.remember and c.user_is_loggedin and sort != user_pref:\n", "user_pref = user_prefs.get(pref)\n", "user_prefs[pref] = sort\n", "return sort\n", "if not sort:\n", "c.user.sort_options = user_prefs\n", "sort = user_pref\n", "user = c.user\n", "utils.worker.do(lambda : user._commit())\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'" ]
[ "def FUNC_11(self):...\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (select name from tabUser), count(name))'],\n limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, (select count(*) from tabSessions)'],\n limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n \"issingle, SELECT LOCATE('', `tabUser`.`user`) AS user;\"], limit_start=\n 0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (SELECT name from tabUser), count(*))'],\n limit_start=0, limit_page_length=1)\n", "VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'count(name)'], limit_start=0, limit_page_length=1)\n", "self.assertTrue('count(name)' in VAR_3[0])\n", "VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n \"locate('', name) as _relevance\"], limit_start=0, limit_page_length=1)\n", "self.assertTrue('_relevance' in VAR_3[0])\n", "VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'date(creation) as creation'], limit_start=0, limit_page_length=1)\n", "self.assertTrue('creation' in VAR_3[0])\n", "VAR_3 = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'datediff(modified, creation) as date_diff'], limit_start=0,\n limit_page_length=1)\n", "self.assertTrue('date_diff' in VAR_3[0])\n" ]
[ "def test_query_fields_sanitizer(self):...\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, version()'], limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (select name from tabUser), count(name))'],\n limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name', 'issingle, (select count(*) from tabSessions)'],\n limit_start=0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n \"issingle, SELECT LOCATE('', `tabUser`.`user`) AS user;\"], limit_start=\n 0, limit_page_length=1)\n", "self.assertRaises(frappe.DataError, DatabaseQuery('DocType').execute,\n fields=['name',\n 'issingle, IF(issingle=1, (SELECT name from tabUser), count(*))'],\n limit_start=0, limit_page_length=1)\n", "data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'count(name)'], limit_start=0, limit_page_length=1)\n", "self.assertTrue('count(name)' in data[0])\n", "data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n \"locate('', name) as _relevance\"], limit_start=0, limit_page_length=1)\n", "self.assertTrue('_relevance' in data[0])\n", "data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'date(creation) as creation'], limit_start=0, limit_page_length=1)\n", "self.assertTrue('creation' in data[0])\n", "data = DatabaseQuery('DocType').execute(fields=['name', 'issingle',\n 'datediff(modified, creation) as date_diff'], limit_start=0,\n limit_page_length=1)\n", "self.assertTrue('date_diff' in data[0])\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_10(self) ->str:...\n", "\"\"\"docstring\"\"\"\n", "return self.stderr_interceptor.flush_all()\n", "return ''\n" ]
[ "def flush_stderr(self) ->str:...\n", "\"\"\"docstring\"\"\"\n", "return self.stderr_interceptor.flush_all()\n", "return ''\n" ]
[ 0, 0, 6, 0 ]
[ "FunctionDef'", "Docstring", "Return'", "Return'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.norun = True\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.norun = True\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_10(self, VAR_11, VAR_3):...\n", "return set()\n" ]
[ "def get_parameters(self, levelfields, doc):...\n", "return set()\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def __exit__(self, VAR_15, VAR_16, VAR_17):...\n", "self.connection.commit()\n", "self.connection.close()\n", "self.lock.release()\n", "if VAR_15 is not None or VAR_16 is not None or VAR_17 is not None:\n", "return False\n" ]
[ "def __exit__(self, type_, value, traceback):...\n", "self.connection.commit()\n", "self.connection.close()\n", "self.lock.release()\n", "if type_ is not None or value is not None or traceback is not None:\n", "return False\n" ]
[ 0, 2, 2, 2, 2, 2 ]
[ "FunctionDef'", "Expr'", "Expr'", "Expr'", "Condition", "Return'" ]
[ "def FUNC_45(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n" ]
[ "def get_image_column_list(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n ImageColumn)]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_12(VAR_1, VAR_2):...\n", "\"\"\"docstring\"\"\"\n", "VAR_11 = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "VAR_11.execute('string', (VAR_1, VAR_2))\n", "VAR_14 = VAR_11.fetchone()\n", "VAR_15 = VAR_14['state'] if VAR_14 else 'REVEALED'\n", "VAR_11.execute('string', {'player_id': VAR_2, 'achievement_id': VAR_1,\n 'state': VAR_15})\n", "return dict(current_state=new_state)\n" ]
[ "def reveal_achievement(achievement_id, player_id):...\n", "\"\"\"docstring\"\"\"\n", "cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n", "cursor.execute(\n \"\"\"SELECT\n state\n FROM player_achievements\n WHERE achievement_id = %s AND player_id = %s\"\"\"\n , (achievement_id, player_id))\n", "player_achievement = cursor.fetchone()\n", "new_state = player_achievement['state'] if player_achievement else 'REVEALED'\n", "cursor.execute(\n \"\"\"INSERT INTO player_achievements (player_id, achievement_id, state)\n VALUES\n (%(player_id)s, %(achievement_id)s, %(state)s)\n ON DUPLICATE KEY UPDATE\n state = VALUES(state)\"\"\"\n , {'player_id': player_id, 'achievement_id': achievement_id, 'state':\n new_state})\n", "return dict(current_state=new_state)\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Return'" ]