Skip to content

Commit

Permalink
suppress warning "never awaited"
Browse files Browse the repository at this point in the history
  • Loading branch information
skokado committed Nov 10, 2023
1 parent cd66ac8 commit 1bb4117
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 1bb4117

Please sign in to comment.