lines
listlengths
1
444
raw_lines
listlengths
1
444
label
listlengths
1
444
type
listlengths
1
444
[ "def FUNC_17(self, VAR_21, VAR_22):...\n", "if type(VAR_21) == str:\n", "VAR_21 = self.locate(VAR_21)\n", "if type(VAR_22) == str:\n", "VAR_22 = self.locate(VAR_22)\n", "if not VAR_21 or not VAR_22:\n", "return False\n", "VAR_48 = VAR_21.parent\n", "VAR_48.sub_items.remove(VAR_21)\n", "VAR_21.pare...
[ "def move(self, source, target_parent):...\n", "if type(source) == str:\n", "source = self.locate(source)\n", "if type(target_parent) == str:\n", "target_parent = self.locate(target_parent)\n", "if not source or not target_parent:\n", "return False\n", "par = source.parent\n", "par.sub_items.remove(...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Return'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Return'" ]
[ "@route('POST', '/-test/stop', VAR_1=website)...\n", "FUNC_7()\n" ]
[ "@route('POST', '/-test/stop', website=website)...\n", "stop_browser()\n" ]
[ 0, 0 ]
[ "Condition", "Expr'" ]
[ "def FUNC_13(self, *VAR_16, **VAR_10):...\n", "if not self.is_group_user(VAR_8):\n", "return VAR_7(self, *VAR_16, **kwargs)\n" ]
[ "def wrapper(self, *args, **kwargs):...\n", "if not self.is_group_user(group):\n", "return method(self, *args, **kwargs)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'" ]
[ "@FUNC_7...\n", "\"\"\"docstring\"\"\"\n", "FUNC_1(VAR_1, VAR_2)\n", "return redirect('/')\n" ]
[ "@oauth_error_handler...\n", "\"\"\"docstring\"\"\"\n", "response_token_setter(remote, resp)\n", "return redirect('/')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Return'" ]
[ "def FUNC_1(self, VAR_2):...\n", "self.read_xsrf_token(VAR_2.base_url)\n", "VAR_2.execute()\n" ]
[ "def login(self, login_request):...\n", "self.read_xsrf_token(login_request.base_url)\n", "login_request.execute()\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Expr'" ]
[ "def FUNC_9(self):...\n", "self.test_strings = ('normal_string', 'string with spaces',\n 'string with quotes\"a', \"string with s-quotes'b\", 'bsn \\n A',\n 'unrecognized \\\\q escape')\n" ]
[ "def setUp(self):...\n", "self.test_strings = ('normal_string', 'string with spaces',\n 'string with quotes\"a', \"string with s-quotes'b\", 'bsn \\n A',\n 'unrecognized \\\\q escape')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def FUNC_2(VAR_0, VAR_1):...\n", "VAR_5 = frappe.session.user\n", "VAR_6 = get_leave_allocation_records(VAR_0.to_date)\n", "VAR_7 = get_leave_allocation_records(VAR_0.from_date)\n", "VAR_8 = frappe.get_all('Employee', VAR_0={'status': 'Active', 'company':\n filters.company}, fields=['name', 'employee_na...
[ "def get_data(filters, leave_types):...\n", "user = frappe.session.user\n", "allocation_records_based_on_to_date = get_leave_allocation_records(filters.\n to_date)\n", "allocation_records_based_on_from_date = get_leave_allocation_records(filters\n .from_date)\n", "active_employees = frappe.get_all('Em...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Assign'", "Return'", "Condition", "Assign'", "For", "Assign'", "Expr'", "Assign'", "Assign'", "AugAssign'" ]
[ "def FUNC_3(self):...\n", "self.check_xsrf()\n", "if self.check() == False:\n", "return self.redirect('/')\n", "VAR_6 = self.request.files['filename']\n", "if VAR_6.filename:\n", "VAR_8 = imghdr.what(VAR_6.file)\n", "return self.redirect('/user')\n", "VAR_9 = self.get_filesize(VAR_6.file)\n", "if ...
[ "def post(self):...\n", "self.check_xsrf()\n", "if self.check() == False:\n", "return self.redirect('/')\n", "fileitem = self.request.files['filename']\n", "if fileitem.filename:\n", "filetype = imghdr.what(fileitem.file)\n", "return self.redirect('/user')\n", "filesize = self.get_filesize(fileitem....
[ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@functools.wraps(VAR_58)...\n", "return VAR_58(*VAR_61, **kwargs)\n" ]
[ "@functools.wraps(orig_attr)...\n", "return orig_attr(*args, **kwargs)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "@VAR_1.user_loader...\n", "return CLASS_0.query.get(VAR_5)\n" ]
[ "@login_manager.user_loader...\n", "return User.query.get(user_id)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_7(self, VAR_9='paths'):...\n", "\"\"\"docstring\"\"\"\n", "assert VAR_9 == 'paths' or VAR_9 == 'ngrams', 'Error: Invalid assumption'\n", "if VAR_9 == 'paths':\n", "return self.dof_paths\n", "return self.dof_ngrams\n" ]
[ "def getDoF(self, assumption='paths'):...\n", "\"\"\"docstring\"\"\"\n", "assert assumption == 'paths' or assumption == 'ngrams', 'Error: Invalid assumption'\n", "if assumption == 'paths':\n", "return self.dof_paths\n", "return self.dof_ngrams\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assert'", "Condition", "Return'", "Return'" ]
[ "def FUNC_4(self, VAR_1, VAR_2, VAR_5, VAR_10=None, VAR_11=False, VAR_4=None):...\n", "\"\"\"docstring\"\"\"\n", "if not VAR_10:\n", "VAR_10 = []\n", "if VAR_4 is None:\n", "VAR_4 = {}\n", "VAR_29 = {}\n", "for VAR_48 in VAR_5:\n", "VAR_29[VAR_48] = {}.fromkeys(VAR_10, 0.0)\n", "for VAR_55 in VAR_...
[ "def _product_available(self, cr, uid, ids, field_names=None, arg=False,...\n", "\"\"\"docstring\"\"\"\n", "if not field_names:\n", "field_names = []\n", "if context is None:\n", "context = {}\n", "res = {}\n", "for id in ids:\n", "res[id] = {}.fromkeys(field_names, 0.0)\n", "for f in field_names:...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "For", "Assign'", "For", "Assign'", "Return'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Condition", "Expr'", "Assign'", "For", "Assign'" ]
[ "@api_post...\n", "VAR_7 = VAR_3.get('submit_id', 0)\n", "VAR_8 = VAR_3.get('password', None)\n", "VAR_9 = VAR_3.get('astree', True)\n", "VAR_6 = VAR_0.get_files(VAR_7=submit_id, VAR_8=password, VAR_9=astree)\n", "return JsonResponse({'status': True, 'data': VAR_6, 'defaults': FUNC_0()},\n encoder=Json...
[ "@api_post...\n", "submit_id = body.get('submit_id', 0)\n", "password = body.get('password', None)\n", "astree = body.get('astree', True)\n", "data = submit_manager.get_files(submit_id=submit_id, password=password,\n astree=astree)\n", "return JsonResponse({'status': True, 'data': data, 'defaults': def...
[ 0, 0, 0, 0, 1, 1 ]
[ "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n", "self.item = VAR_18\n", "CLASS_0.__init__(self, VAR_18, *VAR_15, **kw)\n" ]
[ "def __init__(self, item, *a, **kw):...\n", "self.item = item\n", "Validator.__init__(self, item, *a, **kw)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "def FUNC_0(self, VAR_9, VAR_5):...\n", "self.instrPtr = VAR_9[1][0]\n", "return ophandlers.makeJump(VAR_9[0], VAR_5, self.symId)\n" ]
[ "def takeJumpPath(self, pair, symbols):...\n", "self.instrPtr = pair[1][0]\n", "return ophandlers.makeJump(pair[0], symbols, self.symId)\n" ]
[ 0, 0, 1 ]
[ "FunctionDef'", "Assign'", "Return'" ]
[ "def FUNC_23(VAR_11):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ "def _fake_recv(ignore_arg):...\n", "return '%s> ' % self.configuration.eqlx_group_name\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_22(self):...\n", "\"\"\"docstring\"\"\"\n", "self.run_example('nonsense.py')\n", "self.assertEqual(1, len(self.b_mgr.skipped))\n" ]
[ "def test_nonsense(self):...\n", "\"\"\"docstring\"\"\"\n", "self.run_example('nonsense.py')\n", "self.assertEqual(1, len(self.b_mgr.skipped))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Expr'", "Expr'" ]
[ "@staticmethod...\n", "VAR_5 = VAR_2.FILES.getlist('files[]')\n", "VAR_6 = []\n", "if VAR_5:\n", "for f in VAR_5:\n", "VAR_3 = json.loads(VAR_2.body)\n", "VAR_6.append({'name': f.name, 'data': f.file})\n", "VAR_7 = VAR_0.pre(VAR_10='files', VAR_6=data)\n", "VAR_10 = VAR_3['type']\n", "return redir...
[ "@staticmethod...\n", "files = request.FILES.getlist('files[]')\n", "data = []\n", "if files:\n", "for f in files:\n", "body = json.loads(request.body)\n", "data.append({'name': f.name, 'data': f.file})\n", "submit_id = submit_manager.pre(submit_type='files', data=data)\n", "submit_type = body['type...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "Assign'", "Assign'", "Condition", "For", "Assign'", "Expr'", "Assign'", "Assign'", "Return'", "Condition", "Return'", "Assign'", "Return'" ]
[ "@wraps(VAR_6)...\n", "if not request.is_xhr:\n", "return abort(401)\n", "return VAR_6(*VAR_11, **kwargs)\n" ]
[ "@wraps(f)...\n", "if not request.is_xhr:\n", "return abort(401)\n", "return f(*args, **kwargs)\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Condition", "Return'", "Return'" ]
[ "def FUNC_31(self):...\n", "if not os.path.isfile(self.usersfile):\n", "return\n", "VAR_50 = pickle.loads(f.read())\n", "for VAR_20 in VAR_50.keys():\n", "self.log.exception(e)\n", "VAR_18 = Queue()\n", "self.log.error('Failed to load users')\n", "for VAR_16 in VAR_50[VAR_20]:\n", "self.log.debug(...
[ "def load_users(self):...\n", "if not os.path.isfile(self.usersfile):\n", "return\n", "users = pickle.loads(f.read())\n", "for domain in users.keys():\n", "self.log.exception(e)\n", "uq = Queue()\n", "self.log.error('Failed to load users')\n", "for ud in users[domain]:\n", "self.log.debug('Loaded ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "For", "Expr'", "Assign'", "Expr'", "For", "Expr'", "Assign'", "Expr'" ]
[ "import os\n", "import time\n", "import json\n", "import base64\n", "from hashlib import sha256\n", "from werkzeug.exceptions import NotFound\n", "from werkzeug.http import dump_cookie\n", "from flask import session\n", "from flask import Blueprint\n", "from saml2.s_utils import deflate_and_base64...
[ "import os\n", "import time\n", "import json\n", "import base64\n", "from hashlib import sha256\n", "from werkzeug.exceptions import NotFound\n", "from werkzeug.http import dump_cookie\n", "from flask import session\n", "from flask import Blueprint\n", "from saml2.s_utils import deflate_and_base64...
[ 0, 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 ]
[ "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'"...
[ "def FUNC_3(VAR_2):...\n", "VAR_4 = FUNC_1(VAR_2)\n", "VAR_1 = set()\n", "for VAR_24, j, _ in VAR_4:\n", "VAR_1.add(VAR_24)\n", "VAR_1 = list(VAR_1)\n", "VAR_1.add(j)\n", "VAR_16, VAR_17 = partition_groups(VAR_1)\n", "VAR_18 = {}\n", "for VAR_24 in VAR_16:\n", "VAR_18[VAR_24] = 0\n", "for VAR_...
[ "def sub_network(keywords):...\n", "tweets = get_tweets(keywords)\n", "users = set()\n", "for i, j, _ in tweets:\n", "users.add(i)\n", "users = list(users)\n", "users.add(j)\n", "group1, group2 = partition_groups(users)\n", "partition = {}\n", "for i in group1:\n", "partition[i] = 0\n", "for i...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "For", "Assign'", "For", "Assign'", "Assign'", "Assign'", "For", "Condition", "Assign'", "Expr'", "Return'" ]
[ "@VAR_4.cli.command('initdb')...\n", "\"\"\"docstring\"\"\"\n", "FUNC_3()\n", "print('Initialized the database.')\n" ]
[ "@app.cli.command('initdb')...\n", "\"\"\"docstring\"\"\"\n", "init_db()\n", "print('Initialized the database.')\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Docstring", "Expr'", "Expr'" ]
[ "def FUNC_39(VAR_101):...\n", "VAR_101.docstring = VAR_68\n", "return VAR_101\n" ]
[ "def decorate(ruleinfo):...\n", "ruleinfo.docstring = string\n", "return ruleinfo\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Return'" ]
[ "def __init__(self, *VAR_5, **VAR_6):...\n", "VAR_2 = VAR_6['campaign']\n", "super(CLASS_1, self).__init__(*VAR_5, **kwargs)\n", "VAR_39 = self.event_choices(VAR_2, 'event_type')\n", "self.filters['event_type'].extra.update(VAR_4=event_type_choices)\n", "self.filters['event_type'].widget.attrs['size'] = m...
[ "def __init__(self, *args, **kwargs):...\n", "campaign = kwargs['campaign']\n", "super(event_filter, self).__init__(*args, **kwargs)\n", "event_type_choices = self.event_choices(campaign, 'event_type')\n", "self.filters['event_type'].extra.update(choices=event_type_choices)\n", "self.filters['event_type']...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Assign'", "Expr'", "Assign'" ]
[ "def FUNC_2(VAR_0, VAR_1=None):...\n", "VAR_9 = cfg.get_config()\n", "if VAR_1 is not None:\n", "VAR_2 = FUNC_3(VAR_9.dsn, VAR_1)\n", "VAR_2 = VAR_9.dsn\n", "VAR_10 = sa.create_engine(VAR_2)\n", "VAR_0.addfinalizer(VAR_10.dispose)\n", "return VAR_10\n" ]
[ "def _get_engine(request, database=None):...\n", "config = cfg.get_config()\n", "if database is not None:\n", "dsn = _replace_dsn_database(config.dsn, database)\n", "dsn = config.dsn\n", "engine = sa.create_engine(dsn)\n", "request.addfinalizer(engine.dispose)\n", "return engine\n" ]
[ 0, 0, 0, 4, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "def __init__(self, VAR_6):...\n", "self.update(VAR_6)\n", "self.dont_update_if_missing = []\n", "if hasattr(self, '__setup__'):\n", "self.__setup__()\n" ]
[ "def __init__(self, d):...\n", "self.update(d)\n", "self.dont_update_if_missing = []\n", "if hasattr(self, '__setup__'):\n", "self.__setup__()\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Expr'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_3(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_6 = jc.Contract()\n", "return st.OperationContract(self.agent.make_create_app_operation(VAR_1=self\n .bindings, application=self.TEST_APP), VAR_6=contract)\n" ]
[ "def create_app(self):...\n", "\"\"\"docstring\"\"\"\n", "contract = jc.Contract()\n", "return st.OperationContract(self.agent.make_create_app_operation(bindings=\n self.bindings, application=self.TEST_APP), contract=contract)\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "def FUNC_28(self):...\n", "VAR_21 = self._time\n", "self._time += 0.0001\n", "return VAR_21\n" ]
[ "def time(self):...\n", "ret = self._time\n", "self._time += 0.0001\n", "return ret\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "AugAssign'", "Return'" ]
[ "def FUNC_4(self):...\n", "" ]
[ "def drop(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_35(self):...\n", "if not os.path.isfile(self.bumplimitfile):\n", "return\n", "self.pc.sets['bumplimit'].update(pickle.loads(f.read()))\n" ]
[ "def load_bumplimit_set(self):...\n", "if not os.path.isfile(self.bumplimitfile):\n", "return\n", "self.pc.sets['bumplimit'].update(pickle.loads(f.read()))\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Expr'" ]
[ "def FUNC_38(self, VAR_16, VAR_11=None, VAR_22=None, VAR_23=False, VAR_24=False...\n", "from frappe.utils.formatters import format_value\n", "VAR_25 = self.meta.get_field(VAR_16)\n", "if not VAR_25 and VAR_16 in default_fields:\n", "from frappe.model.meta import get_default_df\n", "VAR_46 = self.get(VAR_1...
[ "def get_formatted(self, fieldname, doc=None, currency=None, absolute_value=...\n", "from frappe.utils.formatters import format_value\n", "df = self.meta.get_field(fieldname)\n", "if not df and fieldname in default_fields:\n", "from frappe.model.meta import get_default_df\n", "val = self.get(fieldname)\n"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Condition", "ImportFrom'", "Assign'", "Condition", "ImportFrom'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Return'" ]
[ "def FUNC_4(self, VAR_3):...\n", "\"\"\"docstring\"\"\"\n", "self.lasttok = VAR_3.type\n", "return VAR_3\n" ]
[ "def t_RPAR(self, tok):...\n", "\"\"\"docstring\"\"\"\n", "self.lasttok = tok.type\n", "return tok\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Return'" ]
[ "@odin.map_field...\n", "return VAR_47.upper()\n" ]
[ "@odin.map_field...\n", "return value.upper()\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_13(VAR_9, VAR_7, VAR_11, VAR_10):...\n", "if VAR_11 == 'POST':\n", "return CLASS_0.session.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=\n _HEADERS, VAR_10=timeout)\n", "if VAR_11 == 'GET':\n", "return CLASS_0.session.get(FUNC_2(VAR_7), headers=_HEADERS, VAR_10=timeout)\n" ]
[ "def SendRequest(data, handler, method, timeout):...\n", "if method == 'POST':\n", "return BaseRequest.session.post(_BuildUri(handler), data=ToUtf8Json(data),\n headers=_HEADERS, timeout=timeout)\n", "if method == 'GET':\n", "return BaseRequest.session.get(_BuildUri(handler), headers=_HEADERS,\n timeo...
[ 0, 0, 7, 0, 7 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'" ]
[ "\"\"\"Integration with webapp2.\"\"\"\n", "import functools\n", "import json\n", "import logging\n", "import urllib\n", "import webapp2\n", "from google.appengine.api import urlfetch\n", "from google.appengine.api import users\n", "from components import utils\n", "from . import api\n", "from ....
[ "\"\"\"Integration with webapp2.\"\"\"\n", "import functools\n", "import json\n", "import logging\n", "import urllib\n", "import webapp2\n", "from google.appengine.api import urlfetch\n", "from google.appengine.api import users\n", "from components import utils\n", "from . import api\n", "from ....
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Expr'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Assign'", "FunctionDef'", "Docstring", "Condit...
[ "def __len__(self):...\n", "return len(self.current)\n" ]
[ "def __len__(self):...\n", "return len(self.current)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "import psycopg2\n", "VAR_0 = 'news'\n", "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "VAR_3 = psycopg2.connect(database=DBNAME)\n", "VAR_4 = VAR_3.cursor()\n", "VAR_4.execute(VAR_1)\n", "VAR_5 = VAR_4.fetchall()\n", "VAR_3.close()\n", "return VAR_5\n" ]
[ "import psycopg2\n", "DBNAME = 'news'\n", "def execute_query(cmd):...\n", "\"\"\"docstring\"\"\"\n", "conn = psycopg2.connect(database=DBNAME)\n", "cursor = conn.cursor()\n", "cursor.execute(cmd)\n", "result = cursor.fetchall()\n", "conn.close()\n", "return result\n" ]
[ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0 ]
[ "Import'", "Assign'", "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "Return'" ]
[ "import discord\n", "def __init__(self):...\n", "super().__init__()\n", "self.on_member_join_callbacks = []\n", "self.on_member_remove_callbacks = []\n", "async def FUNC_0(self, VAR_0):...\n", "for callback in self.on_member_join_callbacks:\n", "await callback(VAR_0)\n", "async def FUNC_1(self, VAR_...
[ "import discord\n", "def __init__(self):...\n", "super().__init__()\n", "self.on_member_join_callbacks = []\n", "self.on_member_remove_callbacks = []\n", "async def on_member_join(self, member):...\n", "for callback in self.on_member_join_callbacks:\n", "await callback(member)\n", "async def on_memb...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "FunctionDef'", "Expr'", "Assign'", "Assign'", "AsyncFunctionDef'", "For", "Expr'", "AsyncFunctionDef'", "For", "Expr'", "AsyncFunctionDef'", "Assign'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_11(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_32 = logging.getLogger(__name__)\n", "VAR_33 = self.gce_observer\n", "VAR_34 = self.bindings.get('GCE_SERVICE_ACCOUNT', None)\n", "VAR_35 = ['--account', VAR_34] if VAR_34 else []\n", "VAR_32.debug('Looking up available images.')\n", "VAR_36 =...
[ "def list_available_images(self):...\n", "\"\"\"docstring\"\"\"\n", "logger = logging.getLogger(__name__)\n", "gcloud_agent = self.gce_observer\n", "service_account = self.bindings.get('GCE_SERVICE_ACCOUNT', None)\n", "extra_args = ['--account', service_account] if service_account else []\n", "logger.de...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Return'" ]
[ "@staticmethod...\n", "return VAR_82\n" ]
[ "@staticmethod...\n", "return f\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_0(self):...\n", "if not LoginRequest.test_success(self):\n", "return False\n", "VAR_4 = re.compile('Failed to log in.')\n", "if VAR_4.search(self.res_data) is not None:\n", "return False\n", "VAR_5 = re.compile(self.username)\n", "if VAR_5.search(self.res_data) is None:\n", "return False\n...
[ "def test_success(self):...\n", "if not LoginRequest.test_success(self):\n", "return False\n", "fail_re = re.compile('Failed to log in.')\n", "if fail_re.search(self.res_data) is not None:\n", "return False\n", "username_re = re.compile(self.username)\n", "if username_re.search(self.res_data) is None:...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Assign'", "Condition", "Return'", "Return'" ]
[ "def FUNC_6(self):...\n", "if not CLASS_1.test_success(self):\n", "return False\n", "return True\n" ]
[ "def test_success(self):...\n", "if not GenericRequest.test_success(self):\n", "return False\n", "return True\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Return'" ]
[ "def FUNC_16(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.list_display:\n", "return [CLASS_5(self.model, '__str__', 1, self.ordering_query_value, self.\n ordering_query_param)]\n", "VAR_22 = []\n", "for index, VAR_10 in enumerate(self.list_display, start=1):\n", "VAR_25 = {'model': self.mode...
[ "def get_columns(self):...\n", "\"\"\"docstring\"\"\"\n", "if not self.list_display:\n", "return [SmartColumn(self.model, '__str__', 1, self.ordering_query_value,\n self.ordering_query_param)]\n", "columns = []\n", "for index, field in enumerate(self.list_display, start=1):\n", "kwargs = {'model': se...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "Assign'", "For", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Expr'", "Assign'", "Assign'" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n" ]
[ "@property...\n", "\"\"\"docstring\"\"\"\n", "return self.format_wildcards(self.rule.shellcmd\n ) if self.rule.shellcmd else None\n" ]
[ 0, 0, 0 ]
[ "Condition", "Docstring", "Return'" ]
[ "def FUNC_1(self, VAR_6, VAR_7=True, VAR_8=1):...\n", "if not self.sshpool:\n", "VAR_13 = self.configuration.san_password\n", "VAR_12 = None\n", "VAR_14 = self.configuration.san_private_key\n", "VAR_17 = VAR_8\n", "VAR_0.error(_('Error running SSH command: %s') % VAR_6)\n", "VAR_15 = self.configuratio...
[ "def _run_ssh(self, command, check_exit_code=True, attempts=1):...\n", "if not self.sshpool:\n", "password = self.configuration.san_password\n", "last_exception = None\n", "privatekey = self.configuration.san_private_key\n", "total_attempts = attempts\n", "LOG.error(_('Error running SSH command: %s') % ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "AugAssign'", "Assign'", "Return'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_2(VAR_10):...\n", "for response_part in VAR_10:\n", "if isinstance(response_part, tuple):\n", "VAR_37 = email.message_from_string(response_part[1].decode('UTF-8'))\n", "VAR_38 = VAR_37['from']\n", "VAR_39 = VAR_37['subject']\n", "VAR_40 = VAR_37['date']\n", "for part in VAR_37.walk():\n", ...
[ "def parse_email(data):...\n", "for response_part in data:\n", "if isinstance(response_part, tuple):\n", "msg = email.message_from_string(response_part[1].decode('UTF-8'))\n", "sender = msg['from']\n", "subject = msg['subject']\n", "date = msg['date']\n", "for part in msg.walk():\n", "if part.get_co...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "For", "Condition", "Return'", "Assign'", "Assign'" ]
[ "def FUNC_17(self):...\n", "VAR_16 = 'string'\n", "VAR_18 = 'fb1f42420b0109020203325d750185673df252de388932a3957f522a6c43aa47'\n", "self.redis_instance.conn.set(VAR_18, json.dumps({'v1': {'id': '0'}}))\n", "VAR_4 = self.test_user_data['eduPersonPrincipalName']\n", "self.assertRaises(NotFound, c.get, '/')\...
[ "def test_cookie(self):...\n", "token = (\n 'a7MPUEQQLAEEQEAQDGJOXKAMFM467EUW6HCETFI4VP5JCU3CDVJDQZSHMXAOSCU25WPZA66NY5ZVAA4RPCVMHBQBJSVGYQPPLZNIBTP3Y'\n )\n", "sessid = 'fb1f42420b0109020203325d750185673df252de388932a3957f522a6c43aa47'\n", "self.redis_instance.conn.set(sessid, json.dumps({'v1': {'id': ...
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'" ]
[ "def __delitem__(self, VAR_7):...\n", "" ]
[ "def __delitem__(self, path):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_5(VAR_27):...\n", "VAR_36 = datetime.utcfromtimestamp(VAR_27.created_utc)\n", "FUNC_2(VAR_14=str(message.author), VAR_18='message', VAR_25=message_time.\n strftime('%Y-%m-%d %H:%M:%S'), VAR_15='create', VAR_26=str(message.body\n )[:255])\n", "VAR_14 = str(VAR_27.author)\n", "VAR_13.execute(\...
[ "def handle_create(message):...\n", "message_time = datetime.utcfromtimestamp(message.created_utc)\n", "add_history_record(username=str(message.author), comment_or_message=\n 'message', reddit_time=message_time.strftime('%Y-%m-%d %H:%M:%S'),\n action='create', comment_text=str(message.body)[:255])\n", "...
[ 0, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_12(self, VAR_11):...\n", "\"\"\"docstring\"\"\"\n", "if self.connection:\n", "for VAR_6 in self.find_item_name([VAR_11[0], '0']):\n", "self.cursor.execute(\n 'insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")'\n % (VAR_6[0], VAR_11[1], VAR_11[...
[ "def add_translationname(self, trname):...\n", "\"\"\"docstring\"\"\"\n", "if self.connection:\n", "for item in self.find_item_name([trname[0], '0']):\n", "self.cursor.execute(\n 'insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")'\n % (item[0], trname[1...
[ 0, 0, 0, 0, 4, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "For", "Expr'", "Expr'" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ "def __hash__(self):...\n", "return hash(tuple(self))\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(self, VAR_11='', VAR_12=None, VAR_13=None, VAR_6=None):...\n", "VAR_5 = self.session.query(self.obj)\n", "VAR_5 = self._get_base_query(VAR_5=query, VAR_6=filters)\n", "VAR_25 = VAR_5.all()\n", "VAR_26 = GroupByCol(VAR_11, 'Group by')\n", "return VAR_26.apply(VAR_25)\n" ]
[ "def query_simple_group(self, group_by='', aggregate_func=None,...\n", "query = self.session.query(self.obj)\n", "query = self._get_base_query(query=query, filters=filters)\n", "query_result = query.all()\n", "group = GroupByCol(group_by, 'Group by')\n", "return group.apply(query_result)\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "import json\n", "import logging\n", "import os.path\n", "import shutil\n", "from glob import glob\n", "from urllib.parse import quote\n", "import aiohttp_jinja2\n", "import jinja2\n", "from aiohttp import web\n", "from pyexiv2 import ImageMetadata\n", "from natsort import natsorted\n", "impor...
[ "import json\n", "import logging\n", "import os.path\n", "import shutil\n", "from glob import glob\n", "from urllib.parse import quote\n", "import aiohttp_jinja2\n", "import jinja2\n", "from aiohttp import web\n", "from pyexiv2 import ImageMetadata\n", "from natsort import natsorted\n", "impor...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "FunctionDe...
[ "def FUNC_13(VAR_9, VAR_7, VAR_11, VAR_10):...\n", "if VAR_11 == 'POST':\n", "return CLASS_0.session.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=\n _HEADERS, VAR_10=timeout)\n", "if VAR_11 == 'GET':\n", "return CLASS_0.session.get(FUNC_2(VAR_7), headers=_HEADERS, VAR_10=timeout)\n" ]
[ "def SendRequest(data, handler, method, timeout):...\n", "if method == 'POST':\n", "return BaseRequest.session.post(_BuildUri(handler), data=ToUtf8Json(data),\n headers=_HEADERS, timeout=timeout)\n", "if method == 'GET':\n", "return BaseRequest.session.get(_BuildUri(handler), headers=_HEADERS,\n timeo...
[ 0, 0, 7, 0, 7 ]
[ "FunctionDef'", "Condition", "Return'", "Condition", "Return'" ]
[ "def FUNC_6(self, VAR_7):...\n", "VAR_8 = self.content\n", "while VAR_8:\n", "yield VAR_8[:VAR_7]\n", "VAR_8 = VAR_8[VAR_7:]\n" ]
[ "def iter_content(self, chunk_size):...\n", "c = self.content\n", "while c:\n", "yield c[:chunk_size]\n", "c = c[chunk_size:]\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Assign'" ]
[ "def FUNC_20(self, VAR_11):...\n", "if self._scsi_disks_timeout_set:\n", "return\n", "VAR_21, VAR_22 = shellutil.run_get_output(\n 'sysctl kern.cam.da.default_timeout={0}'.format(VAR_11))\n", "if VAR_21:\n", "self._scsi_disks_timeout_set = True\n" ]
[ "def set_scsi_disks_timeout(self, timeout):...\n", "if self._scsi_disks_timeout_set:\n", "return\n", "ret, output = shellutil.run_get_output('sysctl kern.cam.da.default_timeout={0}'\n .format(timeout))\n", "if ret:\n", "self._scsi_disks_timeout_set = True\n" ]
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Assign'" ]
[ "\"\"\"string\"\"\"\n", "from sys import argv\n", "from model_state import Base, State\n", "from sqlalchemy import create_engine\n", "from sqlalchemy import Column, Integer, String\n", "from sqlalchemy.orm import sessionmaker\n", "from sqlalchemy.ext.declarative import declarative_base\n", "if __name_...
[ "\"\"\" Module that lists all objects with a given attribute in a given table,\nusing SQLAlchemy, this is linked to a MySQL table via SQLAlchemy \"\"\"\n", "from sys import argv\n", "from model_state import Base, State\n", "from sqlalchemy import create_engine\n", "from sqlalchemy import Column, Integer, St...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0 ]
[ "Expr'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "ImportFrom'", "Condition", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_44(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n FileColumn)]\n" ]
[ "def get_file_column_list(self):...\n", "return [i.name for i in self.obj.__mapper__.columns if isinstance(i.type,\n FileColumn)]\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_4(VAR_7):...\n", "\"\"\"docstring\"\"\"\n", "def FUNC_24(VAR_36):...\n", "return type(VAR_36).__name__ == 'cython_function_or_method'\n" ]
[ "def is_cython(obj):...\n", "\"\"\"docstring\"\"\"\n", "def check_cython(x):...\n", "return type(x).__name__ == 'cython_function_or_method'\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "FunctionDef'", "Return'" ]
[ "@property...\n", "return str(self.group_type.code)\n" ]
[ "@property...\n", "return str(self.group_type.code)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_34(self):...\n", "return self.replace(self.dynamic_fill, '{*}')\n" ]
[ "def format_dynamic(self):...\n", "return self.replace(self.dynamic_fill, '{*}')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_27(self):...\n", "VAR_0 = [KeyboardInterruptCheck(), SleepCheck(10), SleepCheck(10),\n SleepCheck(10)]\n", "self._run_checks(VAR_0, 4)\n" ]
[ "def test_kbd_interrupt_in_wait_with_concurrency(self):...\n", "checks = [KeyboardInterruptCheck(), SleepCheck(10), SleepCheck(10),\n SleepCheck(10)]\n", "self._run_checks(checks, 4)\n" ]
[ 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'" ]
[ "from __future__ import absolute_import\n", "from __future__ import division\n", "from __future__ import print_function\n", "import argparse\n", "import logging\n", "import os\n", "import time\n", "import traceback\n", "import redis\n", "import ray\n", "from ray.autoscaler.autoscaler import Load...
[ "from __future__ import absolute_import\n", "from __future__ import division\n", "from __future__ import print_function\n", "import argparse\n", "import logging\n", "import os\n", "import time\n", "import traceback\n", "import redis\n", "import ray\n", "from ray.autoscaler.autoscaler import Load...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ "ImportFrom'", "ImportFrom'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "Import'", "Import'", "Import'", "Import'", "ImportFrom'", "ImportFrom'", "Assign'", "Expr'", "FunctionDef'", "Assign'", "Expr'", "Assi...
[ "def FUNC_11(self):...\n", "self.run_test_case(self.scenario.create_server_group(), timeout_ok=True)\n" ]
[ "def test_c_create_server_group(self):...\n", "self.run_test_case(self.scenario.create_server_group(), timeout_ok=True)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_16(self, VAR_25, VAR_26='', VAR_21=True):...\n", "VAR_20 = request_mock(VAR_25)\n", "VAR_20.args = VAR_26\n", "return self._render(VAR_20, VAR_21)\n" ]
[ "def get(self, path, get_args='', as_json=True):...\n", "request = request_mock(path)\n", "request.args = get_args\n", "return self._render(request, as_json)\n" ]
[ 0, 5, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Return'" ]
[ "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'" ]
[ "@integration_synonym_api...\n", "FUNC_2(VAR_2)\n", "FUNC_3(VAR_2, 'NEIGHBOUR', VAR_7='1')\n", "FUNC_5(VAR_4, VAR_5, VAR_11='NAYBOR', VAR_10=[{'name': '----NAYBOR'}, {\n 'name': 'NEIGHBOUR'}])\n" ]
[ "@integration_synonym_api...\n", "clean_database(solr)\n", "seed_database_with(solr, 'NEIGHBOUR', id='1')\n", "verify_results(client, jwt, query='NAYBOR', expected=[{'name': '----NAYBOR'\n }, {'name': 'NEIGHBOUR'}])\n" ]
[ 0, 0, 0, 0 ]
[ "Condition", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_23(VAR_38, VAR_39):...\n", "\"\"\"docstring\"\"\"\n", "VAR_65 = cmp(len(VAR_39[1][0]), len(VAR_38[1][0]))\n", "if VAR_65:\n", "return VAR_65\n", "if VAR_38[0].isComposite() and VAR_39[0].isComposite():\n", "VAR_85 = sum(VAR_38[1][1]) / len(VAR_38[1][1])\n", "return cmp(len(str(VAR_39[0])), l...
[ "def _skw_matches_comparator(kw0, kw1):...\n", "\"\"\"docstring\"\"\"\n", "list_comparison = cmp(len(kw1[1][0]), len(kw0[1][0]))\n", "if list_comparison:\n", "return list_comparison\n", "if kw0[0].isComposite() and kw1[0].isComposite():\n", "component_avg0 = sum(kw0[1][1]) / len(kw0[1][1])\n", "return...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Condition", "Return'" ]
[ "def FUNC_18(self, VAR_14=False, VAR_15=False, VAR_13=False):...\n", "VAR_11 = self.get_valid_dict(VAR_13=convert_dates_to_str)\n", "VAR_11['doctype'] = self.doctype\n", "for VAR_25 in self.meta.get_table_fields():\n", "VAR_55 = self.get(VAR_25.fieldname) or []\n", "if VAR_14:\n", "VAR_11[VAR_25.fieldna...
[ "def as_dict(self, no_nulls=False, no_default_fields=False,...\n", "doc = self.get_valid_dict(convert_dates_to_str=convert_dates_to_str)\n", "doc['doctype'] = self.doctype\n", "for df in self.meta.get_table_fields():\n", "children = self.get(df.fieldname) or []\n", "if no_nulls:\n", "doc[df.fieldname] =...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "For", "Assign'", "Condition", "Assign'", "For", "Condition", "Condition", "For", "For", "Condition", "Condition", "Return'", "Assign'" ]
[ "@staticmethod...\n", "return users.create_logout_url(VAR_23)\n" ]
[ "@staticmethod...\n", "return users.create_logout_url(dest_url)\n" ]
[ 0, 0 ]
[ "Condition", "Return'" ]
[ "def FUNC_35(VAR_40):...\n", "VAR_68 = VAR_10[VAR_40]\n", "for pattern, has_argument in VAR_39.items():\n", "if pattern.match(VAR_68):\n", "VAR_8.warn(\n \"Zinc argument '{}' is not supported, and is subject to change/removal!\"\n .format(VAR_68))\n", "return 2 if has_argument else 1\n", "return 1...
[ "def validate(idx):...\n", "arg = args[idx]\n", "for pattern, has_argument in valid_patterns.items():\n", "if pattern.match(arg):\n", "log.warn(\n \"Zinc argument '{}' is not supported, and is subject to change/removal!\"\n .format(arg))\n", "return 2 if has_argument else 1\n", "return 1\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "For", "Condition", "Expr'", "Return'", "Return'" ]
[ "def FUNC_9(self, VAR_0):...\n", "if not cint(self.published):\n", "VAR_0.full_name = get_fullname(self.owner)\n", "VAR_0.updated = global_date_format(self.published_on)\n", "if self.blogger:\n", "VAR_0.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n", "VAR_0.description = self.blog_i...
[ "def get_context(self, context):...\n", "if not cint(self.published):\n", "context.full_name = get_fullname(self.owner)\n", "context.updated = global_date_format(self.published_on)\n", "if self.blogger:\n", "context.blogger_info = frappe.get_doc('Blogger', self.blogger).as_dict()\n", "context.descriptio...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_15(self, VAR_34):...\n", "\"\"\"docstring\"\"\"\n", "VAR_34 = get_filter(self.doctype, VAR_34)\n", "VAR_52 = '`tab' + VAR_34.doctype + '`'\n", "if not VAR_52 in self.tables:\n", "self.append_table(VAR_52)\n", "if 'ifnull(' in VAR_34.fieldname:\n", "VAR_59 = VAR_34.fieldname\n", "VAR_59 = '...
[ "def prepare_filter_condition(self, f):...\n", "\"\"\"docstring\"\"\"\n", "f = get_filter(self.doctype, f)\n", "tname = '`tab' + f.doctype + '`'\n", "if not tname in self.tables:\n", "self.append_table(tname)\n", "if 'ifnull(' in f.fieldname:\n", "column_name = f.fieldname\n", "column_name = '{tname...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", ...
[ "def FUNC_0(self, VAR_4):...\n", "VAR_11 = super(CLASS_1, self).run(VAR_4)\n", "self.logger.print_response_code(VAR_11)\n", "self.logger.print_headers(VAR_4.items(), sending=True)\n", "self.logger.print_headers(VAR_11.getheaders())\n" ]
[ "def run(self, headers):...\n", "response = super(HttpHead, self).run(headers)\n", "self.logger.print_response_code(response)\n", "self.logger.print_headers(headers.items(), sending=True)\n", "self.logger.print_headers(response.getheaders())\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Expr'", "Expr'" ]
[ "def FUNC_5(self, VAR_21):...\n", "\"\"\"docstring\"\"\"\n", "VAR_24 = self.getfile(VAR_21, VAR_23=False)\n", "if VAR_24 is not False:\n", "return True\n" ]
[ "def lexists(self, path):...\n", "\"\"\"docstring\"\"\"\n", "f = self.getfile(path, follow_symlinks=False)\n", "if f is not False:\n", "return True\n" ]
[ 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Condition", "Return'" ]
[ "def FUNC_4(self):...\n", "VAR_7 = {}\n", "VAR_8 = '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf'\n", "VAR_6 = self.exec_master_cmd('cat %s' % VAR_8, need_root=True)\n", "if VAR_6['status'] == 0:\n", "VAR_13 = VAR_6['stdout'].splitlines()\n", "return False\n", "for line in VAR_13:\n", "ret...
[ "def parse_db_conf(self):...\n", "conf = {}\n", "engconf = '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf'\n", "res = self.exec_master_cmd('cat %s' % engconf, need_root=True)\n", "if res['status'] == 0:\n", "config = res['stdout'].splitlines()\n", "return False\n", "for line in config:\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Return'", "For", "Return'", "Assign'", "Assign'", "Assign'" ]
[ "def FUNC_2(self):...\n", "self.expected_requests([(\n 'http://localhost/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'expiration_sec': 100,\n 'xsrf_token': 'token'}), ('http://localhost/a', {'data': {'foo': 'bar'},\n 'headers': {'X-XSRF-Token': 'to...
[ "def testXsrfRemoteSimple(self):...\n", "self.expected_requests([(\n 'http://localhost/auth/api/v1/accounts/self/xsrf_token', {'data': {},\n 'headers': {'X-XSRF-Token-Request': '1'}}, {'expiration_sec': 100,\n 'xsrf_token': 'token'}), ('http://localhost/a', {'data': {'foo': 'bar'},\n 'headers': {'X-XS...
[ 0, 5, 0, 5 ]
[ "FunctionDef'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_20(self, VAR_6):...\n", "if VAR_6['host'] != 'localhost' and not self.run_on_localhost(VAR_6):\n", "self.logger.debug(\"Starting remote component '%s' on host '%s'\" % (VAR_6[\n 'name'], VAR_6['host']))\n", "VAR_13 = '%s/%s' % (VAR_3, VAR_6['name'])\n", "self.start_remote_component(VAR_6['name'...
[ "def start_component_without_deps(self, comp):...\n", "if comp['host'] != 'localhost' and not self.run_on_localhost(comp):\n", "self.logger.debug(\"Starting remote component '%s' on host '%s'\" % (comp[\n 'name'], comp['host']))\n", "log_file = '%s/%s' % (TMP_LOG_PATH, comp['name'])\n", "self.start_remot...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "Assign'", "Expr'", "Assign'", "Condition", "Expr'", "Expr'", "Expr'", "Assign'", "Expr'" ]
[ "def FUNC_0(VAR_1):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.document import Document\n", "if not VAR_1 in VAR_0:\n", "VAR_31, VAR_32 = VAR_54.db.get_value('DocType', VAR_1, ('module', 'custom'),\n cache=True) or ['Core', False]\n", "return VAR_0[VAR_1]\n", "if VAR_32:\n", "VAR_51 = Doc...
[ "def get_controller(doctype):...\n", "\"\"\"docstring\"\"\"\n", "from frappe.model.document import Document\n", "if not doctype in _classes:\n", "module_name, custom = frappe.db.get_value('DocType', doctype, ('module',\n 'custom'), cache=True) or ['Core', False]\n", "return _classes[doctype]\n", "if ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "ImportFrom'", "Condition", "Assign'", "Return'", "Condition", "Assign'", "Assign'", "Assign'", "Assign'", "Condition", "Assign'", "Condition", "Assign'" ]
[ "def FUNC_24(self, VAR_17):...\n", "VAR_35, VAR_9, VAR_36 = sys.exc_info()\n", "VAR_16, VAR_37 = str(VAR_17).split(\"'\")[-2], None\n", "if 'unique_' in VAR_16:\n", "VAR_16 = VAR_16.split('_', 1)[1]\n", "VAR_25 = self.meta.get_field(VAR_16)\n", "if VAR_25:\n", "VAR_37 = VAR_25.label\n", "VAR_54.msgp...
[ "def show_unique_validation_message(self, e):...\n", "type, value, traceback = sys.exc_info()\n", "fieldname, label = str(e).split(\"'\")[-2], None\n", "if 'unique_' in fieldname:\n", "fieldname = fieldname.split('_', 1)[1]\n", "df = self.meta.get_field(fieldname)\n", "if df:\n", "label = df.label\n",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Assign'", "Expr'" ]
[ "def FUNC_2(self):...\n", "\"\"\"docstring\"\"\"\n", "VAR_4 = '/api/apps'\n", "VAR_5 = self.client.post(VAR_4)\n", "self.assertEqual(VAR_5.status_code, 201)\n", "VAR_6 = VAR_5.data['id']\n", "VAR_7 = {'sha': 'df1e628f2244b73f9cdf944f880a2b3470a122f4', 'fingerprint':\n '88:25:ed:67:56:91:3d:c6:1b:7f:4...
[ "def test_push_hook(self):...\n", "\"\"\"docstring\"\"\"\n", "url = '/api/apps'\n", "response = self.client.post(url)\n", "self.assertEqual(response.status_code, 201)\n", "app_id = response.data['id']\n", "body = {'sha': 'df1e628f2244b73f9cdf944f880a2b3470a122f4', 'fingerprint':\n '88:25:ed:67:56:91:...
[ 0, 0, 0, 5, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Assign'", "Assign'", "Expr'", "Assign'", "Assign'", "Assign'", "Assign'", "Expr'", "Assign'", "Expr'", "For", "Expr'" ]
[ "def FUNC_3(self, VAR_6):...\n", "if 'doctype' in VAR_6:\n", "self.set('doctype', VAR_6.get('doctype'))\n", "for VAR_7 in default_fields:\n", "if VAR_7 in VAR_6:\n", "for VAR_7, VAR_9 in iteritems(VAR_6):\n", "self.set(VAR_7, VAR_6.get(VAR_7))\n", "self.set(VAR_7, VAR_9)\n", "return self\n" ]
[ "def update(self, d):...\n", "if 'doctype' in d:\n", "self.set('doctype', d.get('doctype'))\n", "for key in default_fields:\n", "if key in d:\n", "for key, value in iteritems(d):\n", "self.set(key, d.get(key))\n", "self.set(key, value)\n", "return self\n" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Expr'", "For", "Condition", "For", "Expr'", "Expr'", "Return'" ]
[ "def FUNC_34(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.ignore_save_passwords is True:\n", "return\n", "for VAR_25 in self.meta.get('fields', {'fieldtype': ('=', 'Password')}):\n", "if self.flags.ignore_save_passwords and VAR_25.fieldname in self.flags.ignore_save_passwords:\n", "VAR_62 = s...
[ "def _save_passwords(self):...\n", "\"\"\"docstring\"\"\"\n", "if self.flags.ignore_save_passwords is True:\n", "return\n", "for df in self.meta.get('fields', {'fieldtype': ('=', 'Password')}):\n", "if self.flags.ignore_save_passwords and df.fieldname in self.flags.ignore_save_passwords:\n", "new_passwo...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Docstring", "Condition", "Return'", "For", "Condition", "Assign'", "Condition", "Expr'", "Expr'" ]
[ "def __init__(self, VAR_3):...\n", "self._handler = VAR_3\n" ]
[ "def __init__(self, handler):...\n", "self._handler = handler\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Assign'" ]
[ "def __init__(self, VAR_18, VAR_35=100, **VAR_16):...\n", "CLASS_17.__init__(self, VAR_18, VAR_35=length, VAR_37=errors.\n LOCATION_TOO_LONG, VAR_36=None, **kw)\n" ]
[ "def __init__(self, item, length=100, **kw):...\n", "VLength.__init__(self, item, length=length, length_error=errors.\n LOCATION_TOO_LONG, empty_error=None, **kw)\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Expr'" ]
[ "def FUNC_2(self):...\n", "VAR_0 = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "VAR_0.put()\n", "VAR_2 = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "VAR_2.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo', {'status': 404}\n ...
[ "def test_update_deletes(self):...\n", "library = Library(id='org/repo', metadata_etag='a', contributors_etag='b',\n tags_etag='c')\n", "library.put()\n", "version = Version(parent=library.key, id='v1.0.0', sha='lol')\n", "version.put()\n", "self.respond_to_github('https://api.github.com/repos/org/repo...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Expr'", "Assign'", "Expr'", "Expr'", "Expr'", "Assign'", "Assign'", "Expr'", "Expr'" ]
[ "def FUNC_6(self, VAR_4):...\n", "return \"'%s'\" % VAR_4.replace(\"'\", \"''\")\n" ]
[ "def sqlForNonNone(self, value):...\n", "return \"'%s'\" % value.replace(\"'\", \"''\")\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_30(self):...\n", "if VAR_54.flags.in_import or self.is_new(\n", "return\n", "VAR_42 = [VAR_6.fieldname for VAR_6 in self.meta.get('fields', {\n 'set_only_once': ('=', 1)})]\n", "if VAR_42:\n", "VAR_57 = VAR_54.db.get_value(self.doctype, self.name, VAR_42, as_dict=True)\n", "for VAR_16 in VA...
[ "def _validate_constants(self):...\n", "if frappe.flags.in_import or self.is_new(\n", "return\n", "constants = [d.fieldname for d in self.meta.get('fields', {'set_only_once':\n ('=', 1)})]\n", "if constants:\n", "values = frappe.db.get_value(self.doctype, self.name, constants, as_dict=True)\n", "for ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Return'", "Assign'", "Condition", "Assign'", "For", "Assign'", "Condition", "Assign'", "Assign'", "Condition", "Expr'" ]
[ "def FUNC_6(self, VAR_22):...\n", "if VAR_22:\n", "VAR_107 = int(VAR_22, 36)\n", "if self.redirect:\n", "return Meetup._byID(VAR_107, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ "def run(self, meetup_id36):...\n", "if meetup_id36:\n", "meetup_id = int(meetup_id36, 36)\n", "if self.redirect:\n", "return Meetup._byID(meetup_id, True)\n", "abort(404, 'page not found')\n", "return None\n" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Return'", "Expr'", "Return'" ]
[ "def FUNC_5(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ "def shutdown(self):...\n", "\"\"\"docstring\"\"\"\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Docstring" ]
[ "def FUNC_1(self):...\n", "" ]
[ "def get_cookie_id_token(self):...\n", "" ]
[ 0, 0 ]
[ "FunctionDef'", "Condition" ]
[ "def FUNC_1(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ "def setUp(self):...\n", "self.assertTrue(self.client.login(username='autotest', password='password'))\n" ]
[ 0, 5 ]
[ "FunctionDef'", "Expr'" ]
[ "def __call__(self, *VAR_18, VAR_2=False, VAR_19=False, VAR_20=None, **VAR_21):...\n", "if VAR_2 and self._r_item_ is VAR_0:\n", "if VAR_20 is not None:\n", "VAR_34 = VAR_20(self._r_item_, *VAR_18, **kwargs)\n", "if callable(self._r_item_):\n", "if VAR_19:\n", "VAR_34 = self._r_item_(*VAR_18, **kwargs)\...
[ "def __call__(self, *args, _raise=False, _roam=False, _invoke=None, **kwargs):...\n", "if _raise and self._r_item_ is MISSING:\n", "if _invoke is not None:\n", "call_result = _invoke(self._r_item_, *args, **kwargs)\n", "if callable(self._r_item_):\n", "if _roam:\n", "call_result = self._r_item_(*args, *...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Condition", "Assign'", "Condition", "Condition", "Assign'", "Condition", "Assign'", "Return'", "Assign'", "Assign'", "Assign'", "Return'" ]
[ "def FUNC_22(VAR_6):...\n", "return FUNC_7(VAR_6, 'Pragma', 'no-cache')\n" ]
[ "def validate_pragma(page):...\n", "return validate_security_header(page, 'Pragma', 'no-cache')\n" ]
[ 0, 0 ]
[ "FunctionDef'", "Return'" ]
[ "def FUNC_25(self):...\n", "VAR_31 = json.loads(get_user_settings(self.doctype))\n", "if hasattr(self, 'user_settings'):\n", "VAR_31.update(self.user_settings)\n", "if self.save_user_settings_fields:\n", "VAR_31['fields'] = self.user_settings_fields\n", "FUNC_25(self.doctype, VAR_31)\n" ]
[ "def update_user_settings(self):...\n", "user_settings = json.loads(get_user_settings(self.doctype))\n", "if hasattr(self, 'user_settings'):\n", "user_settings.update(self.user_settings)\n", "if self.save_user_settings_fields:\n", "user_settings['fields'] = self.user_settings_fields\n", "update_user_set...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Assign'", "Condition", "Expr'", "Condition", "Assign'", "Expr'" ]
[ "import psycopg2\n", "import secretConstants\n", "VAR_0 = ('dbname=' + secretConstants.DATABASE_NAME + ' user=' +\n secretConstants.DATABASE_USER + ' host=' + secretConstants.\n DATABASE_HOST + ' password=' + secretConstants.DATABASE_PASSWORD +\n ' port=' + secretConstants.DATABASE_PORT)\n", "VAR_1 =...
[ "import psycopg2\n", "import secretConstants\n", "connectionString = ('dbname=' + secretConstants.DATABASE_NAME + ' user=' +\n secretConstants.DATABASE_USER + ' host=' + secretConstants.\n DATABASE_HOST + ' password=' + secretConstants.DATABASE_PASSWORD +\n ' port=' + secretConstants.DATABASE_PORT)\n",...
[ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0 ]
[ "Import'", "Import'", "Assign'", "Assign'", "Assign'", "FunctionDef'", "Assign'", "Assign'", "Assign'", "Expr'", "Condition", "Return'", "Assign'", "Expr'", "Expr'", "Assign'" ]
[ "@VAR_0.route('/star/<hip>/compositions')...\n", "" ]
[ "@app.route('/star/<hip>/compositions')...\n", "" ]
[ 0, 0 ]
[ "Condition", "Condition" ]
[ "def FUNC_2():...\n", "for blog in frappe.db.sql_list(\n", "clear_cache(blog)\n", "clear_cache('writers')\n" ]
[ "def clear_blog_cache():...\n", "for blog in frappe.db.sql_list(\n", "clear_cache(blog)\n", "clear_cache('writers')\n" ]
[ 0, 0, 0, 0 ]
[ "FunctionDef'", "For", "Expr'", "Expr'" ]
[ "def FUNC_27(self, VAR_2, VAR_3, VAR_32, *VAR_6, **VAR_14):...\n", "if 'hours' in VAR_32 and not VAR_32['hours']:\n", "VAR_32['hours'] = 0.0\n", "if 'task_id' in VAR_32:\n", "VAR_2.execute(\n 'update project_task set remaining_hours=remaining_hours - %s where id=%s',\n (VAR_32.get('hours', 0.0), VAR_3...
[ "def create(self, cr, uid, vals, *args, **kwargs):...\n", "if 'hours' in vals and not vals['hours']:\n", "vals['hours'] = 0.0\n", "if 'task_id' in vals:\n", "cr.execute(\n 'update project_task set remaining_hours=remaining_hours - %s where id=%s',\n (vals.get('hours', 0.0), vals['task_id']))\n", "re...
[ 0, 0, 0, 0, 0, 0 ]
[ "FunctionDef'", "Condition", "Assign'", "Condition", "Expr'", "Return'" ]