Skip to content

Commit 4dc3b48

Browse files
committed
Address mypy issues
1 parent 50c6ea9 commit 4dc3b48

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/backend/chat_history/cosmosdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,6 @@ async def setup_clients():
187187

188188
@chat_history_cosmosdb_bp.after_app_serving
189189
async def close_clients():
190-
cosmos_client: CosmosClient = current_app.config.get(CONFIG_COSMOS_HISTORY_CLIENT)
191-
if cosmos_client:
190+
if current_app.config.get(CONFIG_COSMOS_HISTORY_CLIENT):
191+
cosmos_client: CosmosClient = current_app.config[CONFIG_COSMOS_HISTORY_CLIENT]
192192
await cosmos_client.close()

app/backend/decorators.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from functools import wraps
3-
from typing import Any, Callable, Dict
3+
from typing import Any, Callable, Dict, TypeVar, cast
44

55
from quart import abort, current_app, request
66

@@ -37,7 +37,10 @@ async def auth_handler(path=""):
3737
return auth_handler
3838

3939

40-
def authenticated(route_fn: Callable[[Dict[str, Any]], Any]):
40+
_C = TypeVar("_C", bound=Callable[..., Any])
41+
42+
43+
def authenticated(route_fn: _C) -> _C:
4144
"""
4245
Decorator for routes that might require access control. Unpacks Authorization header information into an auth_claims dictionary
4346
"""
@@ -52,4 +55,4 @@ async def auth_handler(*args, **kwargs):
5255

5356
return await route_fn(auth_claims, *args, **kwargs)
5457

55-
return auth_handler
58+
return cast(_C, auth_handler)

0 commit comments

Comments
 (0)