Skip to content

Commit

Permalink
switch black -> ruff, fix detected problems
Browse files Browse the repository at this point in the history
  • Loading branch information
shuckc committed Aug 19, 2024
1 parent fa044e0 commit 87263d6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ COPY generate_liabilities.py /app/generate_liabilities.py
COPY validate_liabilities.py /app/validate_liabilities.py
COPY test/test_liabilities.py /app/test_liabilities.py
RUN python /app/test_liabilities.py
RUN black --check /app/*.py
RUN ruff check /app/*.py
RUN ruff format --check /app/*.py
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
black==22.8.0
click==8.0.4
mypy-extensions==1.0.0
packaging==21.3
pathspec==0.9.0
platformdirs==2.4.0
tomli==1.2.3
typing_extensions==4.1.1
ruff==0.5.7
6 changes: 3 additions & 3 deletions test/test_reserves.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def wait_until_alive(self):
time.sleep(1)
self.version = self.getnetworkinfo([])["version"]
break
except Exception as e:
except Exception:
logging.info("Bitcoin server not responding, sleeping for retry.")


Expand Down Expand Up @@ -211,7 +211,7 @@ def test_reserves(self):
"--result-file",
proof_hash + "_result.json",
]
output = subprocess.check_output(run_args).decode("utf-8")
subprocess.check_output(run_args).decode("utf-8")

# Check output file's value
with open(proof_hash + "_result.json") as f:
Expand All @@ -230,7 +230,7 @@ def test_reserves(self):
"regtest://user:[email protected]:18443",
"--reconsider",
]
output = subprocess.check_output(run_args).decode("utf-8")
subprocess.check_output(run_args).decode("utf-8")
while self.bitcoin.getblockcount([]) != tip_height:
time.sleep(0.1)
self.assertEqual(self.bitcoin.getbestblockhash([]), tip_hash)
Expand Down
1 change: 0 additions & 1 deletion validate_liabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def validate_liabilities(block_height, tree, account, nonce, account_nonce, args
)

# Next validate tree up to root, printing out single proof
proof_vector = []
current_index = leaf_index

proof_nodes = [] # [us, parent, ..., n-parent, root]
Expand Down
6 changes: 2 additions & 4 deletions validate_reserves.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/python3

import argparse
import copy
from collections import Counter
import decimal
import json
Expand Down Expand Up @@ -51,7 +50,7 @@ def wait_until_alive(self):
time.sleep(1)
self.version = self.getnetworkinfo([])["version"]
break
except Exception as e:
except Exception:
logging.exception("Bitcoin server not responding, sleeping for retry.")


Expand Down Expand Up @@ -139,7 +138,6 @@ def compile_proofs(proof_data):
script = script[2:]
found_vanitykey = 0
found_pubkeys = 0
wrong_keys = False
ordered_pubkeys = []
while len(script) > 4:
if script[:2] != pubkey_sep:
Expand Down Expand Up @@ -236,7 +234,7 @@ def validate_proofs(bitcoin, proof_data, chunk_size=60000):
block_hash = bitcoin.getblockhash([proof_data["height"]])
try:
bitcoin.getblock([block_hash])
except Exception as e:
except Exception:
if "pruned":
raise Exception(
"Looks like your node has pruned beyond the reserve snapshot; bailing."
Expand Down

0 comments on commit 87263d6

Please sign in to comment.