Resolve some pylint warnings in class_addressGenerator
This commit is contained in:
parent
6045b587e9
commit
d8e0c52ecd
|
@ -5,19 +5,20 @@ import hashlib
|
||||||
import time
|
import time
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
|
||||||
|
from six.moves import configparser, queue
|
||||||
|
|
||||||
import defaults
|
import defaults
|
||||||
import highlevelcrypto
|
import highlevelcrypto
|
||||||
import queues
|
import queues
|
||||||
import shared
|
import shared
|
||||||
import state
|
import state
|
||||||
import tr
|
|
||||||
from addresses import decodeAddress, encodeAddress, encodeVarint
|
from addresses import decodeAddress, encodeAddress, encodeVarint
|
||||||
from bmconfigparser import config
|
from bmconfigparser import config
|
||||||
from fallback import RIPEMD160Hash
|
from fallback import RIPEMD160Hash
|
||||||
from network import StoppableThread
|
from network import StoppableThread
|
||||||
from pyelliptic import arithmetic
|
from pyelliptic import arithmetic
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
from six.moves import configparser, queue
|
from tr import _translate
|
||||||
|
|
||||||
|
|
||||||
class AddressGeneratorException(Exception):
|
class AddressGeneratorException(Exception):
|
||||||
|
@ -31,6 +32,7 @@ class addressGenerator(StoppableThread):
|
||||||
name = "addressGenerator"
|
name = "addressGenerator"
|
||||||
|
|
||||||
def stopThread(self):
|
def stopThread(self):
|
||||||
|
"""Tell the thread to stop putting a special command to it's queue"""
|
||||||
try:
|
try:
|
||||||
queues.addressGeneratorQueue.put(("stopThread", "data"))
|
queues.addressGeneratorQueue.put(("stopThread", "data"))
|
||||||
except queue.Full:
|
except queue.Full:
|
||||||
|
@ -43,8 +45,7 @@ class addressGenerator(StoppableThread):
|
||||||
Process the requests for addresses generation
|
Process the requests for addresses generation
|
||||||
from `.queues.addressGeneratorQueue`
|
from `.queues.addressGeneratorQueue`
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-locals, too-many-branches
|
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
|
||||||
# pylint: disable=protected-access, too-many-statements
|
|
||||||
# pylint: disable=too-many-nested-blocks
|
# pylint: disable=too-many-nested-blocks
|
||||||
|
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
|
@ -119,7 +120,7 @@ class addressGenerator(StoppableThread):
|
||||||
if command == 'createRandomAddress':
|
if command == 'createRandomAddress':
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
_translate(
|
||||||
"MainWindow", "Generating one new address")
|
"MainWindow", "Generating one new address")
|
||||||
))
|
))
|
||||||
# This next section is a little bit strange. We're going
|
# This next section is a little bit strange. We're going
|
||||||
|
@ -199,7 +200,7 @@ class addressGenerator(StoppableThread):
|
||||||
|
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Done generating address. Doing work necessary"
|
"Done generating address. Doing work necessary"
|
||||||
" to broadcast it...")
|
" to broadcast it...")
|
||||||
|
@ -214,9 +215,10 @@ class addressGenerator(StoppableThread):
|
||||||
queues.workerQueue.put((
|
queues.workerQueue.put((
|
||||||
'sendOutOrStoreMyV4Pubkey', address))
|
'sendOutOrStoreMyV4Pubkey', address))
|
||||||
|
|
||||||
elif command == 'createDeterministicAddresses' \
|
elif command in (
|
||||||
or command == 'getDeterministicAddress' \
|
'createDeterministicAddresses', 'createChan',
|
||||||
or command == 'createChan' or command == 'joinChan':
|
'getDeterministicAddress', 'joinChan'
|
||||||
|
):
|
||||||
if not deterministicPassphrase:
|
if not deterministicPassphrase:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
'You are creating deterministic'
|
'You are creating deterministic'
|
||||||
|
@ -225,7 +227,7 @@ class addressGenerator(StoppableThread):
|
||||||
if command == 'createDeterministicAddresses':
|
if command == 'createDeterministicAddresses':
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Generating %1 new addresses."
|
"Generating %1 new addresses."
|
||||||
).arg(str(numberOfAddressesToMake))
|
).arg(str(numberOfAddressesToMake))
|
||||||
|
@ -330,7 +332,7 @@ class addressGenerator(StoppableThread):
|
||||||
)
|
)
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"%1 is already in 'Your Identities'."
|
"%1 is already in 'Your Identities'."
|
||||||
" Not adding it again."
|
" Not adding it again."
|
||||||
|
@ -341,8 +343,7 @@ class addressGenerator(StoppableThread):
|
||||||
config.set(address, 'label', label)
|
config.set(address, 'label', label)
|
||||||
config.set(address, 'enabled', 'true')
|
config.set(address, 'enabled', 'true')
|
||||||
config.set(address, 'decoy', 'false')
|
config.set(address, 'decoy', 'false')
|
||||||
if command == 'joinChan' \
|
if command in ('createChan', 'joinChan'):
|
||||||
or command == 'createChan':
|
|
||||||
config.set(address, 'chan', 'true')
|
config.set(address, 'chan', 'true')
|
||||||
config.set(
|
config.set(
|
||||||
address, 'noncetrialsperbyte',
|
address, 'noncetrialsperbyte',
|
||||||
|
@ -384,7 +385,7 @@ class addressGenerator(StoppableThread):
|
||||||
'sendOutOrStoreMyV4Pubkey', address))
|
'sendOutOrStoreMyV4Pubkey', address))
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
_translate(
|
||||||
"MainWindow", "Done generating address")
|
"MainWindow", "Done generating address")
|
||||||
))
|
))
|
||||||
elif saveAddressToDisk and not live \
|
elif saveAddressToDisk and not live \
|
||||||
|
@ -393,8 +394,9 @@ class addressGenerator(StoppableThread):
|
||||||
address)
|
address)
|
||||||
|
|
||||||
# Done generating addresses.
|
# Done generating addresses.
|
||||||
if command == 'createDeterministicAddresses' \
|
if command in (
|
||||||
or command == 'joinChan' or command == 'createChan':
|
'createDeterministicAddresses', 'createChan', 'joinChan'
|
||||||
|
):
|
||||||
queues.apiAddressGeneratorReturnQueue.put(
|
queues.apiAddressGeneratorReturnQueue.put(
|
||||||
listOfNewAddressesToSendOutThroughTheAPI)
|
listOfNewAddressesToSendOutThroughTheAPI)
|
||||||
elif command == 'getDeterministicAddress':
|
elif command == 'getDeterministicAddress':
|
||||||
|
|
Reference in New Issue
Block a user