From 1451c9e3aeb23a16851465deb906d8764e5190cb Mon Sep 17 00:00:00 2001 From: undeath Date: Sun, 19 Aug 2018 18:21:28 +0200 Subject: [PATCH] remove unused imports --- jmbase/jmbase/commands.py | 2 +- jmbase/jmbase/support.py | 1 - jmbase/test/test_base_support.py | 3 +-- jmbase/test/test_commands.py | 4 ---- jmbitcoin/jmbitcoin/bci.py | 1 - jmbitcoin/jmbitcoin/secp256k1_deterministic.py | 1 - jmbitcoin/jmbitcoin/secp256k1_main.py | 4 ---- jmbitcoin/jmbitcoin/secp256k1_transaction.py | 5 ++++- jmbitcoin/test/test_btc_formatting.py | 1 - jmbitcoin/test/test_main.py | 1 - jmclient/jmclient/blockchaininterface.py | 3 --- jmclient/jmclient/client_protocol.py | 1 - jmclient/jmclient/commitment_utils.py | 2 +- jmclient/jmclient/configure.py | 1 - jmclient/jmclient/jsonrpc.py | 1 - jmclient/jmclient/schedule.py | 1 - jmclient/jmclient/taker.py | 2 +- jmclient/jmclient/taker_utils.py | 2 +- jmclient/test/test_argon2.py | 1 - jmclient/test/test_blockchaininterface.py | 2 +- jmclient/test/test_client_protocol.py | 7 +------ jmclient/test/test_configure.py | 2 -- jmdaemon/jmdaemon/enc_wrapper.py | 2 -- jmdaemon/jmdaemon/irc.py | 7 ------- jmdaemon/jmdaemon/message_channel.py | 4 +++- jmdaemon/test/dummy_mc.py | 6 ------ jmdaemon/test/test_daemon_protocol.py | 8 +------- scripts/joinmarketd.py | 4 ++-- scripts/qtsupport.py | 1 - scripts/sendpayment.py | 7 +------ scripts/sendtomany.py | 2 -- scripts/tumbler.py | 2 +- scripts/yield-generator-basic.py | 3 --- 33 files changed, 19 insertions(+), 75 deletions(-) diff --git a/jmbase/jmbase/commands.py b/jmbase/jmbase/commands.py index a43dda2..d136dc2 100644 --- a/jmbase/jmbase/commands.py +++ b/jmbase/jmbase/commands.py @@ -4,7 +4,7 @@ Commands defining client-server (daemon) messaging protocol (*not* Joinmarket p2p protocol). Used for AMP asynchronous messages. """ -from twisted.protocols.amp import Integer, String, Unicode, Boolean, Command +from twisted.protocols.amp import Boolean, Command, Integer, String from bigstring import BigString class DaemonNotReady(Exception): diff --git a/jmbase/jmbase/support.py b/jmbase/jmbase/support.py index a975fe6..647afe0 100644 --- a/jmbase/jmbase/support.py +++ b/jmbase/jmbase/support.py @@ -4,7 +4,6 @@ import sys import logging import pprint -import random from getpass import getpass logFormatter = logging.Formatter( diff --git a/jmbase/test/test_base_support.py b/jmbase/test/test_base_support.py index 4f333bd..5a53083 100644 --- a/jmbase/test/test_base_support.py +++ b/jmbase/test/test_base_support.py @@ -1,7 +1,6 @@ #! /usr/bin/env python from __future__ import print_function -from jmbase.support import debug_dump_object, get_password, get_log, joinmarket_alert -import pytest +from jmbase.support import debug_dump_object, joinmarket_alert def test_debug_dump_object(): joinmarket_alert[0] = "dummy jm alert" diff --git a/jmbase/test/test_commands.py b/jmbase/test/test_commands.py index db23972..85ec547 100644 --- a/jmbase/test/test_commands.py +++ b/jmbase/test/test_commands.py @@ -1,12 +1,9 @@ #! /usr/bin/env python from __future__ import print_function -from twisted.python.log import startLogging, err -from twisted.python.log import msg as tmsg from twisted.internet import protocol, reactor from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) from twisted.protocols.amp import UnknownRemoteError -from twisted.python import failure from twisted.protocols import amp from twisted.trial import unittest from twisted.internet import reactor, task @@ -14,7 +11,6 @@ from twisted.internet import reactor, task from jmbase.commands import * import json -import pytest test_completed = False diff --git a/jmbitcoin/jmbitcoin/bci.py b/jmbitcoin/jmbitcoin/bci.py index a51e232..6eda124 100644 --- a/jmbitcoin/jmbitcoin/bci.py +++ b/jmbitcoin/jmbitcoin/bci.py @@ -1,7 +1,6 @@ #!/usr/bin/python import json, re import random -import sys import time import platform from jmbase.support import get_log diff --git a/jmbitcoin/jmbitcoin/secp256k1_deterministic.py b/jmbitcoin/jmbitcoin/secp256k1_deterministic.py index 6957dd3..c1d3436 100644 --- a/jmbitcoin/jmbitcoin/secp256k1_deterministic.py +++ b/jmbitcoin/jmbitcoin/secp256k1_deterministic.py @@ -1,7 +1,6 @@ from jmbitcoin.secp256k1_main import * import hmac import hashlib -from binascii import hexlify # Below code ASSUMES binary inputs and compressed pubkeys MAINNET_PRIVATE = b'\x04\x88\xAD\xE4' diff --git a/jmbitcoin/jmbitcoin/secp256k1_main.py b/jmbitcoin/jmbitcoin/secp256k1_main.py index fbb9e4c..15a8b7e 100644 --- a/jmbitcoin/jmbitcoin/secp256k1_main.py +++ b/jmbitcoin/jmbitcoin/secp256k1_main.py @@ -4,11 +4,7 @@ import binascii import hashlib import re import sys -import os import base64 -import time -import random -import hmac import secp256k1 #Required only for PoDLE calculation: diff --git a/jmbitcoin/jmbitcoin/secp256k1_transaction.py b/jmbitcoin/jmbitcoin/secp256k1_transaction.py index c234d34..c563225 100644 --- a/jmbitcoin/jmbitcoin/secp256k1_transaction.py +++ b/jmbitcoin/jmbitcoin/secp256k1_transaction.py @@ -1,5 +1,8 @@ #!/usr/bin/python -import binascii, re, json, copy, sys +import binascii +import copy +import re +import sys from jmbitcoin.secp256k1_main import * from jmbitcoin.bech32 import * from _functools import reduce diff --git a/jmbitcoin/test/test_btc_formatting.py b/jmbitcoin/test/test_btc_formatting.py index 6223ba2..53691e0 100644 --- a/jmbitcoin/test/test_btc_formatting.py +++ b/jmbitcoin/test/test_btc_formatting.py @@ -5,7 +5,6 @@ from __future__ import absolute_import import jmbitcoin as btc import pytest import binascii -import hashlib #used in p2sh addresses def test_hash160(): diff --git a/jmbitcoin/test/test_main.py b/jmbitcoin/test/test_main.py index 8327472..1532eed 100644 --- a/jmbitcoin/test/test_main.py +++ b/jmbitcoin/test/test_main.py @@ -5,7 +5,6 @@ from __future__ import absolute_import import jmbitcoin as btc import binascii -import json import pytest import os testdir = os.path.dirname(os.path.realpath(__file__)) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index 565eacc..b0a1285 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -164,7 +164,6 @@ class BlockchainInterface(object): the wallet. Call the callbacks and update the watcher loop state. End the loop when the confirmation has been seen (no spent monitoring here). """ - pass @abc.abstractmethod def tx_watcher(self, txd, unconfirmfun, confirmfun, spentfun, c, n): @@ -174,7 +173,6 @@ class BlockchainInterface(object): of confs = c. TODO: Deal with conflicts correctly. Here just abandons monitoring. """ - pass @abc.abstractmethod def pushtx(self, txhex): @@ -924,7 +922,6 @@ class RegtestBitcoinCoreInterface(BitcoinCoreInterface): #pragma: no cover log.debug( "Failed to generate blocks, looks like the bitcoin daemon \ has been shut down. Ignoring.") - pass def grab_coins(self, receiving_addr, amt=50): """ diff --git a/jmclient/jmclient/client_protocol.py b/jmclient/jmclient/client_protocol.py index 06418af..24e9fe3 100644 --- a/jmclient/jmclient/client_protocol.py +++ b/jmclient/jmclient/client_protocol.py @@ -6,7 +6,6 @@ from twisted.internet.error import (ConnectionLost, ConnectionAborted, from twisted.protocols import amp try: from twisted.internet.ssl import ClientContextFactory - from twisted.internet import ssl except ImportError: pass from jmbase import commands diff --git a/jmclient/jmclient/commitment_utils.py b/jmclient/jmclient/commitment_utils.py index 007c1b3..588049b 100644 --- a/jmclient/jmclient/commitment_utils.py +++ b/jmclient/jmclient/commitment_utils.py @@ -1,6 +1,6 @@ from __future__ import print_function -import sys, os +import sys import jmclient.btc as btc from jmclient import jm_single, get_p2pk_vbyte, get_p2sh_vbyte diff --git a/jmclient/jmclient/configure.py b/jmclient/jmclient/configure.py index 07ee465..bd0a17a 100644 --- a/jmclient/jmclient/configure.py +++ b/jmclient/jmclient/configure.py @@ -5,7 +5,6 @@ import logging import threading import os import binascii -import sys from ConfigParser import SafeConfigParser, NoOptionError diff --git a/jmclient/jmclient/jsonrpc.py b/jmclient/jmclient/jsonrpc.py index 53a0ea1..6a83603 100644 --- a/jmclient/jmclient/jsonrpc.py +++ b/jmclient/jmclient/jsonrpc.py @@ -46,7 +46,6 @@ class JsonRpcConnectionError(Exception): are wrong. """ - pass class JsonRpc(object): diff --git a/jmclient/jmclient/schedule.py b/jmclient/jmclient/schedule.py index 0f9f7ab..90287d3 100644 --- a/jmclient/jmclient/schedule.py +++ b/jmclient/jmclient/schedule.py @@ -1,7 +1,6 @@ #!/usr/bin/env python from __future__ import print_function import copy -from pprint import pformat from jmclient import (validate_address, rand_exp_array, rand_norm_array, rand_pow_array, jm_single) """Utility functions for dealing with Taker schedules. diff --git a/jmclient/jmclient/taker.py b/jmclient/jmclient/taker.py index bc06f54..8074982 100644 --- a/jmclient/jmclient/taker.py +++ b/jmclient/jmclient/taker.py @@ -7,7 +7,7 @@ import random from binascii import hexlify, unhexlify import btc -from jmclient.configure import jm_single, get_p2pk_vbyte, get_p2sh_vbyte +from jmclient.configure import get_p2sh_vbyte, jm_single from jmbase.support import get_log from jmclient.support import (calc_cj_fee, weighted_order_choose, choose_orders, choose_sweep_orders) diff --git a/jmclient/jmclient/taker_utils.py b/jmclient/jmclient/taker_utils.py index 25eb295..ea03973 100644 --- a/jmclient/jmclient/taker_utils.py +++ b/jmclient/jmclient/taker_utils.py @@ -9,7 +9,7 @@ from binascii import hexlify, unhexlify from .configure import get_log, jm_single, validate_address from .schedule import human_readable_schedule_entry, tweak_tumble_schedule from .wallet import BaseWallet, estimate_tx_fee -from .btc import mktx, serialize, deserialize, sign, txhash +from .btc import deserialize, mktx, serialize, txhash log = get_log() """ diff --git a/jmclient/test/test_argon2.py b/jmclient/test/test_argon2.py index 7de4b78..158c084 100644 --- a/jmclient/test/test_argon2.py +++ b/jmclient/test/test_argon2.py @@ -1,7 +1,6 @@ from __future__ import print_function, absolute_import, division, unicode_literals from jmclient import Argon2Hash, get_random_bytes -import pytest def test_argon2_sanity(): diff --git a/jmclient/test/test_blockchaininterface.py b/jmclient/test/test_blockchaininterface.py index 58fe400..f6e6bcf 100644 --- a/jmclient/test/test_blockchaininterface.py +++ b/jmclient/test/test_blockchaininterface.py @@ -3,7 +3,7 @@ from __future__ import absolute_import, print_function """Blockchaininterface functionality tests.""" import binascii -from commontest import create_wallet_for_sync, make_sign_and_push +from commontest import create_wallet_for_sync import pytest from jmclient import load_program_config, jm_single, sync_wallet, get_log diff --git a/jmclient/test/test_client_protocol.py b/jmclient/test/test_client_protocol.py index f0e8f17..87cd114 100644 --- a/jmclient/test/test_client_protocol.py +++ b/jmclient/test/test_client_protocol.py @@ -2,24 +2,19 @@ from __future__ import absolute_import '''test client-protocol interfacae.''' -import pytest from jmclient import (get_schedule, load_program_config, start_reactor, Taker, get_log, JMClientProtocolFactory, jm_single) -from jmclient.client_protocol import JMProtocolError, JMTakerClientProtocol -import os -from twisted.python.log import startLogging, err +from jmclient.client_protocol import JMTakerClientProtocol from twisted.python.log import msg as tmsg from twisted.internet import protocol, reactor, task from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) from twisted.protocols.amp import UnknownRemoteError -from twisted.python import failure from twisted.protocols import amp from twisted.trial import unittest from jmbase.commands import * from taker_test_data import t_raw_signed_tx import json -import time import jmbitcoin as bitcoin import twisted diff --git a/jmclient/test/test_configure.py b/jmclient/test/test_configure.py index 1136ad6..ff3a610 100644 --- a/jmclient/test/test_configure.py +++ b/jmclient/test/test_configure.py @@ -8,8 +8,6 @@ from jmclient import (load_program_config, jm_single, get_irc_mchannels, JsonRpcConnectionError) from jmclient.configure import (get_config_irc_channel, get_p2sh_vbyte, get_p2pk_vbyte, get_blockchain_interface_instance) -import jmbitcoin as bitcoin -import copy import os def test_attribute_dict(): diff --git a/jmdaemon/jmdaemon/enc_wrapper.py b/jmdaemon/jmdaemon/enc_wrapper.py index 10e8ac2..06fc8c5 100644 --- a/jmdaemon/jmdaemon/enc_wrapper.py +++ b/jmdaemon/jmdaemon/enc_wrapper.py @@ -8,8 +8,6 @@ from __future__ import absolute_import, print_function import binascii import base64 -import string -import random from libnacl import public diff --git a/jmdaemon/jmdaemon/irc.py b/jmdaemon/jmdaemon/irc.py index d9370a6..85ccb15 100644 --- a/jmdaemon/jmdaemon/irc.py +++ b/jmdaemon/jmdaemon/irc.py @@ -1,17 +1,10 @@ from __future__ import absolute_import, print_function -import base64 -import random -import socket -import ssl #TODO: SSL support (can it be done without back-end openssl?) -import threading -import time from twisted.internet import reactor, protocol from twisted.internet.endpoints import TCP4ClientEndpoint from twisted.application.internet import ClientService from twisted.internet.ssl import ClientContextFactory -from twisted.logger import Logger from twisted.words.protocols import irc from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) diff --git a/jmdaemon/jmdaemon/message_channel.py b/jmdaemon/jmdaemon/message_channel.py index ba6c6af..7567871 100644 --- a/jmdaemon/jmdaemon/message_channel.py +++ b/jmdaemon/jmdaemon/message_channel.py @@ -1,6 +1,8 @@ #! /usr/bin/env python from __future__ import print_function -import base64, abc, threading, time +import abc +import base64 +import threading from jmdaemon import ( encrypt_encode, decode_decrypt, COMMAND_PREFIX, ORDER_KEYS, NICK_HASH_LENGTH, NICK_MAX_ENCODED, JM_VERSION, JOINMARKET_NICK_HEADER, diff --git a/jmdaemon/test/dummy_mc.py b/jmdaemon/test/dummy_mc.py index edcb0d7..5394c50 100644 --- a/jmdaemon/test/dummy_mc.py +++ b/jmdaemon/test/dummy_mc.py @@ -1,10 +1,5 @@ from __future__ import absolute_import, print_function -import base64 -import random -import socket -import ssl -import threading import time @@ -61,7 +56,6 @@ class DummyMessageChannel(MessageChannel): def _privmsg(self, nick, cmd, message): """As for pubmsg """ - pass def _announce_orders(self, orderlist): pass def change_nick(self, new_nick): diff --git a/jmdaemon/test/test_daemon_protocol.py b/jmdaemon/test/test_daemon_protocol.py index 08b4e1c..4e0f9b9 100644 --- a/jmdaemon/test/test_daemon_protocol.py +++ b/jmdaemon/test/test_daemon_protocol.py @@ -2,31 +2,25 @@ from __future__ import absolute_import '''test daemon-protocol interfacae.''' -import pytest from jmdaemon import (JMDaemonServerProtocolFactory, MessageChannelCollection) from jmdaemon.orderbookwatch import OrderbookWatch from jmdaemon.daemon_protocol import JMDaemonServerProtocol from jmdaemon.protocol import (COMMAND_PREFIX, ORDER_KEYS, NICK_HASH_LENGTH, NICK_MAX_ENCODED, JM_VERSION, JOINMARKET_NICK_HEADER) from jmclient import (load_program_config, get_log, jm_single, get_irc_mchannels) -import os -from twisted.python.log import startLogging, err from twisted.python.log import msg as tmsg from twisted.internet import protocol, reactor, task -from twisted.internet.protocol import ServerFactory, ClientCreator +from twisted.internet.protocol import ServerFactory from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) from twisted.protocols.amp import UnknownRemoteError -from twisted.python import failure from twisted.protocols import amp from twisted.trial import unittest from jmbase.commands import * from msgdata import * import json -import time import base64 from dummy_mc import DummyMessageChannel -from test_message_channel import make_valid_nick test_completed = False end_early = False jlog = get_log() diff --git a/scripts/joinmarketd.py b/scripts/joinmarketd.py index aaa7a76..7aa20b8 100644 --- a/scripts/joinmarketd.py +++ b/scripts/joinmarketd.py @@ -1,6 +1,6 @@ import sys -from twisted.internet import reactor, ssl -from twisted.python.log import startLogging, err +from twisted.internet import reactor +from twisted.python.log import startLogging import jmdaemon def startup_joinmarketd(host, port, usessl, finalizer=None, finalizer_args=None): diff --git a/scripts/qtsupport.py b/scripts/qtsupport.py index ed29b78..36b8060 100644 --- a/scripts/qtsupport.py +++ b/scripts/qtsupport.py @@ -20,7 +20,6 @@ Qt files for the wizard for initiating a tumbler run. ''' import sys, math, re, logging, Queue from collections import namedtuple -from decimal import Decimal from PyQt4 import QtCore from PyQt4.QtGui import * diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index ed033fd..35b6776 100644 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -8,13 +8,8 @@ For notes, see scripts/README.md; in particular, note the use of "schedules" with the -S flag. """ -import random import sys -import threading -from optparse import OptionParser from twisted.internet import reactor -import time -import os import pprint from jmclient import ( @@ -24,7 +19,7 @@ from jmclient import ( sync_wallet, RegtestBitcoinCoreInterface, estimate_tx_fee, direct_send, open_test_wallet_maybe, get_wallet_path) from twisted.python.log import startLogging -from jmbase.support import get_log, debug_dump_object, get_password +from jmbase.support import get_log from cli_options import get_sendpayment_parser log = get_log() diff --git a/scripts/sendtomany.py b/scripts/sendtomany.py index a5b44e0..25c71fd 100644 --- a/scripts/sendtomany.py +++ b/scripts/sendtomany.py @@ -6,8 +6,6 @@ for a Joinmarket user, although of course it may be useful for other reasons). """ -import binascii -import sys, os from pprint import pformat from optparse import OptionParser import jmclient.btc as btc diff --git a/scripts/tumbler.py b/scripts/tumbler.py index 5d05b3c..d351c32 100644 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -14,7 +14,7 @@ from jmclient import ( tweak_tumble_schedule, human_readable_schedule_entry, schedule_to_text, restart_waiter, get_tumble_log, tumbler_taker_finished_update, tumbler_filter_orders_callback) -from jmbase.support import get_log, debug_dump_object, get_password +from jmbase.support import get_log from cli_options import get_tumbler_parser log = get_log() logsdir = os.path.join(os.path.dirname( diff --git a/scripts/yield-generator-basic.py b/scripts/yield-generator-basic.py index 485fa7f..713ae6f 100644 --- a/scripts/yield-generator-basic.py +++ b/scripts/yield-generator-basic.py @@ -1,9 +1,6 @@ #! /usr/bin/env python from __future__ import absolute_import, print_function -import datetime -import os -import time from jmclient import (YieldGenerator, YieldGeneratorBasic, ygmain, get_log, jm_single, calc_cj_fee)