code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
def _get_unauth_response(self, request, reason): """ Get an error response (or raise a Problem) for a given request and reason message. :type request: Request. :param request: HttpRequest :type reason: Reason string. :param reason: str """ if request....
Base
1
def export_bookmarks(self): filename = choose_save_file( self, 'export-viewer-bookmarks', _('Export bookmarks'), filters=[(_('Saved bookmarks'), ['pickle'])], all_files=False, initial_filename='bookmarks.pickle') if filename: with open(filename, 'wb') as fileobj: ...
Base
1
def test_with_admins(self) -> None: no_admins = InstanceConfig(admins=None) with_admins = InstanceConfig(admins=[UUID(int=0)]) with_admins_2 = InstanceConfig(admins=[UUID(int=1)]) no_admins.update(with_admins) self.assertEqual(no_admins.admins, None) with_admins.upd...
Class
2
def feed_author(book_id): off = request.args.get("offset") or 0 entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0, db.Books, db.Books.authors....
Base
1
def test_uses_xdg_config_home(self, apiver): with WindowsSafeTempDir() as d: account_info = self._make_sqlite_account_info( env={ 'HOME': self.home, 'USERPROFILE': self.home, XDG_CONFIG_HOME_ENV_VAR: d, }...
Base
1
def wrapper(request, *args, **kwargs): if request.user.is_authenticated: return redirect(request.GET.get('next', request.user.st.get_absolute_url())) return view_func(request, *args, **kwargs)
Base
1
def test_login_inactive_user(self): self.user.is_active = False self.user.save() login_code = LoginCode.objects.create(user=self.user, code='foobar') response = self.client.post('/accounts/login/code/', { 'code': login_code.code, }) self.assertEqual(res...
Base
1
def head_file(path): try: data_file, metadata = get_info( path, pathlib.Path(app.config["DATA_ROOT"]) ) stat = data_file.stat() except (OSError, ValueError): return flask.Response( "Not Found", 404, mimetype="text/plain...
Base
1
def update(request, pk): notification = get_object_or_404(TopicNotification, pk=pk, user=request.user) form = NotificationForm(data=request.POST, instance=notification) if form.is_valid(): form.save() else: messages.error(request, utils.render_form_errors(form)) return redirect(req...
Base
1
def save_cover(img, book_path): content_type = img.headers.get('content-type') if use_IM: if content_type not in ('image/jpeg', 'image/png', 'image/webp', 'image/bmp'): log.error("Only jpg/jpeg/png/webp/bmp files are supported as coverfile") return False, _("Only jpg/jpeg/png/we...
Base
1
def try_ldap_login(login, password): """ Connect to a LDAP directory to verify user login/passwords""" result = "Wrong login/password" s = Server(config.LDAPURI, port=config.LDAPPORT, use_ssl=False, get_info=ALL) # 1. connection with service account to find the user uid uid = useruid(...
Class
2
def send_mail(book_id, book_format, convert, kindle_mail, calibrepath, user_id): """Send email with attachments""" book = calibre_db.get_book(book_id) if convert == 1: # returns None if success, otherwise errormessage return convert_book_format(book_id, calibrepath, u'epub', book_format.low...
Base
1
def testRunCommandInvalidInputKeyError(self, use_tfrt): self.parser = saved_model_cli.create_parser() base_path = test.test_src_dir_path(SAVED_MODEL_PATH) args = self.parser.parse_args([ 'run', '--dir', base_path, '--tag_set', 'serve', '--signature_def', 'regress_x2_to_y3', '--input_exprs'...
Base
1
def test_list_instructor_tasks_running(self, act): """ Test list of all running tasks. """ act.return_value = self.tasks url = reverse('list_instructor_tasks', kwargs={'course_id': self.course.id.to_deprecated_string()}) mock_factory = MockCompletionInfo() with patch('instruc...
Compound
4
def test_captcha_validate_value(self): captcha = FlaskSessionCaptcha(self.app) _default_routes(captcha, self.app) with self.app.test_request_context('/'): captcha.generate() answer = captcha.get_answer() assert not captcha.validate(value="wrong") ...
Class
2
async def handle_404(request, response): if 'json' not in response.headers['Content-Type']: if request.path.endswith('/'): return web.HTTPFound(request.path.rstrip('/')) return web.json_response({ "status": 404, "message": "Page '{}' not found".format(request.path...
Base
1
def get(self, path: str) -> None: parts = path.split("/") component_name = parts[0] component_root = self._registry.get_component_path(component_name) if component_root is None: self.write("not found") self.set_status(404) return filename ...
Base
1
def icalc(self, irc, msg, args, text): """<math expression> This is the same as the calc command except that it allows integer math, and can thus cause the bot to suck up CPU. Hence it requires the 'trusted' capability to use. """ if self._calc_match_forbidden_chars...
Base
1
def CreateAuthenticator(): """Create a packet autenticator. All RADIUS packets contain a sixteen byte authenticator which is used to authenticate replies from the RADIUS server and in the password hiding algorithm. This function returns a suitable random string that can be used as an...
Class
2
def check_send_to_kindle_with_converter(formats): bookformats = list() if 'EPUB' in formats and 'MOBI' not in formats: bookformats.append({'format': 'Mobi', 'convert': 1, 'text': _('Convert %(orig)s to %(format)s and send to Kindle', ...
Base
1
def test_basic(settings): items, url, crawler = yield crawl_items(ResponseSpider, HelloWorld, settings) assert len(items) == 1 resp = items[0]['response'] assert resp.url == url assert resp.css('body::text').extract_first().strip() == "hello world!"
Class
2
def generate_auth_token(user_id): host_list = request.host.rsplit(':') if len(host_list) == 1: host = ':'.join(host_list) else: host = ':'.join(host_list[0:-1]) if host.startswith('127.') or host.lower() == 'localhost' or host.startswith('[::ffff:7f'): warning = _('PLease access ...
Base
1
def PUT(self, path, body, ensure_encoding=True, log_request_body=True): return self._request('PUT', path, body=body, ensure_encoding=ensure_encoding, log_request_body=log_request_body)
Base
1
def jstree_data(node, selected_node): result = [] result.append('{') result.append('"text": "{}",'.format(node.label)) result.append( '"state": {{ "opened": true, "selected": {} }},'.format( 'true' if node == selected_node else 'false' ) ) result.append( '"dat...
Base
1
def test_parse_header_11_te_chunked(self): # NB: test that capitalization of header value is unimportant data = b"GET /foobar HTTP/1.1\ntransfer-encoding: ChUnKed" self.parser.parse_header(data) self.assertEqual(self.parser.body_rcv.__class__.__name__, "ChunkedReceiver")
Base
1
def test_unicorn_render_context_variable(): token = Token( TokenType.TEXT, "unicorn 'tests.templatetags.test_unicorn_render.FakeComponentKwargs' test_kwarg=test_var.nested", ) unicorn_node = unicorn(None, token) context = {"test_var": {"nested": "variable!"}} actual = unicorn_node.re...
Base
1
def generate_auth_token(user_id): host_list = request.host.rsplit(':') if len(host_list) == 1: host = ':'.join(host_list) else: host = ':'.join(host_list[0:-1]) if host.startswith('127.') or host.lower() == 'localhost' or host.startswith('[::ffff:7f'): warning = _('PLease access ...
Pillar
3
def test_request_login_code(self): response = self.client.post('/accounts/login/', { 'username': self.user.username, 'next': '/private/', }) self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], '/accounts/login/code/') l...
Base
1
def send_note_attachment(filename): """Return a file from the note attachment directory""" file_path = os.path.join(PATH_NOTE_ATTACHMENTS, filename) if file_path is not None: try: return send_file(file_path, as_attachment=True) except Exception: logger.exception("Send...
Base
1
def login_user(self, username, password, otp, context, **kwargs): user = authenticate(request=context.get('request'), username=username, password=password) if not user: login_reject.send(sender=self.__class__, username=username, reason='creds') rai...
Class
2
def test_modify_access_bad_role(self): """ Test with an invalid action parameter. """ url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, { 'unique_student_identifier': self.other_staff.email, 'ro...
Compound
4
def build_request(self, key_filename, req_config, entry): """ creates the certificate request """ req = tempfile.mkstemp()[1] days = self.cert_specs[entry.get('name')]['days'] key = self.data + key_filename cmd = "openssl req -new -config %s -days %s -key %s -...
Class
2
def should_run(self): if self.force: return True if not os.path.exists(self.bower_dir): return True return mtime(self.bower_dir) < mtime(pjoin(repo_root, 'bower.json'))
Base
1
def test_file_position_after_tofile(self): # gh-4118 sizes = [io.DEFAULT_BUFFER_SIZE//8, io.DEFAULT_BUFFER_SIZE, io.DEFAULT_BUFFER_SIZE*8] for size in sizes: err_msg = "%d" % (size,) f = open(self.filename, 'wb') f.seek(...
Base
1
def append(self, key, value): self.dict.setdefault(_hkey(key), []).append( value if isinstance(value, unicode) else str(value))
Base
1
def feed_category(book_id): off = request.args.get("offset") or 0 entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0, db.Books, db.Books.tags.a...
Base
1
def edit(request, user_id): user = get_object_or_404(User, pk=user_id) uform = UserForm(data=post_data(request), instance=user) form = UserProfileForm(data=post_data(request), instance=user.st) if is_post(request) and all([uform.is_valid(), form.is_valid()]): uform.save() form.save() ...
Base
1
def __init__(self, app, conf): self.app = app self.memcache_servers = conf.get('memcache_servers') if not self.memcache_servers: path = os.path.join(conf.get('swift_dir', '/etc/swift'), 'memcache.conf') memcache_conf = ConfigParser() ...
Base
1
def edit_book_languages(languages, book, upload=False, invalid=None): input_languages = languages.split(',') unknown_languages = [] if not upload: input_l = isoLanguages.get_language_codes(get_locale(), input_languages, unknown_languages) else: input_l = isoLanguages.get_valid_language_c...
Base
1
def make_homeserver(self, reactor, clock): self.hs = self.setup_test_homeserver( "red", http_client=None, federation_client=Mock(), ) self.hs.get_federation_handler = Mock() self.hs.get_federation_handler.return_value.maybe_backfill = Mock( return_value=make...
Base
1
def another_upload_file(request): path = tempfile.mkdtemp() file_name = os.path.join(path, "another_%s.txt" % request.node.name) with open(file_name, "w") as f: f.write(request.node.name) return file_name
Base
1
def __init__(self, expression, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderBy() expression. ordering = ( (OrderBy(F(o[1:]), descending=T...
Base
1
def visit_Call(self, call): if call.func.id in INVALID_CALLS: raise Exception("invalid function: %s" % call.func.id)
Class
2
def on_permitted_domain(team: Team, request: HttpRequest) -> bool: permitted_domains = ["127.0.0.1", "localhost"] for url in team.app_urls: hostname = parse_domain(url) if hostname: permitted_domains.append(hostname) origin = parse_domain(request.headers.get("Origin")) refe...
Base
1
def get_credits(request, project=None, component=None): """View for credits.""" if project is None: obj = None kwargs = {"translation__isnull": False} elif component is None: obj = get_project(request, project) kwargs = {"translation__component__project": obj} else: ...
Base
1
def table_get_custom_enum(c_id): ret = list() cc = (calibre_db.session.query(db.Custom_Columns) .filter(db.Custom_Columns.id == c_id) .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).one_or_none()) ret.append({'value': "", 'text': ""}) for idx, en in enumerate(cc....
Base
1
def _unpack_returndata(buf, contract_sig, skip_contract_check, context): return_t = contract_sig.return_type if return_t is None: return ["pass"], 0, 0 return_t = calculate_type_for_external_return(return_t) # if the abi signature has a different type than # the vyper type, we need to wrap ...
Class
2
def initSession(self, expire_on_commit=True): self.session = self.session_factory() self.session.expire_on_commit = expire_on_commit self.update_title_sort(self.config)
Base
1
def author_list(): if current_user.check_visibility(constants.SIDEBAR_AUTHOR): if current_user.get_view_property('author', 'dir') == 'desc': order = db.Authors.sort.desc() order_no = 0 else: order = db.Authors.sort.asc() order_no = 1 entries = ...
Base
1
def _build_url(self, path, queries=()): """ Takes a relative path and query parameters, combines them with the base path, and returns the result. Handles utf-8 encoding as necessary. :param path: relative path for this request, relative to self.base_prefix...
Base
1
def home_get_preview(): vId = request.form['vId'] d = db.sentences_stats('get_preview', vId) n = db.sentences_stats('id_networks', vId) return json.dumps({'status' : 'OK', 'vId' : vId, 'd' : d, 'n' : n});
Base
1
def test_level_as_none(self): body = [ast.ImportFrom(module='time', names=[ast.alias(name='sleep')], level=None, lineno=0, col_offset=0)] mod = ast.Module(body) code = compile(mod, 'test', 'exec') ...
Base
1
def render_hot_books(page, order): if current_user.check_visibility(constants.SIDEBAR_HOT): if order[1] not in ['hotasc', 'hotdesc']: # Unary expression comparsion only working (for this expression) in sqlalchemy 1.4+ #if not (order[0][0].compare(func.count(ub.Downloads.book_id).desc()) or ...
Base
1
def test_notfilelike_http10(self): to_send = "GET /notfilelike HTTP/1.0\n\n" to_send = tobytes(to_send) self.connect() self.sock.send(to_send) fp = self.sock.makefile("rb", 0) line, headers, response_body = read_http(fp) self.assertline(line, "200", "OK", "H...
Base
1
def deserialize(self, content, format='application/json'): """ Given some data and a format, calls the correct method to deserialize the data and returns the result. """ desired_format = None format = format.split(';')[0] for short_format, long_format in sel...
Class
2
def from_html(self, content): """ Reserved for future usage. The desire is to handle form-based (maybe Javascript?) input, making an API available to a browser. This is on the TODO list but not currently implemented. """ pass
Class
2
def test_get_header_lines(self): result = self._callFUT(b"slam\nslim") self.assertEqual(result, [b"slam", b"slim"])
Base
1
def testOrdering(self): import six import random with ops.Graph().as_default() as G: with ops.device('/cpu:0'): x = array_ops.placeholder(dtypes.int32, name='x') pi = array_ops.placeholder(dtypes.int64, name='pi') gi = array_ops.placeholder(dtypes.int64, name='gi') wit...
Base
1
def __init__(self, hs): self.server_name = hs.hostname self.client = hs.get_http_client()
Base
1
def list_users(): off = int(request.args.get("offset") or 0) limit = int(request.args.get("limit") or 10) search = request.args.get("search") sort = request.args.get("sort", "id") state = None if sort == "state": state = json.loads(request.args.get("state", "[]")) else: if so...
Base
1
def fetch(cls) -> "InstanceConfig": entry = cls.get(get_instance_name()) if entry is None: entry = cls() entry.save() return entry
Class
2
def test_get_frontend_context_variables_safe(component): # Set component.name to a potential XSS attack component.name = '<a><style>@keyframes x{}</style><a style="animation-name:x" onanimationend="alert(1)"></a>' class Meta: safe = [ "name", ] setattr(component, "Meta", Me...
Base
1
def render_POST(self, request): """ Register with the Identity Server """ send_cors(request) args = get_args(request, ('matrix_server_name', 'access_token')) result = yield self.client.get_json( "matrix://%s/_matrix/federation/v1/openid/userinfo?access_t...
Base
1
def test_remote_static(app): """Test endpoint that serves files as a logged user""" # GIVEN a file on disk file = "../demo/ACC5963A1_lanes_1234_star_sorted_sj_filtered_sorted.bed.gz" # GIVEN a running demo app with app.test_client() as client: # GIVEN that user is logged in client.g...
Base
1
async def initialize(self, bot): # temporary backwards compatibility key = await self.config.tenorkey() if not key: return await bot.set_shared_api_tokens("tenor", api_key=key) await self.config.tenorkey.clear()
Base
1
def test_http10_list(self): body = string.ascii_letters to_send = ( "GET /list HTTP/1.0\n" "Connection: Keep-Alive\n" "Content-Length: %d\n\n" % len(body) ) to_send += body to_send = tobytes(to_send) self.connect() self.sock...
Base
1
def get_file(recipe): if not recipe.link: recipe.link = Dropbox.get_share_link(recipe) recipe.save() response = requests.get(recipe.link.replace('www.dropbox.', 'dl.dropboxusercontent.')) return io.BytesIO(response.content)
Base
1
def test_get_problem_responses_already_running(self): """ Test whether get_problem_responses returns an appropriate status message if CSV generation is already in progress. """ url = reverse( 'get_problem_responses', kwargs={'course_id': unicode(self.c...
Compound
4
def generate_subparsers(root, parent_parser, definitions): action_dest = '_'.join(parent_parser.prog.split()[1:] + ['action']) actions = parent_parser.add_subparsers( dest=action_dest ) for command, properties in definitions.items(): is_subparser = isinstance(properties, dict) de...
Class
2
def opds_download_link(book_id, book_format): # I gave up with this: With enabled ldap login, the user doesn't get logged in, therefore it's always guest # workaround, loading the user from the request and checking it's download rights here # in case of anonymous browsing user is None user = load_user_f...
Base
1
def func_begin(self, name): ctype = get_c_type(name) self.emit("PyObject*", 0) self.emit("ast2obj_%s(void* _o)" % (name), 0) self.emit("{", 0) self.emit("%s o = (%s)_o;" % (ctype, ctype), 1) self.emit("PyObject *result = NULL, *value = NULL;", 1) self.emit('if...
Base
1
def process_response(self, request, response, spider): if ( request.meta.get('dont_redirect', False) or response.status in getattr(spider, 'handle_httpstatus_list', []) or response.status in request.meta.get('handle_httpstatus_list', []) or request.meta.get('h...
Class
2
def count(cls, **kwargs): """Return a count of server side resources given filtering arguments in kwargs. """ url = urljoin(recurly.base_uri(), cls.collection_path) if kwargs: url = '%s?%s' % (url, urlencode(kwargs)) return Page.count_for_url(url)
Base
1
def render_prepare_search_form(cc): # prepare data for search-form tags = calibre_db.session.query(db.Tags)\ .join(db.books_tags_link)\ .join(db.Books)\ .filter(calibre_db.common_filters()) \ .group_by(text('books_tags_link.tag'))\ .order_by(db.Tags.name).all() series...
Base
1
def uniq(inpt): output = [] inpt = [ " ".join(inp.split()) for inp in inpt] for x in inpt: if x not in output: output.append(x) return output
Base
1
def test_auth_type_stored_in_session_file(self, httpbin): self.config_dir = mk_config_dir() self.session_path = self.config_dir / 'test-session.json' class Plugin(AuthPlugin): auth_type = 'test-saved' auth_require = True def get_auth(self, username=None,...
Class
2
def test_rescore_problem_all(self, act): """ Test rescoring for all students. """ url = reverse('rescore_problem', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, { 'problem_to_reset': self.problem_urlname, 'all_students': ...
Compound
4
def __init__(self): field_infos = [ FieldInfo.factory(key) for key in list(request.form.keys()) + list(request.files.keys()) ] # important to sort them so they will be in expected order on command line self.field_infos = list(sorted(field_infos))
Compound
4
def refresh(self): """ Security endpoint for the refresh token, so we can obtain a new token without forcing the user to login again --- post: description: >- Use the refresh token to get a new JWT access token responses: 20...
Class
2
def __setitem__(self, key, value): self.dict[_hkey(key)] = [value if isinstance(value, unicode) else str(value)]
Base
1
def assert_update_forum_role_membership(self, current_user, identifier, rolename, action): """ Test update forum role membership. Get unique_student_identifier, rolename and action and update forum role. """ url = reverse('update_forum_role_membership', kwargs={'course_id': s...
Compound
4
def preprocess_input_exprs_arg_string(input_exprs_str): """Parses input arg into dictionary that maps input key to python expression. Parses input string in the format of 'input_key=<python expression>' into a dictionary that maps each input_key to its python expression. Args: input_exprs_str: A string th...
Base
1
def feed_hot(): off = request.args.get("offset") or 0 all_books = ub.session.query(ub.Downloads, func.count(ub.Downloads.book_id)).order_by( func.count(ub.Downloads.book_id).desc()).group_by(ub.Downloads.book_id) hot_books = all_books.offset(off).limit(config.config_books_per_page) entries = lis...
Base
1
def setUp(self): self.mock_federation = Mock() self.mock_registry = Mock() self.query_handlers = {} def register_query_handler(query_type, handler): self.query_handlers[query_type] = handler self.mock_registry.register_query_handler = register_query_handler ...
Base
1
def test_parse_www_authenticate_correct(data, strict): headers, info = data # FIXME: move strict to parse argument httplib2.USE_WWW_AUTH_STRICT_PARSING = strict try: assert httplib2._parse_www_authenticate(headers) == info finally: httplib2.USE_WWW_AUTH_STRICT_PARSING = 0
Class
2
def render_edit_book(book_id): cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all() book = calibre_db.get_filtered_book(book_id, allow_show_archived=True) if not book: flash(_(u"Oops! Selected book title is unavailable. File does not exis...
Base
1
def test_invoice_payment_is_still_pending_for_registration_codes(self): """ test generate enrollment report enroll a user in a course using registration code whose invoice has not been paid yet """ course_registration_code = CourseRegistrationCode.objects.create( ...
Compound
4
def test_get_sale_records_features_json(self): """ Test that the response from get_sale_records is in json format. """ for i in range(5): course_registration_code = CourseRegistrationCode( code='sale_invoice{}'.format(i), course_id=self.cou...
Compound
4
def __init__(self, sydent): self.sydent = sydent # The default endpoint factory in Twisted 14.0.0 (which we require) uses the # BrowserLikePolicyForHTTPS context factory which will do regular cert validation # 'like a browser' self.agent = Agent( self.sydent.react...
Class
2
def __init__( self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=None, proxy_info=None,
Class
2
def setup_logging(): """Configure the python logging appropriately for the tests. (Logs will end up in _trial_temp.) """ root_logger = logging.getLogger() log_format = ( "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s" " - %(message)s" ) handler = ToTwistedHandler() ...
Base
1
async def get_user_list( *, client: Client, an_enum_value: List[AnEnum], some_date: Union[date, datetime],
Base
1
def prepare(self, reactor, clock, homeserver): # make a second homeserver, configured to use the first one as a key notary self.http_client2 = Mock() config = default_config(name="keyclient") config["trusted_key_servers"] = [ { "server_name": self.hs.hostn...
Base
1
def remote_static(): """Stream *large* static files with special requirements.""" file_path = request.args.get("file") or "." # Check that user is logged in or that file extension is valid if current_user.is_authenticated is False or file_path not in session.get("igv_tracks", []): LOG.warning(f...
Base
1
def get_response(self): token_serializer = self.token_serializer_class( instance=self.token, context=self.get_serializer_context(), ) data = token_serializer.data data['next'] = self.serializer.validated_data['code'].next return Response(data, status=s...
Base
1
def test_list_background_email_tasks(self, act): """Test list of background email tasks.""" act.return_value = self.tasks url = reverse('list_background_email_tasks', kwargs={'course_id': self.course.id.to_deprecated_string()}) mock_factory = MockCompletionInfo() with patch('...
Compound
4
def test_session_with_cookie_followed_by_another_header(self, httpbin): """ Make sure headers don’t get mutated — <https://github.com/httpie/httpie/issues/1126> """ self.start_session(httpbin) session_data = { "headers": { "cookie": "...", ...
Class
2
def check_unrar(unrarLocation): if not unrarLocation: return if not os.path.exists(unrarLocation): return _('Unrar binary file not found') try: unrarLocation = [unrarLocation] value = process_wait(unrarLocation, pattern='UNRAR (.*) freeware') if value: v...
Base
1
def to_yaml(self, **kwargs): """Returns a yaml string containing the network configuration. To load a network from a yaml save file, use `keras.models.model_from_yaml(yaml_string, custom_objects={})`. `custom_objects` should be a dictionary mapping the names of custom losses / layers / etc to th...
Base
1
def custom_logout(request, **kwargs): if not request.user.is_authenticated: return redirect(request.GET.get('next', reverse(settings.LOGIN_URL))) if request.method == 'POST': return _logout_view(request, **kwargs) return render(request, 'spirit/user/auth/logout.html')
Base
1