chore: replace calls to asyncio.iscoroutinefunction
Replace calls to deprecated asyncio.iscoroutinefunction with calls to inspect.iscoroutinefunction to prevent the following deprecation warnings from showing up if running with Python 3.14: ``` /home/user/code/electrum-fork/electrum/util.py:1225: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead assert asyncio.iscoroutinefunction(func), 'func needs to be a coroutine' /home/user/code/electrum-fork/electrum/util.py:507: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead if asyncio.iscoroutinefunction(func): /home/user/code/electrum-fork/electrum/util.py:1246: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead assert asyncio.iscoroutinefunction(func), 'func needs to be a coroutine' /home/user/code/electrum-fork/electrum/lnpeer.py:272: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead assert asyncio.iscoroutinefunction(func), 'func needs to be a coroutine' /home/user/code/electrum-fork/electrum/util.py:1225: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead assert asyncio.iscoroutinefunction(func), 'func needs to be a coroutine' /home/user/code/electrum-fork/electrum/util.py:507: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead if asyncio.iscoroutinefunction(func): ```
This commit is contained in:
@@ -36,6 +36,7 @@ import queue
|
||||
import asyncio
|
||||
from typing import Optional, TYPE_CHECKING, Sequence, Union, Dict, Mapping, Callable, List, Set
|
||||
import concurrent.futures
|
||||
import inspect
|
||||
|
||||
from PyQt6.QtGui import QPixmap, QKeySequence, QIcon, QCursor, QFont, QFontMetrics, QAction, QShortcut
|
||||
from PyQt6.QtCore import Qt, QRect, QStringListModel, QSize, pyqtSignal, QTimer
|
||||
@@ -2734,7 +2735,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
||||
Registers a callback that will be called when the wallet is closed. If the callback
|
||||
returns a string it will be shown to the user as a warning to prevent them closing the wallet.
|
||||
"""
|
||||
assert not asyncio.iscoroutinefunction(callback)
|
||||
assert not inspect.iscoroutinefunction(callback)
|
||||
def warning_callback() -> Optional[str]:
|
||||
try:
|
||||
return callback()
|
||||
|
||||
Reference in New Issue
Block a user