Skip to content

Commit

Permalink
Fix pass through overrides typing
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Feb 12, 2024
1 parent d2bb39b commit 900a197
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 9 additions & 9 deletions jupyter_server/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import warnings
from http.client import responses
from logging import Logger
from typing import TYPE_CHECKING, Any, Awaitable, Sequence, cast
from typing import TYPE_CHECKING, Any, Awaitable, Coroutine, Sequence, cast
from urllib.parse import urlparse

import prometheus_client
Expand Down Expand Up @@ -1016,14 +1016,14 @@ def compute_etag(self) -> str | None:
# access is allowed as this class is used to serve static assets on login page
# TODO: create an allow-list of files used on login page and remove this decorator
@allow_unauthenticated
def get(self, *args, **kwargs) -> None:
return super().get(*args, **kwargs)
def get(self, path: str, include_body: bool = ...) -> Coroutine[Any, Any, None]:
return super().get(path, include_body)

# access is allowed as this class is used to serve static assets on login page
# TODO: create an allow-list of files used on login page and remove this decorator
@allow_unauthenticated
def head(self, *args, **kwargs) -> None:
return super().head(*args, **kwargs)
def head(self, path: str) -> Awaitable[None]:
return super().head(path)

@classmethod
def get_absolute_path(cls, roots: Sequence[str], path: str) -> str:
Expand Down Expand Up @@ -1170,12 +1170,12 @@ class PublicStaticFileHandler(web.StaticFileHandler):
"""Same as web.StaticFileHandler, but decorated to acknowledge that auth is not required."""

@allow_unauthenticated
def head(self, *args, **kwargs) -> None:
return super().head(*args, **kwargs)
def head(self, path: str) -> Awaitable[None]:
return super().head(path)

@allow_unauthenticated
def get(self, *args, **kwargs) -> None:
return super().get(*args, **kwargs)
def get(self, path: str, include_body: bool = ...) -> Coroutine[Any, Any, None]:
return super().get(path, include_body)


# -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions jupyter_server/base/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def _maybe_auth(self):
self.log.warning("Couldn't authenticate WebSocket connection")
raise web.HTTPError(403)

@no_type_check
def prepare(self, *args, **kwargs):
"""Handle a get request."""
self._maybe_auth()
Expand Down

0 comments on commit 900a197

Please sign in to comment.