Skip to content

Commit

Permalink
mypy (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie authored Jun 10, 2022
1 parent 026046a commit f415676
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ class CylcUIServer(ExtensionApp):
load_other_extensions = True
description = '''
Cylc - A user interface for monitoring and controlling Cylc workflows.
'''
''' # type: ignore[assignment]
examples = '''
cylc gui # start the cylc GUI
'''
''' # type: ignore[assignment]
config_file_paths = get_conf_dir_hierarchy(
[
SITE_CONF_ROOT, # site configuration
Expand Down
18 changes: 9 additions & 9 deletions cylc/uiserver/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def _authorise(
"""
if username == ME or handler.auth.is_permitted(
username, Authorization.READ_OPERATION):
username, Authorization.READ_OPERATION
):
return True
else:
handler.log.warning(f'Authorization failed for {username}')
Expand Down Expand Up @@ -166,13 +167,15 @@ class CylcAppHandler(JupyterHandler):
3800ceaf9edf33a0171922b93ea3d94f87aa8d91/jupyterhub/
singleuser/mixins.py#L826
"""

def initialize(self, auth):
self.auth = auth

# Without this, there is no xsrf token from the GET which causes a 403 and
# a missing _xsrf argument error on the first POST.
def prepare(self):
_ = self.xsrf_token

auth_level = None

@property
def hub_users(self):
# allow all users (handled by Cylc authorisation decorator)
Expand All @@ -198,6 +201,9 @@ class CylcStaticHandler(CylcAppHandler, web.StaticFileHandler):
multi-user access.
"""

def initialize(self, *args, **kwargs):
return web.StaticFileHandler.initialize(self, *args, **kwargs)

@web.authenticated
def get(self, path):
# authenticate the static handler
Expand All @@ -211,9 +217,6 @@ class CylcVersionHandler(CylcAppHandler):
Equivalent to running `cylc version --long` in the UIS environment.
"""

def initialize(self, auth):
self.auth = auth

@authorised
@web.authenticated
def get(self):
Expand Down Expand Up @@ -257,9 +260,6 @@ class UserProfileHandler(CylcAppHandler):
would have returned.
"""

def initialize(self, auth):
self.auth = auth

def set_default_headers(self) -> None:
super().set_default_headers()
self.set_header("Content-Type", 'application/json')
Expand Down

0 comments on commit f415676

Please sign in to comment.