lines listlengths 1 383 | raw_lines listlengths 1 383 | label listlengths 1 383 | type listlengths 1 383 |
|---|---|---|---|
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_155 and not VAR_7.record:\n",
"return None\n",
"VAR_153 = VAR_7.table\n",
"if not VAR_154:\n",
"VAR_382 = '%s_archive' % VAR_153\n",
"VAR_286 = {VAR_122: VAR_7.vars.id}\n",
"if VAR_382 not in VAR_153._db:\n",
"for VAR_385 in VAR_154.fiel... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"if not archive_current and not form.record:\n",
"return None\n",
"table = form.table\n",
"if not archive_table:\n",
"archive_table_name = '%s_archive' % table\n",
"new_record = {current_record: form.vars.id}\n",
"if archive_table_name not in table._d... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"For",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = VAR_9['iid']\n",
"VAR_79 = VAR_9.get('key', None)\n",
"VAR_15 = VAR_8.getObject('Image', VAR_6)\n",
"if VAR_15 is None:\n",
"if is_public_user(VAR_2):\n",
"if VAR_2.GET.get('getDefaults') == 'true':\n",
"return HttpResponseForbidden()\n",... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"iid = kwargs['iid']\n",
"key = kwargs.get('key', None)\n",
"image = conn.getObject('Image', iid)\n",
"if image is None:\n",
"if is_public_user(request):\n",
"if request.GET.get('getDefaults') == 'true':\n",
"return HttpResponseForbidden()\n",
"... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_41(VAR_105):...\n",
"return VAR_50 or VAR_104 != VAR_105.get_etag()[0]\n"
] | [
"def validate_cache(cached):...\n",
"return force_refresh or current_etag != cached.get_etag()[0]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_16(self, VAR_0, VAR_8, VAR_7, VAR_5, VAR_10, VAR_11):...\n",
"VAR_0.get(VAR_8 + self.url)\n",
"VAR_16 = VAR_0.find_element(By.XPATH, \"//input[@name='file']\")\n",
"VAR_16.send_keys(' \\n '.join([VAR_5, VAR_10]))\n",
"VAR_16 = VAR_0.find_element(By.XPATH, \"//input[@name='other_file']\")\n",
"VA... | [
"def test_multi_file(self, driver, live_server, freeze, upload_file,...\n",
"driver.get(live_server + self.url)\n",
"file_input = driver.find_element(By.XPATH, \"//input[@name='file']\")\n",
"file_input.send_keys(' \\n '.join([upload_file, another_upload_file]))\n",
"file_input = driver.find_element(By.XPAT... | [
0,
0,
0,
1,
0,
1,
0,
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assert'"
] |
[
"def FUNC_32(self):...\n",
"VAR_74 = VAR_53.session.get('playlist', [])\n",
"return VAR_74\n"
] | [
"def api_restoreplaylist(self):...\n",
"session_playlist = cherrypy.session.get('playlist', [])\n",
"return session_playlist\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"def FUNC_6(self, VAR_18):...\n",
"VAR_28 = self.secured.get(VAR_18.id)\n",
"if VAR_28 is not None:\n",
"return Symbol(VAR_28)\n",
"return VAR_18\n"
] | [
"def visit_Name(self, node):...\n",
"value = self.secured.get(node.id)\n",
"if value is not None:\n",
"return Symbol(value)\n",
"return node\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"self.get_failure(self.handler.check_device_registered(VAR_5='@boris:foo',\n VAR_6='foo', initial_device_display_name='a' * (synapse.handlers.device\n .MAX_DEVICE_DISPLAY_NAME_LEN + 1)), synapse.api.errors.SynapseError)\n"
] | [
"def test_device_is_created_with_invalid_name(self):...\n",
"self.get_failure(self.handler.check_device_registered(user_id='@boris:foo',\n device_id='foo', initial_device_display_name='a' * (synapse.handlers.\n device.MAX_DEVICE_DISPLAY_NAME_LEN + 1)), synapse.api.errors.SynapseError)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_73(VAR_129, *VAR_79, **VAR_42):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(VAR_129, string_types):\n",
"VAR_129 = FUNC_72(VAR_129)\n",
"VAR_194 = FUNC_74(VAR_129, VAR_42)\n",
"return VAR_129(*VAR_79, **newargs)\n"
] | [
"def call(fn, *args, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if isinstance(fn, string_types):\n",
"fn = get_attr(fn)\n",
"newargs = get_newargs(fn, kwargs)\n",
"return fn(*args, **newargs)\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_53(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._send_labelled_messages_in_room()\n",
"VAR_39 = 's0_0_0_0_0_0_0_0_0'\n",
"VAR_22, VAR_23 = self.make_request('GET', \n '/rooms/%s/messages?access_token=%s&from=%s&filter=%s' % (self.room_id,\n self.tok, VAR_39, json.dumps(self.FILTER_LABELS_N... | [
"def test_messages_filter_labels_not_labels(self):...\n",
"\"\"\"docstring\"\"\"\n",
"self._send_labelled_messages_in_room()\n",
"token = 's0_0_0_0_0_0_0_0_0'\n",
"request, channel = self.make_request('GET', \n '/rooms/%s/messages?access_token=%s&from=%s&filter=%s' % (self.room_id,\n self.tok, token, ... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_19(self):...\n",
"self.assertFormfield(models.Member, 'gender', widgets.AdminRadioSelect,\n radio_fields={'gender': admin.VERTICAL})\n"
] | [
"def testChoicesWithRadioFields(self):...\n",
"self.assertFormfield(models.Member, 'gender', widgets.AdminRadioSelect,\n radio_fields={'gender': admin.VERTICAL})\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"async def FUNC_18(self, VAR_23: Iterable[str], VAR_11: str, VAR_27: str,...\n",
"VAR_5, VAR_1, VAR_28 = await self.federation_client.make_membership_event(\n VAR_23, VAR_11, VAR_27, VAR_29, VAR_25, VAR_30=params)\n",
"VAR_0.debug('Got response to make_%s: %s', VAR_29, VAR_1)\n",
"assert VAR_1.type == VAR_... | [
"async def _make_and_verify_event(self, target_hosts: Iterable[str], room_id:...\n",
"origin, event, room_version = (await self.federation_client.\n make_membership_event(target_hosts, room_id, user_id, membership,\n content, params=params))\n",
"logger.debug('Got response to make_%s: %s', membership, eve... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Assign'",
"Expr'",
"Assert'",
"Assert'",
"Assert'",
"Assert'",
"Return'"
] |
[
"def FUNC_7(VAR_24=None, VAR_28=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_177 = {}\n",
"VAR_24 = VAR_24 or getattr(VAR_1, 'sites_path', None)\n",
"VAR_28 = VAR_28 or getattr(VAR_1, 'site_path', None)\n",
"if VAR_24:\n",
"VAR_207 = os.path.join(VAR_24, 'common_site_config.json')\n",
"if VAR_28:\n",... | [
"def get_site_config(sites_path=None, site_path=None):...\n",
"\"\"\"docstring\"\"\"\n",
"config = {}\n",
"sites_path = sites_path or getattr(local, 'sites_path', None)\n",
"site_path = site_path or getattr(local, 'site_path', None)\n",
"if sites_path:\n",
"common_site_config = os.path.join(sites_path, ... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Return'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
[
"@VAR_0.route('/api/credentials/renew', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_98 = FUNC_58('/internal/credentials/renew', 'put')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_98)\n"
] | [
"@gui.route('/api/credentials/renew', methods=['PUT'])...\n",
"\"\"\"docstring\"\"\"\n",
"response_info = query_internal_api('/internal/credentials/renew', 'put')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(response_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_29(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertIs(VAR_5.evaluate('nocall:open'), open)\n"
] | [
"def test_open_in_path_expr(self):...\n",
"ec = self._makeContext()\n",
"self.assertIs(ec.evaluate('nocall:open'), open)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def FUNC_83(VAR_9, VAR_10):...\n",
""
] | [
"def wrapped(request, course_id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_24(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.sites.models import Site\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.urls import reverse\n",
"VAR_162 = Site.objects.get_current()\n",
"VAR_162 = Site(domain='configure-django-sites.com')\n",
"... | [
"def _get_ticket_url(self):...\n",
"\"\"\"docstring\"\"\"\n",
"from django.contrib.sites.models import Site\n",
"from django.core.exceptions import ImproperlyConfigured\n",
"from django.urls import reverse\n",
"site = Site.objects.get_current()\n",
"site = Site(domain='configure-django-sites.com')\n",
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_5(VAR_13):...\n",
"if VAR_13 <= 10000:\n",
"return float(math.factorial(VAR_13))\n"
] | [
"def _factorial(x):...\n",
"if x <= 10000:\n",
"return float(math.factorial(x))\n"
] | [
0,
5,
5
] | [
"FunctionDef'",
"Condition",
"Return'"
] |
[
"def FUNC_0(VAR_0):...\n",
""
] | [
"def constructObject(data):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_4(self, VAR_13):...\n",
"if not VAR_13:\n",
"return None\n",
"return User.objects.get(Q(username=value) | Q(email=value))\n"
] | [
"def clean(self, value):...\n",
"if not value:\n",
"return None\n",
"return User.objects.get(Q(username=value) | Q(email=value))\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_18():...\n",
"if len(VAR_1.message_log) > 0:\n",
"VAR_1.message_log = VAR_1.message_log[:-1]\n"
] | [
"def clear_last_message():...\n",
"if len(local.message_log) > 0:\n",
"local.message_log = local.message_log[:-1]\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'"
] |
[
"def FUNC_7(self) ->Sequence[GeneratorError]:...\n",
"VAR_6 = []\n",
"for collection in self.openapi.endpoint_collections_by_tag.values():\n",
"VAR_6.extend(collection.parse_errors)\n",
"VAR_6.extend(self.openapi.schemas.errors)\n",
"return VAR_6\n"
] | [
"def _get_errors(self) ->Sequence[GeneratorError]:...\n",
"errors = []\n",
"for collection in self.openapi.endpoint_collections_by_tag.values():\n",
"errors.extend(collection.parse_errors)\n",
"errors.extend(self.openapi.schemas.errors)\n",
"return errors\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"For",
"Expr'",
"Expr'",
"Return'"
] |
[
"@VAR_5.route('/id/start/<int:start>/span/<int:span>/<path:video>')...\n",
"VAR_16 = Headers([('Content-Type', 'text/xml')])\n",
"return Response(FUNC_4(VAR_9, VAR_8, VAR_10), '200 OK', VAR_16=headers)\n"
] | [
"@scope_blueprint.route('/id/start/<int:start>/span/<int:span>/<path:video>')...\n",
"headers = Headers([('Content-Type', 'text/xml')])\n",
"return Response(_get_object_element(start, span, video), '200 OK', headers=\n headers)\n"
] | [
0,
0,
0
] | [
"Condition",
"Assign'",
"Return'"
] |
[
"async def FUNC_7(self, VAR_11: str, VAR_19: int, VAR_17: int) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_18 = await self.store.get_oldest_events_with_depth_in_room(VAR_11)\n",
"if not VAR_18:\n",
"VAR_0.debug('Not backfilling as no extremeties found.')\n",
"VAR_73 = await self.store.get_successor_eve... | [
"async def maybe_backfill(self, room_id: str, current_depth: int, limit: int...\n",
"\"\"\"docstring\"\"\"\n",
"extremities = await self.store.get_oldest_events_with_depth_in_room(room_id)\n",
"if not extremities:\n",
"logger.debug('Not backfilling as no extremeties found.')\n",
"forward_events = await se... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"AsyncFunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"FunctionDef'",
... |
[
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_22:\n",
"VAR_2 = FUNC_1('/publicRooms')\n",
"VAR_2 = FUNC_1('/publicRooms')\n",
"VAR_39 = {'include_all_networks': 'true' if VAR_23 else 'false'}\n",
"VAR_3 = {'include_all_networks': 'true' if VAR_23 else 'false'}\n",
"if VAR_24:\n",
"if VAR_... | [
"@log_function...\n",
"\"\"\"docstring\"\"\"\n",
"if search_filter:\n",
"path = _create_v1_path('/publicRooms')\n",
"path = _create_v1_path('/publicRooms')\n",
"data = {'include_all_networks': 'true' if include_all_networks else 'false'}\n",
"args = {'include_all_networks': 'true' if include_all_network... | [
0,
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",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Return'",... |
[
"def FUNC_30(self, VAR_22='write'):...\n",
"if not hasattr(self, '_has_access_to'):\n",
"self._has_access_to = {}\n",
"self._has_access_to[VAR_22] = []\n",
"VAR_59 = frappe.get_roles()\n",
"for perm in self.get_permissions():\n",
"if perm.role in VAR_59 and perm.get(VAR_22):\n",
"return self._has_acce... | [
"def get_permlevel_access(self, permission_type='write'):...\n",
"if not hasattr(self, '_has_access_to'):\n",
"self._has_access_to = {}\n",
"self._has_access_to[permission_type] = []\n",
"roles = frappe.get_roles()\n",
"for perm in self.get_permissions():\n",
"if perm.role in roles and perm.get(permissi... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_6(self):...\n",
"VAR_10 = test.test_src_dir_path(VAR_0)\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_11 = self.parser.parse_args(['show', '--dir', VAR_10, '--tag_set', 'serve']\n )\n",
"saved_model_cli.show(VAR_11)\n",
"VAR_12 = out.getvalue().strip()\n",
"VAR_16 = (\n 'Th... | [
"def testShowCommandSignature(self):...\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"self.parser = saved_model_cli.create_parser()\n",
"args = self.parser.parse_args(['show', '--dir', base_path, '--tag_set',\n 'serve'])\n",
"saved_model_cli.show(args)\n",
"output = out.getvalue().stri... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@wraps(VAR_13)...\n",
"if VAR_8.auth:\n",
"@login_required...\n",
"return VAR_13(*VAR_41, **kwargs)\n",
"return VAR_13(*VAR_41, **kwargs)\n"
] | [
"@wraps(func)...\n",
"if app.auth:\n",
"@login_required...\n",
"return func(*args, **kwargs)\n",
"return func(*args, **kwargs)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_9(self):...\n",
"def __call__(self):...\n",
"VAR_6 = CLASS_5()\n",
"VAR_5 = self._makeContext(VAR_0={'dummy': dummy})\n",
"self.assertIs(VAR_5.evaluate('dummy'), VAR_6)\n"
] | [
"def test_evaluate_with_unimplemented_call(self):...\n",
"def __call__(self):...\n",
"dummy = Dummy()\n",
"ec = self._makeContext(bindings={'dummy': dummy})\n",
"self.assertIs(ec.evaluate('dummy'), dummy)\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_38 = CourseKey.from_string(VAR_10)\n",
"VAR_45 = FUNC_75(VAR_9)\n",
"return JsonResponse({'message': VAR_169.message}, status=400)\n",
"if VAR_9.method == 'POST':\n",
"VAR_163 = FUNC_82(VAR_45, VAR_38)\n",
"if VAR_9.method == 'DE... | [
"@transaction.non_atomic_requests...\n",
"\"\"\"docstring\"\"\"\n",
"course_key = CourseKey.from_string(course_id)\n",
"certificate_invalidation_data = parse_request_data(request)\n",
"return JsonResponse({'message': error.message}, status=400)\n",
"if request.method == 'POST':\n",
"certificate = valida... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Return'",
"Return'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_17(self, VAR_4, VAR_39, VAR_40):...\n",
"if not VAR_40.startswith('/'):\n",
"self.base_url = '/' + VAR_40\n",
"if not VAR_40.endswith('/'):\n",
"self.base_url = VAR_40 + '/'\n"
] | [
"def _base_url_changed(self, name, old, new):...\n",
"if not new.startswith('/'):\n",
"self.base_url = '/' + new\n",
"if not new.endswith('/'):\n",
"self.base_url = new + '/'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Condition",
"Assign'"
] |
[
"def FUNC_25(self):...\n",
"self.other_id = '@zzsid1:red'\n",
"VAR_32 = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.other_id)\n",
"VAR_19 = '{\"membership\":\"%s\"}' % Membership.INVITE\n",
"VAR_22, VAR_23 = self.make_request('PUT', VAR_32, VAR_19)\n",
"self.assertEquals(... | [
"def test_rooms_members_other(self):...\n",
"self.other_id = '@zzsid1:red'\n",
"path = '/rooms/%s/state/m.room.member/%s' % (urlparse.quote(self.room_id),\n self.other_id)\n",
"content = '{\"membership\":\"%s\"}' % Membership.INVITE\n",
"request, channel = self.make_request('PUT', path, content)\n",
"s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_39(self, VAR_124=None, VAR_83=None, VAR_125=False, VAR_126=None,...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_101 = self.db\n",
"if VAR_126 is None:\n",
"VAR_126 = VAR_101._migrate\n",
"if VAR_127 is None:\n",
"VAR_127 = VAR_101._fake_migrate\n",
"VAR_222 = self.settings\n",
"VAR_222.enable_toke... | [
"def define_tables(self, username=None, signature=None, enable_tokens=False,...\n",
"\"\"\"docstring\"\"\"\n",
"db = self.db\n",
"if migrate is None:\n",
"migrate = db._migrate\n",
"if fake_migrate is None:\n",
"fake_migrate = db._fake_migrate\n",
"settings = self.settings\n",
"settings.enable_token... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Assign'",
"... |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_2.session.modified = True\n",
"if VAR_27 == 'clean':\n",
"if 'jobKey' in VAR_2.POST:\n",
"return HttpResponse('OK')\n",
"VAR_198 = VAR_2.POST.get('jobKey')\n",
"VAR_199 = list(VAR_2.session['callback'].items())\n",
"VAR_172 = {}\n",
"for VA... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"request.session.modified = True\n",
"if action == 'clean':\n",
"if 'jobKey' in request.POST:\n",
"return HttpResponse('OK')\n",
"jobId = request.POST.get('jobKey')\n",
"jobs = list(request.session['callback'].items())\n",
"rv = {}\n",
"for key,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"For",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_10(self, VAR_27, VAR_28=None, VAR_29=None, VAR_15=None):...\n",
"VAR_42 = self.contexts.get('request')\n",
"return FUNC_10(VAR_27, VAR_28=domain, VAR_29=mapping, VAR_42=context,\n VAR_15=default)\n"
] | [
"def translate(self, msgid, domain=None, mapping=None, default=None):...\n",
"context = self.contexts.get('request')\n",
"return translate(msgid, domain=domain, mapping=mapping, context=context,\n default=default)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Return'"
] |
[
"@keep_lazy_text...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(quote_plus(force_str(VAR_14), force_str(VAR_15)))\n"
] | [
"@keep_lazy_text...\n",
"\"\"\"docstring\"\"\"\n",
"return force_text(quote_plus(force_str(url), force_str(safe)))\n"
] | [
0,
0,
0
] | [
"Condition",
"Docstring",
"Return'"
] |
[
"\"\"\"string\"\"\"\n",
"import argparse\n",
"import ast\n",
"import os\n",
"import re\n",
"import sys\n",
"from absl import app\n",
"import numpy as np\n",
"import six\n",
"from tensorflow.core.example import example_pb2\n",
"from tensorflow.core.framework import types_pb2\n",
"from tensorflo... | [
"\"\"\"Command-line interface to inspect and execute a graph in a SavedModel.\n\nFor detailed usages and examples, please refer to:\nhttps://www.tensorflow.org/guide/saved_model#cli_to_inspect_and_execute_savedmodel\n\n\"\"\"\n",
"import argparse\n",
"import ast\n",
"import os\n",
"import re\n",
"import s... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Import'",
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFro... |
[
"def FUNC_8(self, VAR_56):...\n",
"\"\"\"docstring\"\"\"\n",
"return False\n"
] | [
"def allow_follow(self, anchor):...\n",
"\"\"\"docstring\"\"\"\n",
"return False\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_9(VAR_12, VAR_1):...\n",
""
] | [
"def migrate_shelfs(engine, session):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_23 in ('share', 'discussion'):\n",
"return handlerInternalError(VAR_2, x)\n",
"VAR_126 = None\n",
"VAR_54 = 'webclient/annotations/annotations_share.html'\n",
"VAR_54 = 'webclient/annotations/metadata_acquisition.html'\n",
"VAR_127 = None\n"... | [
"@login_required()...\n",
"\"\"\"docstring\"\"\"\n",
"if c_type in ('share', 'discussion'):\n",
"return handlerInternalError(request, x)\n",
"form_environment = None\n",
"template = 'webclient/annotations/annotations_share.html'\n",
"template = 'webclient/annotations/metadata_acquisition.html'\n",
"fo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"A... |
[
"def FUNC_8(self, VAR_10):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.flags.error_message = _('Insufficient Permission for {0}').format(self\n .doctype)\n"
] | [
"def raise_no_permission_to(self, perm_type):...\n",
"\"\"\"docstring\"\"\"\n",
"frappe.flags.error_message = _('Insufficient Permission for {0}').format(self\n .doctype)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'"
] |
[
"def FUNC_9(self):...\n",
"assert get_param_tuples('<int:id>') == [('int', 'id')]\n"
] | [
"def test_it_works(self):...\n",
"assert get_param_tuples('<int:id>') == [('int', 'id')]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_9(self, VAR_0, VAR_13):...\n",
"VAR_30 = VAR_0 / 'foo&bar'\n",
"VAR_30.ensure()\n",
"VAR_25 = VAR_13(str(VAR_0))\n",
"VAR_8 = self.Item(FUNC_1(VAR_30), VAR_30.relto(VAR_0))\n",
"assert VAR_25.files == [VAR_8]\n"
] | [
"def test_html_special_chars(self, tmpdir, parser):...\n",
"special_file = tmpdir / 'foo&bar'\n",
"special_file.ensure()\n",
"parsed = parser(str(tmpdir))\n",
"item = self.Item(_file_url(special_file), special_file.relto(tmpdir))\n",
"assert parsed.files == [item]\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assert'"
] |
[
"def FUNC_53(VAR_2, VAR_42, VAR_8=None, VAR_43=None, VAR_44=False, **VAR_9):...\n",
"\"\"\"docstring\"\"\"\n",
"if VAR_43 is None:\n",
"VAR_43 = VAR_2.GET.get('query')\n",
"if not VAR_43:\n",
"return dict(VAR_176='Must specify query parameter, use * to retrieve all')\n",
"VAR_166 = VAR_2.GET.getlist('co... | [
"def _table_query(request, fileid, conn=None, query=None, lazy=False, **kwargs):...\n",
"\"\"\"docstring\"\"\"\n",
"if query is None:\n",
"query = request.GET.get('query')\n",
"if not query:\n",
"return dict(error='Must specify query parameter, use * to retrieve all')\n",
"col_names = request.GET.getlis... | [
0,
0,
0,
0,
0,
0,
0,
0,
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,
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... | [
"FunctionDef'",
"Docstring",
"Condition",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Condition",
"Return'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Ass... |
[
"def FUNC_166(VAR_215, VAR_309, VAR_37=None, VAR_17=None):...\n",
"VAR_394 = {'code': VAR_309}\n",
"if VAR_309 in CLASS_5.jsonrpc_errors:\n",
"VAR_394['message'] = CLASS_5.jsonrpc_errors[VAR_309][0]\n",
"if VAR_37 is not None:\n",
"VAR_394['data'] = CLASS_5.jsonrpc_errors[VAR_309][1]\n",
"VAR_394['messa... | [
"def return_error(id, code, message=None, data=None):...\n",
"error = {'code': code}\n",
"if code in Service.jsonrpc_errors:\n",
"error['message'] = Service.jsonrpc_errors[code][0]\n",
"if message is not None:\n",
"error['data'] = Service.jsonrpc_errors[code][1]\n",
"error['message'] = message\n",
"if... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_3(VAR_10, *VAR_11):...\n",
"if callable(VAR_10):\n",
"redirect(VAR_10(*VAR_11))\n",
"redirect(VAR_10)\n"
] | [
"def call_or_redirect(f, *args):...\n",
"if callable(f):\n",
"redirect(f(*args))\n",
"redirect(f)\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Expr'",
"Expr'"
] |
[
"def FUNC_11(self):...\n",
"VAR_15 = {'display_name': 'new_display'}\n",
"self.get_failure(self.handler.update_device('user_id', 'unknown_device_id',\n VAR_15), synapse.api.errors.NotFoundError)\n"
] | [
"def test_update_unknown_device(self):...\n",
"update = {'display_name': 'new_display'}\n",
"self.get_failure(self.handler.update_device('user_id', 'unknown_device_id',\n update), synapse.api.errors.NotFoundError)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"@FUNC_0...\n",
"return PaginationHandler(self)\n"
] | [
"@cache_in_self...\n",
"return PaginationHandler(self)\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_16(VAR_24: Fingerprint, VAR_43: Text, VAR_37: Text, VAR_44:...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_43 = create_output_path(VAR_43, prefix=model_prefix, fixed_name=\n fixed_model_name)\n",
"FUNC_5(VAR_37, VAR_43, VAR_24)\n",
"print_success(\"Your Rasa model is trained and saved at '{}'.\".format... | [
"def package_model(fingerprint: Fingerprint, output_directory: Text,...\n",
"\"\"\"docstring\"\"\"\n",
"output_directory = create_output_path(output_directory, prefix=model_prefix,\n fixed_name=fixed_model_name)\n",
"create_package_rasa(train_path, output_directory, fingerprint)\n",
"print_success(\"Your... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Return'"
] |
[
"\"\"\" Generate modern Python clients from OpenAPI \"\"\"\n",
"from __future__ import annotations\n",
"import shutil\n",
"import subprocess\n",
"import sys\n",
"from pathlib import Path\n",
"from typing import Any, Dict, Optional, Sequence, Union\n",
"import httpcore\n",
"import httpx\n",
"import... | [
"\"\"\" Generate modern Python clients from OpenAPI \"\"\"\n",
"from __future__ import annotations\n",
"import shutil\n",
"import subprocess\n",
"import sys\n",
"from pathlib import Path\n",
"from typing import Any, Dict, Optional, Sequence, Union\n",
"import httpcore\n",
"import httpx\n",
"import... | [
0,
0,
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'",
"ImportFrom'",
"ImportFrom'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Re... |
[
"def FUNC_28(self, VAR_27):...\n",
"return [entry.to_dict() for entry in self.playlistdb.loadPlaylist(VAR_27=\n playlistid, VAR_15=self.getUserId())]\n"
] | [
"def api_loadplaylist(self, playlistid):...\n",
"return [entry.to_dict() for entry in self.playlistdb.loadPlaylist(\n playlistid=playlistid, userid=self.getUserId())]\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_57(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('use_xhtml'):\n",
"return '<br />\\n'\n",
"return '<br>\\n'\n"
] | [
"def linebreak(self):...\n",
"\"\"\"docstring\"\"\"\n",
"if self.options.get('use_xhtml'):\n",
"return '<br />\\n'\n",
"return '<br>\\n'\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Return'"
] |
[
"@VAR_0.route('/api/jobs/<int:job_id>/<attribute>', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_113 = FUNC_58(f'/internal/jobs/{VAR_9}/{VAR_16}', 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(VAR_113)\n"
] | [
"@gui.route('/api/jobs/<int:job_id>/<attribute>', methods=['GET'])...\n",
"\"\"\"docstring\"\"\"\n",
"job_attribute_info = query_internal_api(f'/internal/jobs/{job_id}/{attribute}',\n 'get')\n",
"return jsonify({'success': False, 'message': str(err)}), 400\n",
"return jsonify(job_attribute_info)\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Return'",
"Return'"
] |
[
"def FUNC_13(VAR_33: Text, VAR_34: Text) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"shutil.move(VAR_33, VAR_34)\n",
"logging.debug(f'Could not merge model: {e}')\n",
"return True\n",
"return False\n"
] | [
"def move_model(source: Text, target: Text) ->bool:...\n",
"\"\"\"docstring\"\"\"\n",
"shutil.move(source, target)\n",
"logging.debug(f'Could not merge model: {e}')\n",
"return True\n",
"return False\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"Expr'",
"Return'",
"Return'"
] |
[
"def FUNC_16(self, VAR_2):...\n",
"assert url_for('some.endpoint')\n",
"VAR_2.add_url_rule('/some-endpoint', endpoint='some.endpoint')\n",
"assert url_for('some.endpoint') == '/some-endpoint'\n"
] | [
"def test_it_works_with_endpoints(self, app):...\n",
"assert url_for('some.endpoint')\n",
"app.add_url_rule('/some-endpoint', endpoint='some.endpoint')\n",
"assert url_for('some.endpoint') == '/some-endpoint'\n"
] | [
0,
0,
0,
0
] | [
"FunctionDef'",
"Assert'",
"Expr'",
"Assert'"
] |
[
"@app.route('/bookmarklet')...\n",
"return render_template('bookmarklet.html', title='Bookmarklet')\n"
] | [
"@app.route('/bookmarklet')...\n",
"return render_template('bookmarklet.html', title='Bookmarklet')\n"
] | [
0,
0
] | [
"Condition",
"Return'"
] |
[
"def FUNC_2(self, *VAR_4, VAR_5: Any=None, VAR_6: Optional[str]=None, **VAR_7...\n",
"\"\"\"docstring\"\"\"\n",
"if len(VAR_4) > 0:\n",
"import pyarrow\n",
"VAR_19 = dict(VAR_7, **{'default': default, 'key': key})\n",
"from streamlit.components.v1 import component_arrow\n",
"VAR_20 = {}\n",
"VAR_21 = ... | [
"def create_instance(self, *args, default: Any=None, key: Optional[str]=None,...\n",
"\"\"\"docstring\"\"\"\n",
"if len(args) > 0:\n",
"import pyarrow\n",
"all_args = dict(kwargs, **{'default': default, 'key': key})\n",
"from streamlit.components.v1 import component_arrow\n",
"json_args = {}\n",
"spec... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
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",
"Condition",
"Import'",
"Assign'",
"ImportFrom'",
"Assign'",
"Assign'",
"For",
"Condition",
"Assign'",
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"E... |
[
"def FUNC_11(self, VAR_17: str, VAR_18: str, VAR_7: str) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"self.ledger.changed()\n",
"VAR_2: Directive = self.ledger.get_entry(VAR_17)\n",
"VAR_6 = next_key(VAR_18, VAR_2.meta)\n",
"VAR_5 = self.ledger.fava_options.indent\n",
"FUNC_2(VAR_2.meta['filename'], VAR_2... | [
"def insert_metadata(self, entry_hash: str, basekey: str, value: str) ->None:...\n",
"\"\"\"docstring\"\"\"\n",
"self.ledger.changed()\n",
"entry: Directive = self.ledger.get_entry(entry_hash)\n",
"key = next_key(basekey, entry.meta)\n",
"indent = self.ledger.fava_options.indent\n",
"insert_metadata_in_... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Expr'",
"AnnAssign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"def FUNC_40(self, VAR_21=0):...\n",
"VAR_22 = 'dummy'\n",
"if not VAR_21:\n",
"VAR_22 = 'http://server/' + VAR_22\n",
"return VAR_22\n"
] | [
"def absolute_url(self, relative=0):...\n",
"url = 'dummy'\n",
"if not relative:\n",
"url = 'http://server/' + url\n",
"return url\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Return'"
] |
[
"def FUNC_1(self, VAR_4=False, **VAR_3):...\n",
"if VAR_4:\n",
"VAR_13 = 'registration_shared_secret: \"%s\"' % (random_string_with_symbols(50),)\n",
"VAR_13 = '#registration_shared_secret: <PRIVATE STRING>'\n",
"return 'string' % locals()\n"
] | [
"def generate_config_section(self, generate_secrets=False, **kwargs):...\n",
"if generate_secrets:\n",
"registration_shared_secret = 'registration_shared_secret: \"%s\"' % (\n random_string_with_symbols(50),)\n",
"registration_shared_secret = '#registration_shared_secret: <PRIVATE STRING>'\n",
"return \"... | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@wraps(VAR_3)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return VAR_3(*VAR_46, **kwargs)\n",
"abort(403)\n"
] | [
"@wraps(f)...\n",
"if current_user.role_edit() or current_user.role_admin():\n",
"return f(*args, **kwargs)\n",
"abort(403)\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Return'",
"Expr'"
] |
[
"def FUNC_21(VAR_29, VAR_30, VAR_31=None, VAR_32=None, VAR_33=None):...\n",
"if VAR_31 is None:\n",
"VAR_31 = VAR_0\n",
"VAR_72 = FUNC_3(VAR_31, VAR_31 + VAR_1)\n",
"VAR_27 = 'http://{}:{}/'.format(VAR_30, VAR_72)\n",
"if VAR_32 is not None:\n",
"if not callable(VAR_32):\n",
"VAR_8.auth = None\n",
"... | [
"def start_server(interface, server_name, server_port=None, auth=None, ssl=None...\n",
"if server_port is None:\n",
"server_port = INITIAL_PORT_VALUE\n",
"port = get_first_available_port(server_port, server_port + TRY_NUM_PORTS)\n",
"path_to_local_server = 'http://{}:{}/'.format(server_name, port)\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'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Condition",
"Condition",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Expr'",
"Ass... |
[
"import hashlib\n",
"import hmac\n",
"import logging\n",
"import time\n",
"from datetime import timedelta\n",
"from urllib.parse import urlsplit, urlunsplit\n",
"from flask import jsonify, redirect, request, url_for, session\n",
"from flask_login import LoginManager, login_user, logout_user, user_logg... | [
"import hashlib\n",
"import hmac\n",
"import logging\n",
"import time\n",
"from datetime import timedelta\n",
"from urllib.parse import urlsplit, urlunsplit\n",
"from flask import jsonify, redirect, request, url_for, session\n",
"from flask_login import LoginManager, login_user, logout_user, user_logg... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Import'",
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Assign'",
"Assign'",
"FunctionDef'",
"Condition",
"Assign'",
"Cond... |
[
"def FUNC_21(VAR_9, VAR_5, VAR_10):...\n",
"VAR_38 = calibre_db.session.query(db.Publishers).filter(db.Publishers.id ==\n VAR_5).first()\n",
"if VAR_38:\n",
"VAR_63, VAR_68, VAR_65 = calibre_db.fill_indexpage(VAR_9, 0, db.Books, db.\n Books.publishers.any(db.Publishers.id == VAR_5), [db.Series.name,\n ... | [
"def render_publisher_books(page, book_id, order):...\n",
"publisher = calibre_db.session.query(db.Publishers).filter(db.Publishers.id ==\n book_id).first()\n",
"if publisher:\n",
"entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books,\n db.Books.publishers.any(db.Publishers.id == bo... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Condition",
"Assign'",
"Expr'",
"Return'"
] |
[
"import os\n",
"import tempfile\n",
"import pytest\n",
"from django.core.files.base import ContentFile\n",
"from django.utils.encoding import force_str\n",
"from selenium import webdriver\n",
"from selenium.common.exceptions import WebDriverException\n",
"@pytest.fixture(scope='session')...\n",
"VAR... | [
"import os\n",
"import tempfile\n",
"import pytest\n",
"from django.core.files.base import ContentFile\n",
"from django.utils.encoding import force_str\n",
"from selenium import webdriver\n",
"from selenium.common.exceptions import WebDriverException\n",
"@pytest.fixture(scope='session')...\n",
"chr... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
1,
0,
1
] | [
"Import'",
"Import'",
"Import'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_2(self):...\n",
"assert controller_name(CLASS_9) == 'api'\n"
] | [
"def test_it_handles_acronyms(self):...\n",
"assert controller_name(APIController) == 'api'\n"
] | [
0,
0
] | [
"FunctionDef'",
"Assert'"
] |
[
"def FUNC_35():...\n",
"return FUNC_0(VAR_6=request.url_root, VAR_7=additional_unless)\n"
] | [
"def unless():...\n",
"return _preemptive_unless(base_url=request.url_root, additional_unless=\n additional_unless)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_6(VAR_11):...\n",
""
] | [
"def firstLinkTextFromElement(el):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"def FUNC_8(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_6 = self._make_request(b'OPTIONS', b'/foo/')\n",
"self.assertEqual(VAR_6.result['code'], b'204')\n",
"self.assertNotIn('body', VAR_6.result)\n",
"self.assertTrue(VAR_6.headers.hasHeader(b'Access-Control-Allow-Origin'),\n 'has CORS Origin header'... | [
"def test_unknown_options_request(self):...\n",
"\"\"\"docstring\"\"\"\n",
"channel = self._make_request(b'OPTIONS', b'/foo/')\n",
"self.assertEqual(channel.result['code'], b'204')\n",
"self.assertNotIn('body', channel.result)\n",
"self.assertTrue(channel.headers.hasHeader(b'Access-Control-Allow-Origin'),... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"def FUNC_0(VAR_0):...\n",
"if VAR_0:\n",
"VAR_0 = '{0:02d}h:{1:02d}m'.format(VAR_0.seconds // 3600, VAR_0.seconds % \n 3600 // 60)\n",
"VAR_0 = ''\n",
"return VAR_0\n"
] | [
"def format_time_spent(time_spent):...\n",
"if time_spent:\n",
"time_spent = '{0:02d}h:{1:02d}m'.format(time_spent.seconds // 3600, \n time_spent.seconds % 3600 // 60)\n",
"time_spent = ''\n",
"return time_spent\n"
] | [
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_11(self):...\n",
"VAR_5 = self._makeContext()\n",
"self.assertTrue(VAR_5.evaluate('x | nothing') is None)\n"
] | [
"def test_evaluate_alternative_first_missing(self):...\n",
"ec = self._makeContext()\n",
"self.assertTrue(ec.evaluate('x | nothing') is None)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Expr'"
] |
[
"def __lt__(self, VAR_18):...\n",
"\"\"\"docstring\"\"\"\n",
"return (self.param.command_index, self.param.param_index) < (VAR_18.param.\n command_index, VAR_18.param.param_index)\n"
] | [
"def __lt__(self, other):...\n",
"\"\"\"docstring\"\"\"\n",
"return (self.param.command_index, self.param.param_index) < (other.param.\n command_index, other.param.param_index)\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"def FUNC_102(VAR_163, VAR_164=None, VAR_165=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_201 = {'int': int, 'float': float, 'long': int, 'round': round}\n",
"if '__' in VAR_163:\n",
"VAR_96('Illegal rule {0}. Cannot use \"__\"'.format(FUNC_101(VAR_163)))\n",
"if not VAR_164:\n",
"VAR_164 = {}\n",
"V... | [
"def safe_eval(code, eval_globals=None, eval_locals=None):...\n",
"\"\"\"docstring\"\"\"\n",
"whitelisted_globals = {'int': int, 'float': float, 'long': int, 'round': round}\n",
"if '__' in code:\n",
"throw('Illegal rule {0}. Cannot use \"__\"'.format(bold(code)))\n",
"if not eval_globals:\n",
"eval_glo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_13(self, VAR_22, VAR_23):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_32 = config.val.content.headers.referer\n",
"if VAR_32 == 'never':\n",
"VAR_22.setRawHeader('Referer'.encode('ascii'), QByteArray())\n",
"if VAR_32 == 'same-domain' and not urlutils.same_domain(VAR_22.url(), VAR_23):\n",
"VAR_22.... | [
"def set_referer(self, req, current_url):...\n",
"\"\"\"docstring\"\"\"\n",
"referer_header_conf = config.val.content.headers.referer\n",
"if referer_header_conf == 'never':\n",
"req.setRawHeader('Referer'.encode('ascii'), QByteArray())\n",
"if referer_header_conf == 'same-domain' and not urlutils.same_do... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Expr'"
] |
[
"def FUNC_18(self, VAR_2):...\n",
"def FUNC_30(self, VAR_8):...\n",
"VAR_2.add_url_rule('/sites/<int:id>', endpoint='site_resource.get')\n",
"assert url_for('get', VAR_8=1, _cls=SiteResource) == '/sites/1'\n",
"VAR_2.add_url_rule('/foo/<string:slug>', endpoint='some.endpoint')\n",
"assert url_for('some.en... | [
"def test_it_works_with_url_for_kwargs(self, app):...\n",
"def get(self, id):...\n",
"app.add_url_rule('/sites/<int:id>', endpoint='site_resource.get')\n",
"assert url_for('get', id=1, _cls=SiteResource) == '/sites/1'\n",
"app.add_url_rule('/foo/<string:slug>', endpoint='some.endpoint')\n",
"assert url_fo... | [
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"FunctionDef'",
"Expr'",
"Assert'",
"Expr'",
"Assert'"
] |
[
"@VAR_2.route('/language')...\n",
"if VAR_87.check_visibility(constants.SIDEBAR_LANGUAGE\n",
"VAR_109 = 0 if VAR_87.get_view_property('language', 'dir') == 'desc' else 1\n",
"abort(404)\n",
"VAR_107 = list()\n",
"VAR_48 = calibre_db.speaking_language(reverse_order=not order_no,\n with_count=True)\n",
... | [
"@web.route('/language')...\n",
"if current_user.check_visibility(constants.SIDEBAR_LANGUAGE\n",
"order_no = 0 if current_user.get_view_property('language', 'dir'\n ) == 'desc' else 1\n",
"abort(404)\n",
"charlist = list()\n",
"languages = calibre_db.speaking_language(reverse_order=not order_no,\n w... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Condition",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"For",
"Assign'",
"Return'",
"Condition",
"Expr'"
] |
[
"def FUNC_22(VAR_27):...\n",
"\"\"\"docstring\"\"\"\n",
"if not VAR_27.is_valid:\n",
"return HttpResponseBadRequest(_(\n 'The sale associated with this invoice has already been invalidated.'))\n",
"VAR_27.is_valid = False\n",
"VAR_27.save()\n",
"VAR_74 = _('Invoice number {0} has been invalidated.').... | [
"def invalidate_invoice(obj_invoice):...\n",
"\"\"\"docstring\"\"\"\n",
"if not obj_invoice.is_valid:\n",
"return HttpResponseBadRequest(_(\n 'The sale associated with this invoice has already been invalidated.'))\n",
"obj_invoice.is_valid = False\n",
"obj_invoice.save()\n",
"message = _('Invoice num... | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Condition",
"Return'",
"Assign'",
"Expr'",
"Assign'",
"Return'"
] |
[
"def FUNC_1(VAR_3):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.dirname(VAR_3) == VAR_3\n"
] | [
"def is_root(directory):...\n",
"\"\"\"docstring\"\"\"\n",
"return os.path.dirname(directory) == directory\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Return'"
] |
[
"@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_3 = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'}, HTTP_HOST=\n 'www.example:dr.frankenstein@evil.tld')\n",
"self.assertEqual(VAR_3.status_code, 400)\n",
"self.assertEqual(len(mail... | [
"@override_settings(DEBUG_PROPAGATE_EXCEPTIONS=True)...\n",
"\"\"\"docstring\"\"\"\n",
"response = self.client.post('/password_reset/', {'email':\n 'staffmember@example.com'}, HTTP_HOST=\n 'www.example:dr.frankenstein@evil.tld')\n",
"self.assertEqual(response.status_code, 400)\n",
"self.assertEqual(le... | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Expr'",
"Expr'",
"Expr'"
] |
[
"from __future__ import unicode_literals\n",
"from django.apps import apps\n",
"from django.utils.html import format_html_join\n",
"from .permissions import permission_cabinet_view\n",
"def FUNC_0(VAR_0, VAR_1):...\n",
"VAR_4 = []\n",
"VAR_4.append('{')\n",
"VAR_4.append('\"text\": \"{}\",'.format(VAR... | [
"from __future__ import unicode_literals\n",
"from django.apps import apps\n",
"from django.utils.html import format_html_join\n",
"from .permissions import permission_cabinet_view\n",
"def jstree_data(node, selected_node):...\n",
"result = []\n",
"result.append('{')\n",
"result.append('\"text\": \"{}... | [
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"ImportFrom'",
"FunctionDef'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Condition",
"Expr'",
"Expr'",
"For",
"Return'",
"Expr'",
"Expr'"
] |
[
"def FUNC_35(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"VAR_9 = test.test_src_dir_path(VAR_0)\n",
"VAR_10 = self.parser.parse_args(['scan', '--dir', VAR_9, '--tag_set', 'serve'])\n",
"VAR_48 = saved_model_cli._OP_DENYLIST\n",
"saved_model_cli._OP_DENYLIST = set(['VariableV2'])\n",
... | [
"def testScanCommandFoundDenylistedOp(self):...\n",
"self.parser = saved_model_cli.create_parser()\n",
"base_path = test.test_src_dir_path(SAVED_MODEL_PATH)\n",
"args = self.parser.parse_args(['scan', '--dir', base_path, '--tag_set',\n 'serve'])\n",
"op_denylist = saved_model_cli._OP_DENYLIST\n",
"save... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(VAR_1, VAR_2):...\n",
"return frappe.local.module_app[scrub(VAR_1)] + '.' + scrub(VAR_1\n ) + '.report.' + scrub(VAR_2) + '.' + scrub(VAR_2)\n"
] | [
"def get_report_module_dotted_path(module, report_name):...\n",
"return frappe.local.module_app[scrub(module)] + '.' + scrub(module\n ) + '.report.' + scrub(report_name) + '.' + scrub(report_name)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_21(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_55 = ['companies']\n",
"self.assertFormfield(models.Advisor, 'companies', widgets.\n FilteredSelectMultiple, VAR_55=['companies'])\n",
"VAR_16 = CLASS_27(models.Advisor, admin.site)\n",
"VAR_20 = VAR_16.formfield_for_dbfield(models.Advisor._met... | [
"def test_m2m_widgets(self):...\n",
"\"\"\"docstring\"\"\"\n",
"filter_vertical = ['companies']\n",
"self.assertFormfield(models.Advisor, 'companies', widgets.\n FilteredSelectMultiple, filter_vertical=['companies'])\n",
"ma = AdvisorAdmin(models.Advisor, admin.site)\n",
"f = ma.formfield_for_dbfield(m... | [
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'"
] |
[
"def FUNC_1(*, VAR_0: Optional[str], VAR_1: Optional[Path]) ->Sequence[...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_4 = FUNC_0(VAR_0=url, VAR_1=path)\n",
"if isinstance(VAR_4, GeneratorError):\n",
"return [VAR_4]\n",
"return VAR_4.build()\n"
] | [
"def create_new_client(*, url: Optional[str], path: Optional[Path]) ->Sequence[...\n",
"\"\"\"docstring\"\"\"\n",
"project = _get_project_for_url_or_path(url=url, path=path)\n",
"if isinstance(project, GeneratorError):\n",
"return [project]\n",
"return project.build()\n"
] | [
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Condition",
"Return'",
"Return'"
] |
[
"def FUNC_30(self, VAR_8):...\n",
""
] | [
"def get(self, id):...\n",
""
] | [
0,
0
] | [
"FunctionDef'",
"Condition"
] |
[
"@FUNC_0...\n",
"if self.config.worker_app:\n",
"return ServerNoticesManager(self)\n"
] | [
"@cache_in_self...\n",
"if self.config.worker_app:\n",
"return ServerNoticesManager(self)\n"
] | [
0,
0,
0
] | [
"Condition",
"Condition",
"Return'"
] |
[
"def FUNC_1(self, VAR_1):...\n",
"from openapi_python_client.parser.properties import Property\n",
"VAR_5 = VAR_1.MagicMock()\n",
"VAR_6 = VAR_1.patch('openapi_python_client.utils.snake_case')\n",
"VAR_4 = Property(VAR_5=name, VAR_26=True, default=None)\n",
"VAR_7 = VAR_1.patch.object(VAR_4, 'get_type_str... | [
"def test_to_string(self, mocker):...\n",
"from openapi_python_client.parser.properties import Property\n",
"name = mocker.MagicMock()\n",
"snake_case = mocker.patch('openapi_python_client.utils.snake_case')\n",
"p = Property(name=name, required=True, default=None)\n",
"get_type_string = mocker.patch.obje... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"ImportFrom'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Assert'",
"Assign'",
"Assert'",
"Assign'",
"Assert'"
] |
[
"def FUNC_5(self):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_14 = signedjson.key.generate_signing_key('ver1')\n",
"self.expect_outgoing_key_request(self.hs.hostname, VAR_14)\n",
"VAR_12 = self.make_notary_request(self.hs.hostname, 'ed25519:ver1')\n",
"VAR_15 = VAR_12['server_keys']\n",
"self.assertEqual(le... | [
"def test_get_own_key(self):...\n",
"\"\"\"docstring\"\"\"\n",
"testkey = signedjson.key.generate_signing_key('ver1')\n",
"self.expect_outgoing_key_request(self.hs.hostname, testkey)\n",
"resp = self.make_notary_request(self.hs.hostname, 'ed25519:ver1')\n",
"keys = resp['server_keys']\n",
"self.assertEq... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Expr'",
"Expr'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@CLASS_4('pastebin-version')...\n",
"\"\"\"docstring\"\"\"\n",
"version.pastebin_version()\n",
"return 'text/plain', b'Paste called.'\n"
] | [
"@add_handler('pastebin-version')...\n",
"\"\"\"docstring\"\"\"\n",
"version.pastebin_version()\n",
"return 'text/plain', b'Paste called.'\n"
] | [
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Expr'",
"Return'"
] |
[
"def FUNC_102(VAR_163, VAR_164=None, VAR_165=None):...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_201 = {'int': int, 'float': float, 'long': int, 'round': round}\n",
"if '__' in VAR_163:\n",
"VAR_96('Illegal rule {0}. Cannot use \"__\"'.format(FUNC_101(VAR_163)))\n",
"if not VAR_164:\n",
"VAR_164 = {}\n",
"V... | [
"def safe_eval(code, eval_globals=None, eval_locals=None):...\n",
"\"\"\"docstring\"\"\"\n",
"whitelisted_globals = {'int': int, 'float': float, 'long': int, 'round': round}\n",
"if '__' in code:\n",
"throw('Illegal rule {0}. Cannot use \"__\"'.format(bold(code)))\n",
"if not eval_globals:\n",
"eval_glo... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Docstring",
"Assign'",
"Condition",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Return'"
] |
[
"def FUNC_10(self, VAR_10=None):...\n",
"self.register_user('room_admin', 'pass', admin=True)\n",
"VAR_8 = self.login('room_admin', 'pass')\n",
"VAR_27 = self.register_user('room_nonadmin', 'pass', admin=False)\n",
"VAR_22 = self.login('room_nonadmin', 'pass')\n",
"VAR_28 = self.helper.create_room_as(VAR_... | [
"def test_quarantine_all_media_in_room(self, override_url_template=None):...\n",
"self.register_user('room_admin', 'pass', admin=True)\n",
"admin_user_tok = self.login('room_admin', 'pass')\n",
"non_admin_user = self.register_user('room_nonadmin', 'pass', admin=False)\n",
"non_admin_user_tok = self.login('r... | [
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'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Expr'"
] |
[
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_10 = SlashSeparatedCourseKey.from_deprecated_string(VAR_10)\n",
"VAR_85 = CourseRegistrationCode.objects.filter(VAR_10=course_id).order_by(\n 'invoice_item__invoice__company_name')\n",
"VAR_88 = VAR_9.POST['download_company_name']\n",
"if VAR_... | [
"@ensure_csrf_cookie...\n",
"\"\"\"docstring\"\"\"\n",
"course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)\n",
"registration_codes = CourseRegistrationCode.objects.filter(course_id=course_id\n ).order_by('invoice_item__invoice__company_name')\n",
"company_name = request.POST['download_... | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Assign'",
"Condition",
"Assign'",
"Assign'",
"Return'"
] |
[
"@VAR_0.route('/shelf/add/<int:shelf_id>/<int:book_id>')...\n",
"VAR_12 = request.headers.get('X-Requested-With') == 'XMLHttpRequest'\n",
"VAR_0 = ub.session.query(ub.Shelf).filter(ub.Shelf.id == VAR_3).first()\n",
"if VAR_0 is None:\n",
"VAR_1.error('Invalid shelf specified: %s', VAR_3)\n",
"if not FUNC_... | [
"@shelf.route('/shelf/add/<int:shelf_id>/<int:book_id>')...\n",
"xhr = request.headers.get('X-Requested-With') == 'XMLHttpRequest'\n",
"shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first()\n",
"if shelf is None:\n",
"log.error('Invalid shelf specified: %s', shelf_id)\n",
"if not chec... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Condition",
"Condition",
"Condition",
"Assign'",
"Expr'",
"Return'",
"Expr'",
"Return'",
"Condition",
"Return'",
"Return'",
"Expr'",
"Assign'",
"Condition",
"Condition",
"Expr'",
"Return'",
"Assign'",
"Assign'",
... |
[
"def FUNC_30(VAR_27, VAR_32='\\n'):...\n",
"print(VAR_26 + VAR_27, VAR_32=end)\n"
] | [
"def in_print(s, end='\\n'):...\n",
"print(indent_str + s, end=end)\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def __str__(self) ->str:...\n",
"return self.sourceName\n"
] | [
"def __str__(self) ->str:...\n",
"return self.sourceName\n"
] | [
0,
0
] | [
"FunctionDef'",
"Return'"
] |
[
"def FUNC_11(VAR_18, VAR_19, VAR_20=None):...\n",
"import time\n",
"VAR_30 = time.time()\n",
"if VAR_20 is None:\n",
"VAR_20 = VAR_30\n",
"if VAR_20 == 0 or VAR_30 - VAR_20 > VAR_18:\n",
"VAR_19()\n",
"return VAR_20\n",
"return VAR_30\n"
] | [
"def doEvery(s, action, lastTime=None):...\n",
"import time\n",
"newTime = time.time()\n",
"if lastTime is None:\n",
"lastTime = newTime\n",
"if lastTime == 0 or newTime - lastTime > s:\n",
"action()\n",
"return lastTime\n",
"return newTime\n"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"FunctionDef'",
"Import'",
"Assign'",
"Condition",
"Assign'",
"Condition",
"Expr'",
"Return'",
"Return'"
] |
[
"@VAR_0.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_42 = VAR_13.get_full_path()\n",
"VAR_43 = iri_to_uri(VAR_42)\n",
"return escape(replace_query_param(VAR_43, VAR_15, VAR_16))\n"
] | [
"@register.simple_tag...\n",
"\"\"\"docstring\"\"\"\n",
"iri = request.get_full_path()\n",
"uri = iri_to_uri(iri)\n",
"return escape(replace_query_param(uri, key, val))\n"
] | [
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"Assign'",
"Return'"
] |
[
"def FUNC_22(self):...\n",
"self.assert_expected(self.folder.t, 'CheckI18nTranslate.html')\n"
] | [
"def testI18nTranslate(self):...\n",
"self.assert_expected(self.folder.t, 'CheckI18nTranslate.html')\n"
] | [
0,
0
] | [
"FunctionDef'",
"Expr'"
] |
[
"def FUNC_4(self):...\n",
"stripBOM(self)\n",
"if self.lineNumbers:\n",
"self.lines = hackyLineNumbers(self.lines)\n",
"self.lines = markdown.stripComments(self.lines)\n",
"self.recordDependencies(self.inputSource)\n",
"self.lines, self.mdDocument = metadata.parse(lines=self.lines)\n",
"self.md = meta... | [
"def assembleDocument(self):...\n",
"stripBOM(self)\n",
"if self.lineNumbers:\n",
"self.lines = hackyLineNumbers(self.lines)\n",
"self.lines = markdown.stripComments(self.lines)\n",
"self.recordDependencies(self.inputSource)\n",
"self.lines, self.mdDocument = metadata.parse(lines=self.lines)\n",
"self... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
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'",
"Expr'",
"Condition",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Assign'",
"Assign'",
"Assign'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Expr'",
"Assign'",
"Assign'",
"Expr'",
"Assign'",
"Exp... |
[
"def __init__(self, VAR_3):...\n",
"super().__init__(VAR_3.toDisplayString())\n",
"self.url = VAR_3\n"
] | [
"def __init__(self, url):...\n",
"super().__init__(url.toDisplayString())\n",
"self.url = url\n"
] | [
0,
0,
0
] | [
"FunctionDef'",
"Expr'",
"Assign'"
] |
[
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"VAR_19 = set(VAR_5.required or [])\n",
"required_properties: List[Property] = []\n",
"optional_properties: List[Property] = []\n",
"relative_imports: Set[str] = set()\n",
"VAR_20 = Reference.from_ref(VAR_5.title or VAR_11)\n",
"for key, value in (VAR_5... | [
"@staticmethod...\n",
"\"\"\"docstring\"\"\"\n",
"required_set = set(data.required or [])\n",
"required_properties: List[Property] = []\n",
"optional_properties: List[Property] = []\n",
"relative_imports: Set[str] = set()\n",
"ref = Reference.from_ref(data.title or name)\n",
"for key, value in (data.p... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
"Condition",
"Docstring",
"Assign'",
"AnnAssign'",
"AnnAssign'",
"AnnAssign'",
"Assign'",
"For",
"Assign'",
"Assign'",
"Assign'",
"Return'",
"Condition",
"Return'",
"Condition",
"Expr'",
"Expr'",
"Expr'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.