Skip to content

Commit 17b5520

Browse files
Compare to None with is/is not
1 parent 1b89074 commit 17b5520

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

contrib/devtools/copyright_header.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def get_git_change_year_range(filename):
491491

492492
def file_already_has_core_copyright(file_lines):
493493
index, _ = get_updatable_copyright_line(file_lines)
494-
return index != None
494+
return index is not None
495495

496496
################################################################################
497497
# insert header execution

contrib/devtools/update-translations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def escape_cdata(text):
125125
return text
126126

127127
def contains_bitcoin_addr(text, errors):
128-
if text != None and ADDRESS_REGEXP.search(text) != None:
128+
if text is not None and ADDRESS_REGEXP.search(text) is not None:
129129
errors.append('Translation "%s" contains a bitcoin address. This will be removed.' % (text))
130130
return True
131131
return False

test/functional/interface_http.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ def run_test(self):
3131
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
3232
out1 = conn.getresponse().read()
3333
assert(b'"error":null' in out1)
34-
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
34+
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
3535

3636
#send 2nd request without closing connection
3737
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
3838
out1 = conn.getresponse().read()
3939
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
40-
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
40+
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
4141
conn.close()
4242

4343
#same should be if we add keep-alive because this should be the std. behaviour
@@ -48,13 +48,13 @@ def run_test(self):
4848
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
4949
out1 = conn.getresponse().read()
5050
assert(b'"error":null' in out1)
51-
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
51+
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
5252

5353
#send 2nd request without closing connection
5454
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
5555
out1 = conn.getresponse().read()
5656
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
57-
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
57+
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
5858
conn.close()
5959

6060
#now do the same with "Connection: close"
@@ -65,7 +65,7 @@ def run_test(self):
6565
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
6666
out1 = conn.getresponse().read()
6767
assert(b'"error":null' in out1)
68-
assert(conn.sock==None) #now the connection must be closed after the response
68+
assert(conn.sock is None) #now the connection must be closed after the response
6969

7070
#node1 (2nd node) is running with disabled keep-alive option
7171
urlNode1 = urllib.parse.urlparse(self.nodes[1].url)
@@ -88,7 +88,7 @@ def run_test(self):
8888
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
8989
out1 = conn.getresponse().read()
9090
assert(b'"error":null' in out1)
91-
assert(conn.sock!=None) #connection must be closed because bitcoind should use keep-alive by default
91+
assert(conn.sock is not None) #connection must be closed because bitcoind should use keep-alive by default
9292

9393
# Check excessive request size
9494
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)

test/functional/mining_prioritisetransaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def run_test(self):
8484
high_fee_tx = x
8585

8686
# Something high-fee should have been mined!
87-
assert(high_fee_tx != None)
87+
assert(high_fee_tx is not None)
8888

8989
# Add a prioritisation before a tx is in the mempool (de-prioritising a
9090
# high-fee transaction so that it's now low fee).

test/functional/test_framework/messages.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def __init__(self, p2pheaders_and_shortids = None):
764764
self.prefilled_txn = []
765765
self.use_witness = False
766766

767-
if p2pheaders_and_shortids != None:
767+
if p2pheaders_and_shortids is not None:
768768
self.header = p2pheaders_and_shortids.header
769769
self.nonce = p2pheaders_and_shortids.nonce
770770
self.shortids = p2pheaders_and_shortids.shortids
@@ -822,7 +822,7 @@ class BlockTransactionsRequest:
822822

823823
def __init__(self, blockhash=0, indexes = None):
824824
self.blockhash = blockhash
825-
self.indexes = indexes if indexes != None else []
825+
self.indexes = indexes if indexes is not None else []
826826

827827
def deserialize(self, f):
828828
self.blockhash = deser_uint256(f)
@@ -863,7 +863,7 @@ class BlockTransactions:
863863

864864
def __init__(self, blockhash=0, transactions = None):
865865
self.blockhash = blockhash
866-
self.transactions = transactions if transactions != None else []
866+
self.transactions = transactions if transactions is not None else []
867867

868868
def deserialize(self, f):
869869
self.blockhash = deser_uint256(f)
@@ -1052,7 +1052,7 @@ class msg_getdata:
10521052
command = b"getdata"
10531053

10541054
def __init__(self, inv=None):
1055-
self.inv = inv if inv != None else []
1055+
self.inv = inv if inv is not None else []
10561056

10571057
def deserialize(self, f):
10581058
self.inv = deser_vector(f, CInv)

test/functional/test_framework/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, i, datadir, *, rpchost, timewait, bitcoind, bitcoin_cli, mock
6868
self.rpc_timeout = timewait
6969
self.binary = bitcoind
7070
self.coverage_dir = coverage_dir
71-
if extra_conf != None:
71+
if extra_conf is not None:
7272
append_config(datadir, extra_conf)
7373
# Most callers will just need to add extra args to the standard list below.
7474
# For those callers that need more flexibility, they can just set the args property directly.

0 commit comments

Comments
 (0)