From 6a2a111b51e5c4b0f42d87e98cedfb8dad4e9bf0 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Tue, 5 Dec 2023 13:35:22 -0800 Subject: [PATCH] typing issues --- jupyter_server/auth/authorizer.py | 2 +- tests/auth/test_authorizer.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jupyter_server/auth/authorizer.py b/jupyter_server/auth/authorizer.py index 96b96e97c5..aaeb3a6eea 100644 --- a/jupyter_server/auth/authorizer.py +++ b/jupyter_server/auth/authorizer.py @@ -44,7 +44,7 @@ class Authorizer(LoggingConfigurable): def is_authorized( self, handler: JupyterHandler, user: User, action: str, resource: str - ) -> Awaitable | bool: + ) -> Awaitable[bool] | bool: """A method to determine if ``user`` is authorized to perform ``action`` (read, write, or execute) on the ``resource`` type. diff --git a/tests/auth/test_authorizer.py b/tests/auth/test_authorizer.py index 775c131da2..a02237aaa0 100644 --- a/tests/auth/test_authorizer.py +++ b/tests/auth/test_authorizer.py @@ -230,7 +230,7 @@ class AsyncAuthorizerTest(Authorizer): called = Bool(False) - async def mock_async_fetch(self): + async def mock_async_fetch(self) -> True: """Mock an async fetch""" # Mock a hang for a half a second. await asyncio.sleep(0.5) @@ -238,7 +238,7 @@ async def mock_async_fetch(self): async def is_authorized( self, handler: JupyterHandler, user: User, action: str, resource: str - ) -> Awaitable | bool: + ) -> Awaitable[bool]: response = await self.mock_async_fetch() self.called = True return response