Remove unused imports. Explicitly import a few deep imports.
This commit is contained in:
@@ -27,9 +27,8 @@ import os
|
||||
from . import bitcoin
|
||||
from . import keystore
|
||||
from .keystore import bip44_derivation
|
||||
from .wallet import Wallet, Imported_Wallet, Standard_Wallet, Multisig_Wallet, wallet_types
|
||||
from .wallet import Imported_Wallet, Standard_Wallet, Multisig_Wallet, wallet_types
|
||||
from .i18n import _
|
||||
from .plugins import run_hook
|
||||
|
||||
|
||||
class BaseWizard(object):
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
import hashlib
|
||||
import base64
|
||||
import re
|
||||
import hmac
|
||||
import os
|
||||
import json
|
||||
|
||||
@@ -27,7 +27,7 @@ from math import floor, log10
|
||||
|
||||
from .bitcoin import sha256, COIN, TYPE_ADDRESS
|
||||
from .transaction import Transaction
|
||||
from .util import NotEnoughFunds, PrintError, profiler
|
||||
from .util import NotEnoughFunds, PrintError
|
||||
|
||||
|
||||
# A simple deterministic PRNG. Used to deterministically shuffle a
|
||||
|
||||
@@ -23,10 +23,8 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
import time
|
||||
import copy
|
||||
import argparse
|
||||
import json
|
||||
@@ -41,9 +39,7 @@ from .import bitcoin
|
||||
from .bitcoin import is_address, hash_160, COIN, TYPE_ADDRESS
|
||||
from .i18n import _
|
||||
from .transaction import Transaction
|
||||
from .import paymentrequest
|
||||
from .paymentrequest import PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED
|
||||
from .import contacts
|
||||
from .plugins import run_hook
|
||||
|
||||
known_commands = {}
|
||||
|
||||
@@ -20,16 +20,12 @@
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
import sys
|
||||
import re
|
||||
import dns
|
||||
import os
|
||||
import json
|
||||
|
||||
from . import bitcoin
|
||||
from . import dnssec
|
||||
from .util import print_error
|
||||
from .i18n import _
|
||||
|
||||
|
||||
class Contacts(dict):
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
# SOFTWARE.
|
||||
import ast
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
# from jsonrpc import JSONRPCResponseManager
|
||||
@@ -34,12 +33,11 @@ from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer, SimpleJSONRPCReq
|
||||
from .version import ELECTRUM_VERSION
|
||||
from .network import Network
|
||||
from .util import json_decode, DaemonThread
|
||||
from .util import print_msg, print_error, print_stderr, UserCancelled
|
||||
from .util import print_error
|
||||
from .wallet import Wallet
|
||||
from .storage import WalletStorage
|
||||
from .commands import known_commands, Commands
|
||||
from .simple_config import SimpleConfig
|
||||
from .plugins import run_hook
|
||||
from .exchange_rate import FxThread
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
# https://github.com/rthalley/dnspython/blob/master/tests/test_dnssec.py
|
||||
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
# import traceback
|
||||
# import sys
|
||||
import time
|
||||
import struct
|
||||
|
||||
@@ -56,7 +56,6 @@ import dns.rdtypes.ANY.SOA
|
||||
import dns.rdtypes.ANY.TXT
|
||||
import dns.rdtypes.IN.A
|
||||
import dns.rdtypes.IN.AAAA
|
||||
from dns.exception import DNSException
|
||||
|
||||
|
||||
# Pure-Python version of dns.dnssec._validate_rsig
|
||||
|
||||
@@ -4,14 +4,12 @@ import requests
|
||||
import sys
|
||||
from threading import Thread
|
||||
import time
|
||||
import traceback
|
||||
import csv
|
||||
from decimal import Decimal
|
||||
|
||||
from .bitcoin import COIN
|
||||
from .i18n import _
|
||||
from .util import PrintError, ThreadJob
|
||||
from .util import format_satoshis
|
||||
|
||||
|
||||
# See https://en.wikipedia.org/wiki/ISO_4217
|
||||
|
||||
@@ -24,21 +24,16 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
import struct
|
||||
|
||||
from unicodedata import normalize
|
||||
|
||||
from .version import *
|
||||
from . import bitcoin
|
||||
from .bitcoin import pw_encode, pw_decode, bip32_root, bip32_private_derivation, bip32_public_derivation, bip32_private_key, deserialize_xprv, deserialize_xpub
|
||||
from .bitcoin import public_key_from_private_key, public_key_to_p2pkh
|
||||
from .bitcoin import *
|
||||
|
||||
from .bitcoin import is_old_seed, is_new_seed, is_seed
|
||||
from .util import PrintError, InvalidPassword, hfu
|
||||
from .mnemonic import Mnemonic, load_wordlist
|
||||
from .plugins import run_hook
|
||||
|
||||
|
||||
class KeyStore(PrintError):
|
||||
|
||||
def has_seed(self):
|
||||
|
||||
@@ -35,7 +35,6 @@ import pbkdf2
|
||||
from .util import print_error
|
||||
from .bitcoin import is_old_seed, is_new_seed
|
||||
from . import version
|
||||
from . import i18n
|
||||
|
||||
# http://www.asahi-net.or.jp/~ax2s-kmtn/ref/unicode/e_asia.html
|
||||
CJK_INTERVALS = [
|
||||
@@ -164,7 +163,6 @@ class Mnemonic(object):
|
||||
return i % custom_entropy == 0
|
||||
|
||||
def make_seed(self, seed_type='standard', num_bits=132, custom_entropy=1):
|
||||
from . import version
|
||||
prefix = version.seed_prefix(seed_type)
|
||||
# increase num_bits in order to obtain a uniform distibution for the last word
|
||||
bpw = math.log(len(self.wordlist), 2)
|
||||
|
||||
@@ -26,11 +26,10 @@ import queue
|
||||
import os
|
||||
import stat
|
||||
import errno
|
||||
import sys
|
||||
import random
|
||||
import re
|
||||
import select
|
||||
import traceback
|
||||
from collections import defaultdict, deque
|
||||
from collections import defaultdict
|
||||
import threading
|
||||
import socket
|
||||
import json
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
import hashlib
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import json
|
||||
|
||||
@@ -4,8 +4,6 @@ from electrum.i18n import _
|
||||
|
||||
import datetime
|
||||
from collections import defaultdict
|
||||
|
||||
from electrum.util import format_satoshis
|
||||
from electrum.bitcoin import COIN
|
||||
|
||||
import matplotlib
|
||||
|
||||
@@ -31,7 +31,7 @@ import pkgutil
|
||||
import time
|
||||
import threading
|
||||
|
||||
from .util import *
|
||||
from .util import print_error
|
||||
from .i18n import _
|
||||
from .util import profiler, PrintError, DaemonThread, UserCancelled, ThreadJob
|
||||
from . import bitcoin
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
import os
|
||||
import math
|
||||
import base64
|
||||
import binascii
|
||||
import hashlib
|
||||
|
||||
from .pem import *
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import ast
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
@@ -6,7 +5,7 @@ import os
|
||||
import stat
|
||||
|
||||
from copy import deepcopy
|
||||
from .util import user_dir, print_error, print_msg, print_stderr, PrintError
|
||||
from .util import user_dir, print_error, print_stderr, PrintError
|
||||
|
||||
from .bitcoin import MAX_FEE_RATE, FEE_TARGETS
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
import os
|
||||
import ast
|
||||
import threading
|
||||
import random
|
||||
import time
|
||||
import json
|
||||
import copy
|
||||
import re
|
||||
@@ -35,8 +33,7 @@ import pbkdf2, hmac, hashlib
|
||||
import base64
|
||||
import zlib
|
||||
|
||||
from .i18n import _
|
||||
from .util import NotEnoughFunds, PrintError, profiler
|
||||
from .util import PrintError, profiler
|
||||
from .plugins import run_hook, plugin_loaders
|
||||
from .keystore import bip44_derivation
|
||||
from . import bitcoin
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
from threading import Lock
|
||||
import hashlib
|
||||
|
||||
from .bitcoin import Hash, hash_encode
|
||||
# from .bitcoin import Hash, hash_encode
|
||||
from .transaction import Transaction
|
||||
from .util import print_error, print_msg, ThreadJob, bh2u
|
||||
from .util import ThreadJob, bh2u
|
||||
|
||||
|
||||
class Synchronizer(ThreadJob):
|
||||
|
||||
@@ -4,7 +4,6 @@ import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
import json
|
||||
|
||||
from io import StringIO
|
||||
from lib.simple_config import (SimpleConfig, read_system_config,
|
||||
|
||||
@@ -2,13 +2,10 @@ import unittest
|
||||
from lib import transaction
|
||||
from lib.bitcoin import TYPE_ADDRESS
|
||||
|
||||
import pprint
|
||||
from lib.keystore import xpubkey_to_address
|
||||
|
||||
from lib.util import bh2u
|
||||
|
||||
from lib.util import bh2u
|
||||
|
||||
unsigned_blob = '01000000012a5c9a94fcde98f5581cd00162c60a13936ceb75389ea65bf38633b424eb4031000000005701ff4c53ff0488b21e03ef2afea18000000089689bff23e1e7fb2f161daa37270a97a3d8c2e537584b2d304ecb47b86d21fc021b010d3bd425f8cf2e04824bfdf1f1f5ff1d51fadd9a41f9e3fb8dd3403b1bfe00000000ffffffff0140420f00000000001976a914230ac37834073a42146f11ef8414ae929feaafc388ac00000000'
|
||||
signed_blob = '01000000012a5c9a94fcde98f5581cd00162c60a13936ceb75389ea65bf38633b424eb4031000000006c493046022100a82bbc57a0136751e5433f41cf000b3f1a99c6744775e76ec764fb78c54ee100022100f9e80b7de89de861dc6fb0c1429d5da72c2b6b2ee2406bc9bfb1beedd729d985012102e61d176da16edd1d258a200ad9759ef63adf8e14cd97f53227bae35cdb84d2f6ffffffff0140420f00000000001976a914230ac37834073a42146f11ef8414ae929feaafc388ac00000000'
|
||||
v2_blob = "0200000001191601a44a81e061502b7bfbc6eaa1cef6d1e6af5308ef96c9342f71dbf4b9b5000000006b483045022100a6d44d0a651790a477e75334adfb8aae94d6612d01187b2c02526e340a7fd6c8022028bdf7a64a54906b13b145cd5dab21a26bd4b85d6044e9b97bceab5be44c2a9201210253e8e0254b0c95776786e40984c1aa32a7d03efa6bdacdea5f421b774917d346feffffff026b20fa04000000001976a914024db2e87dd7cfd0e5f266c5f212e21a31d805a588aca0860100000000001976a91421919b94ae5cefcdf0271191459157cdb41c4cbf88aca6240700"
|
||||
|
||||
@@ -27,21 +27,15 @@
|
||||
|
||||
# Note: The deserialization code originally comes from ABE.
|
||||
|
||||
from . import bitcoin
|
||||
from .bitcoin import *
|
||||
from .util import print_error, profiler, to_string
|
||||
from .util import print_error, profiler
|
||||
|
||||
from . import bitcoin
|
||||
from .bitcoin import *
|
||||
import time
|
||||
import sys
|
||||
import struct
|
||||
|
||||
#
|
||||
# Workalike python implementation of Bitcoin's CDataStream class.
|
||||
#
|
||||
import struct
|
||||
import random
|
||||
from .keystore import xpubkey_to_address, xpubkey_to_pubkey
|
||||
|
||||
NO_SIGNATURE = 'ff'
|
||||
|
||||
@@ -583,7 +583,6 @@ class timeout(Exception):
|
||||
pass
|
||||
|
||||
import socket
|
||||
import errno
|
||||
import json
|
||||
import ssl
|
||||
import time
|
||||
|
||||
@@ -28,18 +28,14 @@
|
||||
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import ast
|
||||
import threading
|
||||
import random
|
||||
import time
|
||||
import json
|
||||
import copy
|
||||
import re
|
||||
import stat
|
||||
import errno
|
||||
from functools import partial
|
||||
from collections import namedtuple, defaultdict
|
||||
from collections import defaultdict
|
||||
|
||||
from .i18n import _
|
||||
from .util import NotEnoughFunds, PrintError, UserCancelled, profiler, format_satoshis
|
||||
@@ -56,15 +52,12 @@ from . import bitcoin
|
||||
from . import coinchooser
|
||||
from .synchronizer import Synchronizer
|
||||
from .verifier import SPV
|
||||
from .mnemonic import Mnemonic
|
||||
|
||||
from . import paymentrequest
|
||||
from .paymentrequest import PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED
|
||||
from .paymentrequest import InvoiceStore
|
||||
from .contacts import Contacts
|
||||
|
||||
from .storage import WalletStorage
|
||||
|
||||
TX_STATUS = [
|
||||
_('Replaceable'),
|
||||
_('Unconfirmed parent'),
|
||||
@@ -1281,7 +1274,6 @@ class Abstract_Wallet(PrintError):
|
||||
self.storage.put('payment_requests', self.receive_requests)
|
||||
|
||||
def add_payment_request(self, req, config):
|
||||
import os
|
||||
addr = req['address']
|
||||
amount = req.get('amount')
|
||||
message = req.get('memo')
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
import queue
|
||||
import threading, os, json, time
|
||||
import threading, os, json
|
||||
from collections import defaultdict
|
||||
try:
|
||||
from SimpleWebSocketServer import WebSocket, SimpleSSLWebSocketServer
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
from datetime import datetime
|
||||
import sys
|
||||
from . import util
|
||||
from .util import profiler, print_error, bh2u
|
||||
from .util import profiler, bh2u
|
||||
import ecdsa
|
||||
import hashlib
|
||||
|
||||
|
||||
Reference in New Issue
Block a user