Skip to content

Commit 95555f7

Browse files
committed
refactor(twisted/consumer): update asyncio.iscoroutinefunction to inspect.iscoroutine
Signed-off-by: Nate Bracy <nate@bracy.dev>
1 parent 8280bc4 commit 95555f7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fedora_messaging/twisted/consumer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: GPL-2.0-or-later
44

55
import asyncio
6+
import inspect
67
import logging
78
import uuid
89
from collections.abc import Coroutine, Generator
@@ -48,8 +49,8 @@ def is_coro(
4849
# Until Python 3.10, inspect.iscoroutinefunction() will fail to identify AsyncMocks
4950
# as coroutines: https://github.com/python/cpython/issues/84753
5051
# Use asyncio.iscoroutinefunction() instead.
51-
return asyncio.iscoroutinefunction(func_or_obj) or (
52-
callable(func_or_obj) and asyncio.iscoroutinefunction(func_or_obj.__call__) # type: ignore
52+
return inspect.iscoroutinefunction(func_or_obj) or (
53+
callable(func_or_obj) and inspect.iscoroutinefunction(func_or_obj.__call__) # type: ignore
5354
)
5455

5556

@@ -164,7 +165,9 @@ def _read(self, queue_object: ClosableDeferredQueue) -> Generator[defer.Deferred
164165
yield self._read_one(queue_object)
165166

166167
@defer.inlineCallbacks
167-
def _read_one(self, queue_object: ClosableDeferredQueue) -> Generator[
168+
def _read_one(
169+
self, queue_object: ClosableDeferredQueue
170+
) -> Generator[
168171
defer.Deferred[Any],
169172
QueueContent,
170173
Any,

0 commit comments

Comments
 (0)