lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"@wraps(VAR_7)...\n",
""
] | [
"@wraps(f)...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_26():...\n",
"frappe.throw(_('Use of sub-query or function is restricted'), frappe.DataError)\n"
] | [
"def _raise_exception():...\n",
"frappe.throw(_('Use of sub-query or function is restricted'), frappe.DataError)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_7=None, VAR_3=None, VAR_4=None, VAR_8=None):...\n",
"if VAR_7:\n",
"if isinstance(VAR_7, dict):\n",
"return self.__dict__\n",
"return FUNC_1(self.get_all_children(), VAR_7, VAR_4=limit)\n",
"if VAR_3:\n",
"if isinstance(VAR_3, dict):\n",
"VAR_9 = self.__dict__.get(VAR_7, VAR_8)\n... | [
"def get(self, key=None, filters=None, limit=None, default=None):...\n",
"if key:\n",
"if isinstance(key, dict):\n",
"return self.__dict__\n",
"return _filter(self.get_all_children(), key, limit=limit)\n",
"if filters:\n",
"if isinstance(filters, dict):\n",
"value = self.__dict__.get(key, default)\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Condition",
"Return'",
"Return'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Assign'",
"Assign'"
] |
[
"import pymysql.cursors\n",
"from datetime import date, datetime\n",
"import json\n",
"import config\n",
"def __init__(self):...\n",
"self.conn = pymysql.connect(user=config.mysql_credentials['user'], password\n =config.mysql_credentials['password'], host=config.mysql_credentials[\n 'host'], db=conf... | [
"import pymysql.cursors\n",
"from datetime import date, datetime\n",
"import json\n",
"import config\n",
"def __init__(self):...\n",
"self.conn = pymysql.connect(user=config.mysql_credentials['user'], password\n =config.mysql_credentials['password'], host=config.mysql_credentials[\n 'host'], db=conf... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"FunctionDef'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_4(VAR_2):...\n",
"VAR_43 = VAR_2[0]\n",
"VAR_44 = VAR_43.__class__\n",
"if VAR_44 not in [LearningUnitYear, EducationGroupYear]:\n",
"if any(obj for obj in VAR_2 if obj.__class__ != VAR_44):\n"
] | [
"def _raise_if_incorrect_instance(objects):...\n",
"first_obj = objects[0]\n",
"obj_class = first_obj.__class__\n",
"if obj_class not in [LearningUnitYear, EducationGroupYear]:\n",
"if any(obj for obj in objects if obj.__class__ != obj_class):\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"For"
] |
[
"@VAR_0.route('/signup/<remote_app>/', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1 not in signup_handlers:\n",
"return abort(404)\n",
"VAR_3 = signup_handlers[VAR_1]['view']()\n",
"return abort(404) if VAR_3 is None else VAR_3\n"
] | [
"@blueprint.route('/signup/<remote_app>/', methods=['GET', 'POST'])...\n",
"\"\"\"docstring\"\"\"\n",
"if remote_app not in signup_handlers:\n",
"return abort(404)\n",
"res = signup_handlers[remote_app]['view']()\n",
"return abort(404) if res is None else res\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_30(self, VAR_78):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.version = VAR_78\n",
"return VAR_101\n"
] | [
"def version(self, version):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.version = version\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_14(self, VAR_10, VAR_11):...\n",
"VAR_24 = self.common._cli_run('createhost -add %s %s' % (VAR_10, ' '.join(\n VAR_11)), None)\n"
] | [
"def _modify_3par_fibrechan_host(self, hostname, wwn):...\n",
"out = self.common._cli_run('createhost -add %s %s' % (hostname, ' '.join(\n wwn)), None)\n"
] | [
0,
2
] | [
"FunctionDef'",
"Assign'"
] |
[
"def FUNC_15(self):...\n",
""
] | [
"def testDownloadFileDownloadError(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"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_2(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return VAR_3.splitlines()\n"
] | [
"def splitlines(text):...\n",
"\"\"\"docstring\"\"\"\n",
"return text.splitlines()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1=None, VAR_2=False):...\n",
"VAR_3 = None\n",
"if conf.eString and conf.eString in VAR_0:\n",
"VAR_4 = VAR_0.index(conf.eString)\n",
"if conf.eRegexp:\n",
"VAR_5 = len(conf.eString)\n",
"VAR_3 = re.findall(conf.eRegexp, VAR_0, re.I | re.M)\n",
"if conf.string:\n",
"VAR_6 = VA... | [
"def comparison(page, headers=None, getSeqMatcher=False):...\n",
"regExpResults = None\n",
"if conf.eString and conf.eString in page:\n",
"index = page.index(conf.eString)\n",
"if conf.eRegexp:\n",
"length = len(conf.eString)\n",
"regExpResults = re.findall(conf.eRegexp, page, re.I | re.M)\n",
"if con... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
2,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"AugAssign'",
"For",
"Return'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Return'",
"Condition",
... |
[
"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_loggedi... | [
"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"... | [
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_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(self.cache_dir):\n",
"shutil.rmtree(self.cache_dir)\n"
] | [
"def clear(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if os.path.exists(self.cache_dir):\n",
"shutil.rmtree(self.cache_dir)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'"
] |
[
"def FUNC_5(self, VAR_5):...\n",
"if VAR_5 in self.groups:\n",
"self.groups.remove(VAR_5)\n",
"for oldg in VAR_5.get_ancestors():\n",
"if oldg.name != 'all':\n",
"for childg in self.groups:\n",
"if oldg in childg.get_ancestors():\n"
] | [
"def remove_group(self, group):...\n",
"if group in self.groups:\n",
"self.groups.remove(group)\n",
"for oldg in group.get_ancestors():\n",
"if oldg.name != 'all':\n",
"for childg in self.groups:\n",
"if oldg in childg.get_ancestors():\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"For",
"Condition",
"For",
"Condition"
] |
[
"def FUNC_41(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'HIGH': 4, 'MEDIUM': 0, 'LOW': 10}, 'CONFIDENCE': {\n 'MEDIUM': 5, 'HIGH': 9}}\n",
"self.check_example('wildcard-injection.py', VAR_2)\n"
] | [
"def test_wildcard_injection(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'HIGH': 4, 'MEDIUM': 0, 'LOW': 10}, 'CONFIDENCE': {\n 'MEDIUM': 5, 'HIGH': 9}}\n",
"self.check_example('wildcard-injection.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_4(VAR_5, VAR_6='csrf_token', VAR_7=VAR_1, VAR_8=True):...\n",
"VAR_10 = VAR_5.params.get(VAR_6, VAR_5.headers.get(VAR_7))\n",
"if VAR_10 != VAR_5.session.get_csrf_token():\n",
"if VAR_8:\n",
"return True\n",
"return False\n"
] | [
"def check_csrf_token(request, token='csrf_token', header=HEADER_NAME,...\n",
"supplied_token = request.params.get(token, request.headers.get(header))\n",
"if supplied_token != request.session.get_csrf_token():\n",
"if raises:\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_3(self):...\n",
"VAR_13 = tweet.objects.order_by('-datetime')\n",
"VAR_14 = self.request.GET.get('keyword')\n",
"if VAR_14 is not None:\n",
"VAR_13 = VAR_13.filter(Q(text__icontains=keyword)).order_by('-datetime')\n",
"return VAR_13\n"
] | [
"def get_queryset(self):...\n",
"query = tweet.objects.order_by('-datetime')\n",
"keyword = self.request.GET.get('keyword')\n",
"if keyword is not None:\n",
"query = query.filter(Q(text__icontains=keyword)).order_by('-datetime')\n",
"return query\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_21(self, VAR_21, VAR_38, VAR_39):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_57 = self.getfile(VAR_21)\n",
"if VAR_57 == False:\n",
"VAR_57[VAR_7] = VAR_39\n"
] | [
"def utime(self, path, atime, mtime):...\n",
"\"\"\"docstring\"\"\"\n",
"p = self.getfile(path)\n",
"if p == False:\n",
"p[A_CTIME] = mtime\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_3(VAR_5):...\n",
""
] | [
"def sendIndexReq(nGram):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_7(self):...\n",
""
] | [
"def checkout(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_5(VAR_5):...\n",
"VAR_13 = FUNC_6()\n",
"conn.execute(f'DROP DATABASE {VAR_13}')\n"
] | [
"def _drop_database(system_engine):...\n",
"test_db_name = _get_test_db_name()\n",
"conn.execute(f'DROP DATABASE {test_db_name}')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.client.get('/api/apps')\n",
"self.assertEqual(VAR_6.status_code, 200)\n",
"self.assertEqual(len(VAR_6.data['results']), 2)\n"
] | [
"def test_admin_can_list(self):...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.get('/api/apps')\n",
"self.assertEqual(response.status_code, 200)\n",
"self.assertEqual(len(response.data['results']), 2)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(self):...\n",
""
] | [
"def touch(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_2(VAR_6, VAR_7):...\n",
"VAR_10 = settings.DYNAMIC_LINK\n",
"if len(VAR_10) > 0:\n",
"VAR_11 = '{}{}/{}'.format(settings.PUBLIC_DOMAIN, VAR_2, VAR_7)\n",
"VAR_12 = '{}{}/{}'.format(settings.APP_DEEPLINK_DOMAIN, VAR_4, VAR_7)\n",
"VAR_12 = VAR_10.format(VAR_11)\n",
"VAR_9 = HttpResponse('', sta... | [
"def experience_redirect(request, experience_share_id):...\n",
"dynamic_link = settings.DYNAMIC_LINK\n",
"if len(dynamic_link) > 0:\n",
"real_link = '{}{}/{}'.format(settings.PUBLIC_DOMAIN, EXPERIENCE_PATH,\n experience_share_id)\n",
"link = '{}{}/{}'.format(settings.APP_DEEPLINK_DOMAIN,\n EXPERIENCE_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@decorators.require_cronjob...\n",
"config.cron_update_buckets()\n"
] | [
"@decorators.require_cronjob...\n",
"config.cron_update_buckets()\n"
] | [
0,
0
] | [
"Condition",
"Expr'"
] |
[
"def FUNC_9(self, VAR_8):...\n",
"return {key: value for key, value in VAR_8.items() if key in self.\n _backend_kwargs}\n"
] | [
"def filter_kwargs_for_backend(self, kwargs):...\n",
"return {key: value for key, value in kwargs.items() if key in self.\n _backend_kwargs}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"from .value_constraints import ClassConstraintComponent\n",
"VAR_0 = [ClassConstraintComponent]\n",
"VAR_1 = {p: c for c in VAR_0 for p in c.constraint_parameters()}\n",
"VAR_2 = list(VAR_1.keys())\n"
] | [
"from .value_constraints import ClassConstraintComponent\n",
"ALL_CONSTRAINT_COMPONENTS = [ClassConstraintComponent]\n",
"CONSTRAINT_PARAMETERS_MAP = {p: c for c in ALL_CONSTRAINT_COMPONENTS for p in\n c.constraint_parameters()}\n",
"ALL_CONSTRAINT_PARAMETERS = list(CONSTRAINT_PARAMETERS_MAP.keys())\n"
] | [
1,
1,
0,
0
] | [
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"@app.route('/metric/api/v1.0/metric', methods=['POST'])...\n",
"if not request.json or not 'Origin' in request.json or not 'Key' in request.json or not 'Value' in request.json:\n",
"abort(400)\n",
"VAR_1 = database.cursor()\n",
"VAR_1.execute(\n 'INSERT INTO log_metric (Time, Origin, Key, Value) VALUES ... | [
"@app.route('/metric/api/v1.0/metric', methods=['POST'])...\n",
"if not request.json or not 'Origin' in request.json or not 'Key' in request.json or not 'Value' in request.json:\n",
"abort(400)\n",
"cursor = database.cursor()\n",
"cursor.execute(\n 'INSERT INTO log_metric (Time, Origin, Key, Value) VALUE... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1, VAR_2):...\n",
"def FUNC_1(VAR_3):...\n",
"return Task('nfs/{}'.format(VAR_0), VAR_1, VAR_2, partial(\n serialize_dashboard_exception, include_http_status=True))(VAR_3)\n"
] | [
"def NfsTask(name, metadata, wait_for):...\n",
"def composed_decorator(func):...\n",
"return Task('nfs/{}'.format(name), metadata, wait_for, partial(\n serialize_dashboard_exception, include_http_status=True))(func)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if ':' not in VAR_0:\n",
"VAR_4 = VAR_0.split(':')\n",
"VAR_5 = importlib.import_module(VAR_4[0])\n",
"return getattr(VAR_5, VAR_4[1])\n"
] | [
"def str2class(value):...\n",
"\"\"\"docstring\"\"\"\n",
"if ':' not in value:\n",
"name = value.split(':')\n",
"module = importlib.import_module(name[0])\n",
"return getattr(module, name[1])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"from datetime import datetime\n",
"import pyodbc\n",
"import sys\n",
"import subprocess as sp\n",
"from os import system\n",
"def FUNC_0():...\n",
"system('cls')\n",
"def FUNC_1():...\n",
"print('-' * 70)\n",
"VAR_0 = 'laserInv'\n",
"VAR_1 = False\n",
"VAR_2 = None\n",
"VAR_3 = False\n",
... | [
"from datetime import datetime\n",
"import pyodbc\n",
"import sys\n",
"import subprocess as sp\n",
"from os import system\n",
"def clear():...\n",
"system('cls')\n",
"def divider():...\n",
"print('-' * 70)\n",
"DBNAME = 'laserInv'\n",
"openConn = False\n",
"confirmed = None\n",
"orderComplet... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"FunctionDef'",
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Condition",
"Condition",
"Expr'",
"Expr'",
"Assi... |
[
"def FUNC_6(self, VAR_51, VAR_44):...\n",
"VAR_51 = FUNC_3(VAR_51)\n",
"VAR_82 = None\n",
"if VAR_51:\n",
"VAR_82 = valid_login(VAR_51, VAR_44)\n",
"if not VAR_82:\n",
"return self.error()\n",
"return VAR_82\n"
] | [
"def run(self, user_name, password):...\n",
"user_name = chkuser(user_name)\n",
"user = None\n",
"if user_name:\n",
"user = valid_login(user_name, password)\n",
"if not user:\n",
"return self.error()\n",
"return user\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_0):...\n",
"self.doctype = VAR_0\n",
"self.tables = []\n",
"self.conditions = []\n",
"self.or_conditions = []\n",
"self.fields = None\n",
"self.user = None\n",
"self.ignore_ifnull = False\n",
"self.flags = frappe._dict()\n"
] | [
"def __init__(self, doctype):...\n",
"self.doctype = doctype\n",
"self.tables = []\n",
"self.conditions = []\n",
"self.or_conditions = []\n",
"self.fields = None\n",
"self.user = None\n",
"self.ignore_ifnull = False\n",
"self.flags = frappe._dict()\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(self, VAR_11):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_29 = get_agent_module(VAR_11)\n",
"if hasattr(VAR_29, 'add_cmdline_args'):\n",
"if hasattr(VAR_29, 'dictionary_class'):\n",
"VAR_29.add_cmdline_args(self)\n",
"VAR_6 = FUNC_2(VAR_29.dictionary_class())\n",
"self.set_defaults(dict_class=... | [
"def add_model_subargs(self, model):...\n",
"\"\"\"docstring\"\"\"\n",
"agent = get_agent_module(model)\n",
"if hasattr(agent, 'add_cmdline_args'):\n",
"if hasattr(agent, 'dictionary_class'):\n",
"agent.add_cmdline_args(self)\n",
"s = class2str(agent.dictionary_class())\n",
"self.set_defaults(dict_cla... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(self):...\n",
"self.objects = load_model_objects()\n",
"self.client.login(username='Karyn', password='specialP@55word')\n"
] | [
"def setUp(self):...\n",
"self.objects = load_model_objects()\n",
"self.client.login(username='Karyn', password='specialP@55word')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_3():...\n",
"VAR_3 = {'foo': 'bar'}\n",
"VAR_1 = json.dumps(VAR_3)\n",
"VAR_4 = tempfile.NamedTemporaryFile(mode='w')\n",
"VAR_4.write(VAR_1)\n",
"VAR_4.file.seek(0)\n",
"VAR_2 = load_source(json_file)\n",
"assert VAR_2 == VAR_3\n"
] | [
"def test_json_file_object():...\n",
"native = {'foo': 'bar'}\n",
"source = json.dumps(native)\n",
"tmp_file = tempfile.NamedTemporaryFile(mode='w')\n",
"tmp_file.write(source)\n",
"tmp_file.file.seek(0)\n",
"result = load_source(json_file)\n",
"assert result == native\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Assert'"
] |
[
"def FUNC_4(self):...\n",
"VAR_14 = self.cleaned_data\n",
"if not VAR_14.get('is_business'):\n",
"VAR_14['company'] = ''\n",
"if self.event.settings.invoice_address_required:\n",
"if VAR_14.get('is_business') and not VAR_14.get('company'):\n",
"if 'vat_id' in self.changed_data or not VAR_14.get('vat_id'... | [
"def clean(self):...\n",
"data = self.cleaned_data\n",
"if not data.get('is_business'):\n",
"data['company'] = ''\n",
"if self.event.settings.invoice_address_required:\n",
"if data.get('is_business') and not data.get('company'):\n",
"if 'vat_id' in self.changed_data or not data.get('vat_id'):\n",
"if ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Expr'",
... |
[
"def FUNC_1(self, VAR_4):...\n",
"VAR_4 = np.float32(VAR_4)\n",
"VAR_4 /= 255.0\n",
"VAR_4 = np.expand_dims(VAR_4, axis=0)\n",
"VAR_4 = np.expand_dims(VAR_4, axis=3)\n",
"self.ball_detector_interpreter.set_tensor(self.ball_detector_input_details[\n 0]['index'], VAR_4)\n",
"self.ball_detector_interpre... | [
"def getBallPosition(self, image):...\n",
"image = np.float32(image)\n",
"image /= 255.0\n",
"image = np.expand_dims(image, axis=0)\n",
"image = np.expand_dims(image, axis=3)\n",
"self.ball_detector_interpreter.set_tensor(self.ball_detector_input_details[\n 0]['index'], image)\n",
"self.ball_detector... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"AugAssign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_5(self):...\n",
"VAR_15 = self.data_group.group_type\n",
"VAR_16 = DocumentType.objects.filter(group_type=this_type)\n",
"if not self.document_type in VAR_16:\n"
] | [
"def clean(self):...\n",
"this_type = self.data_group.group_type\n",
"doc_types = DocumentType.objects.filter(group_type=this_type)\n",
"if not self.document_type in doc_types:\n"
] | [
0,
0,
6,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition"
] |
[
"@VAR_0.route('/level-2/search', methods=['POST'])...\n",
"VAR_26 = str(request.form['term'])\n",
"VAR_21 = psycopg2.connect('dbname=unlock user=ubuntu')\n",
"VAR_22 = VAR_21.cursor()\n",
"VAR_22.execute('SELECT * FROM nile_items;')\n",
"VAR_23 = VAR_22.fetchall()\n",
"VAR_22.close()\n",
"VAR_21.close... | [
"@app.route('/level-2/search', methods=['POST'])...\n",
"term = str(request.form['term'])\n",
"conn = psycopg2.connect('dbname=unlock user=ubuntu')\n",
"cur = conn.cursor()\n",
"cur.execute('SELECT * FROM nile_items;')\n",
"res = cur.fetchall()\n",
"cur.close()\n",
"conn.close()\n",
"items = [dict()... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def __init__(self, VAR_0, VAR_1=False):...\n",
"self.settings = VAR_0\n",
"self.sensors = VAR_0['sensors']\n"
] | [
"def __init__(self, settings, debug=False):...\n",
"self.settings = settings\n",
"self.sensors = settings['sensors']\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"@staticmethod...\n",
"if VAR_6.last_run_at:\n",
"return VAR_6.schedule.remaining_estimate(last_run_at=obj.last_run_at)\n",
"VAR_23, VAR_24 = VAR_6.schedule.is_due(last_run_at=datetime.now(pytz.utc))\n",
"VAR_25 = datetime.now(pytz.utc) + timedelta(seconds=y)\n",
"return VAR_25\n"
] | [
"@staticmethod...\n",
"if obj.last_run_at:\n",
"return obj.schedule.remaining_estimate(last_run_at=obj.last_run_at)\n",
"z, y = obj.schedule.is_due(last_run_at=datetime.now(pytz.utc))\n",
"date = datetime.now(pytz.utc) + timedelta(seconds=y)\n",
"return date\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_28(self, *VAR_76, **VAR_52):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.resources = VAR_76, VAR_52\n",
"return VAR_101\n"
] | [
"def resources(self, *args, **resources):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.resources = args, resources\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_9):...\n",
"VAR_9 = u\"'{0}'\".format(VAR_9)\n",
"return VAR_9\n"
] | [
"def insert_format(self, value):...\n",
"value = u\"'{0}'\".format(value)\n",
"return value\n"
] | [
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_10(VAR_32, VAR_34):...\n",
"logging.info('Got signal %s', VAR_32)\n"
] | [
"def handler(sig, _):...\n",
"logging.info('Got signal %s', sig)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"VAR_1 = 'http://my.url.com'\n",
"VAR_2 = 'True'\n",
"url_helper.urllib2.urlopen(mox.IsA(urllib2.Request), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(VAR_2))\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen(VAR_1, method='POSTFORM'), VAR_2)\n",
... | [
"def testUrlOpenPOSTFORMSuccess(self):...\n",
"url = 'http://my.url.com'\n",
"response = 'True'\n",
"url_helper.urllib2.urlopen(mox.IsA(urllib2.Request), timeout=mox.IgnoreArg()\n ).AndReturn(StringIO.StringIO(response))\n",
"self._mox.ReplayAll()\n",
"self.assertEqual(url_helper.UrlOpen(url, method='P... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_48(self, VAR_22, VAR_6=None):...\n",
"if VAR_6:\n",
"VAR_5 = VAR_5 = self.session.query(self.obj)\n",
"return self.session.query(self.obj).get(VAR_22)\n",
"VAR_35 = VAR_6.copy()\n",
"VAR_35.add_filter(self.get_pk_name(), self.FilterEqual, VAR_22)\n",
"VAR_5 = self._get_base_query(VAR_5=query, ... | [
"def get(self, id, filters=None):...\n",
"if filters:\n",
"query = query = self.session.query(self.obj)\n",
"return self.session.query(self.obj).get(id)\n",
"_filters = filters.copy()\n",
"_filters.add_filter(self.get_pk_name(), self.FilterEqual, id)\n",
"query = self._get_base_query(query=query, filter... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def __init__(self, VAR_0, VAR_1, VAR_2=None):...\n",
"self.base_directory_path = VAR_1\n",
"self.directory_filter, self.file_filter = VAR_0.filters\n",
"if VAR_2 is None:\n",
"VAR_2 = os_walk\n",
"self.walk_fn = VAR_2\n"
] | [
"def __init__(self, loader, base_directory_path, walk_fn=None):...\n",
"self.base_directory_path = base_directory_path\n",
"self.directory_filter, self.file_filter = loader.filters\n",
"if walk_fn is None:\n",
"walk_fn = os_walk\n",
"self.walk_fn = walk_fn\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'"
] |
[
"\"\"\"This module is the video repository in charge of all database requests.\"\"\"\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_1.execute('string'.format(VAR_0=playlist_id))\n",
"VAR_8 = VAR_1.fetchall()\n",
"return VAR_8\n"
] | [
"\"\"\"This module is the video repository in charge of all database requests.\"\"\"\n",
"def retrieve_videos_from_playlist(playlist_id, db):...\n",
"db.execute(\n 'SELECT id, title, thumbnail, position from video WHERE playlist_id={playlist_id} ORDER BY position ASC;'\n .format(playlist_id=playlist_id))\... | [
0,
0,
4,
0,
0
] | [
"Expr'",
"FunctionDef'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_7(VAR_17, *VAR_18, **VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = VAR_17.POST\n",
"VAR_21 = VAR_20.get('new_status')\n",
"if not VAR_21:\n",
"if not VAR_8 or not callable(VAR_8):\n",
"if not 'fields' in VAR_20:\n",
"return error_handler.logErrorAndReturnOK(\n 'No valid status can ... | [
"def manageModelsStatus(request, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"post_dict = request.POST\n",
"new_status = post_dict.get('new_status')\n",
"if not new_status:\n",
"if not status_retriever or not callable(status_retriever):\n",
"if not 'fields' in post_dict:\n",
"return error_hand... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_16(self, VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_23:\n",
"return VAR_23\n",
"VAR_39 = '\\\\\"password\\\\\": [^,}]*'\n",
"return re.sub(VAR_39, '\"password\": \"********\"', VAR_23)\n"
] | [
"def _mask_password(self, json):...\n",
"\"\"\"docstring\"\"\"\n",
"if not json:\n",
"return json\n",
"pattern = '\\\\\"password\\\\\": [^,}]*'\n",
"return re.sub(pattern, '\"password\": \"********\"', json)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = 'SELECT description FROM crimes;'\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"return cursor.fetchall()\n"
] | [
"def get_all_inputs(self):...\n",
"connection = self.connect()\n",
"query = 'SELECT description FROM crimes;'\n",
"connection.close()\n",
"cursor.execute(query)\n",
"return cursor.fetchall()\n"
] | [
0,
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def __init__(self, *VAR_5, **VAR_6):...\n",
"VAR_31 = VAR_6.get('null', False)\n",
"VAR_29 = VAR_6.get('default', None)\n",
"self.encoder = VAR_6.get('encoder', None)\n",
"if not VAR_31 and VAR_29 is None:\n",
"VAR_6['default'] = '{}'\n",
"if isinstance(VAR_29, (list, dict)):\n",
"VAR_6['default'] = ... | [
"def __init__(self, *args, **kwargs):...\n",
"null = kwargs.get('null', False)\n",
"default = kwargs.get('default', None)\n",
"self.encoder = kwargs.get('encoder', None)\n",
"if not null and default is None:\n",
"kwargs['default'] = '{}'\n",
"if isinstance(default, (list, dict)):\n",
"kwargs['default'... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_8(self):...\n",
"VAR_14 = []\n",
"for n in self.nodes:\n",
"if len(self.get_dependents(n['node_object'])) < 1:\n",
"return VAR_14\n",
"VAR_14.append(n)\n"
] | [
"def get_root_nodes(self):...\n",
"roots = []\n",
"for n in self.nodes:\n",
"if len(self.get_dependents(n['node_object'])) < 1:\n",
"return roots\n",
"roots.append(n)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'",
"Expr'"
] |
[
"def __str__(self):...\n",
"VAR_26 = list()\n",
"if self.forced:\n",
"VAR_26.append('Forced execution')\n",
"if self.noio:\n",
"VAR_26 = '; '.join(VAR_26)\n",
"VAR_26.append('Rules with neither input nor output files are always executed.')\n",
"if self.nooutput:\n",
"return VAR_26\n",
"VAR_26.appe... | [
"def __str__(self):...\n",
"s = list()\n",
"if self.forced:\n",
"s.append('Forced execution')\n",
"if self.noio:\n",
"s = '; '.join(s)\n",
"s.append('Rules with neither input nor output files are always executed.')\n",
"if self.nooutput:\n",
"return s\n",
"s.append(\n 'Rules with a run or shell... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_8(VAR_2, VAR_5, VAR_7, VAR_1):...\n",
"VAR_1.execute('string'.format(VAR_5=position, VAR_7=next_position))\n"
] | [
"def update_video_position(id, position, next_position, db):...\n",
"db.execute(\n 'UPDATE video SET position = Case position When {position} Then {next_position} Else position + 1 End WHERE position BETWEEN {next_position} AND {position};'\n .format(position=position, next_position=next_position))\n"
] | [
0,
4
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __init__(self, VAR_10, VAR_11={}):...\n",
"self._leap_provider = VAR_10\n",
"self._credentials = VAR_11.copy()\n"
] | [
"def __init__(self, leap_provider, credentials={}):...\n",
"self._leap_provider = leap_provider\n",
"self._credentials = credentials.copy()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'"
] |
[
"def FUNC_9(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_0.debug(_('Updating volume stats'))\n",
"VAR_34 = {}\n",
"VAR_35 = 'eqlx'\n",
"if self.configuration:\n",
"VAR_35 = self.configuration.safe_get('volume_backend_name')\n",
"VAR_34['volume_backend_name'] = VAR_35 or 'eqlx'\n",
"VAR_34['vendor_n... | [
"def _update_volume_stats(self):...\n",
"\"\"\"docstring\"\"\"\n",
"LOG.debug(_('Updating volume stats'))\n",
"data = {}\n",
"backend_name = 'eqlx'\n",
"if self.configuration:\n",
"backend_name = self.configuration.safe_get('volume_backend_name')\n",
"data['volume_backend_name'] = backend_name or 'eql... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_20(self, VAR_4):...\n",
""
] | [
"def on_task_failure(self, task):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(self):...\n",
"super(CLASS_0, self).setUp()\n"
] | [
"def setUp(self):...\n",
"super(TestAuthMiddleware, self).setUp()\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"subprocess.Popen([sys.executable, '-c',\n 'import os; print(\"HORK\" in os.environ)'], stdout=output).wait()\n",
"VAR_18.seek(0)\n",
"self.assertEqual('False\\n', VAR_18.read())\n"
] | [
"def test_environment_negation(self):...\n",
"subprocess.Popen([sys.executable, '-c',\n 'import os; print(\"HORK\" in os.environ)'], stdout=output).wait()\n",
"output.seek(0)\n",
"self.assertEqual('False\\n', output.read())\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_8, VAR_9):...\n",
"for line in VAR_8:\n",
"if line.startswith(VAR_9):\n",
"return\n",
"return line[len(VAR_9):]\n"
] | [
"def _get_prefixed_value(self, lines, prefix):...\n",
"for line in lines:\n",
"if line.startswith(prefix):\n",
"return\n",
"return line[len(prefix):]\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_6(self, *VAR_17, **VAR_18):...\n",
"super(CLASS_0, self).setUp()\n",
"FUNC_0()\n",
"if self.use_client_cert_auth():\n",
"VAR_54 = FUNC_2()\n",
"VAR_54 = FUNC_1()\n",
"self.nsxlib = v3.NsxLib(VAR_54)\n",
"self.maxDiff = None\n"
] | [
"def setUp(self, *args, **kwargs):...\n",
"super(NsxLibTestCase, self).setUp()\n",
"_mock_nsxlib()\n",
"if self.use_client_cert_auth():\n",
"nsxlib_config = get_nsxlib_config_with_client_cert()\n",
"nsxlib_config = get_default_nsxlib_config()\n",
"self.nsxlib = v3.NsxLib(nsxlib_config)\n",
"self.maxDi... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_6(VAR_12):...\n",
"if isinstance(VAR_12, set):\n",
"return list(VAR_12)\n",
"if hasattr(VAR_12, '__str__'):\n",
"return str(VAR_12)\n",
"log.msg('RENDERING ERROR, cannot json serialize %s' % VAR_12, system='httprest'\n )\n"
] | [
"def render(obj):...\n",
"if isinstance(obj, set):\n",
"return list(obj)\n",
"if hasattr(obj, '__str__'):\n",
"return str(obj)\n",
"log.msg('RENDERING ERROR, cannot json serialize %s' % obj, system='httprest')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_34(self):...\n",
"if JvmPlatform.global_instance().get_options().compiler == 'zinc':\n",
"return super(CLASS_1, self).execute()\n"
] | [
"def execute(self):...\n",
"if JvmPlatform.global_instance().get_options().compiler == 'zinc':\n",
"return super(ZincCompile, self).execute()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Return'"
] |
[
"def FUNC_6(self, VAR_51, VAR_44):...\n",
"VAR_51 = FUNC_3(VAR_51)\n",
"VAR_82 = None\n",
"if VAR_51:\n",
"VAR_82 = valid_login(VAR_51, VAR_44)\n",
"if not VAR_82:\n",
"return self.error()\n",
"return VAR_82\n"
] | [
"def run(self, user_name, password):...\n",
"user_name = chkuser(user_name)\n",
"user = None\n",
"if user_name:\n",
"user = valid_login(user_name, password)\n",
"if not user:\n",
"return self.error()\n",
"return user\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_5(*VAR_17):...\n",
"VAR_18 = VAR_8.replace('_', '-')\n",
"VAR_9 = ' '.join(str(elem) for elem in VAR_17)\n",
"return self._exec_adb_cmd(VAR_18, VAR_9)\n"
] | [
"def adb_call(*args):...\n",
"clean_name = name.replace('_', '-')\n",
"arg_str = ' '.join(str(elem) for elem in args)\n",
"return self._exec_adb_cmd(clean_name, arg_str)\n"
] | [
0,
0,
2,
2
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_5, VAR_6, VAR_7, VAR_8=False):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = self.read_metadata(VAR_7)\n",
"VAR_15, VAR_16, VAR_17 = self.workspace_changes(VAR_5, VAR_14, update_meta=\n False)\n",
"VAR_18, VAR_12 = refpath_to_mfs(Path(f'@{VAR_7}'))\n",
"for path in VAR_15:\n",
"os... | [
"def _load_ref_into_repo(self, fs_repo_root, branch, ref, without_timestamps...\n",
"\"\"\"docstring\"\"\"\n",
"metadata = self.read_metadata(ref)\n",
"added, removed, modified = self.workspace_changes(fs_repo_root, metadata,\n update_meta=False)\n",
"mfs_refpath, _ = refpath_to_mfs(Path(f'@{ref}'))\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"For",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_14(self, VAR_41, VAR_42=None):...\n",
""
] | [
"def get(self, key, default=None):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_0(self, VAR_0='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
"def connect(self, database='crimemap'):...\n",
"return pymysql.connect(host='localhost', user=dbconfig.db_user, passwd=\n dbconfig.db_password, db=database)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_8(self, VAR_26):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_21 = self.resolve_path(VAR_26, os.path.dirname(VAR_26))\n",
"if not VAR_21 or not self.exists(VAR_21):\n",
"VAR_24 = self.getfile(VAR_21)\n",
"if VAR_24[VAR_2] == VAR_12:\n",
"if VAR_24[VAR_2] == VAR_13 and VAR_24[VAR_10]:\n",
"return F... | [
"def file_contents(self, target):...\n",
"\"\"\"docstring\"\"\"\n",
"path = self.resolve_path(target, os.path.dirname(target))\n",
"if not path or not self.exists(path):\n",
"f = self.getfile(path)\n",
"if f[A_TYPE] == T_DIR:\n",
"if f[A_TYPE] == T_FILE and f[A_REALFILE]:\n",
"return open(f[A_REALFILE... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.json:\n",
"abort(400)\n",
"VAR_7 = request.json.get('Note', '')\n",
"VAR_8 = request.json.get('Attributter', {})\n",
"VAR_9 = request.json.get('Tilstande', {})\n",
"VAR_10 = request.json.get('Relationer', {})\n",
"if not db.object_exist... | [
"@classmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.json:\n",
"abort(400)\n",
"note = request.json.get('Note', '')\n",
"attributes = request.json.get('Attributter', {})\n",
"states = request.json.get('Tilstande', {})\n",
"relations = request.json.get('Relationer', {})\n",
"if not db.obje... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_2(VAR_0, VAR_1):...\n",
"VAR_8 = get_object_or_404(Hunt, id=pk)\n",
"if VAR_8.notice == True:\n",
"VAR_8.setNoticeFalse()\n",
"VAR_8.setNoticeTrue()\n",
"VAR_8.run()\n",
"return redirect('threat_hunter:index')\n"
] | [
"def hunt_switch_notice(request, pk):...\n",
"hunt = get_object_or_404(Hunt, id=pk)\n",
"if hunt.notice == True:\n",
"hunt.setNoticeFalse()\n",
"hunt.setNoticeTrue()\n",
"hunt.run()\n",
"return redirect('threat_hunter:index')\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"\"\"\"\nThis module contains ...\n\"\"\"\n",
"from __future__ import division, absolute_import\n",
"import cPickle as pickle\n",
"import pickle\n",
"import os\n",
"import time\n",
"import fnmatch\n",
"import hashlib\n",
"import re\n",
"import stat\n",
"import errno\n",
"from twisted.python im... | [
"\"\"\"\nThis module contains ...\n\"\"\"\n",
"from __future__ import division, absolute_import\n",
"import cPickle as pickle\n",
"import pickle\n",
"import os\n",
"import time\n",
"import fnmatch\n",
"import hashlib\n",
"import re\n",
"import stat\n",
"import errno\n",
"from twisted.python im... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Expr'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'... |
[
"def FUNC_5(VAR_9, VAR_12, VAR_13, VAR_14):...\n",
"FUNC_8(VAR_9, VAR_13, VAR_14)\n",
"VAR_9.cmd('send-keys', VAR_12, 'Enter')\n"
] | [
"def start_window(window, cmd, log_file, comp_name):...\n",
"setup_log(window, log_file, comp_name)\n",
"window.cmd('send-keys', cmd, 'Enter')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def __hash__(self):...\n",
"return hash(self.value)\n"
] | [
"def __hash__(self):...\n",
"return hash(self.value)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@VAR_0.filter...\n",
"return int(VAR_5 * 100)\n"
] | [
"@register.filter...\n",
"return int(decimal * 100)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"@commands.command(pass_context=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_6.lower()\n",
"if VAR_6 == '3ds' or VAR_6 == 'auto' and 'wiiu' not in VAR_4.message.channel.name:\n",
"VAR_7 = discord.Embed(VAR_2='Guide', VAR_3=discord.Color(13506590))\n",
"if (VAR_6 == 'wiiu' or VAR_6 == 'wii u'\n",
... | [
"@commands.command(pass_context=True)...\n",
"\"\"\"docstring\"\"\"\n",
"console = console.lower()\n",
"if console == '3ds' or console == 'auto' and 'wiiu' not in ctx.message.channel.name:\n",
"embed = discord.Embed(title='Guide', color=discord.Color(13506590))\n",
"if (console == 'wiiu' or console == 'wi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_0():...\n",
"VAR_0 = sqlite3.connect(CFG('dbname'))\n",
"return VAR_0, VAR_0.cursor()\n"
] | [
"def connectDB():...\n",
"conn = sqlite3.connect(CFG('dbname'))\n",
"return conn, conn.cursor()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"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_loggedi... | [
"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"... | [
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'"
] |
[
"@property...\n",
"return self.get_object()\n"
] | [
"@property...\n",
"return self.get_object()\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_4(self):...\n",
"VAR_3 = self.get_root_nodes()\n",
"VAR_4 = copy.copy(VAR_3)\n",
"VAR_8 = []\n",
"VAR_9 = set()\n",
"for index, n in enumerate(VAR_4):\n",
"VAR_10 = n['node_object']\n",
"return [n['node_object'] for n in VAR_8]\n",
"if VAR_10.id in VAR_9:\n",
"VAR_9.add(VAR_10.id)\n",
... | [
"def mark_dnr_nodes(self):...\n",
"root_nodes = self.get_root_nodes()\n",
"nodes = copy.copy(root_nodes)\n",
"nodes_marked_do_not_run = []\n",
"node_ids_visited = set()\n",
"for index, n in enumerate(nodes):\n",
"obj = n['node_object']\n",
"return [n['node_object'] for n in nodes_marked_do_not_run]\n"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Assign'... |
[
"def FUNC_5(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = kijiji_api.KijijiApi()\n",
"VAR_20.login(VAR_0.username, VAR_0.password)\n",
"[print(\"{} '{}'\".format(adId, adName)) for adName, adId in VAR_20.get_all_ads()\n ]\n"
] | [
"def show_ads(args):...\n",
"\"\"\"docstring\"\"\"\n",
"api = kijiji_api.KijijiApi()\n",
"api.login(args.username, args.password)\n",
"[print(\"{} '{}'\".format(adId, adName)) for adName, adId in api.get_all_ads()]\n"
] | [
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_17(self):...\n",
"if not self._IsServerAlive():\n",
"return\n",
"VAR_5 = {}\n",
"FUNC_1(VAR_5)\n",
"SendEventNotificationAsync('BufferVisit', VAR_5)\n"
] | [
"def OnBufferVisit(self):...\n",
"if not self._IsServerAlive():\n",
"return\n",
"extra_data = {}\n",
"_AddUltiSnipsDataIfNeeded(extra_data)\n",
"SendEventNotificationAsync('BufferVisit', extra_data)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_3(self, VAR_6=None, VAR_7='', VAR_8='', VAR_9=None, VAR_10=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_5 = self.session.query(self.obj)\n",
"if len(VAR_7.split('.')) >= 2:\n",
"VAR_33 = ''\n",
"VAR_23 = self.session.query(func.count('*')).select_from(self.obj)\n",
"for join_relation in VAR_7... | [
"def query(self, filters=None, order_column='', order_direction='', page=...\n",
"\"\"\"docstring\"\"\"\n",
"query = self.session.query(self.obj)\n",
"if len(order_column.split('.')) >= 2:\n",
"tmp_order_column = ''\n",
"query_count = self.session.query(func.count('*')).select_from(self.obj)\n",
"for jo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_21 = {}\n",
"VAR_22 = {}\n",
"VAR_23 = f'{VAR_7}, {VAR_8}'\n",
"log.debug('Getting address from coordinates %s...', VAR_23)\n",
"VAR_24 = Nominatim()\n",
"VAR_33 = VAR_24.reverse(VAR_23, language='en')\n",
"log.error('Getting address has failed!'... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"address = {}\n",
"country = {}\n",
"coordinates = f'{latitude}, {longitude}'\n",
"log.debug('Getting address from coordinates %s...', coordinates)\n",
"geolocator = Nominatim()\n",
"location = geolocator.reverse(coordinates, language='en')\n",
"log.e... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(VAR_21):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_45 = FUNC_21(VAR_21)\n",
"if not isinstance(VAR_45, dict):\n",
"return VAR_45\n"
] | [
"def load_configfile(configpath):...\n",
"\"\"\"docstring\"\"\"\n",
"config = _load_configfile(configpath)\n",
"if not isinstance(config, dict):\n",
"return config\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Return'"
] |
[
"@click.command()...\n",
""
] | [
"@click.command()...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_6(self, VAR_41):...\n",
"if VAR_41:\n",
"VAR_95 = Thing._by_fullname(VAR_41, False, data=True)\n",
"abort(403, 'forbidden')\n",
"if isinstance(VAR_95, Message):\n",
"return VAR_95\n",
"VAR_52 = VAR_95.subreddit_slow\n",
"if VAR_101.user_is_loggedin and VAR_52.can_comment(VAR_101.user):\n",
... | [
"def run(self, fullname):...\n",
"if fullname:\n",
"parent = Thing._by_fullname(fullname, False, data=True)\n",
"abort(403, 'forbidden')\n",
"if isinstance(parent, Message):\n",
"return parent\n",
"sr = parent.subreddit_slow\n",
"if c.user_is_loggedin and sr.can_comment(c.user):\n",
"return parent\n... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Return'"
] |
[
"def FUNC_3(VAR_3, VAR_4):...\n",
"VAR_7 = '(i) ' + VAR_3 + ' -> ' + VAR_4.__str__()\n",
"SCAN_ERRORS.append(VAR_7)\n"
] | [
"def ErrorLogger(url, error):...\n",
"con = '(i) ' + url + ' -> ' + error.__str__()\n",
"SCAN_ERRORS.append(con)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_29(self, VAR_77):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.priority = VAR_77\n",
"return VAR_101\n"
] | [
"def priority(self, priority):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.priority = priority\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def __repr__(self):...\n",
"return 'UInt({})'.format(self.size)\n"
] | [
"def __repr__(self):...\n",
"return 'UInt({})'.format(self.size)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_2(VAR_87):...\n",
"return map(self._rules.__getitem__, filter(self.is_rule, VAR_87))\n"
] | [
"def rules(items):...\n",
"return map(self._rules.__getitem__, filter(self.is_rule, items))\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_9 = {}\n",
"if not VAR_5:\n",
"VAR_5 = CLASS_0.get_report(VAR_1)['analysis']\n",
"VAR_15 = CLASS_0.behavior_get_processes(VAR_1, VAR_5)\n",
"for proc in VAR_15['data']:\n",
"VAR_6 = proc['pid']\n",
"return VAR_9\n",
"VAR_22 = proc['process_name... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"data = {}\n",
"if not report:\n",
"report = AnalysisController.get_report(task_id)['analysis']\n",
"procs = AnalysisController.behavior_get_processes(task_id, report)\n",
"for proc in procs['data']:\n",
"pid = proc['pid']\n",
"return data\n",
"pnam... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"Condition",
"Assign'",
"For",
"Condition",
"Assign'",
"For... |
[
"def FUNC_10(self, VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.connection:\n",
"self.cursor.execute('insert into itemlanguage (language) values (\"%s\")' %\n VAR_9[0])\n",
"self.connection.commit()\n"
] | [
"def add_language(self, language):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.connection:\n",
"self.cursor.execute('insert into itemlanguage (language) values (\"%s\")' %\n language[0])\n",
"self.connection.commit()\n"
] | [
0,
0,
0,
4,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Expr'",
"Expr'"
] |
[
"@VAR_2.route('/')...\n",
"VAR_4 = 'SELECT img_path, img_name\\t\\t\\tFROM imageTable'\n",
"VAR_1.execute(VAR_4)\n",
"return render_template('index.html', images=cursor)\n"
] | [
"@app.route('/')...\n",
"query = 'SELECT img_path, img_name\\t\\t\\tFROM imageTable'\n",
"cursor.execute(query)\n",
"return render_template('index.html', images=cursor)\n"
] | [
0,
4,
4,
4
] | [
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"@VAR_0.route('/login', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"VAR_5 = CLASS_0(request.form['email'], request.form['password'])\n",
"return render_template('login.html')\n",
"VAR_1.session.add(VAR_5)\n",
"VAR_1.session.commit()\n",
"return redirect(url_for('tables'))\n"
] | [
"@app.route('/login', methods=['GET', 'POST'])...\n",
"if request.method == 'POST':\n",
"user = User(request.form['email'], request.form['password'])\n",
"return render_template('login.html')\n",
"db.session.add(user)\n",
"db.session.commit()\n",
"return redirect(url_for('tables'))\n"
] | [
0,
0,
4,
0,
4,
4,
4
] | [
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = self.bindings\n",
"VAR_11 = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n",
"VAR_9 = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'serverGroupName': group_name, 'region': bindi... | [
"def delete_server_group(self):...\n",
"\"\"\"docstring\"\"\"\n",
"bindings = self.bindings\n",
"group_name = '{app}-{stack}-v000'.format(app=self.TEST_APP, stack=bindings[\n 'TEST_STACK'])\n",
"payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider':\n 'gce', 'serverGroupName': group... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self, VAR_3):...\n",
"if VAR_3.name not in self.host_names:\n",
"self.hosts.append(VAR_3)\n",
"self._hosts.add(VAR_3.name)\n",
"VAR_3.add_group(self)\n",
"self.clear_hosts_cache()\n"
] | [
"def add_host(self, host):...\n",
"if host.name not in self.host_names:\n",
"self.hosts.append(host)\n",
"self._hosts.add(host.name)\n",
"host.add_group(self)\n",
"self.clear_hosts_cache()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.