diff --git a/conftest.py b/conftest.py index 044a6b3..bb8293c 100644 --- a/conftest.py +++ b/conftest.py @@ -7,7 +7,7 @@ from typing import Any, Tuple import pytest -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor def get_bitcoind_version(bitcoind_path: str, conf: str) -> Tuple[int, int]: diff --git a/scripts/add-utxo.py b/scripts/add-utxo.py index 2f7b64c..f6d6d8b 100755 --- a/scripts/add-utxo.py +++ b/scripts/add-utxo.py @@ -12,7 +12,7 @@ import json from pprint import pformat from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/bencode.py b/scripts/bencode.py index 10fb5a8..cf1c67a 100755 --- a/scripts/bencode.py +++ b/scripts/bencode.py @@ -3,7 +3,6 @@ import click import json -from pprint import pprint from fastbencode import bencode_utf8 diff --git a/scripts/bond-calculator.py b/scripts/bond-calculator.py index 51ce375..9646679 100755 --- a/scripts/bond-calculator.py +++ b/scripts/bond-calculator.py @@ -7,7 +7,7 @@ from decimal import Decimal from json import loads from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/bumpfee.py b/scripts/bumpfee.py index ebfb44b..2a6b8d8 100755 --- a/scripts/bumpfee.py +++ b/scripts/bumpfee.py @@ -3,7 +3,7 @@ import asyncio from decimal import Decimal -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/genwallet.py b/scripts/genwallet.py index b2bf996..4861f79 100755 --- a/scripts/genwallet.py +++ b/scripts/genwallet.py @@ -7,7 +7,7 @@ import asyncio import os from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/joinmarket-qt.py b/scripts/joinmarket-qt.py index 1948b88..963f435 100755 --- a/scripts/joinmarket-qt.py +++ b/scripts/joinmarket-qt.py @@ -21,7 +21,7 @@ Some widgets copied and modified from https://github.com/spesmilo/electrum import asyncio import sys, datetime, os, logging -import platform, json, time +import platform, json from optparse import OptionParser from typing import Optional, Tuple @@ -77,7 +77,7 @@ from jmclient import load_program_config, get_network, update_persist_config,\ from jmclient.wallet import BaseWallet from qtsupport import (ScheduleWizard, TumbleRestartWizard, config_tips, - config_types, QtHandler, XStream, Buttons, OkButton, CancelButton, + config_types, QtHandler, XStream, JMPasswordDialog, MyTreeWidget, JMQtMessageBox, BLUE_FG, donation_more_message, BitcoinAmountEdit, JMIntValidator, ReceiveBIP78Dialog, QRCodePopup, JMExportPrivkeysDialog, @@ -2573,7 +2573,7 @@ def qt_exception_handler(context): async def main(): - global logsdir, tumble_log, mainWindow + global logsdir, tumble_log loop = asyncio.get_event_loop() loop.set_exception_handler(qt_exception_handler) diff --git a/scripts/receive-payjoin.py b/scripts/receive-payjoin.py index 23ca4ed..637bdb0 100755 --- a/scripts/receive-payjoin.py +++ b/scripts/receive-payjoin.py @@ -5,7 +5,7 @@ from optparse import OptionParser import sys -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index 9b51817..16fe606 100755 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -11,7 +11,7 @@ import asyncio import sys import pprint -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/sendtomany.py b/scripts/sendtomany.py index fd9c780..d089042 100755 --- a/scripts/sendtomany.py +++ b/scripts/sendtomany.py @@ -9,7 +9,7 @@ import asyncio from optparse import OptionParser import jmbitcoin as btc -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/create-snicker-proposal.py b/scripts/snicker/create-snicker-proposal.py index 15ea4d0..3e6150b 100755 --- a/scripts/snicker/create-snicker-proposal.py +++ b/scripts/snicker/create-snicker-proposal.py @@ -25,7 +25,7 @@ import asyncio import sys from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/receive-snicker.py b/scripts/snicker/receive-snicker.py index 9b0e2f1..5376a2b 100755 --- a/scripts/snicker/receive-snicker.py +++ b/scripts/snicker/receive-snicker.py @@ -4,7 +4,7 @@ import asyncio from optparse import OptionParser import sys -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/snicker-finder.py b/scripts/snicker/snicker-finder.py index c890987..c33c3fd 100755 --- a/scripts/snicker/snicker-finder.py +++ b/scripts/snicker/snicker-finder.py @@ -28,7 +28,7 @@ import asyncio import sys from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/snicker-recovery.py b/scripts/snicker/snicker-recovery.py index f8ea120..3a70dbc 100755 --- a/scripts/snicker/snicker-recovery.py +++ b/scripts/snicker/snicker-recovery.py @@ -28,7 +28,7 @@ import asyncio import sys from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/snicker-seed-tx.py b/scripts/snicker/snicker-seed-tx.py index 07cc423..3ce1c3f 100755 --- a/scripts/snicker/snicker-seed-tx.py +++ b/scripts/snicker/snicker-seed-tx.py @@ -24,7 +24,7 @@ import sys import random from optparse import OptionParser -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/snicker/snicker-server.py b/scripts/snicker/snicker-server.py index 765b2c3..da11b03 100755 --- a/scripts/snicker/snicker-server.py +++ b/scripts/snicker/snicker-server.py @@ -24,7 +24,7 @@ arguments: import asyncio -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/tumbler.py b/scripts/tumbler.py index 718a501..950a9b2 100755 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -3,7 +3,7 @@ import asyncio import sys -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/wallet-tool.py b/scripts/wallet-tool.py index 5b9b319..945e0d5 100755 --- a/scripts/wallet-tool.py +++ b/scripts/wallet-tool.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 import asyncio -import sys -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/scripts/yg-privacyenhanced.py b/scripts/yg-privacyenhanced.py index d1332f3..9425e46 100755 --- a/scripts/yg-privacyenhanced.py +++ b/scripts/yg-privacyenhanced.py @@ -4,11 +4,12 @@ import asyncio import random import sys -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task from jmbase import get_log, jmprint, EXIT_ARGERROR +from jmclient import YieldGeneratorBasic, ygmain, jm_single from jmbitcoin import amount_to_str # This is a maker for the purposes of generating a yield from held bitcoins @@ -19,8 +20,10 @@ from jmbitcoin import amount_to_str # YIELD GENERATOR SETTINGS ARE NOW IN YOUR joinmarket.cfg CONFIG FILE # (You can also use command line flags; see --help for this script). + jlog = get_log() + class YieldGeneratorPrivacyEnhanced(YieldGeneratorBasic): def __init__(self, wallet_service, offerconfig): diff --git a/scripts/yield-generator-basic.py b/scripts/yield-generator-basic.py index 4e6cc79..62c3aa9 100755 --- a/scripts/yield-generator-basic.py +++ b/scripts/yield-generator-basic.py @@ -2,7 +2,7 @@ import asyncio -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmclient.scripts_support import wrap_main, finalize_main_task diff --git a/src/jmclient/blockchaininterface.py b/src/jmclient/blockchaininterface.py index fcefe7e..7cb9a29 100644 --- a/src/jmclient/blockchaininterface.py +++ b/src/jmclient/blockchaininterface.py @@ -1,7 +1,6 @@ import ast import binascii import random -import sys import time from abc import ABC, abstractmethod from decimal import Decimal diff --git a/src/jmclient/client_protocol.py b/src/jmclient/client_protocol.py index a08b2f2..30230e7 100644 --- a/src/jmclient/client_protocol.py +++ b/src/jmclient/client_protocol.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +# -*- coding: utf-8 -*- import asyncio import base64 @@ -11,7 +11,7 @@ try: from twisted.internet.ssl import ClientContextFactory except ImportError: pass -from jmbase import commands, jmprint +from jmbase import commands import binascii import json import hashlib @@ -405,7 +405,7 @@ class JMClientProtocol(BaseClientProtocol): """DKG specifics """ async def dkg_gen(self): - jlog.debug(f'Coordinator call dkg_gen') + jlog.debug('Coordinator call dkg_gen') client = self.factory.client md_type_idx = None session_id = None @@ -528,7 +528,7 @@ class JMClientProtocol(BaseClientProtocol): client = self.factory.client bin_session_id = hextobin(session_id) - jlog.debug(f'Coordinator get dkgfinalized') + jlog.debug('Coordinator get dkgfinalized') client.on_dkg_finalized(nick, bin_session_id) return {'accepted': True} @@ -584,7 +584,7 @@ class JMClientProtocol(BaseClientProtocol): """FROST specifics """ def frost_req(self, dkg_session_id, msg_bytes): - jlog.debug(f'Coordinator call frost_req') + jlog.debug('Coordinator call frost_req') client = self.factory.client hostpubkeyhash, sig, session_id = client.frost_req( dkg_session_id, msg_bytes) diff --git a/src/jmclient/commitment_utils.py b/src/jmclient/commitment_utils.py index fcfd10d..57c6159 100644 --- a/src/jmclient/commitment_utils.py +++ b/src/jmclient/commitment_utils.py @@ -1,5 +1,5 @@ +# -*- coding: utf-8 -*- -import sys from jmbase import (jmprint, utxostr_to_utxo, utxo_to_utxostr, EXIT_FAILURE, twisted_sys_exit) from jmclient import jm_single, BTCEngine, BTC_P2PKH, BTC_P2SH_P2WPKH, BTC_P2WPKH diff --git a/src/jmclient/frost_clients.py b/src/jmclient/frost_clients.py index 4780e40..439f820 100644 --- a/src/jmclient/frost_clients.py +++ b/src/jmclient/frost_clients.py @@ -12,20 +12,13 @@ from jmbase import hextobin, get_log from jmbitcoin import CCoinKey from jmclient.configure import jm_single from jmfrost.chilldkg_ref.chilldkg import ( - params_id, hostpubkey_gen, participant_step1, participant_step2, participant_finalize, - participant_investigate, coordinator_step1, coordinator_finalize, - coordinator_investigate, SessionParams, - DKGOutput, - RecoveryData, - FaultyParticipantOrCoordinatorError, - UnknownFaultyParticipantOrCoordinatorError, ParticipantMsg1, ParticipantMsg2, CoordinatorMsg1, @@ -259,7 +252,7 @@ class DKGClient: raise Exception(f'pubkey for {pubkeyhash.hex()} not found') xpubkey = XOnlyPubKey(pubkey[1:]) if not xpubkey.verify_schnorr(session_id, hextobin(sig)): - raise Exception(f'signature verification failed') + raise Exception('signature verification failed') if pubkey in coordinator.parties: jlog.debug(f'pubkey {pubkey.hex()} already in' f' coordinator parties') diff --git a/src/jmclient/maker.py b/src/jmclient/maker.py index f0a5d36..a16f539 100644 --- a/src/jmclient/maker.py +++ b/src/jmclient/maker.py @@ -1,13 +1,12 @@ import base64 import hashlib -import sys import abc import atexit from bitcointx.wallet import CCoinKey, XOnlyPubKey, tap_tweak_pubkey import jmbitcoin as btc -from jmbase import (bintohex, hexbin, async_hexbin, get_log, EXIT_FAILURE, +from jmbase import (bintohex, async_hexbin, get_log, EXIT_FAILURE, twisted_sys_exit) from jmclient.wallet import TaprootWallet, FrostWallet from jmclient.wallet_service import WalletService diff --git a/src/jmclient/podle.py b/src/jmclient/podle.py index be372b8..7014c3c 100644 --- a/src/jmclient/podle.py +++ b/src/jmclient/podle.py @@ -1,7 +1,6 @@ #Proof Of Discrete Logarithm Equivalence #For algorithm steps, see https://gist.github.com/AdamISZ/9cbba5e9408d23813ca8 import os -import sys import hashlib import json import struct diff --git a/src/jmclient/taker_utils.py b/src/jmclient/taker_utils.py index 7217fed..91d0abf 100644 --- a/src/jmclient/taker_utils.py +++ b/src/jmclient/taker_utils.py @@ -2,7 +2,6 @@ import asyncio import logging import pprint import os -import sys import time import numbers from typing import Callable, List, Optional, Tuple, Union diff --git a/src/jmclient/wallet.py b/src/jmclient/wallet.py index 3ca168b..b5d1d2e 100644 --- a/src/jmclient/wallet.py +++ b/src/jmclient/wallet.py @@ -32,7 +32,6 @@ from .cryptoengine import TYPE_P2PKH, TYPE_P2SH_P2WPKH, TYPE_P2WSH,\ TYPE_WATCHONLY_P2WPKH, TYPE_P2TR, TYPE_P2TR_FROST, ENGINES, \ detect_script_type, EngineError, TYPE_TAPROOT_WALLET_FIDELITY_BONDS, \ TYPE_TAPROOT_WATCHONLY_FIDELITY_BONDS, TYPE_WATCHONLY_P2TR -from .storage import DKGRecoveryStorage from .support import get_random_bytes from . import mn_encode, mn_decode import jmbitcoin as btc @@ -40,7 +39,6 @@ from jmbase import JM_WALLET_NAME_PREFIX, bintohex, hextobin, jmprint, get_log from jmfrost.chilldkg_ref import chilldkg from .frost_clients import (chilldkg_hexlify, decrypt_ext_recovery, deserialize_ext_recovery, serialize_ext_recovery) -from jmfrost.chilldkg_ref.chilldkg import hostpubkey_gen jlog = get_log() diff --git a/src/jmclient/wallet_service.py b/src/jmclient/wallet_service.py index aa00632..c6e6610 100644 --- a/src/jmclient/wallet_service.py +++ b/src/jmclient/wallet_service.py @@ -8,8 +8,6 @@ from typing import Dict, List, Optional, Set, Tuple from decimal import Decimal from copy import deepcopy from twisted.internet import reactor -from twisted.internet import task -from twisted.internet.defer import Deferred from twisted.application.service import Service from numbers import Integral import jmbitcoin as btc @@ -326,7 +324,7 @@ class WalletService(Service): async def transaction_monitor(self): """Keeps track of any changes in the wallet (new transactions). - Intended to be run as a twisted task.LoopingCall so that this + Intended to be run as a asyncio Task so that this Service is constantly in near-realtime sync with the blockchain. """ diff --git a/src/jmclient/wallet_utils.py b/src/jmclient/wallet_utils.py index bc6d674..2acee21 100644 --- a/src/jmclient/wallet_utils.py +++ b/src/jmclient/wallet_utils.py @@ -12,8 +12,6 @@ from collections import Counter, defaultdict from itertools import islice, chain from typing import Callable, Optional, Tuple, Union -from twisted.internet import reactor, task - from jmclient import (get_network, WALLET_IMPLEMENTATIONS, Storage, podle, jm_single, WalletError, BaseWallet, VolatileStorage, DKGRecoveryStorage, StoragePasswordError, is_taproot_mode, is_segwit_mode, SegwitLegacyWallet, @@ -24,7 +22,6 @@ from jmclient import (get_network, WALLET_IMPLEMENTATIONS, Storage, podle, from jmclient.blockchaininterface import (BitcoinCoreInterface, BitcoinCoreNoHistoryInterface) from jmclient.wallet_service import WalletService -from jmbase import stop_reactor from jmbase.support import (get_password, jmprint, EXIT_FAILURE, EXIT_ARGERROR, utxo_to_utxostr, hextobin, bintohex, IndentedHelpFormatterWithNL, dict_factory, @@ -459,7 +456,7 @@ async def wallet_showutxos(wallet_service: WalletService, showprivkey: bool, for md in _utxos: (enabled, disabled) = await get_utxos_enabled_disabled(wallet_service, md) - for u, av in utxos[md].items(): + for u, av in _utxos[md].items(): success, us = utxo_to_utxostr(u) assert success key = wallet_service._get_key_from_path(av["path"])[0] diff --git a/src/jmfrost/frost_ref/reference.py b/src/jmfrost/frost_ref/reference.py index 2be1b9a..598d582 100644 --- a/src/jmfrost/frost_ref/reference.py +++ b/src/jmfrost/frost_ref/reference.py @@ -10,15 +10,13 @@ # be used in production environments. The code is vulnerable to timing attacks, # for example. -from typing import Any, List, Optional, Tuple, NewType, NamedTuple, Sequence +from typing import List, Optional, Tuple, NewType, NamedTuple, Sequence import itertools import secrets -import time -from ..secp256k1lab.bip340 import schnorr_verify from ..secp256k1lab.keys import pubkey_gen_plain from ..secp256k1lab.secp256k1 import G, GE, Scalar -from ..secp256k1lab.util import bytes_from_int, int_from_bytes, tagged_hash +from ..secp256k1lab.util import int_from_bytes, tagged_hash PlainPk = NewType('PlainPk', bytes) XonlyPk = NewType('XonlyPk', bytes) diff --git a/test/jmclient/commontest.py b/test/jmclient/commontest.py index 403b447..c0d85ff 100644 --- a/test/jmclient/commontest.py +++ b/test/jmclient/commontest.py @@ -5,9 +5,9 @@ import os import random from decimal import Decimal from typing import Callable, List, Optional, Set, Tuple, Union -from unittest import IsolatedAsyncioTestCase as AsyncioTestCase +from unittest import IsolatedAsyncioTestCase as AsyncioTestCase # noqa: F401 -from twisted.trial.unittest import TestCase as TrialTestCase +from twisted.trial.unittest import TestCase as TrialTestCase # noqa: F401 import jmbitcoin as btc from jmbase import (get_log, hextobin, bintohex, dictchanger) diff --git a/test/jmclient/test_client_protocol.py b/test/jmclient/test_client_protocol.py index e56051f..f7990d2 100644 --- a/test/jmclient/test_client_protocol.py +++ b/test/jmclient/test_client_protocol.py @@ -8,7 +8,7 @@ import base64 import pytest -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor from jmbase import get_log, bintohex @@ -17,7 +17,7 @@ from jmclient import load_test_config, Taker,\ JMClientProtocolFactory, jm_single, Maker, WalletService from jmclient.client_protocol import JMTakerClientProtocol from twisted.python.log import msg as tmsg -from twisted.internet import protocol, reactor, task +from twisted.internet import protocol, task from twisted.internet.defer import inlineCallbacks from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) diff --git a/test/jmclient/test_coinjoin.py b/test/jmclient/test_coinjoin.py index 8a96462..d710c6b 100644 --- a/test/jmclient/test_coinjoin.py +++ b/test/jmclient/test_coinjoin.py @@ -13,7 +13,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor import pytest diff --git a/test/jmclient/test_core_nohistory_sync.py b/test/jmclient/test_core_nohistory_sync.py index 3b26d60..62b3069 100644 --- a/test/jmclient/test_core_nohistory_sync.py +++ b/test/jmclient/test_core_nohistory_sync.py @@ -7,8 +7,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest from jmbase import get_log diff --git a/test/jmclient/test_frost_clients.py b/test/jmclient/test_frost_clients.py index 1d18b93..839df4c 100644 --- a/test/jmclient/test_frost_clients.py +++ b/test/jmclient/test_frost_clients.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- -from pprint import pprint - from hashlib import sha256 from unittest import IsolatedAsyncioTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest diff --git a/test/jmclient/test_frost_ipc.py b/test/jmclient/test_frost_ipc.py index bc975a7..918753c 100644 --- a/test/jmclient/test_frost_ipc.py +++ b/test/jmclient/test_frost_ipc.py @@ -1,14 +1,11 @@ # -*- coding: utf-8 -*- import asyncio -import base64 import time -from pprint import pprint from unittest import IsolatedAsyncioTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest @@ -48,7 +45,7 @@ class DummyFrostJMClientProtocol: self.party_clients = {} async def dkg_gen(self): - log.debug(f'Coordinator call dkg_gen') + log.debug('Coordinator call dkg_gen') client = self.factory.client md_type_idx = None session_id = None @@ -167,11 +164,11 @@ class DummyFrostJMClientProtocol: async def on_dkg_finalized(self, nick, session_id): client = self.factory.client - log.debug(f'Coordinator get dkgfinalized') + log.debug('Coordinator get dkgfinalized') client.on_dkg_finalized(nick, session_id) def frost_req(self, dkg_session_id, msg_bytes): - log.debug(f'Coordinator call frost_req') + log.debug('Coordinator call frost_req') client = self.factory.client hostpubkeyhash, sig, session_id = client.frost_req( dkg_session_id, msg_bytes) diff --git a/test/jmclient/test_frost_wallet.py b/test/jmclient/test_frost_wallet.py index 58145c8..74960a5 100644 --- a/test/jmclient/test_frost_wallet.py +++ b/test/jmclient/test_frost_wallet.py @@ -1,14 +1,12 @@ '''Wallet functionality tests.''' import os import json -from pprint import pprint from unittest import IsolatedAsyncioTestCase from fastbencode import bdecode -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest import jmbitcoin as btc diff --git a/test/jmclient/test_maker.py b/test/jmclient/test_maker.py index 6c12d6d..198afd5 100644 --- a/test/jmclient/test_maker.py +++ b/test/jmclient/test_maker.py @@ -2,20 +2,17 @@ import datetime from unittest import IsolatedAsyncioTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import jmbitcoin as btc from jmclient import Maker, load_test_config, jm_single, WalletService, VolatileStorage, \ SegwitWalletFidelityBonds, get_network -import jmclient from commontest import DummyBlockchainInterface from test_taker import DummyWallet import struct import binascii from itertools import chain -import pytest from _pytest.monkeypatch import MonkeyPatch diff --git a/test/jmclient/test_psbt_wallet.py b/test/jmclient/test_psbt_wallet.py index 10e4d2a..a7c5659 100644 --- a/test/jmclient/test_psbt_wallet.py +++ b/test/jmclient/test_psbt_wallet.py @@ -12,8 +12,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor from commontest import make_wallets, dummy_accept_callback, dummy_info_callback diff --git a/test/jmclient/test_snicker.py b/test/jmclient/test_snicker.py index afe1370..11bc2bf 100644 --- a/test/jmclient/test_snicker.py +++ b/test/jmclient/test_snicker.py @@ -7,8 +7,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor from commontest import make_wallets, dummy_accept_callback, dummy_info_callback import jmbitcoin as btc diff --git a/test/jmclient/test_taker.py b/test/jmclient/test_taker.py index d1e513b..0249463 100644 --- a/test/jmclient/test_taker.py +++ b/test/jmclient/test_taker.py @@ -12,8 +12,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor from commontest import DummyBlockchainInterface import jmbitcoin as bitcoin diff --git a/test/jmclient/test_taproot_wallet.py b/test/jmclient/test_taproot_wallet.py index bd655f5..db1954e 100644 --- a/test/jmclient/test_taproot_wallet.py +++ b/test/jmclient/test_taproot_wallet.py @@ -9,8 +9,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest from _pytest.monkeypatch import MonkeyPatch diff --git a/test/jmclient/test_tx_creation.py b/test/jmclient/test_tx_creation.py index 3c6b713..c5acc46 100644 --- a/test/jmclient/test_tx_creation.py +++ b/test/jmclient/test_tx_creation.py @@ -9,8 +9,7 @@ import pytest import struct from unittest import IsolatedAsyncioTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor from commontest import make_wallets, make_sign_and_push, ensure_bip65_activated diff --git a/test/jmclient/test_utxomanager.py b/test/jmclient/test_utxomanager.py index ff086b6..8e4dbc2 100644 --- a/test/jmclient/test_utxomanager.py +++ b/test/jmclient/test_utxomanager.py @@ -1,15 +1,12 @@ from test_storage import MockStorage -import pytest from _pytest.monkeypatch import MonkeyPatch from unittest import IsolatedAsyncioTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor from jmclient.wallet import UTXOManager from jmclient import load_test_config -import jmclient from commontest import DummyBlockchainInterface diff --git a/test/jmclient/test_wallet.py b/test/jmclient/test_wallet.py index d09d059..038cebf 100644 --- a/test/jmclient/test_wallet.py +++ b/test/jmclient/test_wallet.py @@ -8,8 +8,7 @@ from unittest import IsolatedAsyncioTestCase from unittest_parametrize import parametrize, ParametrizedTestCase -import jmclient # install asyncioreactor -from twisted.internet import reactor +import jmclient # noqa: F401 install asyncioreactor import pytest from _pytest.monkeypatch import MonkeyPatch @@ -22,7 +21,7 @@ from jmclient import load_test_config, jm_single, BaseWallet, \ SegwitWallet, WalletService, SegwitWalletFidelityBonds,\ create_wallet, open_test_wallet_maybe, open_wallet, \ FidelityBondMixin, FidelityBondWatchonlyWallet,\ - wallet_gettimelockaddress, UnknownAddressForLabel, TaprootWallet + wallet_gettimelockaddress, UnknownAddressForLabel from test_blockchaininterface import sync_test_wallet from freezegun import freeze_time diff --git a/test/jmclient/test_wallet_rpc.py b/test/jmclient/test_wallet_rpc.py index 8e61a48..7479ef1 100644 --- a/test/jmclient/test_wallet_rpc.py +++ b/test/jmclient/test_wallet_rpc.py @@ -4,7 +4,7 @@ import functools import json import os -import jmclient # install asyncioreactor +import jmclient # noqa: F401 install asyncioreactor from twisted.internet import reactor import jwt diff --git a/test/jmclient/test_websocket.py b/test/jmclient/test_websocket.py index 6d3cdf0..cabccbb 100644 --- a/test/jmclient/test_websocket.py +++ b/test/jmclient/test_websocket.py @@ -1,7 +1,7 @@ import os import json -from twisted.internet import reactor, task +from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, Deferred from twisted.trial import unittest from autobahn.twisted.websocket import WebSocketClientFactory, \ diff --git a/test/jmclient/test_yieldgenerator.py b/test/jmclient/test_yieldgenerator.py index 71af967..614f809 100644 --- a/test/jmclient/test_yieldgenerator.py +++ b/test/jmclient/test_yieldgenerator.py @@ -1,5 +1,4 @@ - -import unittest +# -*- coding: utf-8 -*- import pytest from jmbitcoin import CMutableTxOut, CMutableTransaction diff --git a/test/jmfrost/test_frost_ref.py b/test/jmfrost/test_frost_ref.py index 822399a..a8e62b5 100644 --- a/test/jmfrost/test_frost_ref.py +++ b/test/jmfrost/test_frost_ref.py @@ -3,7 +3,6 @@ import json import os import secrets -import sys import time from typing import List, Optional, Tuple diff --git a/test/unified/common.py b/test/unified/common.py index a3b5ade..9caec62 100644 --- a/test/unified/common.py +++ b/test/unified/common.py @@ -10,8 +10,8 @@ from decimal import Decimal data_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.insert(0, os.path.join(data_dir)) -from unittest import IsolatedAsyncioTestCase as AsyncioTestCase -from twisted.trial.unittest import TestCase as TrialTestCase +from unittest import IsolatedAsyncioTestCase as AsyncioTestCase # noqa: F401 +from twisted.trial.unittest import TestCase as TrialTestCase # noqa: F401 from jmbase import get_log from jmclient import open_test_wallet_maybe, BIP32Wallet, SegwitWallet, \ diff --git a/test/unified/test_e2e_coinjoin.py b/test/unified/test_e2e_coinjoin.py index fdc38d1..2451b81 100644 --- a/test/unified/test_e2e_coinjoin.py +++ b/test/unified/test_e2e_coinjoin.py @@ -16,8 +16,8 @@ import asyncio -import jmclient # install asyncioreactor -from twisted.internet import reactor, defer, task +import jmclient # noqa: F401 install asyncioreactor +from twisted.internet import reactor, defer from twisted.web.client import readBody, Headers from twisted import trial @@ -26,12 +26,10 @@ import pytest import json from datetime import datetime from _pytest.monkeypatch import MonkeyPatch -from jmbase import (get_nontor_agent, BytesProducer, jmprint, - get_log, stop_reactor) +from jmbase import get_nontor_agent, BytesProducer, jmprint, get_log from jmclient import (YieldGeneratorBasic, load_test_config, jm_single, JMClientProtocolFactory, start_reactor, SegwitWallet, get_mchannels, SegwitLegacyWallet, JMWalletDaemon) -import jmclient from jmclient.wallet_rpc import api_version_string pytestmark = pytest.mark.usefixtures("setup_miniircd", "setup_regtest_bitcoind")