mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
Make Python code conform to the Python PEP 8 style guide
This commit is contained in:
committed by
Christian Decker
parent
0ac5e93065
commit
ae7d857c44
@@ -1,6 +1,4 @@
|
||||
from bitcoin.rpc import RawProxy as BitcoinProxy
|
||||
from lightning import LightningRpc
|
||||
|
||||
import binascii
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@@ -8,7 +6,8 @@ import sqlite3
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
import binascii
|
||||
|
||||
from bitcoin.rpc import RawProxy as BitcoinProxy
|
||||
|
||||
|
||||
BITCOIND_CONFIG = {
|
||||
@@ -28,6 +27,7 @@ LIGHTNINGD_CONFIG = {
|
||||
|
||||
DEVELOPER = os.getenv("DEVELOPER", "0") == "1"
|
||||
|
||||
|
||||
def write_config(filename, opts):
|
||||
with open(filename, 'w') as f:
|
||||
for k, v in opts.items():
|
||||
@@ -109,7 +109,7 @@ class TailableProc(object):
|
||||
self.running = False
|
||||
self.proc.stdout.close()
|
||||
|
||||
def is_in_log(self, regex, start = 0):
|
||||
def is_in_log(self, regex, start=0):
|
||||
"""Look for `regex` in the logs."""
|
||||
|
||||
ex = re.compile(regex)
|
||||
@@ -135,7 +135,6 @@ class TailableProc(object):
|
||||
exs = [re.compile(r) for r in regexs]
|
||||
start_time = time.time()
|
||||
pos = self.logsearch_start
|
||||
initial_pos = len(self.logs)
|
||||
while True:
|
||||
if timeout is not None and time.time() > start_time + timeout:
|
||||
print("Time-out: can't find {} in logs".format(exs))
|
||||
@@ -152,7 +151,7 @@ class TailableProc(object):
|
||||
continue
|
||||
|
||||
for r in exs.copy():
|
||||
self.logsearch_start = pos+1
|
||||
self.logsearch_start = pos + 1
|
||||
if r.search(self.logs[pos]):
|
||||
logging.debug("Found '%s' in logs", r)
|
||||
exs.remove(r)
|
||||
@@ -178,7 +177,7 @@ class SimpleBitcoinProxy:
|
||||
library to close, reopen and reauth upon failure.
|
||||
"""
|
||||
def __init__(self, btc_conf_file, *args, **kwargs):
|
||||
self.__btc_conf_file__= btc_conf_file
|
||||
self.__btc_conf_file__ = btc_conf_file
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name.startswith('__') and name.endswith('__'):
|
||||
@@ -240,6 +239,7 @@ class BitcoinD(TailableProc):
|
||||
# lightning-4 => 0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199 aka JUNIORFELONY #0382ce
|
||||
# lightning-5 => 032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e aka SOMBERFIRE #032cf1
|
||||
|
||||
|
||||
class LightningD(TailableProc):
|
||||
def __init__(self, lightning_dir, bitcoin_dir, port=9735, random_hsm=False):
|
||||
TailableProc.__init__(self, lightning_dir)
|
||||
@@ -281,6 +281,7 @@ class LightningD(TailableProc):
|
||||
self.proc.wait(timeout)
|
||||
return self.proc.returncode
|
||||
|
||||
|
||||
class LightningNode(object):
|
||||
def __init__(self, daemon, rpc, btc, executor, may_fail=False):
|
||||
self.rpc = rpc
|
||||
@@ -316,7 +317,7 @@ class LightningNode(object):
|
||||
|
||||
self.bitcoin.generate_block(1)
|
||||
|
||||
#fut.result(timeout=5)
|
||||
# fut.result(timeout=5)
|
||||
|
||||
# Now wait for confirmation
|
||||
self.daemon.wait_for_log(" to CHANNELD_NORMAL|STATE_NORMAL")
|
||||
|
||||
Reference in New Issue
Block a user