Problem: Imports inside a function violate PEP-8

Solution: Moved them to the top of the file
This commit is contained in:
z-bowen 2018-08-08 14:33:45 +02:00
parent 3fd14ed93a
commit 11e572d1a8

View File

@ -2,9 +2,13 @@ import contextlib
import threading
import queue
import multiprocessing as mp
import json
import setproctitle
from bigchaindb.tendermint_utils import key_from_base64
from bigchaindb.common.crypto import key_pair_from_ed25519_key
class ProcessGroup(object):
@ -31,7 +35,8 @@ class ProcessGroup(object):
class Process(mp.Process):
"""Wrapper around multiprocessing.Process that uses
setproctitle to set the name of the process when running
the target task."""
the target task.
"""
def run(self):
setproctitle.setproctitle(self.name)
@ -171,9 +176,6 @@ class Lazy:
# Load Tendermint's public and private key from the file path
def load_node_key(path):
import json
from bigchaindb.tendermint_utils import key_from_base64
from bigchaindb.common.crypto import key_pair_from_ed25519_key
with open(path) as json_data:
priv_validator = json.load(json_data)
priv_key = priv_validator['priv_key']['value']