Skip to content

Commit

Permalink
Merge pull request #916 from skokado/fix/address-warning-async-auth
Browse files Browse the repository at this point in the history
Suppress async-auth Warning "never awaited"
  • Loading branch information
vitalik authored Nov 10, 2023
2 parents cd66ac8 + 1bb4117 commit 98468e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ninja/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
TYPE_CHECKING,
Any,
Callable,
Coroutine,
Dict,
Iterable,
List,
Expand Down Expand Up @@ -305,9 +306,11 @@ async def _run_authentication(self, request: HttpRequest) -> Optional[HttpRespon
for callback in self.auth_callbacks:
try:
if is_async_callable(callback) or getattr(callback, "is_async", False):
result = callback(request)
if result is not None:
result = await callback(request)
cor: Optional[Coroutine] = callback(request)
if cor is None:
result = None
else:
result = await cor
else:
result = callback(request)
except Exception as exc:
Expand Down

0 comments on commit 98468e5

Please sign in to comment.