From fde23c3cc59de334caa6dfa5ada7041468d5c903 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 14 Apr 2021 15:54:18 +0300 Subject: [PATCH] Remove unused imports --- jmbitcoin/jmbitcoin/blocks.py | 5 ++--- jmbitcoin/jmbitcoin/secp256k1_transaction.py | 1 - jmbitcoin/test/test_tx_signing.py | 3 +-- jmdaemon/jmdaemon/daemon_protocol.py | 2 +- scripts/add-utxo.py | 7 +++---- scripts/joinmarket-qt.py | 7 +++---- scripts/receive-payjoin.py | 3 +-- scripts/sendpayment.py | 2 +- scripts/sendtomany.py | 1 - scripts/snicker/create-snicker-proposal.py | 8 ++++---- scripts/snicker/snicker-finder.py | 2 +- scripts/snicker/snicker-recovery.py | 4 ++-- scripts/snicker/snicker-seed-tx.py | 11 ++++------- scripts/snicker/snicker-server.py | 3 +-- scripts/yg-privacyenhanced.py | 1 - test/payjoinserver.py | 4 +--- 16 files changed, 25 insertions(+), 39 deletions(-) diff --git a/jmbitcoin/jmbitcoin/blocks.py b/jmbitcoin/jmbitcoin/blocks.py index 95eb0da..89289b9 100644 --- a/jmbitcoin/jmbitcoin/blocks.py +++ b/jmbitcoin/jmbitcoin/blocks.py @@ -3,10 +3,9 @@ Module implementing actions that can be taken on network-serialized bitcoin blocks. """ -import struct -from jmbase import hextobin, bintohex +from jmbase import hextobin from bitcointx.core import CBitcoinTransaction -from bitcointx.core.serialize import VarIntSerializer, VarBytesSerializer +from bitcointx.core.serialize import VarIntSerializer def decode_varint(data): n, tail = VarIntSerializer.deserialize_partial(data) diff --git a/jmbitcoin/jmbitcoin/secp256k1_transaction.py b/jmbitcoin/jmbitcoin/secp256k1_transaction.py index beaa80d..5b061d7 100644 --- a/jmbitcoin/jmbitcoin/secp256k1_transaction.py +++ b/jmbitcoin/jmbitcoin/secp256k1_transaction.py @@ -3,7 +3,6 @@ # note, only used for non-cryptographic randomness: import random import json -import itertools # needed for single sha256 evaluation, which is used # in bitcoin (p2wsh) but not exposed in python-bitcointx: import hashlib diff --git a/jmbitcoin/test/test_tx_signing.py b/jmbitcoin/test/test_tx_signing.py index 28ca2ba..48fc7bf 100644 --- a/jmbitcoin/test/test_tx_signing.py +++ b/jmbitcoin/test/test_tx_signing.py @@ -2,7 +2,6 @@ import pytest -import binascii import hashlib from jmbase import bintohex import jmbitcoin as btc @@ -90,4 +89,4 @@ def test_bip143_tv(): tx = btc.CMutableTransaction.deserialize(btc.x(rawtx_hex)) btc.sign(tx, 0, btc.x(privkey_hex), amount=btc.coins_to_satoshi(10), native=False) expectedsignedtx = "01000000000101db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a5477010000001716001479091972186c449eb1ded22b78e40d009bdf0089feffffff02b8b4eb0b000000001976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac0008af2f000000001976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac02473044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb012103ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a2687392040000" - assert btc.b2x(tx.serialize()) == expectedsignedtx \ No newline at end of file + assert btc.b2x(tx.serialize()) == expectedsignedtx diff --git a/jmdaemon/jmdaemon/daemon_protocol.py b/jmdaemon/jmdaemon/daemon_protocol.py index 3bc9268..2694e0b 100644 --- a/jmdaemon/jmdaemon/daemon_protocol.py +++ b/jmdaemon/jmdaemon/daemon_protocol.py @@ -11,7 +11,7 @@ from .irc import IRCMessageChannel from jmbase import (hextobin, is_hs_uri, get_tor_agent, JMHiddenService, get_nontor_agent, BytesProducer, wrapped_urlparse, - bintohex, bdict_sdict_convert, JMHTTPResource) + bdict_sdict_convert, JMHTTPResource) from jmbase.commands import * from twisted.protocols import amp from twisted.internet import reactor, ssl, task diff --git a/scripts/add-utxo.py b/scripts/add-utxo.py index 6c1e03e..3675cb9 100755 --- a/scripts/add-utxo.py +++ b/scripts/add-utxo.py @@ -9,16 +9,15 @@ the anti-snooping feature employed by makers. import sys import os import json -import binascii from pprint import pformat from optparse import OptionParser from jmclient import load_program_config, jm_single,\ open_wallet, WalletService, add_external_commitments, update_commitments,\ PoDLE, get_podle_commitments, get_utxo_info, validate_utxo_data, quit,\ - get_wallet_path, add_base_options, BTCEngine, BTC_P2SH_P2WPKH -from jmbase.support import EXIT_SUCCESS, EXIT_FAILURE, EXIT_ARGERROR, \ - jmprint, utxostr_to_utxo + get_wallet_path, add_base_options, BTCEngine +from jmbase.support import EXIT_SUCCESS, EXIT_FAILURE, \ + jmprint def add_ext_commitments(utxo_datas): diff --git a/scripts/joinmarket-qt.py b/scripts/joinmarket-qt.py index f862237..6cb5164 100755 --- a/scripts/joinmarket-qt.py +++ b/scripts/joinmarket-qt.py @@ -60,7 +60,7 @@ JM_GUI_VERSION = '21dev' from jmbase import get_log, stop_reactor from jmbase.support import DUST_THRESHOLD, EXIT_FAILURE, utxo_to_utxostr,\ - bintohex, hextobin, JM_CORE_VERSION + hextobin, JM_CORE_VERSION import jmbitcoin as btc from jmclient import load_program_config, get_network, update_persist_config,\ open_test_wallet_maybe, get_wallet_path,\ @@ -72,9 +72,8 @@ from jmclient import load_program_config, get_network, update_persist_config,\ wallet_generate_recover_bip39, wallet_display, get_utxos_enabled_disabled,\ NO_ROUNDING, get_max_cj_fee_values, get_default_max_absolute_fee, \ get_default_max_relative_fee, RetryableStorageError, add_base_options, \ - BTCEngine, BTC_P2SH_P2WPKH, FidelityBondMixin, wallet_change_passphrase, \ - parse_payjoin_setup, send_payjoin, JMBIP78ReceiverManager, \ - BIP78ClientProtocolFactory + BTCEngine, FidelityBondMixin, wallet_change_passphrase, \ + parse_payjoin_setup, send_payjoin, JMBIP78ReceiverManager from qtsupport import ScheduleWizard, TumbleRestartWizard, config_tips,\ config_types, QtHandler, XStream, Buttons, OkButton, CancelButton,\ PasswordDialog, MyTreeWidget, JMQtMessageBox, BLUE_FG,\ diff --git a/scripts/receive-payjoin.py b/scripts/receive-payjoin.py index c1e2df7..af78a85 100755 --- a/scripts/receive-payjoin.py +++ b/scripts/receive-payjoin.py @@ -3,9 +3,8 @@ from optparse import OptionParser import sys -from twisted.python.log import startLogging from twisted.internet import reactor -from jmbase import get_log, set_logging_level, jmprint +from jmbase import get_log, jmprint from jmclient import jm_single, load_program_config, \ WalletService, open_test_wallet_maybe, get_wallet_path, check_regtest, \ add_base_options, JMBIP78ReceiverManager, start_reactor diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index 847a6c1..b812e2a 100755 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -18,7 +18,7 @@ from jmclient import Taker, load_program_config, get_schedule,\ get_sendpayment_parser, get_max_cj_fee_values, check_regtest, \ parse_payjoin_setup, send_payjoin from twisted.python.log import startLogging -from jmbase.support import get_log, set_logging_level, jmprint, \ +from jmbase.support import get_log, jmprint, \ EXIT_FAILURE, EXIT_ARGERROR, DUST_THRESHOLD import jmbitcoin as btc diff --git a/scripts/sendtomany.py b/scripts/sendtomany.py index 44b8652..8087b42 100755 --- a/scripts/sendtomany.py +++ b/scripts/sendtomany.py @@ -5,7 +5,6 @@ for a Joinmarket user, although of course it may be useful for other reasons). """ -from pprint import pformat from optparse import OptionParser import jmbitcoin as btc from jmbase import (get_log, jmprint, bintohex, utxostr_to_utxo, diff --git a/scripts/snicker/create-snicker-proposal.py b/scripts/snicker/create-snicker-proposal.py index 50e150d..9099f6e 100644 --- a/scripts/snicker/create-snicker-proposal.py +++ b/scripts/snicker/create-snicker-proposal.py @@ -23,12 +23,12 @@ output to stdout in the same string format: base64proposal,hexpubkey. import sys from optparse import OptionParser -from jmbase import BytesProducer, bintohex, jmprint, hextobin, \ +from jmbase import bintohex, jmprint, hextobin, \ EXIT_ARGERROR, EXIT_FAILURE, EXIT_SUCCESS, get_pow import jmbitcoin as btc -from jmclient import (RegtestBitcoinCoreInterface, process_shutdown, - jm_single, load_program_config, check_regtest, select_one_utxo, - estimate_tx_fee, SNICKERReceiver, add_base_options, get_wallet_path, +from jmclient import (process_shutdown, + jm_single, load_program_config, check_regtest, + estimate_tx_fee, add_base_options, get_wallet_path, open_test_wallet_maybe, WalletService, SNICKERClientProtocolFactory, start_reactor, JMPluginService) from jmclient.configure import get_log diff --git a/scripts/snicker/snicker-finder.py b/scripts/snicker/snicker-finder.py index 4fc2dee..e49e31c 100644 --- a/scripts/snicker/snicker-finder.py +++ b/scripts/snicker/snicker-finder.py @@ -25,7 +25,7 @@ parses the raw blocks. """ from optparse import OptionParser -from jmbase import bintohex, EXIT_ARGERROR, EXIT_FAILURE, jmprint +from jmbase import bintohex, EXIT_ARGERROR, jmprint import jmbitcoin as btc from jmclient import (jm_single, add_base_options, load_program_config, check_regtest) diff --git a/scripts/snicker/snicker-recovery.py b/scripts/snicker/snicker-recovery.py index c5c8e1e..1fa6b85 100644 --- a/scripts/snicker/snicker-recovery.py +++ b/scripts/snicker/snicker-recovery.py @@ -25,9 +25,9 @@ or at least, the imported keys themselves.) """ from optparse import OptionParser -from jmbase import bintohex, EXIT_ARGERROR, EXIT_FAILURE, jmprint +from jmbase import bintohex, EXIT_ARGERROR, jmprint import jmbitcoin as btc -from jmclient import (jm_single, add_base_options, load_program_config, +from jmclient import (add_base_options, load_program_config, check_regtest, get_wallet_path, open_test_wallet_maybe, WalletService) from jmclient.configure import get_log diff --git a/scripts/snicker/snicker-seed-tx.py b/scripts/snicker/snicker-seed-tx.py index a51855b..2aec47b 100644 --- a/scripts/snicker/snicker-seed-tx.py +++ b/scripts/snicker/snicker-seed-tx.py @@ -22,14 +22,11 @@ a *signalling* fake coinjoin, so it is better not to violate the principle. import sys import random from optparse import OptionParser -from jmbase import BytesProducer, bintohex, jmprint, hextobin, \ - EXIT_ARGERROR, EXIT_FAILURE, EXIT_SUCCESS +from jmbase import bintohex, jmprint, EXIT_ARGERROR, EXIT_FAILURE import jmbitcoin as btc -from jmclient import (RegtestBitcoinCoreInterface, process_shutdown, - jm_single, load_program_config, check_regtest, select_one_utxo, - estimate_tx_fee, SNICKERReceiver, add_base_options, get_wallet_path, - open_test_wallet_maybe, WalletService, SNICKERClientProtocolFactory, - start_reactor, JMPluginService) +from jmclient import (jm_single, load_program_config, check_regtest, + estimate_tx_fee, add_base_options, get_wallet_path, + open_test_wallet_maybe, WalletService, JMPluginService) from jmclient.support import select_greedy, NotEnoughFundsException from jmclient.configure import get_log diff --git a/scripts/snicker/snicker-server.py b/scripts/snicker/snicker-server.py index 5f6677b..9601ebf 100644 --- a/scripts/snicker/snicker-server.py +++ b/scripts/snicker/snicker-server.py @@ -33,9 +33,8 @@ import base64 import json import sqlite3 import threading -import hashlib from io import BytesIO -from jmbase import jmprint, hextobin, bintohex, verify_pow +from jmbase import jmprint, hextobin, verify_pow from jmclient import process_shutdown, jm_single, load_program_config from jmclient.configure import get_log diff --git a/scripts/yg-privacyenhanced.py b/scripts/yg-privacyenhanced.py index ee0bb35..f4760e8 100755 --- a/scripts/yg-privacyenhanced.py +++ b/scripts/yg-privacyenhanced.py @@ -4,7 +4,6 @@ from future.utils import iteritems import random from jmbase import get_log, jmprint -from jmbase.support import lookup_appdata_folder from jmclient import YieldGeneratorBasic, ygmain, jm_single # This is a maker for the purposes of generating a yield from held bitcoins diff --git a/test/payjoinserver.py b/test/payjoinserver.py index 83e0f88..d1b6c9e 100644 --- a/test/payjoinserver.py +++ b/test/payjoinserver.py @@ -13,13 +13,11 @@ """ import os from twisted.web.server import Site -from twisted.web.resource import Resource from twisted.internet import ssl -from twisted.internet import reactor, endpoints +from twisted.internet import reactor from common import make_wallets import pytest from jmbase import jmprint -import jmbitcoin as btc from jmclient import load_test_config, jm_single,\ SegwitWallet, SegwitLegacyWallet, cryptoengine, PayjoinServer