Skip to content

Commit

Permalink
Update dependencies (#29)
Browse files Browse the repository at this point in the history
* Update dependencies

* Reformat

* Fix Flake
  • Loading branch information
michaelsproul authored Oct 12, 2023
1 parent 3e249e3 commit 74c03ed
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def on_post(self, req, resp, since_slot=None):
return

# I love type checking.
if type(validator_indices) != list or any(
type(x) != int for x in validator_indices
if type(validator_indices) is list or any(
type(x) is not int for x in validator_indices
):
resp.text = json.dumps({"error": "request must be a list of integers"})
resp.code = falcon.HTTP_400
Expand Down
2 changes: 1 addition & 1 deletion background_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def run(self):
sync_gaps = get_sync_gaps(self.blockprint_url)
chunks = explode_gaps(sync_gaps)

for (start_slot, end_slot) in chunks:
for start_slot, end_slot in chunks:
print(f"Downloading backfill blocks {start_slot}..={end_slot}")
block_rewards = download_block_rewards(
start_slot, end_slot, beacon_node=self.bn_url
Expand Down
8 changes: 4 additions & 4 deletions build_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get_sync_gaps(block_db):
missing_parent_slots = get_missing_parent_blocks(block_db)
gaps = []

for (block_slot, parent_slot) in missing_parent_slots:
for block_slot, parent_slot in missing_parent_slots:
prior_slot = get_greatest_prior_block_slot(block_db, parent_slot)

if prior_slot is None:
Expand Down Expand Up @@ -221,7 +221,7 @@ def get_blocks_per_client(block_db, start_slot, end_slot):
(start_slot, end_slot),
)

for (client, count) in client_counts:
for client, count in client_counts:
blocks_per_client[client] = int(count)

return blocks_per_client
Expand All @@ -230,8 +230,8 @@ def get_blocks_per_client(block_db, start_slot, end_slot):
def get_validator_blocks(block_db, validator_index, since_slot=None):
since_slot = since_slot or 0
rows = block_db.execute(
"""SELECT slot, best_guess_single, best_guess_multi, pr_grandine, pr_lighthouse, pr_lodestar,
pr_nimbus, pr_prysm, pr_teku
"""SELECT slot, best_guess_single, best_guess_multi, pr_grandine, pr_lighthouse,
pr_lodestar, pr_nimbus, pr_prysm, pr_teku
FROM blocks WHERE proposer_index = ? AND slot >= ?""",
(validator_index, since_slot),
)
Expand Down
4 changes: 2 additions & 2 deletions compute_periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_validators_per_client(period_db, period_id, guess_column=DEFAULT_GUESS):
(period_id,),
)

for (client, count) in client_counts:
for client, count in client_counts:
validators_per_client[client] = int(count)

return validators_per_client
Expand All @@ -339,7 +339,7 @@ def period_db_to_csv(period_db, output_file, guess_column=DEFAULT_GUESS):

periods = period_db.execute("SELECT * FROM periods")

for (period_id, end_slot, num_active_validators) in periods:
for period_id, end_slot, num_active_validators in periods:
row = {
"period_id": period_id,
"end_slot": end_slot,
Expand Down
2 changes: 1 addition & 1 deletion multi_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, data_dir):
def classify(self, block_reward):
slot = int(block_reward["meta"]["slot"])

for (i, (start_slot, end_slot, classifier)) in enumerate(self.classifiers):
for i, (start_slot, end_slot, classifier) in enumerate(self.classifiers):
# Allow the last classifier to be used for slots beyond its end slot
if start_slot <= slot and (
slot <= end_slot or i + 1 == len(self.classifiers)
Expand Down
4 changes: 2 additions & 2 deletions prepare_training_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def check_graffiti(graffiti: str, disabled_clients=[]) -> str:
for (client, regexes) in REGEX.items():
for client, regexes in REGEX.items():
if client in disabled_clients:
continue

Expand Down Expand Up @@ -66,7 +66,7 @@ def process_file(

res = classify_rewards_by_graffiti(rewards, disabled_clients=disabled_clients)

for (client, examples) in res.items():
for client, examples in res.items():
for block_rewards in examples:
store_block_rewards(block_rewards, client, proc_data_dir)

Expand Down
7 changes: 3 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
black==22.1.0
flake8==4.0.1
pytest==7.0.1
click >= 6.6, <= 8.0.4
black==23.9.1
flake8==6.1.0
pytest==7.4.2
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
requests==2.27.1
scikit-learn==1.0.2
numpy==1.22.2
falcon==3.0.1
sseclient-py==1.7.2
gunicorn==20.1.0
matplotlib==3.5.1
scipy==1.8.0
requests==2.31.0
scikit-learn==1.3.1
numpy==1.26.0
falcon==3.1.1
sseclient-py==1.8.0
gunicorn==21.2.0
matplotlib==3.8.0
scipy==1.11.3

0 comments on commit 74c03ed

Please sign in to comment.