Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python cleanups #10781

Merged
merged 6 commits into from Aug 28, 2017
Merged

Python cleanups #10781

merged 6 commits into from Aug 28, 2017

Conversation

practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Jul 9, 2017

Python cleanups:

  • Avoid reference to undefined name: stderr does not exist, sys.stderr does
  • Use print(...) instead of undefined printf(...)
  • Avoid redefinition of variable (tx) in list comprehension
  • Remove unused variables and/or function calls
  • Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs

@practicalswift practicalswift force-pushed the python-cleanups branch 2 times, most recently from 2190ff6 to a2724e4 Compare July 9, 2017 21:36
Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. utACK. One question inline and another general question:

In commit Use the variable name _ to show that we are intentionally ignoring a return value, why not just ignore the return value?

@@ -293,7 +293,7 @@ def test_compactblock_construction(self, node, test_node, version, use_witness_a

# Store the raw block in our internal format.
block = FromHex(CBlock(), node.getblock("%02x" % block_hash, False))
[tx.calc_sha256() for tx in block.vtx]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see how using tx is an issue. Does this cause a linter warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does :-)

$ flake8 test/functional/p2p-compactblocks.py | grep redefine
test/functional/p2p-compactblocks.py:296:31: F812 list comprehension redefines 'tx' from line 276

Should I remove the commit 263686d03fbfa2191c160d4c50951852fa1a4900 from this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, let's just swap this list comprehension for a for loop. We're using it for its side-effects, so a for loop is clearer.

@@ -168,7 +168,7 @@ def test_bumpfee_with_descendant_fails(rbf_node, rbf_node_address, dest_address)
parent_id = spend_one_input(rbf_node, rbf_node_address)
tx = rbf_node.createrawtransaction([{"txid": parent_id, "vout": 0}], {dest_address: 0.00020000})
tx = rbf_node.signrawtransaction(tx)
txid = rbf_node.sendrawtransaction(tx["hex"])
_ = rbf_node.sendrawtransaction(tx["hex"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about something more clear like throwaway_txid or something of the sort?

@jtimon
Copy link
Contributor

jtimon commented Jul 13, 2017

fast review ACK

@practicalswift
Copy link
Contributor Author

practicalswift commented Jul 16, 2017

@jnewbery Good point! I've now changed from _ = f() to f() for calls that appear to have side effects. For calls that appear to have no side effects I've simply removed the calls.

@jnewbery @jtimon Could you take a look at the updated version and see if it looks correct? :-)

@practicalswift
Copy link
Contributor Author

Added two commits :-)

@@ -91,7 +91,7 @@ def handle(self):
self.conn.sendall(bytearray([0x01, 0x00]))

# Read connect request
(ver,cmd,rsv,atyp) = recvall(self.conn, 4)
(ver, cmd, _, atyp) = recvall(self.conn, 4)
Copy link
Contributor

@jnewbery jnewbery Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this to be a tuple. Just:

ver, cmd, _, atyp = recvall(self.conn, 4)

There are other examples in commit Use the variable name _ for unused return values. I won't comment on each of them.

@@ -47,16 +47,16 @@ def run_test(self):
self.log.info("Ensure submitblock can in principle reorg to a competing chain")
self.nodes[0].generate(1)
assert_equal(self.nodes[0].getblockcount(), 1)
(hashY, hashZ) = self.nodes[1].generate(2)
(_, hashZ) = self.nodes[1].generate(2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer:

hashZ = self.nodes[1].generate(2)[-1]

since it conveys the meaning better: "give me the hash of the last block generated".

same for the two examples below

@@ -15,17 +15,7 @@
import os
from binascii import unhexlify, hexlify

STATE_ESTABLISHED = '01'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps change these to comments rather than erase them (for context).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Fixed!

@@ -48,8 +48,6 @@
COIN = 100000000 # 1 btc in satoshis

NODE_NETWORK = (1 << 0)
NODE_GETUTXO = (1 << 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No harm in leaving these as comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Updated but GitHub doesn't show the # NODE_GETUTXO = (1 << 1) below (in the comment view), so it appears as if it is not fixed :-)

@@ -112,40 +112,16 @@ def set_secretbytes(self, secret):
ssl.BN_CTX_free(ctx)
return self.k

def set_privkey(self, key):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine these methods potentially being useful at some point. I don't think there's any need to remove them.

@@ -158,11 +158,6 @@ def __call__(self, *args, **argsn):
else:
return response['result']

def _batch(self, rpc_call_list):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave this for now.

@jnewbery
Copy link
Contributor

Mostly ACK, but a few comments.

@practicalswift practicalswift force-pushed the python-cleanups branch 2 times, most recently from 441552d to 8693042 Compare July 20, 2017 21:22
@practicalswift
Copy link
Contributor Author

@jnewbery Thanks for reviewing! Good feedback - I've addressed all points raised. Would you mind re-reviewing? :-)

@jnewbery
Copy link
Contributor

Looks good. Just #10781 (comment) unaddressed (using a for loop instead of list comprehension for functions with side-effects)

@practicalswift
Copy link
Contributor Author

practicalswift commented Jul 20, 2017

@jnewbery Thanks! List comprehension now fixed as well. Looks good? :-)

@jnewbery
Copy link
Contributor

looks good. utACK db442ada2b7e162c3748ddcc130c414fd86e2bab

@practicalswift
Copy link
Contributor Author

Rebased and and added another commit ("Remove import of unused constants").

@jnewbery, would you mind re-reviewing? :-)

@jnewbery
Copy link
Contributor

Looks good to me, but can you remove the final commit? Marco's #11067 will already remove those unused constants.

@MarcoFalke - if you have time, can you check whether this is suitable for merge? It's likely to require continual rebase if left open.

I've verified that @practicalswift hasn't added any backdoors in the last rebase :)

@practicalswift
Copy link
Contributor Author

@jnewbery Removed last commit :-) Thanks fo reviewing :-)

@jtimon
Copy link
Contributor

jtimon commented Aug 28, 2017

repeatead fast review ack

@meshcollider
Copy link
Contributor

Fast review utACK

@maflcko maflcko merged commit 7821458 into bitcoin:master Aug 28, 2017
maflcko pushed a commit that referenced this pull request Aug 28, 2017
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 19, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 23, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 24, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 19, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 21, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 9, 2019
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 1, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 3, 2020
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
@practicalswift practicalswift deleted the python-cleanups branch April 10, 2021 19:32
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 24, 2021
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 14, 2022
7821458 Use for-loop instead of list comprehension (practicalswift)
8239794 Use the variable name _ for unused return values (practicalswift)
2e6080b Remove unused variables and/or function calls (practicalswift)
9b94054 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b8 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520 Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](bitcoin#10753 (comment))

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants