lines listlengths 1 444 | raw_lines listlengths 1 444 | label listlengths 1 444 | type listlengths 1 444 |
|---|---|---|---|
[
"def FUNC_6():...\n",
"VAR_0.info('Combining coverage results.')\n",
"FUNC_4([sys.executable, '-m', 'coverage', 'combine'])\n"
] | [
"def combine_coverage():...\n",
"logger.info('Combining coverage results.')\n",
"sh([sys.executable, '-m', 'coverage', 'combine'])\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'"
] |
[
"def FUNC_10(VAR_13, VAR_14, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = str(VAR_13)\n",
"VAR_14 = str(VAR_14)\n",
"FUNC_0(VAR_13)\n",
"FUNC_0(VAR_14)\n",
"VAR_26 = pathlib.Path(VAR_13).glob('**/*.vcf')\n",
"for VAR_0 in VAR_26:\n",
"VAR_31 = str(VAR_0)\n",
"VAR_32 = FUNC_8(VAR_31)\n",
... | [
"def setup_vcf_to_zarr(input_vcf_dir, output_zarr_dir, conversion_config):...\n",
"\"\"\"docstring\"\"\"\n",
"input_vcf_dir = str(input_vcf_dir)\n",
"output_zarr_dir = str(output_zarr_dir)\n",
"create_directory_tree(input_vcf_dir)\n",
"create_directory_tree(output_zarr_dir)\n",
"pathlist_vcf = pathlib.P... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_9(self, VAR_3, VAR_4):...\n",
"return int(datetime.utcfromtimestamp(VAR_3).replace(tzinfo=local_timezone).\n timestamp())\n"
] | [
"def convert_local_ts_to_utc(self, ts, local_timezone):...\n",
"return int(datetime.utcfromtimestamp(ts).replace(tzinfo=local_timezone).\n timestamp())\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_13(self, VAR_15):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = VAR_15.target\n",
"if isinstance(VAR_13, JavacPlugin):\n",
"self._write_javac_plugin_info(VAR_15.classes_dir, VAR_13)\n",
"if isinstance(VAR_13, AnnotationProcessor) and VAR_13.processors:\n",
"VAR_16 = os.path.join(VAR_15.classes_d... | [
"def write_extra_resources(self, compile_context):...\n",
"\"\"\"docstring\"\"\"\n",
"target = compile_context.target\n",
"if isinstance(target, JavacPlugin):\n",
"self._write_javac_plugin_info(compile_context.classes_dir, target)\n",
"if isinstance(target, AnnotationProcessor) and target.processors:\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_0(VAR_0=None):...\n",
"VAR_1 = FUNC_1()\n",
"VAR_2 = FUNC_2(VAR_0)\n",
"return VAR_1, VAR_2\n"
] | [
"def execute(filters=None):...\n",
"columns = get_columns()\n",
"data = get_data(filters)\n",
"return columns, data\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.use_instance_names = ['katotest%sa' % self.test_id, 'katotest%sb' %\n self.test_id, 'katotest%sc' % self.test_id]\n",
"self.use_instance_zones = [self.bindings['TEST_GCE_ZONE'], 'us-central1-b',\n self.bindings['TEST_GCE_ZONE']]\n",
"if self.u... | [
"def create_instances(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.use_instance_names = ['katotest%sa' % self.test_id, 'katotest%sb' %\n self.test_id, 'katotest%sc' % self.test_id]\n",
"self.use_instance_zones = [self.bindings['TEST_GCE_ZONE'], 'us-central1-b',\n self.bindings['TEST_GCE_ZONE']]\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Assign'",
"Expr'",
"Return'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"VAR_3 = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n",
"VAR_4 = 'fake_snap_name'\n",
"self.driver._eql_execute('volume', 'select', VAR_3['volume_name'],\n 'snapshot', 'create-now').AndRetu... | [
"def test_create_snapshot(self):...\n",
"self.driver._eql_execute = self.mox.CreateMock(self.driver._eql_execute)\n",
"snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}\n",
"snap_name = 'fake_snap_name'\n",
"self.driver._eql_execute('volume', 'select', snapshot['volume_name'],\n 'snapshot... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(self):...\n",
"self.assertEqual(self.view.get_success_url(), '/users/~update/#success')\n"
] | [
"def test_get_success_url(self):...\n",
"self.assertEqual(self.view.get_success_url(), '/users/~update/#success')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_23(VAR_14):...\n",
"return cgi.escape(VAR_14, quote=True)\n"
] | [
"def escape_html(text):...\n",
"return cgi.escape(text, quote=True)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@pytest.fixture(scope='session', autouse=True)...\n",
"VAR_12 = (VAR_2 +\n '/solr/admin/cores?action=RELOAD&core=possible.conflicts&wt=json')\n",
"VAR_13 = requests.get(VAR_12)\n",
"assert VAR_13.status_code == 200\n"
] | [
"@pytest.fixture(scope='session', autouse=True)...\n",
"url = solr + '/solr/admin/cores?action=RELOAD&core=possible.conflicts&wt=json'\n",
"r = requests.get(url)\n",
"assert r.status_code == 200\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_32(VAR_19):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n VAR_19)\n"
] | [
"def BuildExtraConfData(extra_conf_vim_data):...\n",
"return dict((expr, vimsupport.VimExpressionToPythonType(expr)) for expr in\n extra_conf_vim_data)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_15(self):...\n",
"if JvmPlatform.global_instance().get_options().compiler == 'javac':\n",
"return super(CLASS_0, self).execute()\n"
] | [
"def execute(self):...\n",
"if JvmPlatform.global_instance().get_options().compiler == 'javac':\n",
"return super(JavacCompile, self).execute()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
"VAR_1 = VAR_0.user\n",
"if not hasattr(VAR_1, 'type') or not is_trainee(VAR_1):\n",
"return {'gospel_trips_available': False}\n",
"VAR_2 = next((gt for gt in GospelTrip.objects.order_by('-open_time') if gt.\n is_open), None)\n",
"return {'gospel_trips_available': False}\n",
... | [
"def gospel_trips_available(request):...\n",
"user = request.user\n",
"if not hasattr(user, 'type') or not is_trainee(user):\n",
"return {'gospel_trips_available': False}\n",
"admin = next((gt for gt in GospelTrip.objects.order_by('-open_time') if gt.\n is_open), None)\n",
"return {'gospel_trips_availa... | [
0,
0,
0,
0,
0,
0,
6,
6,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Return'",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_1.route('/run/form/history', methods=['POST'])...\n",
"VAR_40 = json.loads(request.data)\n",
"VAR_40 = [{'id': item['id'], 'date': datetime.fromtimestamp(item['date'] / \n 1000), 'commands': item['commands']} for item in VAR_40]\n",
"return render_template('run_history.html', VAR_40=history)\n"
] | [
"@app.route('/run/form/history', methods=['POST'])...\n",
"history = json.loads(request.data)\n",
"history = [{'id': item['id'], 'date': datetime.fromtimestamp(item['date'] /\n 1000), 'commands': item['commands']} for item in history]\n",
"return render_template('run_history.html', history=history)\n"
] | [
0,
0,
0,
0
] | [
"For",
"Assign'",
"Assign'",
"Return'"
] |
[
"@retries(5, delay=0.5, backoff=1.5)...\n",
"if VAR_11 == 'POST':\n",
"return requests.post(FUNC_2(VAR_7), VAR_9=ToUtf8Json(data), headers=_HEADERS)\n",
"if VAR_11 == 'GET':\n",
"return requests.get(FUNC_2(VAR_7), headers=_HEADERS)\n"
] | [
"@retries(5, delay=0.5, backoff=1.5)...\n",
"if method == 'POST':\n",
"return requests.post(_BuildUri(handler), data=ToUtf8Json(data), headers=\n _HEADERS)\n",
"if method == 'GET':\n",
"return requests.get(_BuildUri(handler), headers=_HEADERS)\n"
] | [
0,
0,
7,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Condition",
"Return'"
] |
[
"def FUNC_15():...\n",
"if VAR_14 not in self._timers:\n",
"return\n",
"self._timers.remove(VAR_14)\n",
"VAR_10()\n",
"logging.exception('Timer callback failed')\n"
] | [
"def call_wrapper():...\n",
"if timer not in self._timers:\n",
"return\n",
"self._timers.remove(timer)\n",
"callback()\n",
"logging.exception('Timer callback failed')\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from m5.params import *\n",
"from m5.proxy import *\n",
"from m5.util.fdthelper import *\n",
"from m5.SimObject import SimObject\n",
"from m5.objects.Device import PioDevice\n",
"from m5.objects.Platform import Platform\n",
"VAR_0 = 'BaseGic'\n",
"VAR_1 = True\n",
"VAR_2 = 'dev/arm/base_gic.hh'\n",... | [
"from m5.params import *\n",
"from m5.proxy import *\n",
"from m5.util.fdthelper import *\n",
"from m5.SimObject import SimObject\n",
"from m5.objects.Device import PioDevice\n",
"from m5.objects.Platform import Platform\n",
"type = 'BaseGic'\n",
"abstract = True\n",
"cxx_header = 'dev/arm/base_gic.... | [
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assig... |
[
"def FUNC_20(self):...\n",
"VAR_15 = self.mock_nsx_clustered_api()\n",
"VAR_15._reinit_cluster()\n"
] | [
"def test_reinitialize_cluster(self):...\n",
"api = self.mock_nsx_clustered_api()\n",
"api._reinit_cluster()\n"
] | [
0,
0,
5
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_4):...\n",
"if isinstance(VAR_4, Promise):\n",
"return force_unicode(VAR_4)\n",
"return super(CLASS_0, self).default(VAR_4)\n"
] | [
"def default(self, obj):...\n",
"if isinstance(obj, Promise):\n",
"return force_unicode(obj)\n",
"return super(LazyEncoder, self).default(obj)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def __init__(self, VAR_37=None, VAR_38=None, VAR_39=False):...\n",
"\"\"\"docstring\"\"\"\n",
"list.__init__(self)\n",
"self._names = dict()\n",
"if VAR_37:\n",
"self.extend(map(str, VAR_37) if VAR_39 else VAR_37)\n",
"if VAR_38:\n",
"if isinstance(VAR_37, CLASS_2):\n",
"for VAR_44, item in VAR_38.... | [
"def __init__(self, toclone=None, fromdict=None, plainstr=False):...\n",
"\"\"\"docstring\"\"\"\n",
"list.__init__(self)\n",
"self._names = dict()\n",
"if toclone:\n",
"self.extend(map(str, toclone) if plainstr else toclone)\n",
"if fromdict:\n",
"if isinstance(toclone, Namedlist):\n",
"for key, ite... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Condition",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_1(self):...\n",
"CLASS_3.ScenarioMaker().given_a_profile(VAR_8='a_b.c', VAR_9='my info',\n VAR_3='url').given_a_public_domain('http://pachatary.com'\n ).given_a_dynamic_link('http://dynamic.link/link={}&other=param'\n ).when_call_profile_redirect('a_b.c'\n ).then_response_should_be_a_redirec... | [
"def test_when_there_is_a_dynamic_link_wraps_public_domain_url(self):...\n",
"RedirectProfileTestCase.ScenarioMaker().given_a_profile(username='a_b.c',\n bio='my info', pic='url').given_a_public_domain('http://pachatary.com'\n ).given_a_dynamic_link('http://dynamic.link/link={}&other=param'\n ).when_call... | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"@classmethod...\n",
"return [handler.gae_cookie_authentication]\n"
] | [
"@classmethod...\n",
"return [handler.gae_cookie_authentication]\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"import urllib.parse\n",
"from django.conf import settings\n",
"from django.contrib.auth.models import User\n",
"from django.core.urlresolvers import reverse\n",
"from django.test import TestCase, modify_settings\n",
"from django.utils import timezone\n",
"VAR_0 = {'SHIB_cn': 'Teemu Teekkari', 'SHIB_mai... | [
"import urllib.parse\n",
"from django.conf import settings\n",
"from django.contrib.auth.models import User\n",
"from django.core.urlresolvers import reverse\n",
"from django.test import TestCase, modify_settings\n",
"from django.utils import timezone\n",
"DEF_SHIBD_META = {'SHIB_cn': 'Teemu Teekkari', ... | [
0,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr... |
[
"def FUNC_5(self, VAR_4, VAR_5):...\n",
""
] | [
"def _executeSQL(self, cur, sql):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@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'"
] |
[
"def FUNC_2(self, VAR_1):...\n",
"VAR_2 = self.connect()\n",
"VAR_3 = \"INSERT INTO crimes (description) VALUES('{}');\".format(VAR_1)\n",
"VAR_2.close()\n",
"cursor.execute(VAR_3)\n",
"VAR_2.commit()\n"
] | [
"def add_input(self, data):...\n",
"connection = self.connect()\n",
"query = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n",
"connection.close()\n",
"cursor.execute(query)\n",
"connection.commit()\n"
] | [
0,
0,
4,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(VAR_1):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1.value = beamr.interpreters.Column(VAR_1.value)\n",
"return VAR_1\n"
] | [
"def t_COLUMN(t):...\n",
"\"\"\"docstring\"\"\"\n",
"t.value = beamr.interpreters.Column(t.value)\n",
"return t\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_17(self):...\n",
"logging.info('Clearing flask session')\n",
"VAR_15['user'] = {}\n",
"VAR_15.clear()\n"
] | [
"def clear_session(self):...\n",
"logging.info('Clearing flask session')\n",
"session['user'] = {}\n",
"session.clear()\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_2, VAR_3, VAR_4, VAR_5, VAR_1, VAR_6, VAR_7):...\n",
"if ' ' in VAR_2:\n",
"VAR_6('Invalid nick')\n",
"VAR_14 = database.get(VAR_1, 'channels', 'votekick', 'chan', VAR_4)\n",
"VAR_14 = 10\n",
"VAR_15 = database.get(VAR_1, 'channels', 'voteban', 'chan', VAR_4)\n",
"VAR_15 = 10\n",
"if l... | [
"def process_vote(target, action, chan, mask, db, notice, conn):...\n",
"if ' ' in target:\n",
"notice('Invalid nick')\n",
"votes2kick = database.get(db, 'channels', 'votekick', 'chan', chan)\n",
"votes2kick = 10\n",
"votes2ban = database.get(db, 'channels', 'voteban', 'chan', chan)\n",
"votes2ban = 10\... | [
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,
0,
0,
0,
4,
0,
0,
4,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Return'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Conditi... |
[
"def FUNC_15(self, VAR_9):...\n",
"VAR_16 = subprocess.check_output(VAR_9, shell=True)\n",
"VAR_17 = VAR_16.decode('UTF-8').rstrip()\n",
"return VAR_17\n"
] | [
"def _execute(self, command):...\n",
"byteOutput = subprocess.check_output(command, shell=True)\n",
"output = byteOutput.decode('UTF-8').rstrip()\n",
"return output\n"
] | [
0,
2,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_42(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2 = {'SEVERITY': {'MEDIUM': 1}, 'CONFIDENCE': {'HIGH': 1}}\n",
"self.check_example('yaml_load.py', VAR_2)\n"
] | [
"def test_yaml(self):...\n",
"\"\"\"docstring\"\"\"\n",
"expect = {'SEVERITY': {'MEDIUM': 1}, 'CONFIDENCE': {'HIGH': 1}}\n",
"self.check_example('yaml_load.py', expect)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_5):...\n",
"for VAR_7 in self.G.edges():\n",
"self.calcWLPVM(VAR_7, VAR_5)\n"
] | [
"def calcAllWLPVM(self, l):...\n",
"for edge in self.G.edges():\n",
"self.calcWLPVM(edge, l)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"For",
"Expr'"
] |
[
"@VAR_0.route('/authorized/<remote_app>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_1 not in handlers:\n",
"return abort(404)\n",
"return handlers[VAR_1]()\n"
] | [
"@blueprint.route('/authorized/<remote_app>/')...\n",
"\"\"\"docstring\"\"\"\n",
"if remote_app not in handlers:\n",
"return abort(404)\n",
"return handlers[remote_app]()\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"@staticmethod...\n",
"VAR_26 = os.path.realpath(VAR_4)\n",
"VAR_22 = CLASS_1.create('root', VAR_5, VAR_4, {}, {}, VAR_15=True)\n",
"if VAR_5 and VAR_8:\n",
"VAR_22.checkout()\n",
"VAR_11 = load_conf(VAR_4)\n",
"if VAR_11 is None:\n",
"return VAR_22, {}\n",
"VAR_27 = join(VAR_4, VAR_11.get('subproje... | [
"@staticmethod...\n",
"source_dir_rp = os.path.realpath(source_dir)\n",
"root = Subproject.create('root', url, source_dir, {}, {}, toplevel=True)\n",
"if url and update:\n",
"root.checkout()\n",
"conf = load_conf(source_dir)\n",
"if conf is None:\n",
"return root, {}\n",
"subproject_dir = join(sourc... | [
0,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
"Condition",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'",
"Assign'",
"For",
"FunctionDef'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"As... |
[
"def FUNC_4(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_3.headers.get('Authorization'):\n",
"return None\n",
"if not utils.is_local_dev_server():\n",
"return api.extract_oauth_caller_identity()\n",
"VAR_32 = VAR_3.headers['Authorization'].split(' ', 1)\n",
"if len(VAR_32) != 2 or VAR_32[0] n... | [
"def oauth_authentication(request):...\n",
"\"\"\"docstring\"\"\"\n",
"if not request.headers.get('Authorization'):\n",
"return None\n",
"if not utils.is_local_dev_server():\n",
"return api.extract_oauth_caller_identity()\n",
"header = request.headers['Authorization'].split(' ', 1)\n",
"if len(header)... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_2(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_53 = VAR_43.read(1)\n",
"return VAR_53\n"
] | [
"def f(x):...\n",
"\"\"\"docstring\"\"\"\n",
"arr = rst.read(1)\n",
"return arr\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def __new__(VAR_22, VAR_3):...\n",
"VAR_48 = str.__new__(VAR_22, VAR_3)\n",
"VAR_48._is_function = type(VAR_3).__name__ == 'function'\n",
"VAR_48._file = VAR_3\n",
"VAR_48.rule = None\n",
"VAR_48._regex = None\n",
"return VAR_48\n"
] | [
"def __new__(cls, file):...\n",
"obj = str.__new__(cls, file)\n",
"obj._is_function = type(file).__name__ == 'function'\n",
"obj._file = file\n",
"obj.rule = None\n",
"obj._regex = None\n",
"return obj\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_16(self, VAR_16, VAR_19):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_46 = self.configuration.volume_name_template % VAR_19['id']\n",
"VAR_0.error(_('Failed to create clone of volume %s'), VAR_16['name'])\n",
"VAR_25 = self._eql_execute('volume', 'select', VAR_46, 'clone', VAR_16['name'])\n",
"return... | [
"def create_cloned_volume(self, volume, src_vref):...\n",
"\"\"\"docstring\"\"\"\n",
"src_volume_name = self.configuration.volume_name_template % src_vref['id']\n",
"LOG.error(_('Failed to create clone of volume %s'), volume['name'])\n",
"out = self._eql_execute('volume', 'select', src_volume_name, 'clone',... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return list(listfiles(VAR_12, VAR_13=restriction, VAR_14=omit_value))\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return list(listfiles(pattern, restriction=restriction, omit_value=omit_value))\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"def FUNC_13(self, VAR_25='default.yaml'):...\n",
"self.config = load(data_file, Loader)\n"
] | [
"def load_config(self, filename='default.yaml'):...\n",
"self.config = load(data_file, Loader)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assign'"
] |
[
"def __getitem__(self, VAR_7):...\n",
"VAR_9, VAR_21 = FUNC_3(self, VAR_7, VAR_2=self._sep, VAR_8=raise_on_missing)\n",
"if VAR_9 is self:\n",
"return self._data[VAR_21]\n",
"return VAR_9[VAR_21]\n"
] | [
"def __getitem__(self, path):...\n",
"node, key = traverse(self, path, sep=self._sep, on_missing=raise_on_missing)\n",
"if node is self:\n",
"return self._data[key]\n",
"return node[key]\n"
] | [
0,
0,
0,
1,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"from __future__ import unicode_literals\n",
"import frappe\n",
"from frappe import _\n",
"from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n",
"def FUNC_0(VAR_0=None):...\n",
"VAR_1 = frappe.db.sql_list('... | [
"from __future__ import unicode_literals\n",
"import frappe\n",
"from frappe import _\n",
"from erpnext.hr.doctype.leave_application.leave_application import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period\n",
"def execute(filters=None):...\n",
"leave_types = frappe.db.s... | [
0,
0,
0,
4,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_16(VAR_13):...\n",
"def FUNC_60(self):...\n",
"self._test_strtype('blob', bytearray(VAR_13), VAR_23(VAR_13))\n",
"return VAR_32\n"
] | [
"def _maketest(value):...\n",
"def t(self):...\n",
"self._test_strtype('blob', bytearray(value), len(value))\n",
"return t\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_6(self):...\n",
"if not VAR_101.user_is_sponsor:\n",
"abort(403, 'forbidden')\n"
] | [
"def run(self):...\n",
"if not c.user_is_sponsor:\n",
"abort(403, 'forbidden')\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'"
] |
[
"def FUNC_30(VAR_35):...\n",
"self.assertEqual(None, VAR_35)\n",
"return 0\n"
] | [
"def run_bot(error):...\n",
"self.assertEqual(None, error)\n",
"return 0\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Return'"
] |
[
"def FUNC_8(self, VAR_11, VAR_3):...\n",
"VAR_19 = set()\n",
"VAR_18 = VAR_11['rules']\n",
"for VAR_37 in VAR_18:\n",
"VAR_8 = VAR_3['rules'][VAR_37]\n",
"return VAR_19\n",
"VAR_19 |= FUNC_1(VAR_8, VAR_3)\n"
] | [
"def get_bookmarks(self, levelfields, doc):...\n",
"bookmarks = set()\n",
"rulenames = levelfields['rules']\n",
"for rulename in rulenames:\n",
"rule = doc['rules'][rulename]\n",
"return bookmarks\n",
"bookmarks |= get_rule_bookmarks(rule, doc)\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"AugAssign'"
] |
[
"def FUNC_1(self, VAR_2, VAR_6, VAR_7, VAR_4, VAR_3):...\n",
"VAR_11 = VAR_4.get(VAR_6 + '.name', '') + '|' + VAR_4.get(VAR_6 + '.phone', ''\n ) + '|' + VAR_4.get(VAR_6 + '.email', '')\n",
"VAR_11 = VAR_11 != '||' and VAR_11 or ''\n",
"setattr(VAR_2, VAR_6, VAR_11)\n"
] | [
"def parse_input(self, report, name, value, request, attribute):...\n",
"contact = request.get(name + '.name', '') + '|' + request.get(name +\n '.phone', '') + '|' + request.get(name + '.email', '')\n",
"contact = contact != '||' and contact or ''\n",
"setattr(report, name, contact)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(self, VAR_0: str):...\n",
"VAR_2 = self._get_subs()\n",
"VAR_3 = api.submission.get_all(VAR_0, email=get_email(self), submitters=subs)\n",
"self.write(VAR_3)\n"
] | [
"def get(self, survey_id: str):...\n",
"subs = self._get_subs()\n",
"response = api.submission.get_all(survey_id, email=get_email(self),\n submitters=subs)\n",
"self.write(response)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_39(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for VAR_40, VAR_41 in self._names.items():\n",
"yield VAR_40, VAR_41\n"
] | [
"def get_names(self):...\n",
"\"\"\"docstring\"\"\"\n",
"for name, index in self._names.items():\n",
"yield name, index\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Expr'"
] |
[
"def __init__(self, VAR_18, *VAR_15, **VAR_16):...\n",
"CLASS_3.__init__(self, VAR_18, errors.WRONG_PASSWORD, *VAR_15, **kw)\n"
] | [
"def __init__(self, item, *a, **kw):...\n",
"VRequired.__init__(self, item, errors.WRONG_PASSWORD, *a, **kw)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_1(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_1 = VAR_0.cursor()\n",
"VAR_1.execute(\n \"SELECT * FROM states WHERE name LIKE BINARY 'N%' ORDER BY states.id ASC\")\n",
"VAR_2 = VAR_1.fetchall()\n",
"for row in VAR_2:\n",
"print(row)\n",
"VAR_1.close()\n",
"VAR_0.close()\n"
] | [
"def print_states_N(db):...\n",
"\"\"\"docstring\"\"\"\n",
"cur = db.cursor()\n",
"cur.execute(\n \"SELECT * FROM states WHERE name LIKE BINARY 'N%' ORDER BY states.id ASC\")\n",
"rows = cur.fetchall()\n",
"for row in rows:\n",
"print(row)\n",
"cur.close()\n",
"db.close()\n"
] | [
0,
0,
0,
0,
4,
4,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_2(VAR_4, VAR_6):...\n",
"VAR_10 = (VAR_4['page'] - 1) * VAR_4['perPage']\n",
"VAR_11 = f\"\"\"string{VAR_0} AS p INNER JOIN {VAR_1} AS pt ON\n p.product_type_id=pt.id\n WHERE p.rating >= {VAR_4['rating']}\n AND p.name LIKE '%{VAR_6}%'\n ORDER BY p.id LIMIT {... | [
"def search_products(filters, search):...\n",
"offset = (filters['page'] - 1) * filters['perPage']\n",
"sql_query = f\"\"\"\n SELECT p.id, p.ean, p.name, p.description, pt.name AS type, p.company, p.price, p.rating, p.weight, p.quantity, p.image_url\n FROM {PRODUCTS_TABLE} AS p INNER JOIN ... | [
0,
0,
4,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def __init__(self, VAR_1, VAR_2=False):...\n",
"self.id = random_id(VAR_1.get('id'))\n",
"self.name = VAR_1['name']\n",
"self.category = VAR_1.get('category', 'Misc')\n",
"self.program = VAR_1['program']\n",
"self.arguments = VAR_1.get('arguments', [])\n",
"self.readonly = VAR_2\n",
"self.ui_properti... | [
"def __init__(self, obj, readonly=False):...\n",
"self.id = random_id(obj.get('id'))\n",
"self.name = obj['name']\n",
"self.category = obj.get('category', 'Misc')\n",
"self.program = obj['program']\n",
"self.arguments = obj.get('arguments', [])\n",
"self.readonly = readonly\n",
"self.ui_properties = o... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'"
] |
[
"def FUNC_5(self):...\n",
"return {'uid': self.uid, 'email': self.email, 'name': self.name}\n"
] | [
"def as_object(self):...\n",
"return {'uid': self.uid, 'email': self.email, 'name': self.name}\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_1(self, VAR_47, VAR_48):...\n",
"VAR_53 = jinja2.FileSystemLoader(searchpath='/')\n",
"VAR_54 = jinja2.Environment(loader=templateLoader)\n",
"VAR_55 = VAR_54.get_template(VAR_47)\n",
"VAR_56 = VAR_55.render(VAR_48)\n",
"return VAR_56\n"
] | [
"def generate_ansible_playbook_from_template(self, template_file, data):...\n",
"templateLoader = jinja2.FileSystemLoader(searchpath='/')\n",
"templateEnv = jinja2.Environment(loader=templateLoader)\n",
"template = templateEnv.get_template(template_file)\n",
"outputText = template.render(data)\n",
"return... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return None\n"
] | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"return None\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"@property...\n",
"return self.hostname if self.hostname else self.address\n"
] | [
"@property...\n",
"return self.hostname if self.hostname else self.address\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_12 = ''\n",
"VAR_40 = VAR_41 = None\n",
"if VAR_1.sort_field and ',' in VAR_1.sort_field:\n",
"VAR_12 = ', '.join(['`tab{0}`.`{1}` {2}'.format(VAR_0, VAR_34.split()[0].\n strip(), VAR_34.split()[1].strip()) for VAR_34 in VAR_1.sort_field.\n split(',')])\n",
"VA... | [
"def get_order_by(doctype, meta):...\n",
"order_by = ''\n",
"sort_field = sort_order = None\n",
"if meta.sort_field and ',' in meta.sort_field:\n",
"order_by = ', '.join(['`tab{0}`.`{1}` {2}'.format(doctype, f.split()[0].\n strip(), f.split()[1].strip()) for f in meta.sort_field.split(',')])\n",
"sort_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'",
"Assign'"
] |
[
"def FUNC_27(VAR_6):...\n",
"if callable(VAR_6):\n",
"return VAR_6()\n"
] | [
"def default_encode(value):...\n",
"if callable(value):\n",
"return value()\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_7(VAR_5):...\n",
"VAR_12 = FUNC_6(VAR_5)\n",
"for VAR_47 in list(VAR_12.keys()):\n",
"if VAR_47[-3:] != '.py':\n",
"return VAR_12\n"
] | [
"def get_python_files_involved_in_pr(data):...\n",
"files = get_files_involved_in_pr(data)\n",
"for file in list(files.keys()):\n",
"if file[-3:] != '.py':\n",
"return files\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Condition",
"Return'"
] |
[
"@tornado.web.authenticated...\n",
""
] | [
"@tornado.web.authenticated...\n",
""
] | [
0,
0
] | [
"Condition",
"Condition"
] |
[
"def FUNC_8(self, VAR_9):...\n",
"VAR_23 = os.path.getsize(VAR_9)\n",
"VAR_5 = mimetypes.guess_type(VAR_9)[0]\n",
"VAR_24 = (\n 'HTTP/1.1 200 OK\\r\\nConnection: Keep-Alive\\r\\nContent-Type: {}\\r\\nContent-Length: {}\\r\\n\\r\\n'\n .format(VAR_5, VAR_23).encode('utf-8'))\n",
"if self.ok:\n",
"self... | [
"def tx_file(self, path):...\n",
"sz = os.path.getsize(path)\n",
"mime = mimetypes.guess_type(path)[0]\n",
"header = (\n 'HTTP/1.1 200 OK\\r\\nConnection: Keep-Alive\\r\\nContent-Type: {}\\r\\nContent-Length: {}\\r\\n\\r\\n'\n .format(mime, sz).encode('utf-8'))\n",
"if self.ok:\n",
"self.s.send(head... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Condition",
"Expr'"
] |
[
"def FUNC_4(self, VAR_2):...\n",
"if self == VAR_2:\n",
"if VAR_2 not in self.child_groups:\n",
"self.child_groups.append(VAR_2)\n",
"VAR_2.depth = max([self.depth + 1, VAR_2.depth])\n",
"VAR_2._check_children_depth()\n",
"if self.name not in [VAR_12.name for VAR_12 in VAR_2.parent_groups]:\n",
"VAR_2... | [
"def add_child_group(self, group):...\n",
"if self == group:\n",
"if group not in self.child_groups:\n",
"self.child_groups.append(group)\n",
"group.depth = max([self.depth + 1, group.depth])\n",
"group._check_children_depth()\n",
"if self.name not in [g.name for g in group.parent_groups]:\n",
"group.... | [
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
1
] | [
"FunctionDef'",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"For",
"Expr'",
"Expr'",
"For",
"Expr'"
] |
[
"def __init__(self, VAR_2=None):...\n",
"self.dumpfilepath = ''\n",
"if VAR_2:\n",
"self.dumpfilepath = 'kijiji_dump_{}.txt'.format(strftime('%Y%m%dT%H%M%S'))\n",
"f.write(VAR_2)\n"
] | [
"def __init__(self, dump=None):...\n",
"self.dumpfilepath = ''\n",
"if dump:\n",
"self.dumpfilepath = 'kijiji_dump_{}.txt'.format(strftime('%Y%m%dT%H%M%S'))\n",
"f.write(dump)\n"
] | [
0,
0,
0,
5,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'"
] |
[
"def FUNC_3(VAR_5, VAR_6=''):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = urllib2.Request(VAR_5)\n",
"if VAR_6:\n",
"VAR_18.add_header('User-Agent', VAR_6)\n",
"VAR_20 = VAR_8(VAR_18)\n",
"VAR_0.error('Unable to read from URL %s.' % VAR_5)\n",
"VAR_11 = FUNC_1(VAR_21, VAR_3=True)\n",
"VAR_21 = tempf... | [
"def text_lines_from_url(url, user_agent=''):...\n",
"\"\"\"docstring\"\"\"\n",
"request = urllib2.Request(url)\n",
"if user_agent:\n",
"request.add_header('User-Agent', user_agent)\n",
"distant_stream = urlopen(request)\n",
"log.error('Unable to read from URL %s.' % url)\n",
"lines = text_lines_from_... | [
0,
0,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
0,
7,
0,
7,
0,
0,
7,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Return'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"For",
"AugAssign'",
"Expr'",
"Return'"
] |
[
"def FUNC_4(*VAR_17):...\n",
"VAR_39 = VAR_17[0]\n",
"return {'rules': [{'display_name': rule['display_name'], 'id': uuidutils.\n generate_uuid()} for rule in VAR_39]}\n"
] | [
"def _mock_add_rules_in_section(*args):...\n",
"rules = args[0]\n",
"return {'rules': [{'display_name': rule['display_name'], 'id': uuidutils.\n generate_uuid()} for rule in rules]}\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def __len__(self):...\n",
""
] | [
"def __len__(self):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_3(VAR_6):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_20 = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n",
"return [field for field in VAR_6['fields'] if field['name'] not in VAR_20]\n"
] | [
"def enterprise_fields_only(fields):...\n",
"\"\"\"docstring\"\"\"\n",
"enterprise_exclusions = configuration_helpers.get_value(\n 'ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS', settings.\n ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS)\n",
"return [field for field in fields['fields'] if field['name'] not in\n ... | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Return'"
] |
[
"def FUNC_2(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def ensure_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_9(self):...\n",
"for VAR_2 in self.query_order.split('.'):\n",
"VAR_23 = VAR_2.replace('-', '')\n",
"return False\n",
"if int(VAR_23) == self.column_id:\n",
"if VAR_2.startswith('-'):\n",
"return True\n"
] | [
"def is_reverse(self):...\n",
"for column in self.query_order.split('.'):\n",
"c = column.replace('-', '')\n",
"return False\n",
"if int(c) == self.column_id:\n",
"if column.startswith('-'):\n",
"return True\n"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"For",
"Assign'",
"Return'",
"Condition",
"Condition",
"Return'"
] |
[
"def __init__(self, VAR_0, VAR_1, VAR_2=None):...\n",
"GenericRequest.__init__(self, VAR_0, VAR_2)\n",
"self.submission_id = VAR_1\n",
"self.url = '%ssubmission/%s' % (self.base_url, VAR_1)\n"
] | [
"def __init__(self, browser, submission_id, base_url=None):...\n",
"GenericRequest.__init__(self, browser, base_url)\n",
"self.submission_id = submission_id\n",
"self.url = '%ssubmission/%s' % (self.base_url, submission_id)\n"
] | [
0,
0,
0,
5
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Assign'"
] |
[
"from gfui.backends.default import Backend\n",
"import mysql.connector\n",
"from gfui.chartgraph import Graph, Table\n",
"import re\n",
"import ipaddress\n",
"import os\n",
"def __init__(self, VAR_0):...\n",
"super().__init__()\n",
"self.required_opts = ['SQL_SERVER', 'SQL_USERNAME', 'SQL_DB']\n",
... | [
"from gfui.backends.default import Backend\n",
"import mysql.connector\n",
"from gfui.chartgraph import Graph, Table\n",
"import re\n",
"import ipaddress\n",
"import os\n",
"def __init__(self, OPTIONS):...\n",
"super().__init__()\n",
"self.required_opts = ['SQL_SERVER', 'SQL_USERNAME', 'SQL_DB']\n",... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0,
0,
0
] | [
"ImportFrom'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
"Return'"
] |
[
"def FUNC_0(VAR_2):...\n",
"print('string'.format(header=c.HEADER, bold=c.BOLD, end=c.END, VAR_2=app))\n"
] | [
"def header(app):...\n",
"print(\n \"\"\"\n [{header}{bold}YunoHost App Package Linter{end}]\n\n App packaging documentation - https://yunohost.org/#/packaging_apps\n App package example - https://github.com/YunoHost/example_ynh\n Official helpers - https://yunohost.org/#/packaging_apps_h... | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_4(self, VAR_6):...\n",
"if isinstance(VAR_6, CLASS_0):\n",
"VAR_6 = VAR_6.get_valid_dict()\n",
"if 'doctype' in VAR_6:\n",
"self.set('doctype', VAR_6.get('doctype'))\n",
"for VAR_7, VAR_9 in iteritems(VAR_6):\n",
"if self.get(VAR_7\n",
"self.set(VAR_7, VAR_9)\n"
] | [
"def update_if_missing(self, d):...\n",
"if isinstance(d, BaseDocument):\n",
"d = d.get_valid_dict()\n",
"if 'doctype' in d:\n",
"self.set('doctype', d.get('doctype'))\n",
"for key, value in iteritems(d):\n",
"if self.get(key\n",
"self.set(key, value)\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"For",
"Condition",
"Expr'"
] |
[
"def FUNC_3(self, VAR_9, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
"def create_export(self, context, volume):...\n",
"\"\"\"docstring\"\"\"\n"
] | [
0,
0
] | [
"FunctionDef'",
"Docstring"
] |
[
"def FUNC_25(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.set('modified', now())\n",
"VAR_54.db.set_value(self.doctype, self.name, 'modified', self.modified,\n update_modified=False)\n"
] | [
"def update_modified(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self.set('modified', now())\n",
"frappe.db.set_value(self.doctype, self.name, 'modified', self.modified,\n update_modified=False)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'"
] |
[
"@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'"
] |
[
"@inlineCallbacks...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self.nodes[0].overlay.metadata_store.ChannelMetadata.create_channel(\n 'test', 'bla')\n",
"for _ in xrange(20):\n",
"self.add_random_torrent(self.nodes[0].overlay.metadata_store.TorrentMetadata)\n",
"VAR_6.commit_channel_torrent()\n",
"VAR_... | [
"@inlineCallbacks...\n",
"\"\"\"docstring\"\"\"\n",
"channel = self.nodes[0].overlay.metadata_store.ChannelMetadata.create_channel(\n 'test', 'bla')\n",
"for _ in xrange(20):\n",
"self.add_random_torrent(self.nodes[0].overlay.metadata_store.TorrentMetadata)\n",
"channel.commit_channel_torrent()\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"For",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_6(self, VAR_33):...\n",
"if VAR_33 and self.valid_re.match(VAR_33):\n",
"return self.splitter.split(VAR_33)\n"
] | [
"def run(self, val):...\n",
"if val and self.valid_re.match(val):\n",
"return self.splitter.split(val)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_6(self, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"@wraps(VAR_8)...\n",
"if g.oidc_id_token is None:\n",
"return self.redirect_to_auth_server(request.url)\n",
"return VAR_8(*VAR_14, **kwargs)\n"
] | [
"def require_login(self, view_func):...\n",
"\"\"\"docstring\"\"\"\n",
"@wraps(view_func)...\n",
"if g.oidc_id_token is None:\n",
"return self.redirect_to_auth_server(request.url)\n",
"return view_func(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_26(VAR_20=None):...\n",
"return json.loads(VAR_7.get('/request', VAR_20=headers).body)\n"
] | [
"def call(headers=None):...\n",
"return json.loads(app.get('/request', headers=headers).body)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(self, VAR_28):...\n",
"VAR_28.row_factory = sqlite3.Row\n",
"VAR_28.text_factory = lambda x: str(x, 'utf-8', 'replace')\n",
"for VAR_62, num_args, func in self.sqlite_functions:\n",
"VAR_28.create_function(VAR_62, num_args, func)\n",
"if self.sqlite_extensions:\n",
"VAR_28.enable_load_exten... | [
"def prepare_connection(self, conn):...\n",
"conn.row_factory = sqlite3.Row\n",
"conn.text_factory = lambda x: str(x, 'utf-8', 'replace')\n",
"for name, num_args, func in self.sqlite_functions:\n",
"conn.create_function(name, num_args, func)\n",
"if self.sqlite_extensions:\n",
"conn.enable_load_extensio... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Expr'",
"Condition",
"Expr'",
"Condition",
"For",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_83.included_stack:\n",
"return None\n",
"return os.path.join(os.path.dirname(VAR_83.included_stack[-1]), VAR_0)\n"
] | [
"def srcdir(path):...\n",
"\"\"\"docstring\"\"\"\n",
"if not workflow.included_stack:\n",
"return None\n",
"return os.path.join(os.path.dirname(workflow.included_stack[-1]), path)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_33(self):...\n",
"def FUNC_39(VAR_101):...\n",
"VAR_101.norun = True\n",
"return VAR_101\n"
] | [
"def norun(self):...\n",
"def decorate(ruleinfo):...\n",
"ruleinfo.norun = True\n",
"return ruleinfo\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_19(self, VAR_25, VAR_27=''):...\n",
"VAR_20 = request_mock(VAR_25=path, VAR_27=body, VAR_28={'Content-Type': [\n 'application/json']}, method='DELETE')\n",
"return self._render(VAR_20)\n"
] | [
"def delete(self, path, body=''):...\n",
"request = request_mock(path=path, body=body, headers={'Content-Type': [\n 'application/json']}, method='DELETE')\n",
"return self._render(request)\n"
] | [
0,
5,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@commands.command()...\n",
"\"\"\"docstring\"\"\"\n",
"await self.simple_embed('string')\n"
] | [
"@commands.command()...\n",
"\"\"\"docstring\"\"\"\n",
"await self.simple_embed(\n \"\"\"Astronautlevel's Luma3DS commit builds can be found here: https://astronautlevel2.github.io/Luma3DS \n(Warning: most builds here are meant for developers and are untested, use at your own risk!)\"\"\"\n )\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'"
] |
[
"from django.conf.urls import url, include\n",
"from .projects import ProjectViewSet\n",
"from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n",
"from .processingnodes import ProcessingNodeViewSet\n",
"from rest_framework_nested import routers\n",
"VAR_0 = routers.DefaultRouter()\n",
"... | [
"from django.conf.urls import url, include\n",
"from .projects import ProjectViewSet\n",
"from .tasks import TaskViewSet, TaskTiles, TaskTilesJson, TaskAssets\n",
"from .processingnodes import ProcessingNodeViewSet\n",
"from rest_framework_nested import routers\n",
"router = routers.DefaultRouter()\n",
... | [
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Assign'"
] |
[
"def FUNC_28(VAR_6):...\n",
"return FUNC_8(VAR_6, 'no-transform')\n"
] | [
"def validate_notransform(page):...\n",
"return validate_cache_control_header(page, 'no-transform')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_5(self, VAR_10):...\n",
"VAR_21 = self.table_view.selectedIndexes()\n",
"if not VAR_21:\n",
"return\n",
"VAR_22 = VAR_21[0].model().data_items[VAR_21[0].row()]\n",
"if VAR_22['type'] == 'channel':\n",
"self.details_container.hide()\n",
"self.details_container.show()\n",
"self.table_view.cl... | [
"def _on_selection_changed(self, _):...\n",
"selected_indices = self.table_view.selectedIndexes()\n",
"if not selected_indices:\n",
"return\n",
"torrent_info = selected_indices[0].model().data_items[selected_indices[0].row()\n ]\n",
"if torrent_info['type'] == 'channel':\n",
"self.details_container.h... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Return'"
] |
[
"def FUNC_27(VAR_13):...\n",
"self.assertEqual('/request', VAR_13.path)\n",
"VAR_12.append('not_applicable')\n",
"return None\n"
] | [
"def not_applicable(request):...\n",
"self.assertEqual('/request', request.path)\n",
"calls.append('not_applicable')\n",
"return None\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Expr'",
"Return'"
] |
[
"import glob\n",
"import logging\n",
"import os\n",
"import subprocess\n",
"from ConfigParser import ConfigParser\n",
"VAR_4 = os.path.abspath(glob.glob('mindfulness_config.ini')[0])\n",
"VAR_4 = '/opt/mindfulness/mindfulness_config.ini'\n",
"def FUNC_0(VAR_0):...\n",
"VAR_5 = ConfigParser()\n",
"... | [
"import glob\n",
"import logging\n",
"import os\n",
"import subprocess\n",
"from ConfigParser import ConfigParser\n",
"CONFIG_INI = os.path.abspath(glob.glob('mindfulness_config.ini')[0])\n",
"CONFIG_INI = '/opt/mindfulness/mindfulness_config.ini'\n",
"def read_config(section):...\n",
"parser = Conf... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_5(VAR_2):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = FUNC_0()\n",
"VAR_6.cursor().execute('INSERT INTO players(name) VALUES (%s)', (VAR_2,))\n",
"VAR_6.commit()\n",
"VAR_6.close()\n"
] | [
"def registerPlayer(name):...\n",
"\"\"\"docstring\"\"\"\n",
"c = connect()\n",
"c.cursor().execute('INSERT INTO players(name) VALUES (%s)', (name,))\n",
"c.commit()\n",
"c.close()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_8(self, VAR_7, VAR_8):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_13 = self._attributes.copy()\n",
"VAR_13['event'] = VAR_7\n",
"VAR_13['message'] = VAR_8\n",
"self._remote.url_read_json('/swarming/api/v1/bot/event', VAR_13=data)\n"
] | [
"def post_event(self, event_type, message):...\n",
"\"\"\"docstring\"\"\"\n",
"data = self._attributes.copy()\n",
"data['event'] = event_type\n",
"data['message'] = message\n",
"self._remote.url_read_json('/swarming/api/v1/bot/event', data=data)\n"
] | [
0,
0,
0,
0,
0,
5
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@staticmethod...\n",
"return tornado.web.authenticated(VAR_7)\n"
] | [
"@staticmethod...\n",
"return tornado.web.authenticated(method)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_17(VAR_16):...\n",
"return VAR_19(VAR_16, 'touch')\n"
] | [
"def touch(value):...\n",
"return flag(value, 'touch')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"VAR_25 = CLASS_3.find_case\n",
"VAR_14 = executors.generate_testcases(self.loader.load_all())\n",
"VAR_26 = VAR_25('Test0', 'e0', VAR_14)\n",
"VAR_27 = VAR_25('Test0', 'e1', VAR_14)\n",
"VAR_28 = VAR_26.clone()\n",
"assert VAR_26 == VAR_28\n... | [
"@rt.switch_runtime(fixtures.TEST_SITE_CONFIG, 'sys0')...\n",
"find_case = TestDependencies.find_case\n",
"cases = executors.generate_testcases(self.loader.load_all())\n",
"case0 = find_case('Test0', 'e0', cases)\n",
"case1 = find_case('Test0', 'e1', cases)\n",
"case0_copy = case0.clone()\n",
"assert ca... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assert'",
"Assert'",
"Assert'"
] |
[
"def FUNC_31(self, VAR_17, VAR_15):...\n",
"VAR_28 = FileManager()\n",
"VAR_29 = ImageManager()\n",
"for file_col in VAR_17.files:\n",
"if self.is_file(file_col):\n",
"for file_col in VAR_17.files:\n",
"VAR_28.save_file(VAR_17.files[file_col], getattr(VAR_15, file_col))\n",
"if self.is_image(file_col)... | [
"def _add_files(self, this_request, item):...\n",
"fm = FileManager()\n",
"im = ImageManager()\n",
"for file_col in this_request.files:\n",
"if self.is_file(file_col):\n",
"for file_col in this_request.files:\n",
"fm.save_file(this_request.files[file_col], getattr(item, file_col))\n",
"if self.is_imag... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"For",
"Condition",
"For",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_0(self, **VAR_34):...\n",
"\"\"\"docstring\"\"\"\n",
"for arg in VAR_34:\n",
"if hasattr(self, arg):\n",
"self._check_usage()\n",
"setattr(self, arg, VAR_34[arg])\n"
] | [
"def update(self, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"for arg in kwargs:\n",
"if hasattr(self, arg):\n",
"self._check_usage()\n",
"setattr(self, arg, kwargs[arg])\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"For",
"Condition",
"Expr'",
"Expr'"
] |
[
"@login_required...\n",
"if VAR_0.user.humanresource.project:\n",
"VAR_17 = VAR_0.user.humanresource.project\n",
"VAR_5 = []\n",
"VAR_5 = VAR_17.testcaseresults_set.latest('updated').results\n",
"VAR_5 = []\n",
"VAR_4 = {'project': VAR_17, 'testcases': VAR_5}\n",
"VAR_17 = None\n",
"if VAR_17:\n",
... | [
"@login_required...\n",
"if request.user.humanresource.project:\n",
"project = request.user.humanresource.project\n",
"testcases = []\n",
"testcases = project.testcaseresults_set.latest('updated').results\n",
"testcases = []\n",
"context = {'project': project, 'testcases': testcases}\n",
"project = No... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_24(self, VAR_6):...\n",
"return self.is_localhost(VAR_6['host'])\n"
] | [
"def run_on_localhost(self, comp):...\n",
"return self.is_localhost(comp['host'])\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.