Browse Source

Remove redundant semicolons in Python code

0.14
practicalswift 8 years ago
parent
commit
5cdf10611f
  1. 4
      contrib/devtools/clang-format-diff.py
  2. 2
      contrib/devtools/optimize-pngs.py
  3. 2
      contrib/zmq/zmq_sub.py
  4. 2
      qa/rpc-tests/fundrawtransaction.py
  5. 14
      qa/rpc-tests/importmulti.py
  6. 4
      qa/rpc-tests/p2p-feefilter.py
  7. 2
      qa/rpc-tests/p2p-segwit.py
  8. 2
      qa/rpc-tests/segwit.py

4
contrib/devtools/clang-format-diff.py

@ -128,7 +128,7 @@ def main():
line_count = int(match.group(3)) line_count = int(match.group(3))
if line_count == 0: if line_count == 0:
continue continue
end_line = start_line + line_count - 1; end_line = start_line + line_count - 1
lines_by_file.setdefault(filename, []).extend( lines_by_file.setdefault(filename, []).extend(
['-lines', str(start_line) + ':' + str(end_line)]) ['-lines', str(start_line) + ':' + str(end_line)])
@ -147,7 +147,7 @@ def main():
stderr=None, stdin=subprocess.PIPE) stderr=None, stdin=subprocess.PIPE)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
if p.returncode != 0: if p.returncode != 0:
sys.exit(p.returncode); sys.exit(p.returncode)
if not args.i: if not args.i:
with open(filename) as f: with open(filename) as f:

2
contrib/devtools/optimize-pngs.py

@ -39,7 +39,7 @@ for folder in folders:
if extension.lower() == '.png': if extension.lower() == '.png':
print("optimizing "+file+"..."), print("optimizing "+file+"..."),
file_path = os.path.join(absFolder, file) file_path = os.path.join(absFolder, file)
fileMetaMap = {'file' : file, 'osize': os.path.getsize(file_path), 'sha256Old' : file_hash(file_path)}; fileMetaMap = {'file' : file, 'osize': os.path.getsize(file_path), 'sha256Old' : file_hash(file_path)}
fileMetaMap['contentHashPre'] = content_hash(file_path) fileMetaMap['contentHashPre'] = content_hash(file_path)
pngCrushOutput = "" pngCrushOutput = ""

2
contrib/zmq/zmq_sub.py

@ -22,7 +22,7 @@ try:
msg = zmqSubSocket.recv_multipart() msg = zmqSubSocket.recv_multipart()
topic = str(msg[0]) topic = str(msg[0])
body = msg[1] body = msg[1]
sequence = "Unknown"; sequence = "Unknown"
if len(msg[-1]) == 4: if len(msg[-1]) == 4:
msgSequence = struct.unpack('<I', msg[-1])[-1] msgSequence = struct.unpack('<I', msg[-1])[-1]
sequence = str(msgSequence) sequence = str(msgSequence)

2
qa/rpc-tests/fundrawtransaction.py

@ -226,7 +226,7 @@ class RawTransactionsTest(BitcoinTestFramework):
assert(False) assert(False)
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, {'changeAddress': change, 'changePosition': 0}) rawtxfund = self.nodes[2].fundrawtransaction(rawtx, {'changeAddress': change, 'changePosition': 0})
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex']) dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
out = dec_tx['vout'][0]; out = dec_tx['vout'][0]
assert_equal(change, out['scriptPubKey']['addresses'][0]) assert_equal(change, out['scriptPubKey']['addresses'][0])

14
qa/rpc-tests/importmulti.py

@ -108,7 +108,7 @@ class ImportMultiTest (BitcoinTestFramework):
"scriptPubKey": address['scriptPubKey'], "scriptPubKey": address['scriptPubKey'],
"pubkeys": [ address['pubkey'] ], "pubkeys": [ address['pubkey'] ],
"internal": True "internal": True
}]; }]
result = self.nodes[1].importmulti(request) result = self.nodes[1].importmulti(request)
assert_equal(result[0]['success'], True) assert_equal(result[0]['success'], True)
address_assert = self.nodes[1].validateaddress(address['address']) address_assert = self.nodes[1].validateaddress(address['address'])
@ -121,7 +121,7 @@ class ImportMultiTest (BitcoinTestFramework):
request = [{ request = [{
"scriptPubKey": address['scriptPubKey'], "scriptPubKey": address['scriptPubKey'],
"pubkeys": [ address['pubkey'] ] "pubkeys": [ address['pubkey'] ]
}]; }]
result = self.nodes[1].importmulti(request) result = self.nodes[1].importmulti(request)
assert_equal(result[0]['success'], False) assert_equal(result[0]['success'], False)
assert_equal(result[0]['error']['code'], -8) assert_equal(result[0]['error']['code'], -8)
@ -197,7 +197,7 @@ class ImportMultiTest (BitcoinTestFramework):
self.nodes[1].generate(100) self.nodes[1].generate(100)
transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
self.nodes[1].generate(1) self.nodes[1].generate(1)
transaction = self.nodes[1].gettransaction(transactionid); transaction = self.nodes[1].gettransaction(transactionid)
print("Should import a p2sh") print("Should import a p2sh")
result = self.nodes[1].importmulti([{ result = self.nodes[1].importmulti([{
@ -222,7 +222,7 @@ class ImportMultiTest (BitcoinTestFramework):
self.nodes[1].generate(100) self.nodes[1].generate(100)
transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
self.nodes[1].generate(1) self.nodes[1].generate(1)
transaction = self.nodes[1].gettransaction(transactionid); transaction = self.nodes[1].gettransaction(transactionid)
print("Should import a p2sh with respective redeem script") print("Should import a p2sh with respective redeem script")
result = self.nodes[1].importmulti([{ result = self.nodes[1].importmulti([{
@ -246,7 +246,7 @@ class ImportMultiTest (BitcoinTestFramework):
self.nodes[1].generate(100) self.nodes[1].generate(100)
transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
self.nodes[1].generate(1) self.nodes[1].generate(1)
transaction = self.nodes[1].gettransaction(transactionid); transaction = self.nodes[1].gettransaction(transactionid)
print("Should import a p2sh with respective redeem script and private keys") print("Should import a p2sh with respective redeem script and private keys")
result = self.nodes[1].importmulti([{ result = self.nodes[1].importmulti([{
@ -270,7 +270,7 @@ class ImportMultiTest (BitcoinTestFramework):
self.nodes[1].generate(100) self.nodes[1].generate(100)
transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
self.nodes[1].generate(1) self.nodes[1].generate(1)
transaction = self.nodes[1].gettransaction(transactionid); transaction = self.nodes[1].gettransaction(transactionid)
print("Should import a p2sh with respective redeem script and private keys") print("Should import a p2sh with respective redeem script and private keys")
result = self.nodes[1].importmulti([{ result = self.nodes[1].importmulti([{
@ -312,7 +312,7 @@ class ImportMultiTest (BitcoinTestFramework):
"scriptPubKey": address['scriptPubKey'], "scriptPubKey": address['scriptPubKey'],
"pubkeys": [ address2['pubkey'] ], "pubkeys": [ address2['pubkey'] ],
"internal": True "internal": True
}]; }]
result = self.nodes[1].importmulti(request) result = self.nodes[1].importmulti(request)
assert_equal(result[0]['success'], False) assert_equal(result[0]['success'], False)
assert_equal(result[0]['error']['code'], -5) assert_equal(result[0]['error']['code'], -5)

4
qa/rpc-tests/p2p-feefilter.py

@ -21,9 +21,9 @@ def allInvsMatch(invsExpected, testnode):
for x in range(60): for x in range(60):
with mininode_lock: with mininode_lock:
if (sorted(invsExpected) == sorted(testnode.txinvs)): if (sorted(invsExpected) == sorted(testnode.txinvs)):
return True; return True
time.sleep(1) time.sleep(1)
return False; return False
# TestNode: bare-bones "peer". Used to track which invs are received from a node # TestNode: bare-bones "peer". Used to track which invs are received from a node
# and to send the node feefilter messages. # and to send the node feefilter messages.

2
qa/rpc-tests/p2p-segwit.py

@ -1662,7 +1662,7 @@ class SegWitTest(BitcoinTestFramework):
# too many sigops (contributing to legacy sigop count). # too many sigops (contributing to legacy sigop count).
checksig_count = (extra_sigops_available // 4) + 1 checksig_count = (extra_sigops_available // 4) + 1
scriptPubKey_checksigs = CScript([OP_CHECKSIG]*checksig_count) scriptPubKey_checksigs = CScript([OP_CHECKSIG]*checksig_count)
tx2.vout.append(CTxOut(0, scriptPubKey_checksigs)); tx2.vout.append(CTxOut(0, scriptPubKey_checksigs))
tx2.vin.pop() tx2.vin.pop()
tx2.wit.vtxinwit.pop() tx2.wit.vtxinwit.pop()
tx2.vout[0].nValue -= tx.vout[-2].nValue tx2.vout[0].nValue -= tx.vout[-2].nValue

2
qa/rpc-tests/segwit.py

@ -39,7 +39,7 @@ def addlength(script):
return scriptlen + script return scriptlen + script
def create_witnessprogram(version, node, utxo, pubkey, encode_p2sh, amount): def create_witnessprogram(version, node, utxo, pubkey, encode_p2sh, amount):
pkscript = witness_script(version, pubkey); pkscript = witness_script(version, pubkey)
if (encode_p2sh): if (encode_p2sh):
p2sh_hash = bytes_to_hex_str(ripemd160(sha256(hex_str_to_bytes(pkscript)))) p2sh_hash = bytes_to_hex_str(ripemd160(sha256(hex_str_to_bytes(pkscript))))
pkscript = "a914"+p2sh_hash+"87" pkscript = "a914"+p2sh_hash+"87"

Loading…
Cancel
Save