mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
python: quieten modern flake8.
After Ubuntu 18.10 upgrade, lots of new flake8 warnings. $ flake8 --version: 3.5.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 1.6.0) CPython 3.6.7rc1 on Linux Note it seems that W503 warned about line breaks before binary operators, and W504 complains about them after. I prefer W504, so disable W503. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
322d483b36
commit
38e6aa66ff
7 changed files with 38 additions and 37 deletions
3
Makefile
3
Makefile
|
@ -274,7 +274,8 @@ PYSRC=$(shell git ls-files "*.py") contrib/pylightning/lightning-pay
|
||||||
check-python:
|
check-python:
|
||||||
@# E501 line too long (N > 79 characters)
|
@# E501 line too long (N > 79 characters)
|
||||||
@# E731 do not assign a lambda expression, use a def
|
@# E731 do not assign a lambda expression, use a def
|
||||||
@flake8 --ignore=E501,E731 --exclude=contrib/pylightning/lightning/__init__.py ${PYSRC}
|
@# W503: line break before binary operator
|
||||||
|
@flake8 --ignore=E501,E731,W503 --exclude=contrib/pylightning/lightning/__init__.py ${PYSRC}
|
||||||
|
|
||||||
check-includes:
|
check-includes:
|
||||||
@tools/check-includes.sh
|
@tools/check-includes.sh
|
||||||
|
|
|
@ -214,8 +214,8 @@ def test_closing_different_fees(node_factory, bitcoind, executor):
|
||||||
bitcoind.generate_block(6)
|
bitcoind.generate_block(6)
|
||||||
|
|
||||||
# Now wait for them all to hit normal state, do payments
|
# Now wait for them all to hit normal state, do payments
|
||||||
l1.daemon.wait_for_logs(['update for channel .* now ACTIVE'] * num_peers +
|
l1.daemon.wait_for_logs(['update for channel .* now ACTIVE'] * num_peers
|
||||||
['to CHANNELD_NORMAL'] * num_peers)
|
+ ['to CHANNELD_NORMAL'] * num_peers)
|
||||||
for p in peers:
|
for p in peers:
|
||||||
if p.amount != 0:
|
if p.amount != 0:
|
||||||
l1.pay(p, 100000000)
|
l1.pay(p, 100000000)
|
||||||
|
@ -1413,16 +1413,16 @@ def test_permfail(node_factory, bitcoind):
|
||||||
l2.daemon.wait_for_log(' to ONCHAIN')
|
l2.daemon.wait_for_log(' to ONCHAIN')
|
||||||
l2.daemon.wait_for_log('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET (.*) after 5 blocks')
|
l2.daemon.wait_for_log('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET (.*) after 5 blocks')
|
||||||
|
|
||||||
wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'])['status'] ==
|
wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'])['status']
|
||||||
['ONCHAIN:Tracking their unilateral close',
|
== ['ONCHAIN:Tracking their unilateral close',
|
||||||
'ONCHAIN:All outputs resolved: waiting 99 more blocks before forgetting channel'])
|
'ONCHAIN:All outputs resolved: waiting 99 more blocks before forgetting channel'])
|
||||||
|
|
||||||
def check_billboard():
|
def check_billboard():
|
||||||
billboard = only_one(l2.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status']
|
billboard = only_one(l2.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status']
|
||||||
return (
|
return (
|
||||||
len(billboard) == 2 and
|
len(billboard) == 2
|
||||||
billboard[0] == 'ONCHAIN:Tracking our own unilateral close' and
|
and billboard[0] == 'ONCHAIN:Tracking our own unilateral close'
|
||||||
re.fullmatch('ONCHAIN:.* outputs unresolved: in 4 blocks will spend DELAYED_OUTPUT_TO_US \(.*:0\) using OUR_DELAYED_RETURN_TO_WALLET', billboard[1])
|
and re.fullmatch(r'ONCHAIN:.* outputs unresolved: in 4 blocks will spend DELAYED_OUTPUT_TO_US \(.*:0\) using OUR_DELAYED_RETURN_TO_WALLET', billboard[1])
|
||||||
)
|
)
|
||||||
wait_for(check_billboard)
|
wait_for(check_billboard)
|
||||||
|
|
||||||
|
|
|
@ -910,7 +910,7 @@ def test_update_fee_reconnect(node_factory, bitcoind):
|
||||||
l1.set_feerates((14000, 14000, 3750))
|
l1.set_feerates((14000, 14000, 3750))
|
||||||
l1.daemon.wait_for_log('Setting REMOTE feerate to 14000')
|
l1.daemon.wait_for_log('Setting REMOTE feerate to 14000')
|
||||||
l2.daemon.wait_for_log('Setting LOCAL feerate to 14000')
|
l2.daemon.wait_for_log('Setting LOCAL feerate to 14000')
|
||||||
l1.daemon.wait_for_log('dev_disconnect: \+WIRE_COMMITMENT_SIGNED')
|
l1.daemon.wait_for_log(r'dev_disconnect: \+WIRE_COMMITMENT_SIGNED')
|
||||||
|
|
||||||
# Wait for reconnect....
|
# Wait for reconnect....
|
||||||
l1.daemon.wait_for_log('Applying feerate 14000 to LOCAL')
|
l1.daemon.wait_for_log('Applying feerate 14000 to LOCAL')
|
||||||
|
@ -1203,7 +1203,7 @@ def test_funder_feerate_reconnect(node_factory, bitcoind):
|
||||||
|
|
||||||
# create fee update, causing disconnect.
|
# create fee update, causing disconnect.
|
||||||
l1.set_feerates((15000, 7500, 3750))
|
l1.set_feerates((15000, 7500, 3750))
|
||||||
l2.daemon.wait_for_log('dev_disconnect: \-WIRE_COMMITMENT_SIGNED')
|
l2.daemon.wait_for_log(r'dev_disconnect: \-WIRE_COMMITMENT_SIGNED')
|
||||||
|
|
||||||
# Wait until they reconnect.
|
# Wait until they reconnect.
|
||||||
l1.daemon.wait_for_log('Peer transient failure in CHANNELD_NORMAL')
|
l1.daemon.wait_for_log('Peer transient failure in CHANNELD_NORMAL')
|
||||||
|
@ -1220,7 +1220,7 @@ def test_dataloss_protection(node_factory, bitcoind):
|
||||||
|
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
# l1 should send out WIRE_INIT (0010)
|
# l1 should send out WIRE_INIT (0010)
|
||||||
l1.daemon.wait_for_log("\[OUT\] 0010"
|
l1.daemon.wait_for_log(r"\[OUT\] 0010"
|
||||||
# gflen == 0
|
# gflen == 0
|
||||||
"0000"
|
"0000"
|
||||||
# lflen == 1
|
# lflen == 1
|
||||||
|
@ -1237,7 +1237,7 @@ def test_dataloss_protection(node_factory, bitcoind):
|
||||||
l2.start()
|
l2.start()
|
||||||
|
|
||||||
# l1 should have sent WIRE_CHANNEL_REESTABLISH with option_data_loss_protect.
|
# l1 should have sent WIRE_CHANNEL_REESTABLISH with option_data_loss_protect.
|
||||||
l1.daemon.wait_for_log("\[OUT\] 0088"
|
l1.daemon.wait_for_log(r"\[OUT\] 0088"
|
||||||
# channel_id
|
# channel_id
|
||||||
"[0-9a-f]{64}"
|
"[0-9a-f]{64}"
|
||||||
# next_local_commitment_number
|
# next_local_commitment_number
|
||||||
|
@ -1255,13 +1255,13 @@ def test_dataloss_protection(node_factory, bitcoind):
|
||||||
|
|
||||||
# Make sure both sides consider it completely settled (has received both
|
# Make sure both sides consider it completely settled (has received both
|
||||||
# REVOKE_AND_ACK)
|
# REVOKE_AND_ACK)
|
||||||
l1.daemon.wait_for_logs(["\[IN\] 0085"] * 2)
|
l1.daemon.wait_for_logs([r"\[IN\] 0085"] * 2)
|
||||||
l2.daemon.wait_for_logs(["\[IN\] 0085"] * 2)
|
l2.daemon.wait_for_logs([r"\[IN\] 0085"] * 2)
|
||||||
|
|
||||||
l2.restart()
|
l2.restart()
|
||||||
|
|
||||||
# l1 should have sent WIRE_CHANNEL_REESTABLISH with option_data_loss_protect.
|
# l1 should have sent WIRE_CHANNEL_REESTABLISH with option_data_loss_protect.
|
||||||
l1.daemon.wait_for_log("\[OUT\] 0088"
|
l1.daemon.wait_for_log(r"\[OUT\] 0088"
|
||||||
# channel_id
|
# channel_id
|
||||||
"[0-9a-f]{64}"
|
"[0-9a-f]{64}"
|
||||||
# next_local_commitment_number
|
# next_local_commitment_number
|
||||||
|
|
|
@ -666,19 +666,19 @@ def test_gossip_query_channel_range(node_factory, bitcoind):
|
||||||
num=65535)
|
num=65535)
|
||||||
l1.daemon.wait_for_log(
|
l1.daemon.wait_for_log(
|
||||||
# WIRE_REPLY_CHANNEL_RANGE
|
# WIRE_REPLY_CHANNEL_RANGE
|
||||||
r'\[IN\] 0108' +
|
r'\[IN\] 0108'
|
||||||
# chain_hash
|
# chain_hash
|
||||||
'................................................................' +
|
+ '................................................................'
|
||||||
# first_blocknum
|
# first_blocknum
|
||||||
'00000000' +
|
+ '00000000'
|
||||||
# number_of_blocks
|
# number_of_blocks
|
||||||
'0000ffff' +
|
+ '0000ffff'
|
||||||
# complete
|
# complete
|
||||||
'01' +
|
+ '01'
|
||||||
# length
|
# length
|
||||||
'....' +
|
+ '....'
|
||||||
# encoding
|
# encoding
|
||||||
'01'
|
+ '01'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ def test_names(node_factory):
|
||||||
|
|
||||||
for key, alias, color in configs:
|
for key, alias, color in configs:
|
||||||
n = node_factory.get_node()
|
n = node_factory.get_node()
|
||||||
assert n.daemon.is_in_log('public key {}, alias {}.* \(color #{}\)'
|
assert n.daemon.is_in_log(r'public key {}, alias {}.* \(color #{}\)'
|
||||||
.format(key, alias, color))
|
.format(key, alias, color))
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ def test_ping(node_factory):
|
||||||
# Test gossip pinging.
|
# Test gossip pinging.
|
||||||
ping_tests(l1, l2)
|
ping_tests(l1, l2)
|
||||||
if DEVELOPER:
|
if DEVELOPER:
|
||||||
l1.daemon.wait_for_log('Got pong 1000 bytes \({}\.\.\.\)'
|
l1.daemon.wait_for_log(r'Got pong 1000 bytes \({}\.\.\.\)'
|
||||||
.format(l2.info['version']), timeout=1)
|
.format(l2.info['version']), timeout=1)
|
||||||
|
|
||||||
l1.fund_channel(l2, 10**5)
|
l1.fund_channel(l2, 10**5)
|
||||||
|
@ -153,7 +153,7 @@ def test_ping(node_factory):
|
||||||
# channeld pinging
|
# channeld pinging
|
||||||
ping_tests(l1, l2)
|
ping_tests(l1, l2)
|
||||||
if DEVELOPER:
|
if DEVELOPER:
|
||||||
l1.daemon.wait_for_log('Got pong 1000 bytes \({}\.\.\.\)'
|
l1.daemon.wait_for_log(r'Got pong 1000 bytes \({}\.\.\.\)'
|
||||||
.format(l2.info['version']))
|
.format(l2.info['version']))
|
||||||
|
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ def test_htlc_send_timeout(node_factory, bitcoind):
|
||||||
timedout = False
|
timedout = False
|
||||||
while not timedout:
|
while not timedout:
|
||||||
try:
|
try:
|
||||||
l2.daemon.wait_for_log('channeld-{} chan #[0-9]*:\[IN\] 0101'.format(l3.info['id']), timeout=30)
|
l2.daemon.wait_for_log(r'channeld-{} chan #[0-9]*:\[IN\] 0101'.format(l3.info['id']), timeout=30)
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
timedout = True
|
timedout = True
|
||||||
|
|
||||||
|
@ -836,9 +836,9 @@ def test_htlc_send_timeout(node_factory, bitcoind):
|
||||||
assert only_one(err.error['data']['failures'])['erring_channel'] == chanid2
|
assert only_one(err.error['data']['failures'])['erring_channel'] == chanid2
|
||||||
|
|
||||||
# L2 should send ping, but never receive pong so never send commitment.
|
# L2 should send ping, but never receive pong so never send commitment.
|
||||||
l2.daemon.wait_for_log('channeld.*:\[OUT\] 0012')
|
l2.daemon.wait_for_log(r'channeld.*:\[OUT\] 0012')
|
||||||
assert not l2.daemon.is_in_log('channeld.*:\[IN\] 0013')
|
assert not l2.daemon.is_in_log(r'channeld.*:\[IN\] 0013')
|
||||||
assert not l2.daemon.is_in_log('channeld.*:\[OUT\] 0084')
|
assert not l2.daemon.is_in_log(r'channeld.*:\[OUT\] 0084')
|
||||||
# L2 killed the channel with l3 because it was too slow.
|
# L2 killed the channel with l3 because it was too slow.
|
||||||
l2.daemon.wait_for_log('channeld-{}.*Adding HTLC too slow: killing channel'.format(l3.info['id']))
|
l2.daemon.wait_for_log('channeld-{}.*Adding HTLC too slow: killing channel'.format(l3.info['id']))
|
||||||
|
|
||||||
|
|
|
@ -385,10 +385,10 @@ def test_sendpay(node_factory):
|
||||||
p1 = l1.rpc.getpeer(l2.info['id'], 'info')
|
p1 = l1.rpc.getpeer(l2.info['id'], 'info')
|
||||||
p2 = l2.rpc.getpeer(l1.info['id'], 'info')
|
p2 = l2.rpc.getpeer(l1.info['id'], 'info')
|
||||||
return (
|
return (
|
||||||
only_one(p1['channels'])['msatoshi_to_us'] == 10**6 * 1000 - amt and
|
only_one(p1['channels'])['msatoshi_to_us'] == 10**6 * 1000 - amt
|
||||||
only_one(p1['channels'])['msatoshi_total'] == 10**6 * 1000 and
|
and only_one(p1['channels'])['msatoshi_total'] == 10**6 * 1000
|
||||||
only_one(p2['channels'])['msatoshi_to_us'] == amt and
|
and only_one(p2['channels'])['msatoshi_to_us'] == amt
|
||||||
only_one(p2['channels'])['msatoshi_total'] == 10**6 * 1000
|
and only_one(p2['channels'])['msatoshi_total'] == 10**6 * 1000
|
||||||
)
|
)
|
||||||
wait_for(check_balances)
|
wait_for(check_balances)
|
||||||
|
|
||||||
|
|
|
@ -585,9 +585,9 @@ class LightningNode(object):
|
||||||
def wait_for_routes(self, channel_ids):
|
def wait_for_routes(self, channel_ids):
|
||||||
# Could happen in any order...
|
# Could happen in any order...
|
||||||
self.daemon.wait_for_logs(['Received channel_update for channel {}\\(0\\)'.format(c)
|
self.daemon.wait_for_logs(['Received channel_update for channel {}\\(0\\)'.format(c)
|
||||||
for c in channel_ids] +
|
for c in channel_ids]
|
||||||
['Received channel_update for channel {}\\(1\\)'.format(c)
|
+ ['Received channel_update for channel {}\\(1\\)'.format(c)
|
||||||
for c in channel_ids])
|
for c in channel_ids])
|
||||||
|
|
||||||
def pay(self, dst, amt, label=None):
|
def pay(self, dst, amt, label=None):
|
||||||
if not label:
|
if not label:
|
||||||
|
|
Loading…
Add table
Reference in a new issue