]> Git Repo - VerusCoin.git/commitdiff
For unused variables reported by pyflakes, either remove the variable,
authorDaira Hopwood <[email protected]>
Tue, 20 Jun 2017 20:20:50 +0000 (21:20 +0100)
committerDaira Hopwood <[email protected]>
Thu, 22 Jun 2017 17:09:05 +0000 (18:09 +0100)
suppress the warning, or fix a bug (if the wrong variable was used).
refs #2450

Signed-off-by: Daira Hopwood <[email protected]>
15 files changed:
qa/rpc-tests/forknotify.py
qa/rpc-tests/hardforkdetection.py
qa/rpc-tests/httpbasics.py
qa/rpc-tests/maxblocksinflight.py
qa/rpc-tests/mempool_coinbase_spends.py
qa/rpc-tests/mempool_tx_input_limit.py
qa/rpc-tests/pruning.py
qa/rpc-tests/rawtransactions.py
qa/rpc-tests/receivedby.py
qa/rpc-tests/rpcbind_test.py
qa/rpc-tests/test_framework/util.py
qa/rpc-tests/txn_doublespend.py
qa/rpc-tests/wallet.py
qa/rpc-tests/wallet_nullifiers.py
qa/rpc-tests/zmq_test.py

index 059bfaddef9c42b03493aea9fb6e7925bd076ce8..1be750a64258053c0828743f2c6d79d8774aa256 100755 (executable)
@@ -19,7 +19,7 @@ class ForkNotifyTest(BitcoinTestFramework):
     def setup_network(self):
         self.nodes = []
         self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
-        with open(self.alert_filename, 'w') as f:
+        with open(self.alert_filename, 'w'):
             pass  # Just open then close to create zero-length file
         self.nodes.append(start_node(0, self.options.tmpdir,
                             ["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""]))
index 553f363a99fff0c5ac4e72c034a469316f645872..dbfb5cd341efe6a36a2c2b72faecbde37e948c20 100755 (executable)
@@ -17,7 +17,7 @@ class HardForkDetectionTest(BitcoinTestFramework):
     def setup_network(self):
         self.nodes = []
         self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
-        with open(self.alert_filename, 'w') as f:
+        with open(self.alert_filename, 'w'):
             pass  # Just open then close to create zero-length file
         self.nodes.append(start_node(0, self.options.tmpdir,
                             ["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""]))
index 5944bb4884251200389cc1bc55819c51964ab3a2..b2ea84b4f9d55d007eea7d887a2282c106084a88 100755 (executable)
@@ -44,7 +44,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
         #send 2nd request without closing connection
         conn.request('POST', '/', '{"method": "getchaintips"}', headers)
         out2 = conn.getresponse().read();
-        assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
+        assert_equal('"error":null' in out2, True) # must also response with a correct json-rpc message
         assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
         conn.close()
 
@@ -61,7 +61,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
         #send 2nd request without closing connection
         conn.request('POST', '/', '{"method": "getchaintips"}', headers)
         out2 = conn.getresponse().read();
-        assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
+        assert_equal('"error":null' in out2, True) # must also response with a correct json-rpc message
         assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
         conn.close()
 
index 4c646040be71d192468003e5f6021d4521bbafd8..227679b69d2ccb41c19b219d38663a0aa254b806 100755 (executable)
@@ -49,7 +49,6 @@ class TestManager(NodeConnCB):
 
     def run(self):
         try:
-            fail = False
             self.connection.rpc.generate(1) # Leave IBD
 
             numBlocksToGenerate = [ 8, 16, 128, 1024 ]
index a5f4260928cd49b0a6aab78080df8b977b578066..041de831b61cccf5bf1d5e28abf41178f14203f9 100755 (executable)
@@ -35,8 +35,6 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
         return signresult["hex"]
 
     def run_test(self):
-        start_count = self.nodes[0].getblockcount()
-
         # Mine three blocks. After this, nodes[0] blocks
         # 101, 102, and 103 are spend-able.
         new_blocks = self.nodes[1].generate(4)
@@ -68,6 +66,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
 
         # Broadcast and mine 103_1:
         spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw)
+        [spend_103_1_id] # hush pyflakes
         self.nodes[0].generate(1)
 
         # ... now put spend_101 and spend_102_1 in memory pools:
index 8483c5d0aa3d990e43402a1440f36cbb8918cecf..538122671c17e6f5d01b2334252f296ad62b1645 100755 (executable)
@@ -63,8 +63,6 @@ class MempoolTxInputLimitTest(BitcoinTestFramework):
         return txid
 
     def run_test(self):
-        start_count = self.nodes[0].getblockcount()
-
         self.nodes[0].generate(100)
         self.sync_all()
         # Mine three blocks. After this, nodes[0] blocks
@@ -118,7 +116,6 @@ class MempoolTxInputLimitTest(BitcoinTestFramework):
         assert_equal(set(self.nodes[0].getrawmempool()), set())
 
         # Check 2: sendfrom is limited by -mempooltxinputlimit
-        node1_taddr = self.nodes[1].getnewaddress();
         recipients = []
         spend_taddr_amount = spend_zaddr_amount - Decimal('0.0001')
         spend_taddr_output = Decimal('8')
index 6bf79933ce6382ff72ccdb4c6684d2f8897c13f6..2639060fa38fdb1f676d21e5d629ca91b6bdd474 100755 (executable)
@@ -194,7 +194,7 @@ class PruneTest(BitcoinTestFramework):
         try:
             self.nodes[2].getblock(self.forkhash)
             raise AssertionError("Old block wasn't pruned so can't test redownload")
-        except JSONRPCException as e:
+        except JSONRPCException:
             print "Will need to redownload block",self.forkheight
 
         # Verify that we have enough history to reorg back to the fork point
@@ -257,7 +257,7 @@ class PruneTest(BitcoinTestFramework):
             newtx = newtx + rawtx[94:]
             # Appears to be ever so slightly faster to sign with SIGHASH_NONE
             signresult = node.signrawtransaction(newtx,None,None,"NONE")
-            txid = node.sendrawtransaction(signresult["hex"], True)
+            node.sendrawtransaction(signresult["hex"], True)
         # Mine a full sized block which will be these transactions we just created
         node.generate(1)
 
index 2eb04813fd5df7f73a7a223d016356b0d5b04a6f..82dbb7b26d95a84f8562016ce0efb89dff5b4447 100755 (executable)
@@ -106,11 +106,13 @@ class RawTransactionsTest(BitcoinTestFramework):
 
         mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey']])
         mSigObjValid = self.nodes[2].validateaddress(mSigObj)
+        assert_equal(mSigObjValid['isvalid'], True)
 
         txId       = self.nodes[0].sendtoaddress(mSigObj, 2.2);
         decTx = self.nodes[0].gettransaction(txId)
         rawTx = self.nodes[0].decoderawtransaction(decTx['hex'])
         sPK = rawTx['vout'][0]['scriptPubKey']['hex']
+        [sPK] # hush pyflakes
         self.sync_all()
         self.nodes[0].generate(1)
         self.sync_all()
index fcab3e29df2d09243bc033bd4ebec972cb659902..e928aec8b5ffef956548f86e25e6da9dd077bb41 100755 (executable)
@@ -14,7 +14,6 @@ def get_sub_array_from_array(object_array, to_match):
         Finds and returns a sub array from an array of arrays.
         to_match should be a unique idetifier of a sub array
     '''
-    num_matched = 0
     for item in object_array:
         all_match = True
         for key,value in to_match.items():
@@ -120,7 +119,7 @@ class ReceivedByTest(BitcoinTestFramework):
         received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(),{"account":account})
         if len(received_by_account_json) == 0:
             raise AssertionError("No accounts found in node")
-        balance_by_account = rec_by_accountArr = self.nodes[1].getreceivedbyaccount(account)
+        balance_by_account = self.nodes[1].getreceivedbyaccount(account)
 
         txid = self.nodes[0].sendtoaddress(addr, 0.1)
         self.sync_all()
index ca0f9b1f896f933c18a96bed4bf9d857c294973e..676a4bf32c2d47ff32cf48b28c609e97b4f1d9bb 100755 (executable)
@@ -120,7 +120,6 @@ def main():
     check_json_precision()
 
     success = False
-    nodes = []
     try:
         print("Initializing test directory "+options.tmpdir)
         if not os.path.isdir(options.tmpdir):
index 4cf925c3641b3f565d638596c71cd063d103f436..8ac09f4725607ca707ae9a5d75a982a5607c0f6d 100644 (file)
@@ -152,7 +152,7 @@ def initialize_chain_clean(test_dir, num_nodes):
     Useful if a test case wants complete control over initialization.
     """
     for i in range(num_nodes):
-        datadir=initialize_datadir(test_dir, i)
+        initialize_datadir(test_dir, i)
 
 
 def _rpchost_to_args(rpchost):
index 3a45938b77f61588ecf743988d6a5c0ff2f619be..bbe383d161949a9cc2da354bc6de0dcef191d51b 100755 (executable)
@@ -76,7 +76,7 @@ class TxnMallTest(BitcoinTestFramework):
             assert_equal(tx2["confirmations"], 0)
 
         # Now give doublespend to miner:
-        mutated_txid = self.nodes[2].sendrawtransaction(doublespend["hex"])
+        self.nodes[2].sendrawtransaction(doublespend["hex"])
         # ... mine a block...
         self.nodes[2].generate(1)
 
index 0e2a7983bfe5430b50445f7389cdeefd591d7191..0aeae995d61b028cc083fe4b0e6ec11bde627cc3 100755 (executable)
@@ -105,7 +105,7 @@ class WalletTest (BitcoinTestFramework):
         # Send 10 BTC normal
         address = self.nodes[0].getnewaddress("")
         self.nodes[2].settxfee(Decimal('0.001'))
-        txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
+        self.nodes[2].sendtoaddress(address, 10, "", "", False)
         self.sync_all()
         self.nodes[2].generate(1)
         self.sync_all()
@@ -115,7 +115,7 @@ class WalletTest (BitcoinTestFramework):
         assert_equal(self.nodes[0].getbalance("*"), Decimal('10.00000000'))
 
         # Send 10 BTC with subtract fee from amount
-        txid = self.nodes[2].sendtoaddress(address, 10, "", "", True)
+        self.nodes[2].sendtoaddress(address, 10, "", "", True)
         self.sync_all()
         self.nodes[2].generate(1)
         self.sync_all()
@@ -125,7 +125,7 @@ class WalletTest (BitcoinTestFramework):
         assert_equal(self.nodes[0].getbalance("*"), Decimal('19.99900000'))
 
         # Sendmany 10 BTC
-        txid = self.nodes[2].sendmany("", {address: 10}, 0, "", [])
+        self.nodes[2].sendmany("", {address: 10}, 0, "", [])
         self.sync_all()
         self.nodes[2].generate(1)
         self.sync_all()
@@ -135,7 +135,7 @@ class WalletTest (BitcoinTestFramework):
         assert_equal(self.nodes[0].getbalance("*"), Decimal('29.99900000'))
 
         # Sendmany 10 BTC with subtract fee from amount
-        txid = self.nodes[2].sendmany("", {address: 10}, 0, "", [address])
+        self.nodes[2].sendmany("", {address: 10}, 0, "", [address])
         self.sync_all()
         self.nodes[2].generate(1)
         self.sync_all()
@@ -176,7 +176,7 @@ class WalletTest (BitcoinTestFramework):
         signedRawTx = self.nodes[1].signrawtransaction(rawTx)
         decRawTx = self.nodes[1].decoderawtransaction(signedRawTx['hex'])
         zeroValueTxid= decRawTx['txid']
-        sendResp = self.nodes[1].sendrawtransaction(signedRawTx['hex'])
+        self.nodes[1].sendrawtransaction(signedRawTx['hex'])
 
         self.sync_all()
         self.nodes[1].generate(1) #mine a block
@@ -243,7 +243,7 @@ class WalletTest (BitcoinTestFramework):
         self.sync_all()
 
         mybalance = self.nodes[2].z_getbalance(mytaddr)
-        assert_equal(self.nodes[2].z_getbalance(mytaddr), Decimal('10.0'));
+        assert_equal(mybalance, Decimal('10.0'));
 
         mytxdetails = self.nodes[2].gettransaction(mytxid)
         myvjoinsplits = mytxdetails["vjoinsplit"]
index b69b9d7d16f0c81ff554971c0b73d1457b08e79f..b7e94b6a67cf95ce158793eabc8c1efaabe1c5ab 100755 (executable)
@@ -154,6 +154,7 @@ class WalletNullifiersTest (BitcoinTestFramework):
                 status = results[0]["status"]
                 assert_equal("success", status)
                 mytxid = results[0]["result"]["txid"]
+                [mytxid] # hush pyflakes
                 break
 
         self.sync_all()
index 901d61699624abd9b941930b6bab6dc89e863b14..b895c628c998c7666592596e9e04e6efc2d87e57 100755 (executable)
@@ -42,6 +42,7 @@ class ZMQTest (BitcoinTestFramework):
         assert_equal(topic, b"hashtx")
         body = msg[1]
         nseq = msg[2]
+        [nseq] # hush pyflakes
         msgSequence = struct.unpack('<I', msg[-1])[-1]
         assert_equal(msgSequence, 0) #must be sequence 0 on hashtx
 
This page took 0.043599 seconds and 4 git commands to generate.