Skip to content

Commit

Permalink
Sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nalepae committed Jul 25, 2023
1 parent 08603a8 commit 1c8269d
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
3 changes: 1 addition & 2 deletions eth_validator_watcher/beacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

from requests import Response, Session, codes
from requests.adapters import HTTPAdapter, Retry
from requests.exceptions import RetryError
from requests.exceptions import ChunkedEncodingError, RetryError
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
from requests.exceptions import ChunkedEncodingError

from .models import (
BeaconType,
Expand Down
1 change: 1 addition & 0 deletions eth_validator_watcher/relays.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Contains the Relays class which is used to interact with the relays."""

from time import sleep

from prometheus_client import Counter
from requests import Session, codes
from requests.adapters import HTTPAdapter, Retry
Expand Down
9 changes: 5 additions & 4 deletions eth_validator_watcher/rewards.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Contains functions to handle rewards calculation"""

from typing import Tuple
from .beacon import Beacon
from .models import BeaconType, Validators

from prometheus_client import Gauge, Counter
from prometheus_client import Counter, Gauge

from .beacon import Beacon
from .models import BeaconType, Validators

Validator = Validators.DataItem.Validator

Expand Down Expand Up @@ -64,7 +64,8 @@ def process_rewards(
if len(index_to_validator) == 0:
return

data = beacon.get_rewards(beacon_type, epoch - 2, set(index_to_validator)).data
validators_index = set(index_to_validator)
data = beacon.get_rewards(beacon_type, epoch - 2, validators_index).data

if len(data.ideal_rewards) == 0 and len(data.total_rewards) == 0:
# We probably are connected to a beacon that does not support rewards
Expand Down
3 changes: 1 addition & 2 deletions eth_validator_watcher/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from pathlib import Path
from time import sleep, time
from typing import Any, Iterator, Optional, Tuple
Expand All @@ -6,8 +7,6 @@
from prometheus_client import Gauge
from slack_sdk import WebClient

import re

from .web3signer import Web3Signer

NB_SLOT_PER_EPOCH = 32
Expand Down
2 changes: 1 addition & 1 deletion tests/beacon/test_get_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from requests_mock import Mocker

from eth_validator_watcher.beacon import Beacon
from tests.beacon import assets
from eth_validator_watcher.models import BeaconType, Rewards
from tests.beacon import assets


def test_get_rewards_not_supported() -> None:
Expand Down
4 changes: 1 addition & 3 deletions tests/entry_queue/test_compute_pessimistic_duration_sec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from eth_validator_watcher.entry_queue import (
NB_SECONDS_PER_EPOCH,
compute_pessimistic_duration_sec,
)
NB_SECONDS_PER_EPOCH, compute_pessimistic_duration_sec)


def test_compute_pessimistic_duration_sec() -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Set

from eth_validator_watcher.missed_attestations import process_missed_attestations
from eth_validator_watcher.missed_attestations import \
process_missed_attestations
from eth_validator_watcher.models import BeaconType, Validators

Validator = Validators.DataItem.Validator
Expand Down
5 changes: 3 additions & 2 deletions tests/relays/test_process.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from eth_validator_watcher.relays import Relays, bad_relay_count
from requests_mock import Mocker
from pytest import raises
from requests.exceptions import ConnectionError
from requests_mock import Mocker

from eth_validator_watcher.relays import Relays, bad_relay_count


def test_process_no_relay() -> None:
Expand Down
26 changes: 12 additions & 14 deletions tests/rewards/test_process_rewards.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
from eth_validator_watcher.models import Rewards, Validators
from math import isclose

from eth_validator_watcher.models import BeaconType, Rewards, Validators
from eth_validator_watcher.rewards import (
suboptimal_sources_rate_gauge,
suboptimal_targets_rate_gauge,
suboptimal_heads_rate_gauge,
ideal_sources_count,
ideal_targets_count,
ideal_heads_count,
actual_positive_sources_count,
actual_heads_count,
actual_negative_sources_count,
actual_positive_targets_count,
actual_negative_targets_count,
actual_heads_count,
actual_positive_sources_count,
actual_positive_targets_count,
ideal_heads_count,
ideal_sources_count,
ideal_targets_count,
process_rewards,
suboptimal_heads_rate_gauge,
suboptimal_sources_rate_gauge,
suboptimal_targets_rate_gauge,
)
from eth_validator_watcher.models import BeaconType

from math import isclose


Validator = Validators.DataItem.Validator

Expand Down
3 changes: 2 additions & 1 deletion tests/utils/test_eth1_address_0x_prefixed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from eth_validator_watcher.utils import eth1_address_0x_prefixed
from pytest import raises

from eth_validator_watcher.utils import eth1_address_0x_prefixed


def test_eth1_address_0x_prefixed_invalid() -> None:
# Too short
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/test_eth2_address_0x_prefixed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from eth_validator_watcher.utils import eth2_address_0x_prefixed
from pytest import raises

from eth_validator_watcher.utils import eth2_address_0x_prefixed


def test_eth2_address_0x_prefixed_invalid() -> None:
# Too short
Expand Down

0 comments on commit 1c8269d

Please sign in to comment.