Skip to content

Commit

Permalink
Linting, fix time based gas strategy test
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Sep 11, 2020
1 parent b50198a commit 90bde3c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/core/middleware/test_filter_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def make_request(self, method, params):
BLOCK_HASH = '0xfe88c94d860f01a17f961bf4bdfb6e0c6cd10d3fda5cc861e805ca1240c58553'
FILTER_LOG = [AttributeDict({'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24', 'blockHash': HexBytes('0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0'), 'blockNumber': 2217196, 'data': '0x0000000000000000000000000000000000000000000000000000000000000001', 'logIndex': 0, 'topics': [HexBytes('0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930'), HexBytes('0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324'), HexBytes('0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3')], 'transactionHash': HexBytes('0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d'), 'transactionIndex': 1})] # noqa: E501


@pytest.fixture(scope='function')
def iter_block_number(start=0):
def iterator():
Expand Down
2 changes: 1 addition & 1 deletion web3/_utils/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
remove_0x_prefix,
)
from eth_utils.toolz import (
curry
curry,
)

from web3.types import (
Expand Down
13 changes: 6 additions & 7 deletions web3/_utils/method_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Collection,
Dict,
Iterable,
NoReturn,
Tuple,
Union,
)
Expand Down Expand Up @@ -71,10 +72,9 @@
)
from web3.exceptions import (
BlockNotFound,
# TimeExhausted,
# TransactionNotFound,
)
from web3.types import (
BlockIdentifier,
RPCEndpoint,
TReturn,
)
Expand Down Expand Up @@ -345,7 +345,7 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
# Eth
RPC.eth_getBalance: apply_formatter_at_index(block_number_formatter, 1),
RPC.eth_getBlockByNumber: apply_formatter_at_index(block_number_formatter, 0),
# RPC.eth_getBlockByNumber: apply_formatter_at_index(block_number_formatter, 0),
RPC.eth_getBlockTransactionCountByNumber: apply_formatter_at_index(
block_number_formatter,
0,
Expand Down Expand Up @@ -500,7 +500,7 @@ def get_request_formatters(
return compose(*formatters)


def raise_block_not_found(params):
def raise_block_not_found(params: Tuple[BlockIdentifier, bool]) -> NoReturn:
block_identifier = params[0]
raise BlockNotFound(f"Block with id: {block_identifier} not found.")

Expand All @@ -514,9 +514,8 @@ def raise_block_not_found(params):
def get_result_formatters(
method_name: Union[RPCEndpoint, Callable[..., RPCEndpoint]]
) -> Dict[str, Callable[..., Any]]:
formatters = combine_formatters((
PYTHONIC_RESULT_FORMATTERS,
),
formatters = combine_formatters(
(PYTHONIC_RESULT_FORMATTERS,),
method_name
)
attrdict_formatter = apply_formatter_if(is_dict and not_attrdict, AttributeDict.recursive)
Expand Down
2 changes: 1 addition & 1 deletion web3/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(
request_formatters: Optional[Callable[..., TReturn]] = None,
result_formatters: Optional[Callable[..., TReturn]] = None,
error_formatters: Optional[Callable[..., TReturn]] = None,
method_choice_depends_on_args: Optional[Callable[..., str]] = None,
method_choice_depends_on_args: Optional[Callable[..., RPCEndpoint]] = None,
web3: Optional["Web3"] = None):

self.json_rpc_method = json_rpc_method
Expand Down

0 comments on commit 90bde3c

Please sign in to comment.